From: compudj Date: Tue, 1 Nov 2005 16:51:44 +0000 (+0000) Subject: lttd changes for lockless lttng X-Git-Tag: 0.80~210 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4f31148bf7aa2be2530fef44d7d2078c81a35042;p=ltt-control.git lttd changes for lockless lttng git-svn-id: http://ltt.polymtl.ca/svn@1303 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttd/lttd.c b/ltt/branches/poly/lttd/lttd.c index 9a6b3d6..6da2924 100644 --- a/ltt/branches/poly/lttd/lttd.c +++ b/ltt/branches/poly/lttd/lttd.c @@ -297,13 +297,13 @@ end: int read_subbuffer(struct fd_pair *pair) { - unsigned int subbuf_index; + unsigned int consumed_old; int err, ret; err = ioctl(pair->channel, RELAYFS_GET_SUBBUF, - &subbuf_index); - printf("index : %u\n", subbuf_index); + &consumed_old); + printf("cookie : %u\n", consumed_old); if(err != 0) { perror("Error in reserving sub buffer"); ret = -EPERM; @@ -311,7 +311,7 @@ int read_subbuffer(struct fd_pair *pair) } err = TEMP_FAILURE_RETRY(write(pair->trace, - pair->mmap + (subbuf_index * pair->subbuf_size), + pair->mmap + (consumed_old & (~(pair->subbuf_size-1))), pair->subbuf_size)); if(err < 0) { @@ -322,10 +322,15 @@ int read_subbuffer(struct fd_pair *pair) write_error: - err = ioctl(pair->channel, RELAYFS_PUT_SUBBUF); + err = ioctl(pair->channel, RELAYFS_PUT_SUBBUF, &consumed_old); if(err != 0) { - perror("Error in unreserving sub buffer"); - ret = -EPERM; + if(errno == -EFAULT) { + perror("Error in unreserving sub buffer"); + ret = -EFAULT; + } else if(errno == -EIO) { + perror("Reader has been pushed by the writer, last subbuffer corrupted."); + ret = -EIO; + } goto get_error; }