From: Mathieu Desnoyers Date: Thu, 23 Jun 2011 19:40:58 +0000 (-0400) Subject: Add ring buffer flush ioctl X-Git-Tag: v2.0-pre1~48 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5c0552665e4d152e97edc995650711d4f6ac418d;p=lttng-modules.git Add ring buffer flush ioctl Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/ring_buffer_vfs.c b/lib/ringbuffer/ring_buffer_vfs.c index 9786d353..60d69a92 100644 --- a/lib/ringbuffer/ring_buffer_vfs.c +++ b/lib/ringbuffer/ring_buffer_vfs.c @@ -245,6 +245,9 @@ long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long ar return put_ulong(buf->backend.array[sb_bindex]->mmap_offset, arg); } + case RING_BUFFER_FLUSH: + lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE); + return 0; default: return -ENOIOCTLCMD; } @@ -355,6 +358,9 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd, return -EINVAL; return put_ulong(read_offset, arg); } + case RING_BUFFER_FLUSH: + lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE); + return 0; default: return -ENOIOCTLCMD; } diff --git a/lib/ringbuffer/vfs.h b/lib/ringbuffer/vfs.h index 0a09637a..d073e4c5 100644 --- a/lib/ringbuffer/vfs.h +++ b/lib/ringbuffer/vfs.h @@ -83,5 +83,7 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd, #define RING_BUFFER_GET_MMAP_LEN _IOR(0xF6, 0x0A, unsigned long) /* returns the offset of the subbuffer belonging to the mmap reader. */ #define RING_BUFFER_GET_MMAP_READ_OFFSET _IOR(0xF6, 0x0B, unsigned long) +/* flush the current sub-buffer */ +#define RING_BUFFER_FLUSH _IO(0xF6, 0x0C) #endif /* _LINUX_RING_BUFFER_VFS_H */