[PATCH] back-port WITH_PROFILE fix to 3_0 branch
Paul_GreenVOS at vos.stratus.com
Paul_GreenVOS at vos.stratus.com
Mon Oct 14 16:07:01 GMT 2002
The following changes have already been applied to the Samba
HEAD and 2_2 branches (around the end of this past August). I
would like to request that they be applied to the 3_0 branch as
well.
The effect is to ifdef out all of the profile code if
WITH_PROFILE is false. We need this change because we don't
implement System V-style SVM.
Tested by me on VOS (#undef WITH_PROFILE)
### START OF PATCH ###
diff -urp --new-file oldsamba/source/profile/profile.c newsamba/source/profile/profile.c
--- oldsamba/source/profile/profile.c Mon Oct 14 11:55:26 2002
+++ newsamba/source/profile/profile.c Mon Oct 14 11:55:14 2002
@@ -21,10 +21,14 @@
#include "includes.h"
+#ifdef WITH_PROFILE
#define IPC_PERMS ((SHM_R | SHM_W) | (SHM_R>>3) | (SHM_R>>6))
+#endif /* WITH_PROFILE */
+#ifdef WITH_PROFILE
static int shm_id;
static BOOL read_only;
+#endif
struct profile_header *profile_h;
struct profile_stats *profile_p;
@@ -45,6 +49,7 @@ void profile_message(int msg_type, pid_t
int level;
memcpy(&level, buf, sizeof(int));
+#ifdef WITH_PROFILE
switch (level) {
case 0: /* turn off profiling */
do_profile_flag = False;
@@ -66,6 +71,9 @@ void profile_message(int msg_type, pid_t
DEBUG(1,("INFO: Profiling values cleared from pid %d\n", (int)src));
break;
}
+#else /* WITH_PROFILE */
+ DEBUG(1,("INFO: Profiling support unavailable in this build.\n"));
+#endif /* WITH_PROFILE */
}
/****************************************************************************
@@ -87,6 +95,7 @@ void reqprofile_message(int msg_type, pi
/*******************************************************************
open the profiling shared memory area
******************************************************************/
+#ifdef WITH_PROFILE
BOOL profile_setup(BOOL rdonly)
{
struct shmid_ds shm_ds;
@@ -154,3 +163,4 @@ BOOL profile_setup(BOOL rdonly)
message_register(MSG_REQ_PROFILELEVEL, reqprofile_message);
return True;
}
+#endif /* WITH_PROFILE */
diff -urp --new-file oldsamba/source/utils/status.c newsamba/source/utils/status.c
--- oldsamba/source/utils/status.c Mon Oct 14 11:55:54 2002
+++ newsamba/source/utils/status.c Mon Oct 14 11:56:03 2002
@@ -146,6 +146,7 @@ static void print_brl(SMB_DEV_T dev, SMB
******************************************************************/
static int profile_dump(void)
{
+#ifdef WITH_PROFILE
if (!profile_setup(True)) {
fprintf(stderr,"Failed to initialise profile memory\n");
return -1;
@@ -482,6 +483,9 @@ static int profile_dump(void)
d_printf("run_elections_time: %u\n", profile_p->run_elections_time);
d_printf("election_count: %u\n", profile_p->election_count);
d_printf("election_time: %u\n", profile_p->election_time);
+#else /* WITH_PROFILE */
+ fprintf(stderr, "Profile data unavailable\n");
+#endif /* WITH_PROFILE */
return 0;
}
@@ -549,12 +553,13 @@ static int traverse_sessionid(TDB_CONTEX
{"conf", 's', POPT_ARG_STRING, 0, 's'},
{"user", 'u', POPT_ARG_STRING, 0, 'u'},
{"brief", 'b', POPT_ARG_NONE, &brief},
+#ifdef WITH_PROFILE
{"profile", 'P', POPT_ARG_NONE, &profile_only},
+#endif /* WITH_PROFILE */
{"byterange", 'B', POPT_ARG_NONE, &show_brl},
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
{ 0, 0, 0, 0}
};
-
setup_logging(argv[0],True);
### END OF PATCH ###
Thanks
PG
--
Paul Green | Mail: Paul.Green at stratus.com
Senior Technical Consultant | Voice: +1 978-461-7557 FAX: +1 978-461-3610
Stratus Technologies | Video: PictureTel/AT&T by request.
Maynard, MA 01754 | Disclaimer: I speak for myself, not Stratus.
More information about the samba-technical
mailing list