Lines Matching refs:fd
209 int fd; /* File descriptor to close */ member
558 static int robustFchown(int fd, uid_t uid, gid_t gid){ in robustFchown() argument
560 return osGeteuid() ? 0 : osFchown(fd,uid,gid); in robustFchown()
676 int fd; in robust_open() local
680 fd = osOpen(z,f|O_CLOEXEC,m2); in robust_open()
682 fd = osOpen(z,f,m2); in robust_open()
684 if( fd<0 ){ in robust_open()
688 if( fd>=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break; in robust_open()
689 osClose(fd); in robust_open()
691 "attempt to open \"%s\" as file descriptor %d", z, fd); in robust_open()
692 fd = -1; in robust_open()
695 if( fd>=0 ){ in robust_open()
698 if( osFstat(fd, &statbuf)==0 in robust_open()
702 osFchmod(fd, m); in robust_open()
706 osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); in robust_open()
709 return fd; in robust_open()
780 static int lockTrace(int fd, int op, struct flock *p){ in lockTrace() argument
789 s = osFcntl(fd, op, p); in lockTrace()
790 sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); in lockTrace()
803 s = osFcntl(fd, op, p); in lockTrace()
806 threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len, in lockTrace()
811 osFcntl(fd, F_GETLK, &l2); in lockTrace()
1312 robust_close(pFile, p->fd, __LINE__); in closePendingFds()
1366 int fd; /* The file descriptor for pFile */ in findInodeInfo() local
1376 fd = pFile->h; in findInodeInfo()
1377 rc = osFstat(fd, &statbuf); in findInodeInfo()
1398 do{ rc = osWrite(fd, "S", 1); }while( rc<0 && errno==EINTR ); in findInodeInfo()
1403 rc = osFstat(fd, &statbuf); in findInodeInfo()
2403 static int robust_flock(int fd, int op){ in robust_flock() argument
2405 do{ rc = flock(fd,op); }while( rc<0 && errno==EINTR ); in robust_flock()
2792 int fd; /* file desc to assoc this lock with */ member
2817 pb.fd = pFile->h; in afpSetLock()
2820 (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""), in afpSetLock()
3413 int fd, /* File descriptor to write to */ in seekAndWriteFd() argument
3422 assert( fd>2 ); in seekAndWriteFd()
3428 do{ rc = (int)osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR ); in seekAndWriteFd()
3430 do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); in seekAndWriteFd()
3433 i64 iSeek = lseek(fd, iOff, SEEK_SET); in seekAndWriteFd()
3439 rc = osWrite(fd, pBuf, nBuf); in seekAndWriteFd()
3444 OSTRACE(("WRITE %-3d %5d %7lld %llu\n", fd, rc, iOff, TIMER_ELAPSED)); in seekAndWriteFd()
3602 static int full_fsync(int fd, int fullSync, int dataOnly){ in full_fsync() argument
3610 UNUSED_PARAMETER(fd); in full_fsync()
3637 rc = osFstat(fd, &buf); in full_fsync()
3641 rc = osFcntl(fd, F_FULLFSYNC, 0); in full_fsync()
3653 if( rc ) rc = fsync(fd); in full_fsync()
3659 rc = fsync(fd); in full_fsync()
3661 rc = fdatasync(fd); in full_fsync()
3664 rc = fsync(fd); in full_fsync()
3700 int fd = -1; in openDirectory() local
3711 fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0); in openDirectory()
3712 if( fd>=0 ){ in openDirectory()
3713 OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname)); in openDirectory()
3715 *pFd = fd; in openDirectory()
3716 if( fd>=0 ) return SQLITE_OK; in openDirectory()
4732 sqlite3_file *fd, /* Handle open on database file */ in unixShmMap() argument
4738 unixFile *pDbFd = (unixFile*)fd; in unixShmMap()
4907 sqlite3_file *fd, /* Database file holding the shared memory */ in unixShmLock() argument
4912 unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */ in unixShmLock()
5045 sqlite3_file *fd /* Database file holding the shared memory */ in unixShmBarrier() argument
5047 UNUSED_PARAMETER(fd); in unixShmBarrier()
5049 assert( fd->pMethods->xLock==nolockLock in unixShmBarrier()
5050 || unixFileMutexNotheld((unixFile*)fd) in unixShmBarrier()
5064 sqlite3_file *fd, /* The underlying database file */ in unixShmUnmap() argument
5072 pDbFd = (unixFile*)fd; in unixShmUnmap()
5274 static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ in unixFetch() argument
5276 unixFile *pFd = (unixFile *)fd; /* The underlying database file */ in unixFetch()
5305 static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ in unixUnfetch() argument
5307 unixFile *pFd = (unixFile *)fd; /* The underlying database file */ in unixUnfetch()
5326 UNUSED_PARAMETER(fd); in unixUnfetch()
6091 int fd = -1; /* File descriptor returned by open() */ in unixOpen() local
6172 fd = pUnused->fd; in unixOpen()
6210 if( fd<0 ){ in unixOpen()
6220 fd = robust_open(zName, openFlags, openMode); in unixOpen()
6221 OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags)); in unixOpen()
6223 if( fd<0 ){ in unixOpen()
6235 fd = robust_open(zName, openFlags, openMode); in unixOpen()
6238 if( fd<0 ){ in unixOpen()
6257 robustFchown(fd, uid, gid); in unixOpen()
6260 assert( fd>=0 ); in unixOpen()
6266 p->pPreallocatedUnused->fd = fd; in unixOpen()
6277 robust_close(p, fd, __LINE__); in unixOpen()
6291 if( fstatfs(fd, &fsInfo) == -1 ){ in unixOpen()
6293 robust_close(p, fd, __LINE__); in unixOpen()
6328 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); in unixOpen()
6348 rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); in unixOpen()
6384 int fd; in unixDelete() local
6385 rc = osOpenDirectory(zPath, &fd); in unixDelete()
6387 if( full_fsync(fd,0,0) ){ in unixDelete()
6390 robust_close(0, fd, __LINE__); in unixDelete()
6651 int fd, got; in unixRandomness() local
6652 fd = robust_open("/dev/urandom", O_RDONLY, 0); in unixRandomness()
6653 if( fd<0 ){ in unixRandomness()
6661 do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR ); in unixRandomness()
6662 robust_close(0, fd, __LINE__); in unixRandomness()
7044 int fd = -1; in proxyCreateUnixFile() local
7060 fd = pUnused->fd; in proxyCreateUnixFile()
7067 if( fd<0 ){ in proxyCreateUnixFile()
7068 fd = robust_open(path, openFlags, 0); in proxyCreateUnixFile()
7070 if( fd<0 && errno==ENOENT && islockfile ){ in proxyCreateUnixFile()
7072 fd = robust_open(path, openFlags, 0); in proxyCreateUnixFile()
7076 if( fd<0 ){ in proxyCreateUnixFile()
7078 fd = robust_open(path, openFlags, 0); in proxyCreateUnixFile()
7081 if( fd<0 ){ in proxyCreateUnixFile()
7105 pUnused->fd = fd; in proxyCreateUnixFile()
7109 rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0); in proxyCreateUnixFile()
7115 robust_close(pNew, fd, __LINE__); in proxyCreateUnixFile()
7185 int fd = -1; in proxyBreakConchLock() local
7203 fd = robust_open(tPath, (O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW), 0); in proxyBreakConchLock()
7204 if( fd<0 ){ in proxyBreakConchLock()
7208 if( osPwrite(fd, buf, readLen, 0) != (ssize_t)readLen ){ in proxyBreakConchLock()
7219 conchFile->h = fd; in proxyBreakConchLock()
7224 if( fd>=0 ){ in proxyBreakConchLock()
7226 robust_close(pFile, fd, __LINE__); in proxyBreakConchLock()
7477 int fd; in proxyTakeConch() local
7482 fd = robust_open(pCtx->dbPath, pFile->openFlags, 0); in proxyTakeConch()
7483 OSTRACE(("TRANSPROXY: OPEN %d\n", fd)); in proxyTakeConch()
7484 if( fd>=0 ){ in proxyTakeConch()
7485 pFile->h = fd; in proxyTakeConch()