/*
- Unix SMB/Netbios implementation.
- Version 1.9.
+ Unix SMB/CIFS implementation.
store smbd profiling information in shared memory
Copyright (C) Andrew Tridgell 1999
#include "includes.h"
-extern int DEBUGLEVEL;
-
+#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;
int level;
memcpy(&level, buf, sizeof(int));
+#ifdef WITH_PROFILE
switch (level) {
case 0: /* turn off profiling */
do_profile_flag = False;
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 */
}
/****************************************************************************
/*******************************************************************
open the profiling shared memory area
******************************************************************/
+#ifdef WITH_PROFILE
BOOL profile_setup(BOOL rdonly)
{
struct shmid_ds shm_ds;
return False;
}
-#if 0
- if (shm_ds.shm_perm.cuid != 0 || shm_ds.shm_perm.cgid != 0) {
- DEBUG(0,("ERROR: root did not create the shmem\n"));
+ if (shm_ds.shm_perm.cuid != sec_initial_uid() || shm_ds.shm_perm.cgid != sec_initial_gid()) {
+ DEBUG(0,("ERROR: we did not create the shmem (owned by another user)\n"));
return False;
}
-#endif
if (shm_ds.shm_segsz != sizeof(*profile_h)) {
DEBUG(0,("WARNING: profile size is %d (expected %d). Deleting\n",
message_register(MSG_REQ_PROFILELEVEL, reqprofile_message);
return True;
}
-
+#endif /* WITH_PROFILE */