From 4e1291a83f61a72989045879763d9ef05fd38f71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 21 Dec 1999 09:25:59 +0000 Subject: converted all our existing shared memory code to use a tdb database instead of either sysv or mmap shared memory or lock files. this means we can now completely remove locking_shm.c locking_slow.c shmem.c shmem_sysv.c and lots of other things also got simpler locking.c got a bit larger, but is much better compartmentalised now (This used to be commit e48c2d9937eea0667b8cd3332e49c06314ef31e7) --- source3/smbd/connection.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'source3/smbd/connection.c') diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index f88d707983..5b5ab005c8 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -26,27 +26,6 @@ extern fstring remote_machine; extern int DEBUGLEVEL; -/**************************************************************************** -open the connections database -****************************************************************************/ -TDB_CONTEXT *open_db(char *name) -{ - pstring fname; - - pstrcpy(fname,lp_lockdir()); - trim_string(fname,"","/"); - - if (!directory_exist(fname,NULL)) { - mkdir(fname,0755); - } - - pstrcat(fname,"/connections.tdb"); - - return tdb_open(fname, 0, O_RDWR | O_CREAT, 0644); -} - - - /**************************************************************************** delete a connection record ****************************************************************************/ @@ -56,7 +35,8 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections) TDB_DATA kbuf; TDB_CONTEXT *tdb; - if (!(tdb = open_db(name))) return False; + tdb = tdb_open(lock_path("connections.tdb"), 0, O_RDWR | O_CREAT, 0644); + if (!tdb) return False; DEBUG(3,("Yielding connection to %s\n",name)); @@ -100,7 +80,8 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO if (max_connections <= 0) return(True); - if (!(tdb = open_db(name))) return False; + tdb = tdb_open(lock_path("connections.tdb"), 0, O_RDWR | O_CREAT, 0644); + if (!tdb) return False; DEBUG(5,("claiming %s %d\n",name,max_connections)); -- cgit