summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/smbprofile.h3
-rw-r--r--source3/profile/profile.c12
-rw-r--r--source3/profile/profile_dummy.c2
-rw-r--r--source3/smbd/server.c4
4 files changed, 12 insertions, 9 deletions
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index c771fd431d6..9d0256313e4 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -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);
diff --git a/source3/profile/profile.c b/source3/profile/profile.c
index 1464a421b4d..833c9c4425d 100644
--- a/source3/profile/profile.c
+++ b/source3/profile/profile.c
@@ -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);
}
/****************************************************************************
diff --git a/source3/profile/profile_dummy.c b/source3/profile/profile_dummy.c
index 1f820ec14b9..7d34d209fce 100644
--- a/source3/profile/profile_dummy.c
+++ b/source3/profile/profile_dummy.c
@@ -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"));
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index d68615e864e..7e5b5d90dd8 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -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) {