#define _DLOG_IOCTL_H_
#include <sys/ioctl.h>
+#include <stdint.h>
// These are taken from the kernel: ./drivers/staging/android/logger.h
#define __LOGGERIO 0xAE
#define LOGGER_SET_TAG _IO(__LOGGERIO, 7) /* set flow mode tag */
#define LOGGER_SET_PRIO _IO(__LOGGERIO, 8) /* set flow mode prio */
+/**
+ * struct logger_set_tag
+ * @len: Length of a NULL-terminated tag including '\0'
+ * @msg: Pointer to a user buffer containing the tag
+ */
+struct logger_set_tag {
+ uint64_t len;
+ uint64_t ptr;
+};
+
#endif
#include <logconfig.h>
#include <logpipe.h>
+#include <stdint.h>
+
static int setup_single_pipe(log_id_t buffer, const char *tag, log_priority prio, struct log_config *config, int *fd)
{
/* We don't really have a way to get the PID correctly in
static int apply_android_logger_ioctl(int fd, const char *tag, log_priority prio)
{
- struct {
- int len;
- char tag[128]; // soft limit on length based on dlogutil output format
- } tag_info;
-
- strncpy(tag_info.tag, tag, sizeof tag_info.tag);
- tag_info.tag[sizeof tag_info.tag - 1] = '\0';
- tag_info.len = strlen(tag_info.tag) + 1;
-
- int r = ioctl(fd, LOGGER_SET_TAG, &tag_info);
+ int r = ioctl(fd, LOGGER_SET_TAG, & (struct logger_set_tag) {
+ .len = strlen(tag) + 1,
+ .ptr = (uintptr_t) tag
+ });
if (r < 0)
return -errno;