/ Check-in [2a20f793]
Login

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

Overview
Comment:Simplification of the error code translator in os_unix.c. Code cleanup only. The logic is unchanged.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2a20f793fdf6a2e88b679a7bd4e8ccf2935df049
User & Date: drh 2015-11-25 14:00:07
Context
2015-11-25
15:15
Remove unused methods from the unix VFS. check-in: 228bd15b user: drh tags: trunk
14:00
Simplification of the error code translator in os_unix.c. Code cleanup only. The logic is unchanged. check-in: 2a20f793 user: drh tags: trunk
11:56
Fix the fts5 "prefix=" option to match the documentation (space separated list, multiple prefix= options supported). The undocumented comma-separated format (compatible with fts4) still works. check-in: 11eb8e87 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   755    755   ** and a variety of "please close the file descriptor NOW" errors into 
   756    756   ** SQLITE_IOERR
   757    757   ** 
   758    758   ** Errors during initialization of locks, or file system support for locks,
   759    759   ** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately.
   760    760   */
   761    761   static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
          762  +  assert( (sqliteIOErr == SQLITE_IOERR_LOCK) || 
          763  +          (sqliteIOErr == SQLITE_IOERR_UNLOCK) || 
          764  +          (sqliteIOErr == SQLITE_IOERR_RDLOCK) ||
          765  +          (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) );
   762    766     switch (posixError) {
   763         -#if 0
   764         -  /* At one point this code was not commented out. In theory, this branch
   765         -  ** should never be hit, as this function should only be called after
   766         -  ** a locking-related function (i.e. fcntl()) has returned non-zero with
   767         -  ** the value of errno as the first argument. Since a system call has failed,
   768         -  ** errno should be non-zero.
   769         -  **
   770         -  ** Despite this, if errno really is zero, we still don't want to return
   771         -  ** SQLITE_OK. The system call failed, and *some* SQLite error should be
   772         -  ** propagated back to the caller. Commenting this branch out means errno==0
   773         -  ** will be handled by the "default:" case below.
   774         -  */
   775         -  case 0: 
   776         -    return SQLITE_OK;
   777         -#endif
   778         -
          767  +  case EACCES: 
   779    768     case EAGAIN:
   780    769     case ETIMEDOUT:
   781    770     case EBUSY:
   782    771     case EINTR:
   783    772     case ENOLCK:  
   784    773       /* random NFS retry error, unless during file system support 
   785    774        * introspection, in which it actually means what it says */
   786    775       return SQLITE_BUSY;
   787    776       
   788         -  case EACCES: 
   789         -    /* EACCES is like EAGAIN during locking operations, but not any other time*/
   790         -    if( (sqliteIOErr == SQLITE_IOERR_LOCK) || 
   791         -        (sqliteIOErr == SQLITE_IOERR_UNLOCK) || 
   792         -        (sqliteIOErr == SQLITE_IOERR_RDLOCK) ||
   793         -        (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) ){
   794         -      return SQLITE_BUSY;
   795         -    }
   796         -    /* else fall through */
   797    777     case EPERM: 
   798    778       return SQLITE_PERM;
   799    779       
   800         -#if EOPNOTSUPP!=ENOTSUP
   801         -  case EOPNOTSUPP: 
   802         -    /* something went terribly awry, unless during file system support 
   803         -     * introspection, in which it actually means what it says */
   804         -#endif
   805         -#ifdef ENOTSUP
   806         -  case ENOTSUP: 
   807         -    /* invalid fd, unless during file system support introspection, in which 
   808         -     * it actually means what it says */
   809         -#endif
   810         -  case EIO:
   811         -  case EBADF:
   812         -  case EINVAL:
   813         -  case ENOTCONN:
   814         -  case ENODEV:
   815         -  case ENXIO:
   816         -  case ENOENT:
   817         -#ifdef ESTALE                     /* ESTALE is not defined on Interix systems */
   818         -  case ESTALE:
   819         -#endif
   820         -  case ENOSYS:
   821         -    /* these should force the client to close the file and reconnect */
   822         -    
   823    780     default: 
   824    781       return sqliteIOErr;
   825    782     }
   826    783   }
   827    784   
   828    785   
   829    786   /******************************************************************************