1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-21 13:38:01 +03:00

Rename the file control to SQLITE_FCNTL_FILESTAT. Rename the SQL function

to sqlite_filestat().  Rename the enable macro to SQLITE_ENABLE_FILESTAT.

FossilOrigin-Name: ee797fec4eeace78caa2c5e463108bf1a6568db7c33d94d9fe6624cfc6b0d4fe
This commit is contained in:
drh
2025-10-25 20:46:09 +00:00
parent ecbeefecd0
commit a105989856
6 changed files with 35 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\sbug\sin\ssqlite_file_info()\soutput:\s\sIt\swas\sshowing\sthe\s"pal"\sfor\nthe\smain\sfile\sdescriptor\swhen\straversing\sother\sunused\sfile\sdescriptors\nfor\sthe\ssame\sinode. C Rename\sthe\sfile\scontrol\sto\sSQLITE_FCNTL_FILESTAT.\s\sRename\sthe\sSQL\sfunction\nto\ssqlite_filestat().\s\sRename\sthe\senable\smacro\sto\sSQLITE_ENABLE_FILESTAT.
D 2025-10-25T19:51:16.580 D 2025-10-25T20:46:09.210
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -689,7 +689,7 @@ F src/delete.c 03a77ba20e54f0f42ebd8eddf15411ed6bdb06a2c472ac4b6b336521bf7cea42
F src/expr.c 4d63c8f6d50fe20637de8bdaf57757a0e424e4ac5e2c3313e621d64727a48a1c F src/expr.c 4d63c8f6d50fe20637de8bdaf57757a0e424e4ac5e2c3313e621d64727a48a1c
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f F src/fkey.c 928ed2517e8732113d2b9821aa37af639688d752f4ea9ac6e0e393d713eeb76f
F src/func.c a2186f55bd641818bf699c31797fbd780ca8b57142b0f8f4e3883a3727f6c642 F src/func.c 5a5bf6ff36fcc69ef2d71e296ef193f31dd884be5961203385e8ed065ca16685
F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b F src/global.c a19e4b1ca1335f560e9560e590fc13081e21f670643367f99cb9e8f9dc7d615b
F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7 F src/hash.c 73934a7f7ab1cb110614a9388cb516893b0cf5b7b69e4fd1a0780ac4ce166be7
F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf F src/hash.h 46b92795a95bfefb210f52f0c316e9d7cdbcdd7e7fcfb0d8be796d3a5767cddf
@@ -720,8 +720,8 @@ F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06 F src/os_common.h 6c0eb8dd40ef3e12fe585a13e709710267a258e2c8dd1c40b1948a1d14582e06
F src/os_kv.c fb7ba8d6204197357f1eb7e1c7450d09c10043bf7e99aba602f4aa46b8fb11a3 F src/os_kv.c fb7ba8d6204197357f1eb7e1c7450d09c10043bf7e99aba602f4aa46b8fb11a3
F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2 F src/os_setup.h 8efc64eda6a6c2f221387eefc2e7e45fd5a3d5c8337a7a83519ba4fbd2957ae2
F src/os_unix.c 53c7636d5bec7884d7f5d02e78ac16dd43162e6d1e0c0dbd6d58805922b84bd7 F src/os_unix.c bbd3ec01b2023bc41b532666533e087feea457c595d1b63284c8acc8929ea7d5
F src/os_win.c 5b14841f9c3ab76841c06a4eca20ba3e7747f44253eba9dfd3d918797e753d49 F src/os_win.c 27617f334168644b542c9d58ac6e5f051b318136273e78d243384b4eca2df6b3
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19 F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c 113f9149092ccff6cf90e97c2611200e5a237f13d26c394bc9fd933377852764 F src/pager.c 113f9149092ccff6cf90e97c2611200e5a237f13d26c394bc9fd933377852764
F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8 F src/pager.h 6137149346e6c8a3ddc1eeb40aee46381e9bc8b0fcc6dda8a1efde993c2275b8
@@ -737,7 +737,7 @@ F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97 F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957 F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957
F src/shell.c.in e58b0cecf2579c0115253e9c02a44b54fbadf77f4f33b43cfaa48a8274c9aa01 F src/shell.c.in e58b0cecf2579c0115253e9c02a44b54fbadf77f4f33b43cfaa48a8274c9aa01
F src/sqlite.h.in 3285114481f84812b9d8c1dc41a2dcd48ce4e79f610b8392ae398b56d1800e1e F src/sqlite.h.in 5590236c56ee8640b531e851544c1dfdb2e557db43c53b2e6825045f11271fc9
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479 F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52 F src/sqlite3ext.h 7f236ca1b175ffe03316d974ef57df79b3938466c28d2f95caef5e08c57f3a52
F src/sqliteInt.h 88f7fc9ce1630d9a5f7e0a8e1f3287cdc63882fba985c18e7eee1b9f457f59aa F src/sqliteInt.h 88f7fc9ce1630d9a5f7e0a8e1f3287cdc63882fba985c18e7eee1b9f457f59aa
@@ -2171,8 +2171,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 5e20a0435b1bd84d90c9a419219afe794fdf8ea73213f4c7ae5612c0375bed55 P 3c4020d76e29c39483f6b92857ea470245afcd514870c63bd3373e0e213cd355
R c88309ce7fbaf9b7abfef05cefac35c2 R 07d3093dc711b476e42052033512d6b3
U drh U drh
Z 5cd0917bc0c47465253ea4be3bf810d7 Z ef90fc149f30ab4d92213c20fbfd67c0
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
3c4020d76e29c39483f6b92857ea470245afcd514870c63bd3373e0e213cd355 ee797fec4eeace78caa2c5e463108bf1a6568db7c33d94d9fe6624cfc6b0d4fe

