From cc8fe0f0629eea9acc39e30d8d76d5890a5b6978 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 28 Oct 1997 14:19:54 +0000 Subject: SYSV IPC implementation of fast share modes. It will try sysv IPC first, then if that fails it will try mmap(), then after that it will try share files. I have defined USE_SYSV_IPC for Linux, Solaris and HPUX at the moment. Probably a lot more could have it defined. In fact, the vast majority of systems support it. Need autoconf again :-) It should actually be faster than the mmap() version, and doesn't need any lock files. This means the problem of the share mem file being on a NFS drive will be gone. --- source/include/includes.h | 12 ++++++++++++ source/include/proto.h | 17 +++++------------ source/include/smb.h | 5 ++++- 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'source/include') diff --git a/source/include/includes.h b/source/include/includes.h index 09c687aed56..91a2ec5c67b 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -214,6 +214,9 @@ Here come some platform specific sections #include #include #include +#include +#include +#include #include #ifndef NO_ASMSIGNALH #include @@ -233,6 +236,7 @@ Here come some platform specific sections #define HAVE_MEMMOVE #define USE_SIGPROCMASK #define USE_WAITPID +#define USE_SYSV_IPC #if 0 /* SETFS disabled until we can check on some bug reports */ #if _LINUX_C_LIB_VERSION_MAJOR >= 5 @@ -293,6 +297,9 @@ typedef unsigned short mode_t; #include #include #include +#include +#include +#include #include #include #include @@ -317,6 +324,7 @@ extern int innetgr (const char *, const char *, const char *, const char *); #define USE_STATVFS #define USE_GETCWD #define USE_SETSID +#define USE_SYSV_IPC #ifndef REPLACE_GETPASS #define REPLACE_GETPASS #endif /* REPLACE_GETPASS */ @@ -548,6 +556,9 @@ char *mktemp(char *); /* No standard include */ #include #include #include +#include +#include +#include #ifdef HPUX_10_TRUSTED #include #include @@ -563,6 +574,7 @@ char *mktemp(char *); /* No standard include */ #define USE_GETCWD #define USE_SETSID #define USE_SETRES +#define USE_SYSV_IPC #define DEFAULT_PRINTING PRINT_HPUX /* Ken Weiss tells us that SIGCLD_IGNORE is not good for HPUX */ diff --git a/source/include/proto.h b/source/include/proto.h index 669ed5fd8d8..13368c873d9 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -878,18 +878,11 @@ int construct_reply(char *inbuf,char *outbuf,int size,int bufsize); /*The following definitions come from shmem.c */ -BOOL smb_shm_open(char *file_name, int size, int ronly); -BOOL smb_shm_close( void ); -int smb_shm_alloc(int size); -BOOL smb_shm_free(int offset); -int smb_shm_get_userdef_off(void); -void *smb_shm_offset2addr(int offset); -int smb_shm_addr2offset(void *addr); -BOOL smb_shm_lock_hash_entry( unsigned int entry); -BOOL smb_shm_unlock_hash_entry( unsigned int entry ); -BOOL smb_shm_get_usage(int *bytes_free, - int *bytes_used, - int *bytes_overhead); +struct shmem_ops *smb_shm_open(char *file_name, int size, int ronly); + +/*The following definitions come from shmem_sysv.c */ + +struct shmem_ops *sysv_shm_open(int size, int ronly); /*The following definitions come from smbdes.c */ diff --git a/source/include/smb.h b/source/include/smb.h index 057a0b75506..d7a576de857 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -46,8 +46,12 @@ /* Default number of hash buckets used in shared memory share mode */ #ifndef SHMEM_HASH_SIZE +#ifdef SEMMSL +#define SHMEM_HASH_SIZE (SEMMSL-1) +#else #define SHMEM_HASH_SIZE 113 #endif +#endif #define NMB_PORT 137 #define DGRAM_PORT 138 @@ -1328,7 +1332,6 @@ struct share_ops { /* each implementation of the shared memory code needs to support the following operations */ struct shmem_ops { - BOOL (*open)(char *, int ); BOOL (*close)( void ); int (*alloc)(int ); BOOL (*free)(int ); -- cgit