From: drh Date: Fri, 27 Sep 2019 16:33:27 +0000 (+0000) Subject: Allow compile-time options -DHAVE_GETHOSTUUID=0 and -DHAVE_GETHOSTUUID=1. X-Git-Tag: version-3.30.0~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4079e1fc52e5bf55fcb261bcbf536005787036c;p=thirdparty%2Fsqlite.git Allow compile-time options -DHAVE_GETHOSTUUID=0 and -DHAVE_GETHOSTUUID=1. FossilOrigin-Name: 3bcb9cc104e0265a600b03415ad955187fc6445ea8e46dc656412cba5bc1d621 --- diff --git a/manifest b/manifest index 09baee6044..5767e4b1d9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Alternative\simplementation\sof\sthe\sprevious\scheck-in\swhich\sis\stestable. -D 2019-09-27T15:15:38.048 +C Allow\scompile-time\soptions\s-DHAVE_GETHOSTUUID=0\sand\s-DHAVE_GETHOSTUUID=1. +D 2019-09-27T16:33:27.006 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -509,7 +509,7 @@ F src/os.c 20f7b32c1e8839999fa7e79756a6cdc3041b44d7fc635c25a1b9399180d1fbd9 F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 -F src/os_unix.c 134c64afd9aa1c5c9819b59f27cab86acc1d51bda9f723bcb1f51495bce6416f +F src/os_unix.c a76a75f179cb233d54e505c3e0c84832224cfe5dfb3ee470bdcaf1ed29da57ab F src/os_win.c 035a813cbd17f355bdcad7ab894af214a9c13a1db8aeac902365350b98cd45a7 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 422fd8cfa59fb9173eff36a95878904a0eeb0dcc62ba49350acc8b1e51c4dc7b @@ -1845,7 +1845,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6a204b192a6c6f21988cab217366f21b14c672b81ceadc43675761a6d8c4484f -R 952d3cb6d35457ec46118b09f2b247c9 +P 102ef64462cf0d78395ccc7ebb8e3bf6b7647c06b7657a037e051697bc08d6b7 +R 1ba73851625828b89e5d77a2045c4095 U drh -Z 82e81fce3607c3830fc29914a247a237 +Z 48ada95eee3455ebd0a21fff552e9486 diff --git a/manifest.uuid b/manifest.uuid index 5eceb07f6b..f83dc3f427 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -102ef64462cf0d78395ccc7ebb8e3bf6b7647c06b7657a037e051697bc08d6b7 \ No newline at end of file +3bcb9cc104e0265a600b03415ad955187fc6445ea8e46dc656412cba5bc1d621 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 071d979828..f2ac89f2cf 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -105,13 +105,29 @@ # include #endif /* SQLITE_ENABLE_LOCKING_STYLE */ -#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ - (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) -# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \ - && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0)) -# define HAVE_GETHOSTUUID 1 -# else -# warning "gethostuuid() is disabled." +/* +** Try to determine if gethostuuid() is available based on standard +** macros. This might sometimes compute the wrong value for some +** obscure platforms. For those cases, simply compile with one of +** the following: +** +** -DHAVE_GETHOSTUUID=0 +** -DHAVE_GETHOSTUUID=1 +** +** None if this matters except when building on Apple products with +** -DSQLITE_ENABLE_LOCKING_STYLE. +*/ +#ifndef HAVE_GETHOSTUUID +# define HAVE_GETHOSTUUID 0 +# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ + (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) +# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \ + && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0)) +# undef HAVE_GETHOSTUUID +# define HAVE_GETHOSTUUID 1 +# else +# warning "gethostuuid() is disabled." +# endif # endif #endif @@ -6929,7 +6945,7 @@ int sqlite3_hostid_num = 0; #define PROXY_HOSTIDLEN 16 /* conch file host id length */ -#ifdef HAVE_GETHOSTUUID +#if HAVE_GETHOSTUUID /* Not always defined in the headers as it ought to be */ extern int gethostuuid(uuid_t id, const struct timespec *wait); #endif @@ -6940,7 +6956,7 @@ extern int gethostuuid(uuid_t id, const struct timespec *wait); static int proxyGetHostID(unsigned char *pHostID, int *pError){ assert(PROXY_HOSTIDLEN == sizeof(uuid_t)); memset(pHostID, 0, PROXY_HOSTIDLEN); -#ifdef HAVE_GETHOSTUUID +#if HAVE_GETHOSTUUID { struct timespec timeout = {1, 0}; /* 1 sec timeout */ if( gethostuuid(pHostID, &timeout) ){