View File

@@ -3083,14 +3083,14 @@ static void percentValue(sqlite3_context *pCtx){
/****** End of percentile family of functions ******/ /****** End of percentile family of functions ******/
#endif /* SQLITE_ENABLE_PERCENTILE */ #endif /* SQLITE_ENABLE_PERCENTILE */
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
/* /*
** Implementation of sqlite_file_info(SCHEMA). ** Implementation of sqlite_filestat(SCHEMA).
** **
** Return JSON text that describes low-level debug/diagnostic information ** Return JSON text that describes low-level debug/diagnostic information
** about the sqlite3_file object associated with SCHEMA. ** about the sqlite3_file object associated with SCHEMA.
*/ */
static void fileInfoFunc( static void filestatFunc(
sqlite3_context *context, sqlite3_context *context,
int argc, int argc,
sqlite3_value **argv sqlite3_value **argv
@@ -3115,12 +3115,12 @@ static void fileInfoFunc(
sqlite3_result_error_nomem(context); sqlite3_result_error_nomem(context);
}else{ }else{
sqlite3_str_append(pStr, "{\"db\":", 6); sqlite3_str_append(pStr, "{\"db\":", 6);
rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_GET_INFO, pStr); rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_FILESTAT, pStr);
if( rc ) sqlite3_str_append(pStr, "null", 4); if( rc ) sqlite3_str_append(pStr, "null", 4);
fd = sqlite3PagerJrnlFile(pPager); fd = sqlite3PagerJrnlFile(pPager);
if( fd && fd->pMethods!=0 ){ if( fd && fd->pMethods!=0 ){
sqlite3_str_appendall(pStr, ",\"journal\":"); sqlite3_str_appendall(pStr, ",\"journal\":");
rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_GET_INFO, pStr); rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_FILESTAT, pStr);
if( rc ) sqlite3_str_append(pStr, "null", 4); if( rc ) sqlite3_str_append(pStr, "null", 4);
} }
sqlite3_str_append(pStr, "}", 1); sqlite3_str_append(pStr, "}", 1);
@@ -3132,7 +3132,7 @@ static void fileInfoFunc(
sqlite3_result_text(context, "{}", 2, SQLITE_STATIC); sqlite3_result_text(context, "{}", 2, SQLITE_STATIC);
} }
} }
#endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILE_INFO */ #endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILESTAT */
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
/* /*
@@ -3292,8 +3292,8 @@ void sqlite3RegisterBuiltinFunctions(void){
#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC
INLINE_FUNC(sqlite_offset, 1, INLINEFUNC_sqlite_offset, 0 ), INLINE_FUNC(sqlite_offset, 1, INLINEFUNC_sqlite_offset, 0 ),
#endif #endif
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
FUNCTION(sqlite_file_info, 1, 0, 0, fileInfoFunc ), FUNCTION(sqlite_filestat, 1, 0, 0, filestatFunc ),
#endif #endif
FUNCTION(ltrim, 1, 1, 0, trimFunc ), FUNCTION(ltrim, 1, 1, 0, trimFunc ),
FUNCTION(ltrim, 2, 1, 0, trimFunc ), FUNCTION(ltrim, 2, 1, 0, trimFunc ),

View File

@@ -596,7 +596,7 @@ static struct unix_syscall {
}; /* End of the overrideable system calls */ }; /* End of the overrideable system calls */
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
/* /*
** Extract Posix Advisory Locking information about file description fd ** Extract Posix Advisory Locking information about file description fd
** from the /proc/PID/fdinfo/FD pseudo-file. Fill the string buffer a[16] ** from the /proc/PID/fdinfo/FD pseudo-file. Fill the string buffer a[16]
@@ -707,7 +707,7 @@ static int unixPosixAdvisoryLocks(
} }
#else #else
# define unixPosixAdvisoryLocks(A,B) SQLITE_ERROR_UNABLE # define unixPosixAdvisoryLocks(A,B) SQLITE_ERROR_UNABLE
#endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILE_INFO */ #endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILESTAT */
/* /*
** On some systems, calls to fchown() will trigger a message in a security ** On some systems, calls to fchown() will trigger a message in a security
@@ -4115,7 +4115,7 @@ static int unixGetTempname(int nBuf, char *zBuf);
#if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL) #if !defined(SQLITE_WASI) && !defined(SQLITE_OMIT_WAL)
static int unixFcntlExternalReader(unixFile*, int*); static int unixFcntlExternalReader(unixFile*, int*);
#endif #endif
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
static void unixDescribeShm(sqlite3_str*,unixShm*); static void unixDescribeShm(sqlite3_str*,unixShm*);
#endif #endif
@@ -4262,8 +4262,8 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
#endif #endif
} }
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
case SQLITE_FCNTL_GET_INFO: { case SQLITE_FCNTL_FILESTAT: {
sqlite3_str *pStr = (sqlite3_str*)pArg; sqlite3_str *pStr = (sqlite3_str*)pArg;
char aLck[16]; char aLck[16];
unixInodeInfo *pInode; unixInodeInfo *pInode;
@@ -4320,7 +4320,7 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
sqlite3_str_append(pStr, "}", 1); sqlite3_str_append(pStr, "}", 1);
return SQLITE_OK; return SQLITE_OK;
} }
#endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILE_INFO */ #endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILESTAT */
} }
return SQLITE_NOTFOUND; return SQLITE_NOTFOUND;
} }
@@ -4587,7 +4587,7 @@ struct unixShm {
#define UNIX_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */ #define UNIX_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */
#define UNIX_SHM_DMS (UNIX_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */ #define UNIX_SHM_DMS (UNIX_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
/* /*
** Describe the pShm object using JSON. Used for diagnostics only. ** Describe the pShm object using JSON. Used for diagnostics only.
*/ */
@@ -4605,7 +4605,7 @@ static void unixDescribeShm(sqlite3_str *pStr, unixShm *pShm){
} }
sqlite3_str_append(pStr, "}", 1); sqlite3_str_append(pStr, "}", 1);
} }
#endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILE_INFO */ #endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILESTAT */
/* /*
** Use F_GETLK to check whether or not there are any readers with open ** Use F_GETLK to check whether or not there are any readers with open

View File

@@ -3953,8 +3953,8 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
} }
#endif /* SQLITE_ENABLE_SETLK_TIMEOUT */ #endif /* SQLITE_ENABLE_SETLK_TIMEOUT */
#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILE_INFO) #if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_FILESTAT)
case SQLITE_FCNTL_GET_INFO: { case SQLITE_FCNTL_FILESTAT: {
sqlite3_str *pStr = (sqlite3_str*)pArg; sqlite3_str *pStr = (sqlite3_str*)pArg;
sqlite3_str_appendf(pStr, "{\"h\":%llu", (sqlite3_uint64)pFile->h); sqlite3_str_appendf(pStr, "{\"h\":%llu", (sqlite3_uint64)pFile->h);
sqlite3_str_appendf(pStr, ",\"vfs\":\"%s\"", pFile->pVfs->zName); sqlite3_str_appendf(pStr, ",\"vfs\":\"%s\"", pFile->pVfs->zName);
@@ -3973,7 +3973,7 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
sqlite3_str_append(pStr, "}", 1); sqlite3_str_append(pStr, "}", 1);
return SQLITE_OK; return SQLITE_OK;
} }
#endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILE_INFO */ #endif /* SQLITE_DEBUG || SQLITE_ENABLE_FILESTAT */
} }
OSTRACE(("FCNTL file=%p, rc=SQLITE_NOTFOUND\n", pFile->h)); OSTRACE(("FCNTL file=%p, rc=SQLITE_NOTFOUND\n", pFile->h));

