SQLite4
Check-in [302b222395]
Not logged in

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

Overview
Comment:Changes to lsm_unix.c to build on android: (a) do not use fdatasync() on android and (b) account for the fact that usleep() returns void on android.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 302b22239598a0cd3426b6c2a5fe1a5b5ce52c94
User & Date: dan 2013-02-08 14:39:31
Context
2013-02-08
15:22
Avoid extending the database file when truncating it to the minimum number of blocks required during system shutdown. check-in: 9afc42d70d user: dan tags: trunk
14:39
Changes to lsm_unix.c to build on android: (a) do not use fdatasync() on android and (b) account for the fact that usleep() returns void on android. check-in: 302b222395 user: dan tags: trunk
11:30
Merge compression-id branch with trunk. check-in: 76297939d3 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/lsm_unix.c.

    34     34   
    35     35   #include <unistd.h>
    36     36   #include <errno.h>
    37     37   
    38     38   #include <sys/mman.h>
    39     39   #include "lsmInt.h"
    40     40   
           41  +/* There is no fdatasync() call on Android */
           42  +#ifdef __ANDROID__
           43  +# define fdatasync(x) fsync(x)
           44  +#endif
           45  +
    41     46   /*
    42     47   ** An open file is an instance of the following object
    43     48   */
    44     49   typedef struct PosixFile PosixFile;
    45     50   struct PosixFile {
    46     51     lsm_env *pEnv;                  /* The run-time environment */
    47     52     const char *zName;              /* Full path to file */
................................................................................
   403    408      close(p->fd);
   404    409      lsm_free(p->pEnv, p->apShm);
   405    410      lsm_free(p->pEnv, p);
   406    411      return LSM_OK;
   407    412   }
   408    413   
   409    414   static int lsmPosixOsSleep(lsm_env *pEnv, int us){
   410         -  if( usleep(us) ){
   411         -    return LSM_IOERR;
   412         -  }
          415  +#if 0
          416  +  /* Apparently on Android usleep() returns void */
          417  +  if( usleep(us) ) return LSM_IOERR;
          418  +#endif
          419  +  usleep(us);
   413    420     return LSM_OK;
   414    421   }
   415    422   
   416    423   /****************************************************************************
   417    424   ** Memory allocation routines.
   418    425   */
   419    426   #define BLOCK_HDR_SIZE ROUND8( sizeof(sqlite4_size_t) )