Added "use mmap" for HPUX.
authorJeremy Allison <jra@samba.org>
Mon, 30 Jul 2001 22:21:31 +0000 (22:21 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 30 Jul 2001 22:21:31 +0000 (22:21 +0000)
Jeremy.
(This used to be commit 840802f10677cb0009cb4df4c37c7d01aa5edacd)

16 files changed:
source3/groupdb/mapping.c
source3/include/smb_macros.h
source3/lib/messages.c
source3/libsmb/unexpected.c
source3/locking/brlock.c
source3/locking/locking.c
source3/param/loadparm.c
source3/passdb/pdb_tdb.c
source3/passdb/secrets.c
source3/printing/nt_printing.c
source3/rpc_server/srv_srvsvc_nt.c
source3/smbd/connection.c
source3/smbd/session.c
source3/utils/smbcontrol.c
source3/utils/status.c
source3/web/statuspage.c

index a86283b556701054efec5942ac8a3ec8a6ccd6ef..97e755158663e1228654d3227b96bd2e493d950e 100644 (file)
@@ -130,7 +130,7 @@ BOOL init_group_mapping(void)
        char *vstring = "INFO/version";
 
        if (tdb && local_pid == sys_getpid()) return True;
-       tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, 0, O_RDWR|O_CREAT, 0600);
+       tdb = tdb_open_log(lock_path("group_mapping.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
        if (!tdb) {
                DEBUG(0,("Failed to open group mapping database\n"));
                return False;
index b168d68862f04f53d038e1263c441a6e0468a431..e1deaf58ea0d54016e664310298f47cb07de2722 100644 (file)
@@ -258,4 +258,5 @@ copy an IP address from one buffer to another
 
 #define vfs_chdir(conn,fname) ((conn)->vfs_ops.chdir((conn),fname))
 
+#define USE_TDB_MMAP_FLAG (!lp_use_mmap() ? TDB_NOMMAP : TDB_DEFAULT)
 #endif /* _SMB_MACROS_H */
index ffa873960e76951d5a37dc9bc43871a67e5ba4f3..78cd3e22bc2353a66dd6518c738cfcb047389c9a 100644 (file)
@@ -90,7 +90,7 @@ BOOL message_init(void)
        if (tdb) return True;
 
        tdb = tdb_open_log(lock_path("messages.tdb"), 
-                      0, TDB_CLEAR_IF_FIRST
+                      0, TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG,
                       O_RDWR|O_CREAT,0600);
 
        if (!tdb) {
index d757551963bc3dc484dcca5578916167fb9a7129..109e2b454abf3623efb094f21cbc60ae3d0a4302 100644 (file)
@@ -50,7 +50,7 @@ void unexpected_packet(struct packet_struct *p)
 
        if (!tdbd) {
                tdbd = tdb_open_log(lock_path("unexpected.tdb"), 1, 
-                              TDB_CLEAR_IF_FIRST,
+                              TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG,
                               O_RDWR | O_CREAT, 0644);
                if (!tdbd) {
                        DEBUG(0,("Failed to open unexpected.tdb\n"));
index 7f3ec6757e328e269997770d59555cf3aaf980b1..1982d9982c24192e54c314be57a5f7091635a830 100644 (file)
@@ -176,7 +176,7 @@ void brl_init(int read_only)
 
        if (tdb)
                return;
-       tdb = tdb_open_log(lock_path("brlock.tdb"), 0, TDB_CLEAR_IF_FIRST, 
+       tdb = tdb_open_log(lock_path("brlock.tdb"), 0, TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG
                       read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644);
        if (!tdb) {
                DEBUG(0,("Failed to open byte range locking database\n"));
index 067b1dc0ddf9fc8e1f5f4079e460a6051a96ee57..9b393ed6bacc698f3339327eb267dcfb8e8e846b 100644 (file)
@@ -295,7 +295,7 @@ BOOL locking_init(int read_only)
                return True;
 
        tdb = tdb_open_log(lock_path("locking.tdb"), 
-                      0, TDB_CLEAR_IF_FIRST, 
+                      0, TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG
                       read_only?O_RDONLY:O_RDWR|O_CREAT,
                       0644);
 
index 079711cab8f7f22968fbd197a75c489010a8fbb6..a1871437ac30458482d546e77ab015766bb06e88 100644 (file)
@@ -258,6 +258,7 @@ typedef struct
        BOOL bHostMSDfs;
        BOOL bHideLocalUsers;
        BOOL bUnicode;
+       BOOL bUseMmap;
 }
 global;
 
@@ -799,6 +800,7 @@ static struct parm_struct parm_table[] = {
        {"stat cache size", P_INTEGER, P_GLOBAL, &Globals.stat_cache_size, NULL, NULL, 0},
        {"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_SHARE},
        {"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_SHARE},
+       {"use mmap", P_BOOL, P_GLOBAL, &Globals.bUseMmap, NULL, NULL, 0},
        {"write cache size", P_INTEGER, P_LOCAL, &sDefault.iWriteCacheSize, NULL, NULL, FLAG_SHARE},
 
        {"Printing Options", P_SEP, P_SEPARATOR},
@@ -1264,6 +1266,7 @@ static void init_globals(void)
        Globals.min_passwd_length = MINPASSWDLENGTH;    /* By Default, 5. */
        Globals.oplock_break_wait_time = 0;     /* By Default, 0 msecs. */
        Globals.enhanced_browsing = True; 
+       Globals.bUseMmap = True;
 
 #ifdef WITH_LDAP
        /* default values for ldap */
@@ -1533,6 +1536,7 @@ FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
+FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
index 5ee7a379152e334d59462829944826a85be8720c..fc19f279181275f1f27be9c296b3f808f37ceadf 100644 (file)
@@ -344,10 +344,10 @@ BOOL pdb_setsampwent(BOOL update)
        pstrcat (tdbfile, PASSDB_FILE_NAME);
        
        /* Open tdb passwd */
-       if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, 0, update ? O_RDWR : O_RDONLY, 0600)))
+       if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, update ? O_RDWR : O_RDONLY, 0600)))
        {
                DEBUG(0, ("Unable to open TDB passwd, trying create new!\n"));
-               if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDWR | O_CREAT | O_EXCL, 0600)))
+               if (!(global_tdb_ent.passwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDWR | O_CREAT | O_EXCL, 0600)))
                {
                        DEBUG(0, ("Unable to create TDB passwd (passdb.tdb) !!!"));
                        return False;
@@ -476,7 +476,7 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, char *sname)
        key.dsize = strlen (keystr) + 1;
 
        /* open the accounts TDB */
-       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDONLY, 0600)))
+       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDONLY, 0600)))
        {
                DEBUG(0, ("pdb_getsampwnam: Unable to open TDB passwd!\n"));
                return False;
@@ -577,7 +577,7 @@ BOOL pdb_getsampwrid (SAM_ACCOUNT *user, uint32 rid)
        key.dsize = strlen (keystr) + 1;
 
        /* open the accounts TDB */
-       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDONLY, 0600)))
+       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDONLY, 0600)))
        {
                DEBUG(0, ("pdb_getsampwrid: Unable to open TDB rid database!\n"));
                return False;
@@ -622,7 +622,7 @@ BOOL pdb_delete_sam_account(char *sname)
        pstrcat (tdbfile, PASSDB_FILE_NAME);
 
        /* open the TDB */
-       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDWR, 0600)))
+       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDWR, 0600)))
        {
                DEBUG(0, ("Unable to open TDB passwd!"));
                return False;
@@ -744,13 +744,13 @@ static BOOL tdb_update_sam(SAM_ACCOUNT* newpwd, BOOL override, int flag)
        }
 
        /* open the account TDB passwd*/
