/ Check-in [b7687e2f]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix the xRandomness() method on the unix VFS to return the number of bytes of randomness obtained. (CVS 5821)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b7687e2f2dfa5b0a01ba87ae0bf13684cda50499
User & Date: drh 2008-10-14 17:58:38
Context
2008-10-14
18:21
Fix the amalgamation generator to recognize indented #include directives. Ticket #3438. (CVS 5822) check-in: 494510d8 user: drh tags: trunk
17:58
Fix the xRandomness() method on the unix VFS to return the number of bytes of randomness obtained. (CVS 5821) check-in: b7687e2f user: drh tags: trunk
15:54
Make sure malloc3.test runs even if a CREATE TABLE transaction commits prior to the last OOM error. (CVS 5820) check-in: 603c40e5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2861
2862
2863
2864
2865
2866
2867


2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to Unix systems.
**
** $Id: os_unix.c,v 1.204 2008/09/24 09:12:47 danielk1977 Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX              /* This file is used on unix only */

/*
** If SQLITE_ENABLE_LOCKING_STYLE is defined and is non-zero, then several
** alternative locking implementations are provided:
................................................................................
    fd = open("/dev/urandom", O_RDONLY);
    if( fd<0 ){
      time_t t;
      time(&t);
      memcpy(zBuf, &t, sizeof(t));
      pid = getpid();
      memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));


    }else{
      read(fd, zBuf, nBuf);
      close(fd);
    }
  }
#endif
  return SQLITE_OK;
}


/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.
** The return value is the number of microseconds of sleep actually







|







 







>
>

|




|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to Unix systems.
**
** $Id: os_unix.c,v 1.205 2008/10/14 17:58:38 drh Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX              /* This file is used on unix only */

/*
** If SQLITE_ENABLE_LOCKING_STYLE is defined and is non-zero, then several
** alternative locking implementations are provided:
................................................................................
    fd = open("/dev/urandom", O_RDONLY);
    if( fd<0 ){
      time_t t;
      time(&t);
      memcpy(zBuf, &t, sizeof(t));
      pid = getpid();
      memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
      assert( sizeof(t)+sizeof(pid)<=nBuf );
      nBuf = sizeof(t) + sizeof(pid);
    }else{
      nBuf = read(fd, zBuf, nBuf);
      close(fd);
    }
  }
#endif
  return nBuf;
}


/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.
** The return value is the number of microseconds of sleep actually