#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);
/****************************************************************************
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);
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;
}
}
}
memcpy(&level, data->data, sizeof(level));
- set_profile_level(level, src);
+ set_profile_level(level, &src);
}
/****************************************************************************
int opt;
poptContext pc;
bool print_build_options = False;
+ struct server_id main_server_id = {0};
enum {
OPT_DAEMON = 1000,
OPT_INTERACTIVE,
} 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) {