Mercurial > gftp.yaz
comparison lib/fsplib/lock.h @ 662:be9663e0be00
2005-1-16 Brian Masney <masneyb@gftp.org>
* lib/fsplib/COPYING lib/fsplib/Makefile.am lib/fsplib/fsplib.c
lib/fsplib/fsplib.h lib/fsplib/lock.c lib/fsplib/lock.h - added FSPLIB
This library is written by Radim Kolar <hsn@netmag.cz> and was included
with his permission
author | masneyb |
---|---|
date | Sun, 16 Jan 2005 16:12:13 +0000 |
parents | |
children | db4b34e3f83f |
comparison
equal
deleted
inserted
replaced
661:2e718fba351e | 662:be9663e0be00 |
---|---|
1 #ifndef _FSPLIB_H_LOCK | |
2 #define _FSPLIB_H_LOCK 1 | |
3 | |
4 #ifndef FSP_NOLOCKING | |
5 /* define locking prefix if needed */ | |
6 # ifndef FSP_KEY_PREFIX | |
7 # define FSP_KEY_PREFIX "/tmp/.FSPL" | |
8 # endif | |
9 #endif | |
10 | |
11 #ifdef FSP_USE_SHAREMEM_AND_SEMOP | |
12 | |
13 typedef struct FSP_LOCK { | |
14 unsigned int *share_key; | |
15 int lock_shm; | |
16 int lock_sem; | |
17 char key_string[sizeof(FSP_KEY_PREFIX)+32]; | |
18 } FSP_LOCK; | |
19 | |
20 #elif defined(FSP_NOLOCKING) | |
21 | |
22 typedef struct FSP_LOCK { | |
23 unsigned short share_key; | |
24 } FSP_LOCK; | |
25 | |
26 #elif defined(FSP_USE_LOCKF) | |
27 | |
28 typedef struct FSP_LOCK { | |
29 int lock_fd; | |
30 char key_string[sizeof(FSP_KEY_PREFIX)+32]; | |
31 } FSP_LOCK; | |
32 | |
33 #else | |
34 #error "No locking type specified" | |
35 #endif | |
36 | |
37 /* prototypes */ | |
38 | |
39 unsigned short client_get_key (FSP_LOCK *lock); | |
40 void client_set_key (FSP_LOCK *lock,unsigned short key); | |
41 int client_init_key (FSP_LOCK *lock, | |
42 unsigned long server_addr, | |
43 unsigned short server_port); | |
44 void client_destroy_key(FSP_LOCK *lock); | |
45 #endif |