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

Add additional information about unix file descriptors to the same database file

in the sqlite_file_info() output.

FossilOrigin-Name: 64045f0a4d71ef068d64f2f25799cf1ae79c3cdb94039c73f1066290e3dbc943
This commit is contained in:
drh
2025-10-25 19:26:16 +00:00
parent 7be565f0cc
commit 726e836108
3 changed files with 40 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
C Adjust\sunixPosixAdvisorLocks()\sto\suse\sredirectable\ssystem\scalls\sso\sthat\nit\scan\sbe\stested. C Add\sadditional\sinformation\sabout\sunix\sfile\sdescriptors\sto\sthe\ssame\sdatabase\sfile\nin\sthe\ssqlite_file_info()\soutput.
D 2025-10-25T18:40:18.437 D 2025-10-25T19:26:16.953
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
@@ -720,7 +720,7 @@ 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 35ea3a2362b58390181bbb2450006558eb2fca72df31f6a933967ade4baa1172 F src/os_unix.c 8259386c205ae2297f9487c4e14169474697ef9c4c78e5ef546787eb2221523b
F src/os_win.c 5b14841f9c3ab76841c06a4eca20ba3e7747f44253eba9dfd3d918797e753d49 F src/os_win.c 5b14841f9c3ab76841c06a4eca20ba3e7747f44253eba9dfd3d918797e753d49
F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19 F src/os_win.h 4c247cdb6d407c75186c94a1e84d5a22cbae4adcec93fcae8d2bc1f956fd1f19
F src/pager.c 113f9149092ccff6cf90e97c2611200e5a237f13d26c394bc9fd933377852764 F src/pager.c 113f9149092ccff6cf90e97c2611200e5a237f13d26c394bc9fd933377852764
@@ -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 82f907016ee75ca288d8ac0664d5c147fbfad42c5f8222211acc3220bd0eb609 P eafe88b782875cd839fc27da509830e3e1d95781c686e27242a2844910203a42
R 72947327af2da3dba426a4fa276ec4a3 R 7022e3a791fb52de409c6fc91d6ad96f
U drh U drh
Z a63b0b7b05ef1a6b7c4fe4c0a7d92948 Z 4dfb0e7c66571c44833f2e4abaab7a73
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
eafe88b782875cd839fc27da509830e3e1d95781c686e27242a2844910203a42 64045f0a4d71ef068d64f2f25799cf1ae79c3cdb94039c73f1066290e3dbc943

View File

@@ -4266,17 +4266,19 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
case SQLITE_FCNTL_GET_INFO: { case SQLITE_FCNTL_GET_INFO: {
sqlite3_str *pStr = (sqlite3_str*)pArg; sqlite3_str *pStr = (sqlite3_str*)pArg;
char aLck[16]; char aLck[16];
unixInodeInfo *pInode;
static const char *azLock[] = { "SHARED", "RESERVED",
"PENDING", "EXCLUSIVE" };
sqlite3_str_appendf(pStr, "{\"h\":%d", pFile->h); sqlite3_str_appendf(pStr, "{\"h\":%d", pFile->h);
sqlite3_str_appendf(pStr, ",\"vfs\":\"%s\"", pFile->pVfs->zName); sqlite3_str_appendf(pStr, ",\"vfs\":\"%s\"", pFile->pVfs->zName);
if( pFile->eFileLock ){ if( pFile->eFileLock ){
static const char *azLock[] = { "SHARED", "RESERVED",
"PENDING", "EXCLUSIVE" };
sqlite3_str_appendf(pStr, ",\"eFileLock\":\"%s\"", sqlite3_str_appendf(pStr, ",\"eFileLock\":\"%s\"",
azLock[pFile->eFileLock-1]); azLock[pFile->eFileLock-1]);
if( unixPosixAdvisoryLocks(pFile->h, aLck)==SQLITE_OK ){ if( unixPosixAdvisoryLocks(pFile->h, aLck)==SQLITE_OK ){
sqlite3_str_appendf(pStr, ",\"pal\":\"%s\"", aLck); sqlite3_str_appendf(pStr, ",\"pal\":\"%s\"", aLck);
} }
} }
unixEnterMutex();
if( pFile->pShm ){ if( pFile->pShm ){
sqlite3_str_appendall(pStr, ",\"shm\":"); sqlite3_str_appendall(pStr, ",\"shm\":");
unixDescribeShm(pStr, pFile->pShm); unixDescribeShm(pStr, pFile->pShm);
@@ -4287,6 +4289,34 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
sqlite3_str_appendf(pStr, ",\"nFetchOut\":%d", pFile->nFetchOut); sqlite3_str_appendf(pStr, ",\"nFetchOut\":%d", pFile->nFetchOut);
} }
#endif #endif
if( (pInode = pFile->pInode)!=0 ){
sqlite3_str_appendf(pStr, ",\"inode\":{\"nRef\":%d",pInode->nRef);
sqlite3_mutex_enter(pInode->pLockMutex);
sqlite3_str_appendf(pStr, ",\"nShared\":%d", pInode->nShared);
if( pInode->eFileLock ){
sqlite3_str_appendf(pStr, ",\"eFileLock\":\"%s\"",
azLock[pInode->eFileLock-1]);
}
if( pInode->pUnused ){
char cSep = '[';
UnixUnusedFd *pUFd = pFile->pInode->pUnused;
sqlite3_str_appendall(pStr, ",\"unusedFd\":");
while( pUFd ){
sqlite3_str_appendf(pStr, "%c{\"fd\":%d,\"flags\":%d",
cSep, pUFd->fd, pUFd->flags);
cSep = ',';
if( unixPosixAdvisoryLocks(pFile->h, aLck)==SQLITE_OK ){
sqlite3_str_appendf(pStr, ",\"pal\":\"%s\"", aLck);
}
sqlite3_str_append(pStr, "}", 1);
pUFd = pUFd->pNext;
}
sqlite3_str_append(pStr, "]", 1);
}
sqlite3_mutex_leave(pInode->pLockMutex);
sqlite3_str_append(pStr, "}", 1);
}
unixLeaveMutex();
sqlite3_str_append(pStr, "}", 1); sqlite3_str_append(pStr, "}", 1);
return SQLITE_OK; return SQLITE_OK;
} }
@@ -4565,9 +4595,8 @@ static void unixDescribeShm(sqlite3_str *pStr, unixShm *pShm){
unixShmNode *pNode = pShm->pShmNode; unixShmNode *pNode = pShm->pShmNode;
char aLck[16]; char aLck[16];
sqlite3_str_appendf(pStr, "{\"h\":%d", pNode->hShm); sqlite3_str_appendf(pStr, "{\"h\":%d", pNode->hShm);
unixEnterMutex(); assert( unixMutexHeld() );
sqlite3_str_appendf(pStr, ",\"nRef\":%d", pNode->nRef); sqlite3_str_appendf(pStr, ",\"nRef\":%d", pNode->nRef);
unixLeaveMutex();
sqlite3_str_appendf(pStr, ",\"id\":%d", pShm->id); sqlite3_str_appendf(pStr, ",\"id\":%d", pShm->id);
sqlite3_str_appendf(pStr, ",\"sharedMask\":%d", pShm->sharedMask); sqlite3_str_appendf(pStr, ",\"sharedMask\":%d", pShm->sharedMask);
sqlite3_str_appendf(pStr, ",\"exclMask\":%d", pShm->exclMask); sqlite3_str_appendf(pStr, ",\"exclMask\":%d", pShm->exclMask);