aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bucket.c6
-rw-r--r--src/falloc.c4
-rw-r--r--src/findkey.c2
-rw-r--r--src/fullio.c4
-rw-r--r--src/gdbmclose.c2
-rw-r--r--src/gdbmopen.c4
-rw-r--r--src/gdbmsetopt.c2
-rw-r--r--src/gdbmstore.c2
-rw-r--r--src/gdbmsync.c2
-rw-r--r--src/gdbmtool.c4
-rw-r--r--src/proto.h20
-rw-r--r--src/recover.c2
-rw-r--r--src/systems.h16
-rw-r--r--src/update.c8
14 files changed, 41 insertions, 37 deletions
diff --git a/src/bucket.c b/src/bucket.c
index 2289594..e17019c 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -109,13 +109,13 @@ _gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
109 } 109 }
110 } 110 }
111 111
112 /* It is not in the cache, read it from the disk. */ 112 /* It is not in the cache, read it from the disk. */
113 113
114 /* Position the file pointer */ 114 /* Position the file pointer */
115 file_pos = __lseek (dbf, bucket_adr, SEEK_SET); 115 file_pos = gdbm_file_seek (dbf, bucket_adr, SEEK_SET);
116 if (file_pos != bucket_adr) 116 if (file_pos != bucket_adr)
117 { 117 {
118 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 118 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
119 _gdbm_fatal (dbf, _("lseek error")); 119 _gdbm_fatal (dbf, _("lseek error"));
120 return -1; 120 return -1;
121 } 121 }
@@ -184,13 +184,13 @@ _gdbm_read_bucket_at (GDBM_FILE dbf, off_t off, hash_bucket *bucket,
184 memcpy (bucket, dbf->bucket_cache[i].ca_bucket, size); 184 memcpy (bucket, dbf->bucket_cache[i].ca_bucket, size);
185 return 0; 185 return 0;
186 } 186 }
187 } 187 }
188 188
189 /* Read the bucket. */ 189 /* Read the bucket. */
190 file_pos = __lseek (dbf, off, SEEK_SET); 190 file_pos = gdbm_file_seek (dbf, off, SEEK_SET);
191 if (file_pos != off) 191 if (file_pos != off)
192 { 192 {
193 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 193 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
194 return -1; 194 return -1;
195 } 195 }
196 if (_gdbm_full_read (dbf, bucket, size)) 196 if (_gdbm_full_read (dbf, bucket, size))
@@ -429,13 +429,13 @@ _gdbm_split_bucket (GDBM_FILE dbf, int next_insert)
429int 429int
430_gdbm_write_bucket (GDBM_FILE dbf, cache_elem *ca_entry) 430_gdbm_write_bucket (GDBM_FILE dbf, cache_elem *ca_entry)
431{ 431{
432 int rc; 432 int rc;
433 off_t file_pos; /* The return value for lseek. */ 433 off_t file_pos; /* The return value for lseek. */
434 434
435 file_pos = __lseek (dbf, ca_entry->ca_adr, SEEK_SET); 435 file_pos = gdbm_file_seek (dbf, ca_entry->ca_adr, SEEK_SET);
436 if (file_pos != ca_entry->ca_adr) 436 if (file_pos != ca_entry->ca_adr)
437 { 437 {
438 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 438 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
439 _gdbm_fatal (dbf, _("lseek error")); 439 _gdbm_fatal (dbf, _("lseek error"));
440 return -1; 440 return -1;
441 } 441 }
diff --git a/src/falloc.c b/src/falloc.c
index 13ee0ed..2f21ebe 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -188,13 +188,13 @@ pop_avail_block (GDBM_FILE dbf)
188 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE); 188 GDBM_SET_ERRNO (dbf, GDBM_MALLOC_ERROR, TRUE);
189 _gdbm_fatal (dbf, _("malloc failed")); 189 _gdbm_fatal (dbf, _("malloc failed"));
190 return -1; 190 return -1;
191 } 191 }
192 192
193 /* Read the block. */ 193 /* Read the block. */
194 file_pos = __lseek (dbf, new_el.av_adr, SEEK_SET); 194 file_pos = gdbm_file_seek (dbf, new_el.av_adr, SEEK_SET);
195 if (file_pos != new_el.av_adr) 195 if (file_pos != new_el.av_adr)
196 { 196 {
197 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 197 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
198 free (new_blk); 198 free (new_blk);
199 _gdbm_fatal (dbf, _("lseek error")); 199 _gdbm_fatal (dbf, _("lseek error"));
200 return -1; 200 return -1;
@@ -318,13 +318,13 @@ push_avail_block (GDBM_FILE dbf)
318 /* Free the unneeded space. */ 318 /* Free the unneeded space. */
319 new_loc.av_adr += av_size; 319 new_loc.av_adr += av_size;
320 new_loc.av_size -= av_size; 320 new_loc.av_size -= av_size;
321 _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size); 321 _gdbm_free (dbf, new_loc.av_adr, new_loc.av_size);
322 322
323 /* Update the disk. */ 323 /* Update the disk. */
324 file_pos = __lseek (dbf, av_adr, SEEK_SET); 324 file_pos = gdbm_file_seek (dbf, av_adr, SEEK_SET);
325 if (file_pos != av_adr) 325 if (file_pos != av_adr)
326 { 326 {
327 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE); 327 GDBM_SET_ERRNO (dbf, GDBM_FILE_SEEK_ERROR, TRUE);
328 _gdbm_fatal (dbf, _("lseek error")); 328 _gdbm_fatal (dbf, _("lseek error"));
329 return -1; 329 return -1;
330 } 330 }
diff --git a/src/findkey.c b/src/findkey.c
index 9bb4553..9c8fd71 100644
--- a/src/findkey.c
+++ b/src/findkey.c
@@ -80,13 +80,13 @@ _gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
80 GDBM_SET_ERRNO2 (dbf, GDBM_MALLOC_ERROR, FALSE, GDBM_DEBUG_LOOKUP); 80 GDBM_SET_ERRNO2 (dbf, GDBM_MALLOC_ERROR, FALSE, GDBM_DEBUG_LOOKUP);
81 _gdbm_fatal (dbf, _("malloc error")); 81 _gdbm_fatal (dbf, _("malloc error"));
82 return NULL; 82 return NULL;
83 } 83 }
84 84
85 /* Read into the cache. */ 85 /* Read into the cache. */
86 file_pos = __lseek (dbf, dbf->bucket->h_table[elem_loc].data_pointer, 86 file_pos = gdbm_file_seek (dbf, dbf->bucket->h_table[elem_loc].data_pointer,
87 SEEK_SET); 87 SEEK_SET);
88 if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer) 88 if (file_pos != dbf->bucket->h_table[elem_loc].data_pointer)
89 { 89 {
90 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_LOOKUP); 90 GDBM_SET_ERRNO2 (dbf, GDBM_FILE_SEEK_ERROR, TRUE, GDBM_DEBUG_LOOKUP);
91 _gdbm_fatal (dbf, _("lseek error")); 91 _gdbm_fatal (dbf, _("lseek error"));
92 return NULL; 92 return NULL;
diff --git a/src/fullio.c b/src/fullio.c
index bdb51cb..84eea60 100644
--- a/src/fullio.c
+++ b/src/fullio.c
@@ -24,13 +24,13 @@
24int 24int
25_gdbm_full_read (GDBM_FILE dbf, void *buffer, size_t size) 25_gdbm_full_read (GDBM_FILE dbf, void *buffer, size_t size)
26{ 26{
27 char *ptr = buffer; 27 char *ptr = buffer;
28 while (size) 28 while (size)
29 { 29 {
30 ssize_t rdbytes = __read (dbf, ptr, size); 30 ssize_t rdbytes = gdbm_file_read (dbf, ptr, size);
31 if (rdbytes == -1) 31 if (rdbytes == -1)
32 { 32 {
33 if (errno == EINTR) 33 if (errno == EINTR)
34 continue; 34 continue;
35 if (gdbm_last_errno (dbf) == GDBM_NO_ERROR) 35 if (gdbm_last_errno (dbf) == GDBM_NO_ERROR)
36 GDBM_SET_ERRNO (dbf, GDBM_FILE_READ_ERROR, FALSE); 36 GDBM_SET_ERRNO (dbf, GDBM_FILE_READ_ERROR, FALSE);
@@ -52,13 +52,13 @@ _gdbm_full_read (GDBM_FILE dbf, void *buffer, size_t size)
52int 52int
53_gdbm_full_write (GDBM_FILE dbf, void *buffer, size_t size) 53_gdbm_full_write (GDBM_FILE dbf, void *buffer, size_t size)
54{ 54{
55 char *ptr = buffer; 55 char *ptr = buffer;
56 while (size) 56 while (size)
57 { 57 {
58 ssize_t wrbytes = __write (dbf, ptr, size); 58 ssize_t wrbytes = gdbm_file_write (dbf, ptr, size);
59 if (wrbytes == -1) 59 if (wrbytes == -1)
60 { 60 {
61 if (errno == EINTR) 61 if (errno == EINTR)
62 continue; 62 continue;
63 if (gdbm_last_errno (dbf) == GDBM_NO_ERROR) 63 if (gdbm_last_errno (dbf) == GDBM_NO_ERROR)
64 GDBM_SET_ERRNO (dbf, GDBM_FILE_WRITE_ERROR, TRUE); 64 GDBM_SET_ERRNO (dbf, GDBM_FILE_WRITE_ERROR, TRUE);
diff --git a/src/gdbmclose.c b/src/gdbmclose.c
index c638183..ead9187 100644
--- a/src/gdbmclose.c
+++ b/src/gdbmclose.c
@@ -32,13 +32,13 @@ gdbm_close (GDBM_FILE dbf)
32 int index; /* For freeing the bucket cache. */ 32 int index; /* For freeing the bucket cache. */
33 33
34 if (dbf->desc != -1) 34 if (dbf->desc != -1)
35 { 35 {
36 /* Make sure the database is all on disk. */ 36 /* Make sure the database is all on disk. */
37 if (dbf->read_write != GDBM_READER) 37 if (dbf->read_write != GDBM_READER)
38 __fsync (dbf); 38 gdbm_file_sync (dbf);
39 39
40 /* Close the file and free all malloced memory. */ 40 /* Close the file and free all malloced memory. */
41#if HAVE_MMAP 41#if HAVE_MMAP
42 _gdbm_mapped_unmap (dbf); 42 _gdbm_mapped_unmap (dbf);
43#endif 43#endif
44 if (dbf->file_locking) 44 if (dbf->file_locking)
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index 22e7ca6..53d62a4 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -426,13 +426,13 @@ gdbm_fd_open (int fd, const char *file_name, int block_size,
426 dbf->desc = -1; 426 dbf->desc = -1;
427 SAVE_ERRNO (gdbm_close (dbf)); 427 SAVE_ERRNO (gdbm_close (dbf));
428 return NULL; 428 return NULL;
429 } 429 }
430 430
431 /* Wait for initial configuration to be written to disk. */ 431 /* Wait for initial configuration to be written to disk. */
432 __fsync (dbf); 432 gdbm_file_sync (dbf);
433 433
434 free (dbf->bucket); 434 free (dbf->bucket);
435 } 435 }
436 else 436 else
437 { 437 {
438 /* This is an old database. Read in the information from the file 438 /* This is an old database. Read in the information from the file
@@ -505,13 +505,13 @@ gdbm_fd_open (int fd, const char *file_name, int block_size,
505 gdbm_close (dbf); 505 gdbm_close (dbf);
506 GDBM_SET_ERRNO2 (NULL, GDBM_MALLOC_ERROR, FALSE, GDBM_DEBUG_OPEN); 506 GDBM_SET_ERRNO2 (NULL, GDBM_MALLOC_ERROR, FALSE, GDBM_DEBUG_OPEN);
507 return NULL; 507 return NULL;
508 } 508 }
509 509
510 /* Read the hash table directory. */ 510 /* Read the hash table directory. */
511 file_pos = __lseek (dbf, dbf->header->dir, SEEK_SET); 511 file_pos = gdbm_file_seek (dbf, dbf->header->dir, SEEK_SET);
512 if (file_pos != dbf->header->dir) 512 if (file_pos != dbf->head