/ Check-in [2a6a0820]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Record the errno on fstat() failures.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: 2a6a0820010268593b8edd3c630734ee5f9aa5ab
User & Date: drh 2014-10-09 11:40:35
Context
2014-10-14
14:17
Merge from trunk recent micro-optimizations and the fix for the DESC index GROUP BY ORDER BY bug. check-in: 880df756 user: drh tags: apple-osx
2014-10-09
11:40
Record the errno on fstat() failures. check-in: 2a6a0820 user: drh tags: apple-osx
11:27
Merge the latest trunk enhancements into the apple-osx branch. check-in: 6fc72077 user: drh tags: apple-osx
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

4100
4101
4102
4103
4104
4105
4106
4107



4108
4109
4110
4111
4112
4113
4114
....
4993
4994
4995
4996
4997
4998
4999

5000
5001
5002
5003
5004
5005
5006
** nBytes or larger, this routine is a no-op.
*/
static int fcntlSizeHint(unixFile *pFile, i64 nByte){
  if( pFile->szChunk>0 ){
    i64 nSize;                    /* Required file size */
    struct stat buf;              /* Used to hold return values of fstat() */
   
    if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT;




    nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
    if( nSize>(i64)buf.st_size ){

#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
      /* The code below is handling the return value of osFallocate() 
      ** correctly. posix_fallocate() is defined to "returns zero on success, 
................................................................................
    const char *zBasePath = pDbFd->zPath;

    /* Call fstat() to figure out the permissions on the database file. If
    ** a new *-shm file is created, an attempt will be made to create it
    ** with the same permissions.
    */
    if( osFstat(pDbFd->h, &sStat) && pInode->bProcessLock==0 ){

      rc = SQLITE_IOERR_FSTAT;
      goto shm_open_err;
    }

#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
    /* If pDbFd is configured with proxy locking mode, use the local 
     ** lock file path to determine the -shm file path







|
>
>
>







 







>







4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
....
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
** nBytes or larger, this routine is a no-op.
*/
static int fcntlSizeHint(unixFile *pFile, i64 nByte){
  if( pFile->szChunk>0 ){
    i64 nSize;                    /* Required file size */
    struct stat buf;              /* Used to hold return values of fstat() */
   
    if( osFstat(pFile->h, &buf) ){
      storeLastErrno(pFile, errno);
      return SQLITE_IOERR_FSTAT;
    }

    nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
    if( nSize>(i64)buf.st_size ){

#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
      /* The code below is handling the return value of osFallocate() 
      ** correctly. posix_fallocate() is defined to "returns zero on success, 
................................................................................
    const char *zBasePath = pDbFd->zPath;

    /* Call fstat() to figure out the permissions on the database file. If
    ** a new *-shm file is created, an attempt will be made to create it
    ** with the same permissions.
    */
    if( osFstat(pDbFd->h, &sStat) && pInode->bProcessLock==0 ){
      storeLastErrno(pDbFd, errno);
      rc = SQLITE_IOERR_FSTAT;
      goto shm_open_err;
    }

#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
    /* If pDbFd is configured with proxy locking mode, use the local 
     ** lock file path to determine the -shm file path