View File

@@ -1230,12 +1230,13 @@ struct sqlite3_io_methods {
** purges the contents of the in-memory page cache. If there is an open ** purges the contents of the in-memory page cache. If there is an open
** transaction, or if the db is a temp-db, this opcode is a no-op, not an error. ** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
** **
** <li>[[SQLITE_FCNTL_GET_INFO]] ** <li>[[SQLITE_FCNTL_FILESTAT]]
** The [SQLITE_FCNTL_GET_INFO] opcode returns debugging information about ** The [SQLITE_FCNTL_FILESTAT] opcode returns low-level diagnostic information
** the underlying [sqlite3_file]. The fourth parameter to [sqlite3_file_control()] ** about the [sqlite3_file] objects used access the database and journal files
** for the given schema. The fourth parameter to [sqlite3_file_control()]
** should be an initialized [sqlite3_str] pointer. JSON text describing ** should be an initialized [sqlite3_str] pointer. JSON text describing
** various aspects of the sqlite3_file object is appended to the sqlite3_str. ** various aspects of the sqlite3_file object is appended to the sqlite3_str.
** The SQLITE_FCNTL_GET_INFO opcode is usually a no-op, unless compile-time ** The SQLITE_FCNTL_FILESTAT opcode is usually a no-op, unless compile-time
** options are used to enable it. ** options are used to enable it.
** </ul> ** </ul>
*/ */
@@ -1282,7 +1283,7 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_RESET_CACHE 42 #define SQLITE_FCNTL_RESET_CACHE 42
#define SQLITE_FCNTL_NULL_IO 43 #define SQLITE_FCNTL_NULL_IO 43
#define SQLITE_FCNTL_BLOCK_ON_CONNECT 44 #define SQLITE_FCNTL_BLOCK_ON_CONNECT 44
#define SQLITE_FCNTL_GET_INFO 45 #define SQLITE_FCNTL_FILESTAT 45
/* deprecated names */ /* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE