|
IDZEBRA 2.2.11
|
#include <stdio.h>#include <assert.h>#include <string.h>#include <errno.h>#include <fcntl.h>#include <sys/types.h>#include <idzebra/flock.h>#include <zebra-lock.h>#include <yaz/xmalloc.h>#include <yaz/log.h>Go to the source code of this file.
Data Structures | |
| struct | zebra_lock_handle |
| struct | zebra_lock_info |
Functions | |
| char * | zebra_mk_fname (const char *dir, const char *name) |
| ZebraLockHandle | zebra_lock_create (const char *dir, const char *name) |
| void | zebra_lock_destroy (ZebraLockHandle h) |
| static int | unixLock (int fd, int type, int cmd) |
| int | zebra_lock_w (ZebraLockHandle h) |
| int | zebra_lock_r (ZebraLockHandle h) |
| int | zebra_unlock (ZebraLockHandle h) |
| static int | check_for_linuxthreads (void) |
| see if the fcntl locking is not POSIX | |
| void | zebra_flock_init () |
Variables | |
| static int | initialized = 0 |
| static int | posix_locks = 1 |
| Zebra_mutex | lock_list_mutex |
| static struct zebra_lock_info * | lock_list = 0 |
| static int | log_level = 0 |
|
static |
see if the fcntl locking is not POSIX
The default posix_locks=1 is assumed.. This function sets posix_locks to zero if linuxthreads is in use.
Definition at line 360 of file flock.c.
References posix_locks.
Referenced by zebra_flock_init().
|
static |
Definition at line 221 of file flock.c.
Referenced by zebra_lock_r(), zebra_lock_w(), and zebra_unlock().
| void zebra_flock_init | ( | void | ) |
Definition at line 380 of file flock.c.
References check_for_linuxthreads(), initialized, lock_list_mutex, log_level, posix_locks, and zebra_mutex_init().
Referenced by main(), and zebra_start_res().
| ZebraLockHandle zebra_lock_create | ( | const char * | dir, |
| const char * | name ) |
Definition at line 106 of file flock.c.
References zebra_lock_info::fd, zebra_lock_info::file_mutex, zebra_lock_info::fname, initialized, lock_list, lock_list_mutex, log_level, zebra_lock_info::next, zebra_lock_info::no_file_read_lock, zebra_lock_info::no_file_write_lock, O_BINARY, zebra_lock_handle::p, posix_locks, zebra_lock_info::rdwr_lock, zebra_lock_info::ref_count, zebra_lock_handle::write_flag, zebra_lock_rdwr_init(), zebra_mk_fname(), zebra_mutex_init(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by run_func(), and zebra_select_register().
| void zebra_lock_destroy | ( | ZebraLockHandle | h | ) |
Definition at line 177 of file flock.c.
References zebra_lock_info::fd, zebra_lock_info::file_mutex, zebra_lock_info::fname, lock_list, lock_list_mutex, log_level, zebra_lock_info::next, zebra_lock_handle::p, posix_locks, zebra_lock_info::rdwr_lock, zebra_lock_info::ref_count, zebra_lock_rdwr_destroy(), zebra_mutex_destroy(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by run_func(), zebra_close(), and zebra_select_register().
| int zebra_lock_r | ( | ZebraLockHandle | h | ) |
Definition at line 277 of file flock.c.
References zebra_lock_info::fd, zebra_lock_info::file_mutex, zebra_lock_info::fname, log_level, zebra_lock_info::no_file_read_lock, zebra_lock_info::no_file_write_lock, zebra_lock_handle::p, posix_locks, zebra_lock_info::rdwr_lock, unixLock(), zebra_lock_handle::write_flag, zebra_lock_rdwr_rlock(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by run_func(), zebra_begin_trans(), and zebra_commit_ex().
| int zebra_lock_w | ( | ZebraLockHandle | h | ) |
Definition at line 240 of file flock.c.
References zebra_lock_info::fd, zebra_lock_info::file_mutex, zebra_lock_info::fname, log_level, zebra_lock_info::no_file_write_lock, zebra_lock_handle::p, posix_locks, zebra_lock_info::rdwr_lock, unixLock(), zebra_lock_handle::write_flag, zebra_lock_rdwr_wlock(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by run_func(), zebra_begin_trans(), and zebra_commit_ex().
| char * zebra_mk_fname | ( | const char * | dir, |
| const char * | name ) |
Definition at line 84 of file flock.c.
References zebra_lock_info::fname.
Referenced by zebra_get_state(), zebra_lock_create(), and zebra_set_state().
| int zebra_unlock | ( | ZebraLockHandle | h | ) |
Definition at line 313 of file flock.c.
References zebra_lock_info::fd, zebra_lock_info::file_mutex, zebra_lock_info::fname, log_level, zebra_lock_info::no_file_read_lock, zebra_lock_info::no_file_write_lock, zebra_lock_handle::p, posix_locks, zebra_lock_info::rdwr_lock, unixLock(), zebra_lock_handle::write_flag, zebra_lock_rdwr_runlock(), zebra_lock_rdwr_wunlock(), zebra_mutex_lock(), and zebra_mutex_unlock().
Referenced by run_func(), zebra_begin_trans(), zebra_commit_ex(), and zebra_end_transaction().
|
static |
have this module (mutex) been initialized?
Definition at line 44 of file flock.c.
Referenced by zebra_flock_init(), and zebra_lock_create().
|
static |
our list of file locked files
Definition at line 53 of file flock.c.
Referenced by zebra_lock_create(), and zebra_lock_destroy().
| Zebra_mutex lock_list_mutex |
mutex for lock_list below
Definition at line 50 of file flock.c.
Referenced by zebra_flock_init(), zebra_lock_create(), and zebra_lock_destroy().
|
static |
Definition at line 82 of file flock.c.
Referenced by add(), begin(), begin(), begin(), calc(), calc_1(), cf_commit(), cf_commit_flat(), checkattr(), code_read(), create(), create(), create(), destroy(), destroy(), destroy(), end(), end(), end(), log_item(), log_pr(), map_basenames(), r_close(), r_close(), r_delete(), r_delete(), r_delete(), r_flush(), r_forward(), r_forward(), r_open(), r_open(), r_open(), r_pos(), r_pos(), r_pos_x(), r_read(), r_read(), r_read(), r_read_filter(), rfd_create_base(), rset_close(), rset_close_int(), rset_create_base(), rset_create_between(), rset_create_temp(), rset_default_forward(), rset_delete(), rset_dup(), rset_set_hits_limit(), rsisamb_create(), rsisamc_create(), rsmulti_andor_create(), tst_insert(), unixLock(), zebra_admin_import_begin(), zebra_admin_import_end(), zebra_admin_import_segment(), zebra_admin_shutdown(), zebra_admin_start(), zebra_begin_trans(), zebra_chdir(), zebra_clean(), zebra_close(), zebra_commit(), zebra_commit_ex(), zebra_compact(), zebra_create_database(), zebra_deleteResultSet(), zebra_drop_database(), zebra_end_trans(), zebra_end_transaction(), zebra_errAdd(), zebra_errCode(), zebra_errString(), zebra_flock_init(), zebra_flush_reg(), zebra_get_resource(), zebra_get_shadow_enable(), zebra_get_state(), zebra_init(), zebra_lock_create(), zebra_lock_destroy(), zebra_lock_r(), zebra_lock_w(), zebra_octet_term_encoding(), zebra_open(), zebra_record_encoding(), zebra_records_retrieve(), zebra_repository_index(), zebra_repository_show(), zebra_result(), zebra_scan(), zebra_search_PQF(), zebra_search_RPN_x(), zebra_select_database(), zebra_select_databases(), zebra_set_resource(), zebra_set_shadow_enable(), zebra_set_state(), zebra_shadow_enable(), zebra_snippets_log(), zebra_sort(), zebra_sort_by_specstr(), zebra_start_res(), zebra_string_norm(), zebra_trans_no(), zebra_unlock(), and zebra_update_record().
|
static |
whether fcntl locks are shared for all threads in a process (POSIX)
Definition at line 47 of file flock.c.
Referenced by check_for_linuxthreads(), zebra_flock_init(), zebra_lock_create(), zebra_lock_destroy(), zebra_lock_r(), zebra_lock_w(), and zebra_unlock().