else printk (KERN_INFO "%s", buf);
#else
if (type != DBUG) {
- /* This is non-urgent .cmd data, so call
- _stp_ctl_write, instead of _stp_ctl_send. */
- _stp_ctl_write(STP_OOB_DATA, buf, start + num + 1);
+ _stp_ctl_send(STP_OOB_DATA, buf, start + num + 1);
} else {
_stp_print(buf);
_stp_print_flush();
#else /* !STP_BULKMODE */
#if STP_TRANSPORT_VERSION == 1
- /** STP_TRANSPORT_VERSION == 1 is special, _stp_ctl_write will
+ /** STP_TRANSPORT_VERSION == 1 is special, _stp_ctl_send/write will
pass through procfs _stp_ctl_write_fs which recognizes
STP_REALTIME_DATA as data that needs to be send right away
over the .cmd channel instead of being queued. */
- if (unlikely(_stp_ctl_write(STP_REALTIME_DATA, pb->buf, len) <= 0))
+ if (unlikely(_stp_ctl_send(STP_REALTIME_DATA, pb->buf, len) <= 0))
atomic_inc (&_stp_transport_failures);
#else /* STP_TRANSPORT_VERSION != 1 */
spin_lock_irqsave(&_stp_ctl_ready_lock, flags);
while (list_empty(&_stp_ctl_ready_q)) {
spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags);
+
+ /* Someone is listening, if exit flag is set AND we have finished
+ with probe_start() we might want them to know. */
+ if (unlikely(_stp_exit_flag && _stp_probes_started))
+ _stp_request_exit();
+
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
if (wait_event_interruptible(_stp_ctl_wq, !list_empty(&_stp_ctl_ready_q)))
static int _stp_exit_called = 0;
static DEFINE_MUTEX(_stp_transport_mutex);
-#ifndef STP_CTL_TIMER_INTERVAL
-/* ctl timer interval in jiffies (default 20 ms) */
-#define STP_CTL_TIMER_INTERVAL ((HZ+49)/50)
-#endif
-
-
// For now, disable transport version 3 (unless STP_USE_RING_BUFFER is
// defined).
#if STP_TRANSPORT_VERSION == 3 && !defined(STP_USE_RING_BUFFER)
static void probe_exit(void);
static int probe_start(void);
-struct timer_list _stp_ctl_work_timer;
-
/*
* _stp_handle_start - handle STP_START
*/
if (!_stp_exit_flag)
_stp_transport_data_fs_overwrite(1);
- del_timer_sync(&_stp_ctl_work_timer);
wake_up_interruptible(&_stp_ctl_wq);
}
dbug_trans(1, "attach\n");
_stp_pid = current->pid;
_stp_transport_data_fs_overwrite(0);
- init_timer(&_stp_ctl_work_timer);
- _stp_ctl_work_timer.expires = jiffies + STP_CTL_TIMER_INTERVAL;
- _stp_ctl_work_timer.function = _stp_ctl_work_callback;
- _stp_ctl_work_timer.data= 0;
- add_timer(&_stp_ctl_work_timer);
-}
-
-/*
- * _stp_ctl_work_callback - periodically check for IO or exit
- * This IO comes from ERRORs or WARNINGs which are send with
- * _stp_ctl_write as type STP_OOB_DATA, so don't immediately
- * trigger a wake_up of _stp_ctl_wq.
- * This is run by a kernel thread and may NOT sleep.
- */
-static void _stp_ctl_work_callback(unsigned long val)
-{
- int do_io = 0;
- unsigned long flags;
-
- spin_lock_irqsave(&_stp_ctl_ready_lock, flags);
- if (!list_empty(&_stp_ctl_ready_q))
- do_io = 1;
- spin_unlock_irqrestore(&_stp_ctl_ready_lock, flags);
- if (do_io)
- wake_up_interruptible(&_stp_ctl_wq);
-
- /* if exit flag is set AND we have finished with probe_start() */
- if (unlikely(_stp_exit_flag && _stp_probes_started))
- _stp_request_exit();
- if (atomic_read(& _stp_ctl_attached))
- mod_timer (&_stp_ctl_work_timer, jiffies + STP_CTL_TIMER_INTERVAL);
}
/**
/* amount of data a print can send. */
#define STP_BUFFER_SIZE 8192
-static int _stp_ctl_write(int type, void *data, unsigned len);
+static void _stp_request_exit(void);
/* STP_CTL_BUFFER_SIZE is the maximum size of a message */
/* exchanged on the control channel. */
* running the stap or staprun command.
*/
function system (cmd:string) %{
- /* NOTE this uses _stp_ctl_write and not _stp_ctl_send,
- so this will only be flushed to the .cmd stream on
- the next periodic _stp_ctl_work timer tick. */
- _stp_ctl_write(STP_SYSTEM, THIS->cmd, strlen(THIS->cmd)+1);
+ _stp_ctl_send(STP_SYSTEM, THIS->cmd, strlen(THIS->cmd)+1);
%}