view lib/fsplib/lock.h @ 918:e9f22ad1dec5

2007-4-26 Brian Masney <masneyb@gftp.org> * src/uicommon/gftpui.c (_gftpui_common_trans_file_or_dir) - don't attempt to create the directory if it already exists. (gftpui_common_add_file_transfer) - don't ask the user what to do with an individual directory that needs to be transferred. * lib/local.c (local_mkdir) - removed code that checks for the EEXISTS error.
author masneyb
date Fri, 27 Apr 2007 00:40:52 +0000
parents db4b34e3f83f
children 26fb4e66736c
line wrap: on
line source

#ifndef _FSPLIB_H_LOCK
#define _FSPLIB_H_LOCK 1

#include "../../config.h"

#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