s3: we have clock_gettime everywhere, remove ifdefs
[nivanova/samba-autobuild/.git] / source3 / profile / profile.c
index 257b0abba534043939fdf4f2a3deef3a4f80100f..4a61753ea388e553011d19af8128bc97ac36d792 100644 (file)
@@ -6,7 +6,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
 #include "includes.h"
+#include "librpc/gen_ndr/messaging.h"
 
 #ifdef WITH_PROFILE
 #define IPC_PERMS ((S_IRUSR | S_IWUSR) | S_IRGRP | S_IROTH)
 
 #ifdef WITH_PROFILE
 static int shm_id;
-static BOOL read_only;
-#if defined(HAVE_CLOCK_GETTIME)
+static bool read_only;
 clockid_t __profile_clock;
-BOOL have_profiling_clock = False;
-#endif
+bool have_profiling_clock = False;
 #endif
 
 struct profile_header *profile_h;
 struct profile_stats *profile_p;
 
-BOOL do_profile_flag = False;
-BOOL do_profile_times = False;
+bool do_profile_flag = False;
+bool do_profile_times = False;
 
 /****************************************************************************
 Set a profiling level.
@@ -90,6 +88,8 @@ void set_profile_level(int level, struct server_id src)
 #endif /* WITH_PROFILE */
 }
 
+#ifdef WITH_PROFILE
+
 /****************************************************************************
 receive a set profile level message
 ****************************************************************************/
