diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/fsplib/lock.h	Sun Jan 16 16:12:13 2005 +0000
@@ -0,0 +1,45 @@
+#ifndef _FSPLIB_H_LOCK
+#define _FSPLIB_H_LOCK 1
+
+#ifndef FSP_NOLOCKING
+/* define locking prefix if needed */
+# ifndef FSP_KEY_PREFIX
+#  define FSP_KEY_PREFIX "/tmp/.FSPL"
+# endif
+#endif
+
+#ifdef FSP_USE_SHAREMEM_AND_SEMOP
+
+typedef struct FSP_LOCK {
+		unsigned int *share_key;
+		int   lock_shm;
+		int   lock_sem;
+		char key_string[sizeof(FSP_KEY_PREFIX)+32];
+} FSP_LOCK;
+
+#elif defined(FSP_NOLOCKING)
+
+typedef struct FSP_LOCK {
+               unsigned short share_key;
+} FSP_LOCK;
+
+#elif defined(FSP_USE_LOCKF)
+
+typedef struct FSP_LOCK {  
+	       int lock_fd;
+	       char key_string[sizeof(FSP_KEY_PREFIX)+32];
+} FSP_LOCK;
+
+#else
+#error "No locking type specified"
+#endif
+
+/* prototypes */
+
+unsigned short client_get_key (FSP_LOCK *lock);
+void client_set_key (FSP_LOCK *lock,unsigned short key);
+int client_init_key (FSP_LOCK *lock,
+                            unsigned long server_addr,
+			    unsigned short server_port);
+void client_destroy_key(FSP_LOCK *lock);
+#endif