From: hunt Date: Fri, 19 Aug 2005 18:29:21 +0000 (+0000) Subject: 2005-08-19 Martin Hunt X-Git-Tag: release-0.3~43 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=efc364eebf15dd7e8b6c93e155af83b6d3971752;p=systemtap.git 2005-08-19 Martin Hunt * transport.c (_stp_cmd_handler): Remove. This was used by stp-control. * procfs.c (_stp_proc_write_cmd): Call schedule_work() instead of running _stp_exit_handler immediately. Fixes a problem where the module couldn't exit if all the output buffers were full. Set .owner for the filesystem entries. --- diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog index ce0114743..2405568bb 100644 --- a/runtime/transport/ChangeLog +++ b/runtime/transport/ChangeLog @@ -1,5 +1,15 @@ 2005-08-19 Martin Hunt + * transport.c (_stp_cmd_handler): Remove. This was used by + stp-control. + + * procfs.c (_stp_proc_write_cmd): Call schedule_work() instead + of running _stp_exit_handler immediately. Fixes a problem where + the module couldn't exit if all the output buffers were full. + Set .owner for the filesystem entries. + +2005-08-19 Martin Hunt + * transport.h: Remove netlink references. * transport.c: Remove netlink references. Ifdef relayfs code. * procfs.c: New file. diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c index 2e0e8e6c1..8af2d018d 100644 --- a/runtime/transport/procfs.c +++ b/runtime/transport/procfs.c @@ -55,6 +55,7 @@ static ssize_t _stp_proc_write (struct file *file, const char __user *buf, } static struct file_operations _stp_proc_fops = { + .owner = THIS_MODULE, .read = _stp_proc_read, .write = _stp_proc_write, }; @@ -87,7 +88,10 @@ static ssize_t _stp_proc_write_cmd (struct file *file, const char __user *buf, break; } case STP_EXIT: - _stp_handle_exit(NULL); + /* Cannot call _stp_handle_exit() directly here */ + /* because the buffers may be full and stpd won't be able */ + /* to empty them until this handler returns. */ + schedule_work (&stp_exit); break; case STP_TRANSPORT_INFO: { @@ -191,6 +195,7 @@ _stp_proc_read_cmd (struct file *file, char __user *buf, size_t count, loff_t *p static struct file_operations _stp_proc_fops_cmd = { + .owner = THIS_MODULE, .read = _stp_proc_read_cmd, .write = _stp_proc_write_cmd, // .poll = _stp_proc_poll_cmd diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index b2df885c2..f2df07c37 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -5,7 +5,7 @@ * transport.c - stp transport functions * * Copyright (C) IBM Corporation, 2005 - * Copyright (C) Redhat Inc, 2005 + * Copyright (C) Red Hat Inc, 2005 * * This file is released under the GPL. */ @@ -34,6 +34,7 @@ int probe_start(void); void _stp_exit(void); void _stp_handle_start (struct transport_start *st); static void _stp_handle_exit (void *data); +static DECLARE_WORK(stp_exit, _stp_handle_exit, NULL); int _stp_transport_open(struct transport_info *info); #include "procfs.c" @@ -118,15 +119,11 @@ static void _stp_cleanup_and_exit (int closing) ssleep(2); } #endif - //printk ("SENDING STP_EXIT\n"); _stp_transport_send(STP_EXIT, &closing, sizeof(int)); } } -static void _stp_handle_exit (void *data); -static DECLARE_WORK(stp_exit, _stp_handle_exit, NULL); - /* * _stp_handle_exit - handle STP_EXIT */ @@ -203,46 +200,6 @@ int _stp_transport_open(struct transport_info *info) /* send reply */ return _stp_transport_send (STP_TRANSPORT_INFO, info, sizeof(*info)); - } - - -/** - * _stp_cmd_handler - control channel command handler callback - * @pid: the pid of the daemon the command was sent from - * @cmd: the command id - * @data: command-specific data - * - * This function must return 0 if the command was handled, nonzero - * otherwise. - */ -static int _stp_cmd_handler(int pid, int cmd, void *data) -{ - int err = 0; - - switch (cmd) { -#ifdef STP_RELAYFS - case STP_BUF_INFO: - _stp_handle_buf_info(data); - break; - case STP_SUBBUFS_CONSUMED: - _stp_handle_subbufs_consumed(pid, data); - break; -#endif - case STP_EXIT: - _stp_handle_exit (data); - break; - case STP_TRANSPORT_INFO: - _stp_transport_open (data); - break; - case STP_START: - _stp_handle_start (data); - break; - default: - err = -1; - break; - } - - return err; } /**