diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2022-02-21 08:33:21 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2022-02-21 18:28:06 +0200 |
commit | c286e0b3f686d36b623e70a5ea1830381b08ab0d (patch) | |
tree | 76081d481619e861ce5560d6885b3f44d7037d53 /src/gdbmdefs.h | |
parent | 6655b123df5ca64327a8f630b7e7d972e253ad73 (diff) | |
download | gdbm-c286e0b3f686d36b623e70a5ea1830381b08ab0d.tar.gz |
Make sure attempts to lock the file never block
* src/gdbmdefs.h: Minor change.
* src/lock.c: Clean up the code. Use F_TLOCK for lockf(), to avoid
blocking.
Diffstat (limited to 'src/gdbmdefs.h')
-rw-r--r-- | src/gdbmdefs.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gdbmdefs.h b/src/gdbmdefs.h index 3348f9d..bad69e9 100644 --- a/src/gdbmdefs.h +++ b/src/gdbmdefs.h @@ -196,6 +196,15 @@ struct cache_elem bytes). */ }; +/* Type of file locking in use. */ +enum lock_type + { + LOCKING_NONE = 0, + LOCKING_FLOCK, + LOCKING_LOCKF, + LOCKING_FCNTL + }; + /* This final structure contains all main memory based information for a gdbm file. This allows multiple gdbm files to be opened at the same time by one program. */ @@ -240,11 +249,9 @@ struct gdbm_file_info int last_syserror; /* Last formatted error */ char *last_errstr; - - /* Type of file locking in use. */ - enum { LOCKING_NONE = 0, LOCKING_FLOCK, LOCKING_LOCKF, - LOCKING_FCNTL } lock_type; + enum lock_type lock_type; + /* The fatal error handling routine. */ void (*fatal_err) (const char *); |