int kernctl_track_pid(int fd, int pid)
{
- return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_PID, pid);
+ int ret = LTTNG_IOCTL_CHECK(
+ fd, LTTNG_KERNEL_ABI_SESSION_TRACK_PID, pid);
+
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID, pid);
+ }
+
+ return ret;
}
int kernctl_untrack_pid(int fd, int pid)
{
- return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID, pid);
+ int ret = LTTNG_IOCTL_CHECK(
+ fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID, pid);
+
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID, pid);
+ }
+
+ return ret;
}
int kernctl_list_tracker_pids(int fd)
int kernctl_track_id(int fd, enum lttng_process_attr process_attr, int id)
{
struct lttng_kernel_abi_tracker_args args;
+ int ret;
args.id = id;
args.type = get_kernel_tracker_type(process_attr);
errno = EINVAL;
return -1;
}
- return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_ID, &args);
+
+ ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_TRACK_ID, &args);
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID, &args);
+ }
+
+ return ret;
}
int kernctl_untrack_id(int fd, enum lttng_process_attr process_attr, int id)
{
struct lttng_kernel_abi_tracker_args args;
+ int ret;
args.id = id;
args.type = get_kernel_tracker_type(process_attr);
errno = EINVAL;
return -1;
}
- return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID, &args);
+
+ ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID, &args);
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID, &args);
+ }
+
+ return ret;
}
int kernctl_list_tracker_ids(int fd, enum lttng_process_attr process_attr)
{
struct lttng_kernel_abi_tracker_args args;
+ int ret;
args.id = -1;
args.type = get_kernel_tracker_type(process_attr);
errno = EINVAL;
return -1;
}
- return LTTNG_IOCTL_NO_CHECK(
+
+ ret = LTTNG_IOCTL_NO_CHECK(
fd, LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS, &args);
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_NO_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS,
+ &args);
+ }
+
+ return ret;
}
int kernctl_session_regenerate_metadata(int fd)
ret = LTTNG_IOCTL_CHECK(
fd, LTTNG_KERNEL_ABI_SESSION_SET_NAME, &session_name);
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME,
+ &session_name);
+ }
+
end:
return ret;
}
ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME,
&creation_time);
+ if (ret == -ENOSYS) {
+ ret = LTTNG_IOCTL_CHECK(fd,
+ LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME,
+ &creation_time);
+ }
+
end:
return ret;
}
#define LTTNG_KERNEL_ABI_SESSION_START _IO(0xF6, 0x56)
#define LTTNG_KERNEL_ABI_SESSION_STOP _IO(0xF6, 0x57)
#define LTTNG_KERNEL_ABI_SESSION_TRACK_PID \
- _IOR(0xF6, 0x58, int32_t)
+ _IOW(0xF6, 0x58, int32_t)
#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID \
- _IOR(0xF6, 0x59, int32_t)
+ _IOW(0xF6, 0x59, int32_t)
/*
* ioctl 0x58 and 0x59 are duplicated here. It works, since _IOR vs _IO
* are generating two different ioctl numbers, but this was not done on
/* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */
#define LTTNG_KERNEL_ABI_SESSION_STATEDUMP _IO(0xF6, 0x5C)
#define LTTNG_KERNEL_ABI_SESSION_SET_NAME \
- _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
+ _IOW(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
#define LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME \
- _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
+ _IOW(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
/* Channel FD ioctl */
#define LTTNG_KERNEL_ABI_STREAM _IO(0xF6, 0x62)
/* Session FD ioctl (continued) */
#define LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS \
- _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
+ _IOW(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
#define LTTNG_KERNEL_ABI_SESSION_TRACK_ID \
- _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
+ _IOW(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
#define LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID \
- _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
+ _IOW(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
/* Event notifier group file descriptor ioctl */
#define LTTNG_KERNEL_ABI_EVENT_NOTIFIER_CREATE \
#define LTTNG_KERNEL_ABI_COUNTER_CLEAR \
_IOW(0xF6, 0xC2, struct lttng_kernel_abi_counter_clear)
+/*
+ * Those ioctl numbers use the wrong direction, but are kept for ABI backward
+ * compatibility.
+ */
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME \
+ _IOR(0xF6, 0x5D, struct lttng_kernel_abi_session_name)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME \
+ _IOR(0xF6, 0x5E, struct lttng_kernel_abi_session_creation_time)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID \
+ _IOW(0xF6, 0x58, int32_t)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID \
+ _IOW(0xF6, 0x59, int32_t)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS \
+ _IOR(0xF6, 0xA0, struct lttng_kernel_abi_tracker_args)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID \
+ _IOR(0xF6, 0xA1, struct lttng_kernel_abi_tracker_args)
+ #define LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID \
+ _IOR(0xF6, 0xA2, struct lttng_kernel_abi_tracker_args)
#endif /* _LTT_KERNEL_IOCTL_H */