1 #ifndef _LOGD_NETLINK_H_
2 #define _LOGD_NETLINK_H_
8 #include <sys/socket.h>
10 #include <linux/genetlink.h>
11 /* TODO: replace "logd-taskstats.h" on " <linux/taskstats.h>
12 * if the build system will contains kernel-headers from tizen.
13 * Now it's necessary due to build system using 2.6.36 kernel and
14 * struct taskstats not contains ac_stime_power_cons, ac_utime_power_cons
17 #include "logd-taskstats.h"
18 #include <linux/netlink.h>
20 #define GENLMSG_DATA(glh) ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
21 #define GENLMSG_PAYLOAD(glh) (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
22 #define NLA_DATA(na) ((void *)((char*)(na) + NLA_HDRLEN))
23 #define NLA_PAYLOAD(len) (len - NLA_HDRLEN)
25 #define MAX_MSG_SIZE 1024
30 char buf[MAX_MSG_SIZE];
33 int create_netlink_socket(int protocol, int groups, int pid);
34 int send_cmd(int sock, unsigned short family_id, pid_t pid, __u8 cmd,
35 unsigned short nl_type, void *nl_data, int nl_len);
36 int get_family_id(int sock, const char *n);
42 #endif /* _LOGD_NETLINK_H_ */