*/
#define _LGPL_SOURCE
-#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
DBG("Adding context to channel %s", chan->channel->name);
ret = kernctl_add_context(chan->fd, &ctx->ctx);
if (ret < 0) {
- switch (errno) {
+ switch (-ret) {
case ENOSYS:
/* Exists but not available for this kernel */
ret = LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE;
ret = kernctl_create_event(channel->fd, event->event);
if (ret < 0) {
- switch (errno) {
+ switch (-ret) {
case EEXIST:
break;
case ENOSYS:
default:
PERROR("create event ioctl");
}
- ret = -errno;
goto free_event;
}
ret = kernctl_enable(event->fd);
if (ret < 0) {
- switch (errno) {
+ switch (-ret) {
case EEXIST:
ret = LTTNG_ERR_KERN_EVENT_EXIST;
break;
ret = kernctl_disable(chan->fd);
if (ret < 0) {
PERROR("disable chan ioctl");
- ret = errno;
goto error;
}
assert(chan);
ret = kernctl_enable(chan->fd);
- if (ret < 0 && errno != EEXIST) {
+ if (ret < 0 && ret != -EEXIST) {
PERROR("Enable kernel chan");
goto error;
}
ret = kernctl_enable(event->fd);
if (ret < 0) {
- switch (errno) {
+ switch (-ret) {
case EEXIST:
ret = LTTNG_ERR_KERN_EVENT_EXIST;
break;
ret = kernctl_disable(event->fd);
if (ret < 0) {
- switch (errno) {
+ switch (-ret) {
case EEXIST:
ret = LTTNG_ERR_KERN_EVENT_EXIST;
break;
if (!ret) {
return LTTNG_OK;
}
- switch (errno) {
+ switch (-ret) {
case EINVAL:
return LTTNG_ERR_INVALID;
case ENOMEM:
if (!ret) {
return LTTNG_OK;
}
- switch (errno) {
+ switch (-ret) {
case EINVAL:
return LTTNG_ERR_INVALID;
case ENOMEM:
}
}
-/*
- * Kernel calibrate
- */
-int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate)
-{
- int ret;
-
- assert(calibrate);
-
- ret = kernctl_calibrate(fd, calibrate);
- if (ret < 0) {
- PERROR("calibrate ioctl");
- return -1;
- }
-
- return 0;
-}
-
-
/*
* Force flush buffer of metadata.
*/