@@ -135,9 +135,6 @@ static void reqprofile_message(struct messaging_context *msg_ctx,
 /*******************************************************************
   open the profiling shared memory area
   ******************************************************************/
-#ifdef WITH_PROFILE
-
-#ifdef HAVE_CLOCK_GETTIME
 
 /* Find a clock. Just because the definition for a particular clock ID is
  * present doesn't mean the system actually supports it.
@@ -194,17 +191,14 @@ static void init_clock_gettime(void)
                ("could not find a working clock for profiling"));
        return;
 }
-#endif
 
-BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
+bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
 {
        struct shmid_ds shm_ds;
 
        read_only = rdonly;
 
-#ifdef HAVE_CLOCK_GETTIME
        init_clock_gettime();
-#endif
 
  again:
        /* try to use an existing key */
@@ -227,7 +221,7 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
        
        profile_h = (struct profile_header *)shmat(shm_id, 0, 
                                                   read_only?SHM_RDONLY:0);
-       if ((long)profile_p == -1) {
+       if ((long)profile_h == -1) {
                DEBUG(0,("Can't attach to IPC area. Error was %s\n", 
                         strerror(errno)));
                return False;
@@ -251,7 +245,7 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
 
        if (shm_ds.shm_segsz != sizeof(*profile_h)) {
                DEBUG(0,("WARNING: profile size is %d (expected %d). Deleting\n",
-                        (int)shm_ds.shm_segsz, sizeof(*profile_h)));
+                        (int)shm_ds.shm_segsz, (int)sizeof(*profile_h)));
                if (shmctl(shm_id, IPC_RMID, &shm_ds) == 0) {
                        goto again;
                } else {
@@ -290,6 +284,7 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
            "syscall_rmdir",            /* PR_VALUE_SYSCALL_RMDIR */
            "syscall_closedir",         /* PR_VALUE_SYSCALL_CLOSEDIR */
            "syscall_open",             /* PR_VALUE_SYSCALL_OPEN */
+           "syscall_createfile",       /* PR_VALUE_SYSCALL_CREATEFILE */
            "syscall_close",            /* PR_VALUE_SYSCALL_CLOSE */
            "syscall_read",             /* PR_VALUE_SYSCALL_READ */
            "syscall_pread",            /* PR_VALUE_SYSCALL_PREAD */
@@ -297,7 +292,9 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
            "syscall_pwrite",           /* PR_VALUE_SYSCALL_PWRITE */
            "syscall_lseek",            /* PR_VALUE_SYSCALL_LSEEK */
            "syscall_sendfile",         /* PR_VALUE_SYSCALL_SENDFILE */
+           "syscall_recvfile",         /* PR_VALUE_SYSCALL_RECVFILE */
            "syscall_rename",           /* PR_VALUE_SYSCALL_RENAME */
+           "syscall_rename_at",        /* PR_VALUE_SYSCALL_RENAME_AT */
            "syscall_fsync",            /* PR_VALUE_SYSCALL_FSYNC */
            "syscall_stat",             /* PR_VALUE_SYSCALL_STAT */
            "syscall_fstat",            /* PR_VALUE_SYSCALL_FSTAT */
@@ -322,6 +319,11 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
            "syscall_realpath",         /* PR_VALUE_SYSCALL_REALPATH */
            "syscall_get_quota",        /* PR_VALUE_SYSCALL_GET_QUOTA */
            "syscall_set_quota",        /* PR_VALUE_SYSCALL_SET_QUOTA */
+           "syscall_get_sd",           /* PR_VALUE_SYSCALL_GET_SD */
+           "syscall_set_sd",           /* PR_VALUE_SYSCALL_SET_SD */
+           "syscall_brl_lock",         /* PR_VALUE_SYSCALL_BRL_LOCK */
+           "syscall_brl_unlock",       /* PR_VALUE_SYSCALL_BRL_UNLOCK */
+           "syscall_brl_cancel",       /* PR_VALUE_SYSCALL_BRL_CANCEL */
            "SMBmkdir",         /* PR_VALUE_SMBMKDIR */
            "SMBrmdir",         /* PR_VALUE_SMBRMDIR */
            "SMBopen",          /* PR_VALUE_SMBOPEN */
@@ -425,7 +427,6 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
            "NT_transact_set_user_quota",/* PR_VALUE_NT_TRANSACT_SET_USER_QUOTA */
            "get_nt_acl",               /* PR_VALUE_GET_NT_ACL */
            "fget_nt_acl",              /* PR_VALUE_FGET_NT_ACL */
-           "set_nt_acl",               /* PR_VALUE_SET_NT_ACL */
            "fset_nt_acl",              /* PR_VALUE_FSET_NT_ACL */
            "chmod_acl",                /* PR_VALUE_CHMOD_ACL */
            "fchmod_acl",               /* PR_VALUE_FCHMOD_ACL */
@@ -447,6 +448,25 @@ BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
            "sync_browse_lists",        /* PR_VALUE_SYNC_BROWSE_LISTS */
            "run_elections",            /* PR_VALUE_RUN_ELECTIONS */
            "election",                 /* PR_VALUE_ELECTION */
+           "smb2_negprot",             /* PR_VALUE_SMB2_NEGPROT */
+           "smb2_sesssetup",           /* PR_VALUE_SMB2_SESSETUP */
+           "smb2_logoff",              /* PR_VALUE_SMB2_LOGOFF */
+           "smb2_tcon",                /* PR_VALUE_SMB2_TCON */
+           "smb2_tdis",                /* PR_VALUE_SMB2_TDIS */
+           "smb2_create",              /* PR_VALUE_SMB2_CREATE */
+           "smb2_close",               /* PR_VALUE_SMB2_CLOSE */
+           "smb2_flush",               /* PR_VALUE_SMB2_FLUSH */
+           "smb2_read",                /* PR_VALUE_SMB2_READ */
+           "smb2_write",               /* PR_VALUE_SMB2_WRITE */
+           "smb2_lock",                /* PR_VALUE_SMB2_LOCK */
+           "smb2_ioctl",               /* PR_VALUE_SMB2_IOCTL */
+           "smb2_cancel",              /* PR_VALUE_SMB2_CANCEL */
+           "smb2_keepalive",           /* PR_VALUE_SMB2_KEEPALIVE */
+           "smb2_find",                /* PR_VALUE_SMB2_FIND */
+           "smb2_notify",              /* PR_VALUE_SMB2_NOTIFY */
+           "smb2_getinfo",             /* PR_VALUE_SMB2_GETINFO */
+           "smb2_setinfo"              /* PR_VALUE_SMB2_SETINFO */
+           "smb2_break",               /* PR_VALUE_SMB2_BREAK */
            "" /* PR_VALUE_MAX */
        };