]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3-profile: reduce dependencies of smbprofile.h
authorUri Simchoni <uri@samba.org>
Mon, 28 Mar 2016 07:11:33 +0000 (10:11 +0300)
committerJeremy Allison <jra@samba.org>
Mon, 28 Mar 2016 18:45:16 +0000 (20:45 +0200)
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/smbprofile.h
source3/profile/profile.c
source3/profile/profile_dummy.c
source3/smbd/server.c

index c771fd431d62543a4303ece653b3dc28c34683df..9d0256313e4a5bde83916e68f99c853c1174c702 100644 (file)
@@ -618,8 +618,9 @@ static inline void smbprofile_cleanup(pid_t pid, pid_t dst)
 #endif /* WITH_PROFILE */
 
 /* The following definitions come from profile/profile.c  */
+struct server_id;
 
-void set_profile_level(int level, struct server_id src);
+void set_profile_level(int level, const struct server_id *src);
 
 struct messaging_context;
 bool profile_setup(struct messaging_context *msg_ctx, bool rdonly);
index 1464a421b4d56040ff92853985f4c00b861438fa..833c9c4425de4d1caf57f5b942a51b2002cf6ef5 100644 (file)
@@ -39,7 +39,7 @@ struct smbprofile_global_state smbprofile_state;
 /****************************************************************************
 Set a profiling level.
 ****************************************************************************/
-void set_profile_level(int level, struct server_id src)
+void set_profile_level(int level, const struct server_id *src)
 {
        SMB_ASSERT(smbprofile_state.internal.db != NULL);
 
@@ -48,25 +48,25 @@ void set_profile_level(int level, struct server_id src)
                smbprofile_state.config.do_count = false;
                smbprofile_state.config.do_times = false;
                DEBUG(1,("INFO: Profiling turned OFF from pid %d\n",
-                        (int)procid_to_pid(&src)));
+                        (int)procid_to_pid(src)));
                break;
        case 1:         /* turn on counter profiling only */
                smbprofile_state.config.do_count = true;
                smbprofile_state.config.do_times = false;
                DEBUG(1,("INFO: Profiling counts turned ON from pid %d\n",
-                        (int)procid_to_pid(&src)));
+                        (int)procid_to_pid(src)));
                break;
        case 2:         /* turn on complete profiling */
                smbprofile_state.config.do_count = true;
                smbprofile_state.config.do_times = true;
                DEBUG(1,("INFO: Full profiling turned ON from pid %d\n",
-                        (int)procid_to_pid(&src)));
+                        (int)procid_to_pid(src)));
                break;
        case 3:         /* reset profile values */
                ZERO_STRUCT(profile_p->values);
                tdb_wipe_all(smbprofile_state.internal.db->tdb);
                DEBUG(1,("INFO: Profiling values cleared from pid %d\n",
-                        (int)procid_to_pid(&src)));
+                        (int)procid_to_pid(src)));
                break;
        }
 }
@@ -88,7 +88,7 @@ static void profile_message(struct messaging_context *msg_ctx,
        }
 
        memcpy(&level, data->data, sizeof(level));
-       set_profile_level(level, src);
+       set_profile_level(level, &src);
 }
 
 /****************************************************************************
index 1f820ec14b9828656bd2de59dac546b0d6751c3b..7d34d209fce06304679168b9646634e5804f8326 100644 (file)
@@ -25,7 +25,7 @@ bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
        return true;
 }
 
-void set_profile_level(int level, struct server_id src)
+void set_profile_level(int level, const struct server_id *src)
 {
        DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
 }
index d68615e864e55fb7ea91de2a1cfc96fca3691db5..7e5b5d90dd8b206b12e6510c1b2fec8b80ef75d6 100644 (file)
@@ -1192,6 +1192,7 @@ extern void build_options(bool screen);
        int opt;
        poptContext pc;
        bool print_build_options = False;
+       struct server_id main_server_id = {0};
         enum {
                OPT_DAEMON = 1000,
                OPT_INTERACTIVE,
@@ -1444,7 +1445,8 @@ extern void build_options(bool screen);
        } else {
                profiling_level = lp_smbd_profiling_level();
        }
-       set_profile_level(profiling_level, messaging_server_id(msg_ctx));
+       main_server_id = messaging_server_id(msg_ctx);
+       set_profile_level(profiling_level, &main_server_id);
 
        if (!is_daemon && !is_a_socket(0)) {
                if (!interactive) {