This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
BOOL do_profile_times = False;
/****************************************************************************
-receive a set profile level message
+Set a profiling level.
****************************************************************************/
-void profile_message(int msg_type, struct process_id src,
- void *buf, size_t len, void *private_data)
+void set_profile_level(int level, struct server_id src)
{
- int level;
-
- memcpy(&level, buf, sizeof(int));
#ifdef WITH_PROFILE
switch (level) {
case 0: /* turn off profiling */
#endif /* WITH_PROFILE */
}
+#ifdef WITH_PROFILE
+
+/****************************************************************************
+receive a set profile level message
+****************************************************************************/
+static void profile_message(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data)
+{
+ int level;
+
+ if (data->length != sizeof(level)) {
+ DEBUG(0, ("got invalid profile message\n"));
+ return;
+ }
+
+ memcpy(&level, data->data, sizeof(level));
+ set_profile_level(level, src);
+}
+
/****************************************************************************
receive a request profile level message
****************************************************************************/
-void reqprofile_message(int msg_type, struct process_id src,
- void *buf, size_t len, void *private_data)
+static void reqprofile_message(struct messaging_context *msg_ctx,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id src,
+ DATA_BLOB *data)
{
int level;
#endif
DEBUG(1,("INFO: Received REQ_PROFILELEVEL message from PID %u\n",
(unsigned int)procid_to_pid(&src)));
- message_send_pid(src, MSG_PROFILELEVEL, &level, sizeof(int), True);
+ messaging_send_buf(msg_ctx, src, MSG_PROFILELEVEL,
+ (uint8 *)&level, sizeof(level));
}
/*******************************************************************
open the profiling shared memory area
******************************************************************/
-#ifdef WITH_PROFILE
#ifdef HAVE_CLOCK_GETTIME
}
#endif
-BOOL profile_setup(BOOL rdonly)
+BOOL profile_setup(struct messaging_context *msg_ctx, BOOL rdonly)
{
struct shmid_ds shm_ds;
if (shm_ds.shm_segsz != sizeof(*profile_h)) {
DEBUG(0,("WARNING: profile size is %d (expected %d). Deleting\n",
- (int)shm_ds.shm_segsz, sizeof(*profile_h)));
+ (int)shm_ds.shm_segsz, (int)sizeof(*profile_h)));
if (shmctl(shm_id, IPC_RMID, &shm_ds) == 0) {
goto again;
} else {
}
profile_p = &profile_h->stats;
- message_register(MSG_PROFILE, profile_message, NULL);
- message_register(MSG_REQ_PROFILELEVEL, reqprofile_message, NULL);
+ if (msg_ctx != NULL) {
+ messaging_register(msg_ctx, NULL, MSG_PROFILE,
+ profile_message);
+ messaging_register(msg_ctx, NULL, MSG_REQ_PROFILELEVEL,
+ reqprofile_message);
+ }
return True;
}
"syscall_fchown", /* PR_VALUE_SYSCALL_FCHOWN */
"syscall_chdir", /* PR_VALUE_SYSCALL_CHDIR */
"syscall_getwd", /* PR_VALUE_SYSCALL_GETWD */
- "syscall_utime", /* PR_VALUE_SYSCALL_UTIME */
+ "syscall_ntimes", /* PR_VALUE_SYSCALL_NTIMES */
"syscall_ftruncate", /* PR_VALUE_SYSCALL_FTRUNCATE */
"syscall_fcntl_lock", /* PR_VALUE_SYSCALL_FCNTL_LOCK */
"syscall_kernel_flock", /* PR_VALUE_SYSCALL_KERNEL_FLOCK */