-       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDWR, 0600)))
+       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDWR, 0600)))
        {
                DEBUG(0, ("tdb_update_sam: Unable to open TDB passwd!\n"));
                if (flag == TDB_INSERT)
                {
                        DEBUG(0, ("Unable to open TDB passwd, trying create new!\n"));
-                       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, 0, O_RDWR | O_CREAT | O_EXCL, 0600)))
+                       if (!(pwd_tdb = tdb_open_log(tdbfile, 0, USE_TDB_MMAP_FLAG, O_RDWR | O_CREAT | O_EXCL, 0600)))
                        {
                                DEBUG(0, ("Unable to create TDB passwd (passdb.tdb) !!!\n"));
                                return False;
index 12b340dfe599d04f5f1eaca22bca9d8ee6633463..d95810bf6111cc5348cece09a95e5394e3c82395 100644 (file)
@@ -36,7 +36,7 @@ BOOL secrets_init(void)
        pstrcpy(fname, lp_private_dir());
        pstrcat(fname,"/secrets.tdb");
 
-       tdb = tdb_open_log(fname, 0, 0, O_RDWR|O_CREAT, 0600);
+       tdb = tdb_open_log(fname, 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
 
        if (!tdb) {
                DEBUG(0,("Failed to open %s\n", fname));
index 10da46501acc6b1912fb122268ce76a496eb2787..57011dc9cc205cee94de28973893611f4ee271e1 100644 (file)
@@ -223,21 +223,21 @@ BOOL nt_printing_init(void)
 
        if (tdb_drivers && tdb_printers && tdb_forms && local_pid == sys_getpid()) return True;
 
-       tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, 0, O_RDWR|O_CREAT, 0600);
+       tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
        if (!tdb_drivers) {
                DEBUG(0,("Failed to open nt drivers database %s (%s)\n",
                        lock_path("ntdrivers.tdb"), strerror(errno) ));
                return False;
        }
 
-       tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, 0, O_RDWR|O_CREAT, 0600);
+       tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
        if (!tdb_printers) {
                DEBUG(0,("Failed to open nt printers database %s (%s)\n",
                        lock_path("ntprinters.tdb"), strerror(errno) ));
                return False;
        }
 
-       tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, 0, O_RDWR|O_CREAT, 0600);
+       tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
        if (!tdb_forms) {
                DEBUG(0,("Failed to open nt forms database %s (%s)\n",
                        lock_path("ntforms.tdb"), strerror(errno) ));
index 78d9429b4357dc3d75c2ae678ae230210bca8274..913b04bca3945624c14f0fb3f258c1f2c4749aa7 100644 (file)
@@ -125,7 +125,7 @@ BOOL share_info_db_init(void)
     char *vstring = "INFO/version";
  
     if (share_tdb && local_pid == sys_getpid()) return True;
-    share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, 0, O_RDWR|O_CREAT, 0600);
+    share_tdb = tdb_open_log(lock_path("share_info.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDWR|O_CREAT, 0600);
     if (!share_tdb) {
         DEBUG(0,("Failed to open share info database %s (%s)\n",
                                lock_path("share_info.tdb"), strerror(errno) ));
index 07ded5f4a367ac48dff37761ea38f0ad3babd359..df5869791712c72a99be8b25cd070c6a2dde45ee 100644 (file)
@@ -119,7 +119,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO
        BOOL ret = True;
 
        if (!tdb) {
-               tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST, 
+               tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG
                               O_RDWR | O_CREAT, 0644);
        }
        if (!tdb)
index 8f6907c5378b6e6e9f0bd9080cdae0bc19ebf90d..7616689fe0c360a563abeb61ef5f8afa3fc21570 100644 (file)
@@ -62,7 +62,7 @@ BOOL session_claim(uint16 vuid)
        }
 
        if (!tdb) {
-               tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST, 
+               tdb = tdb_open_log(lock_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST|USE_TDB_MMAP_FLAG
                               O_RDWR | O_CREAT, 0644);
                if (!tdb) {
                        DEBUG(1,("session_claim: failed to open sessionid tdb\n"));
index fef4ded218b9c79db6f2ecbe47f84c16a388293b..088ce0c08ed2e115d6c03c4c5bf7a0b808db77c7 100644 (file)
@@ -131,7 +131,7 @@ static BOOL send_message(char *dest, int msg_type, void *buf, int len, BOOL dupl
                TDB_CONTEXT *tdb;
                BOOL ret;
 
-               tdb = tdb_open_log(lock_path("connections.tdb"), 0, 0, O_RDONLY, 0);
+               tdb = tdb_open_log(lock_path("connections.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDONLY, 0);
                if (!tdb) {
                        fprintf(stderr,"Failed to open connections database in send_message.\n");
                        return False;
index ea683ad19c2e23e8582d4634ac91bdacd48b8a15..e5beb6403c8ca5296cb8c3795973d7fa93c5d259 100644 (file)
@@ -316,7 +316,7 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st
                return profile_dump();
        }
        
-       tdb = tdb_open_log(lock_path("connections.tdb"), 0, 0, O_RDONLY, 0);
+       tdb = tdb_open_log(lock_path("connections.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDONLY, 0);
        if (!tdb) {
                printf("connections.tdb not initialised\n");
                if (!lp_status(-1))
index 2efc37a0510368ee7c1d1adec9f41aa2c68c92bd..dc26e86ef88c2b1e0f269de4fd37935522a3bcc5 100644 (file)
@@ -187,7 +187,7 @@ void status_page(void)
                refresh_interval = atoi(v);
        }
 
-       tdb = tdb_open_log(lock_path("connections.tdb"), 0, 0, O_RDONLY, 0);
+       tdb = tdb_open_log(lock_path("connections.tdb"), 0, USE_TDB_MMAP_FLAG, O_RDONLY, 0);
        if (tdb) tdb_traverse(tdb, traverse_fn1, NULL);
 
        printf("<H2>Server Status</H2>\n");