Message ID | 20211211063949.49533-3-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Phase 2 of task comm cleanups | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Sat, Dec 11, 2021 at 06:39:48AM +0000, Yafang Shao wrote: > This TASK_COMM_LEN_16 has the same meaning with the macro defined in > linux/sched.h, but we can't include linux/sched.h in a UAPI header, so > we should specifically define it in the cn_proc.h. [...] > index db210625cee8..6dcccaed383f 100644 > --- a/include/uapi/linux/cn_proc.h > +++ b/include/uapi/linux/cn_proc.h > @@ -21,6 +21,8 @@ > > #include <linux/types.h> > > +#define TASK_COMM_LEN_16 16 Hi, Since this is added to UAPI header, maybe you could make it a single instance also used elsewhere? Even though this is constant and not going to change I don't really like multiplying the sources of truth. Best Regards Michał Mirosław
On Sun, Dec 12, 2021 at 2:10 PM Michal Miroslaw <mirq-linux@rere.qmqm.pl> wrote: > > On Sat, Dec 11, 2021 at 06:39:48AM +0000, Yafang Shao wrote: > > This TASK_COMM_LEN_16 has the same meaning with the macro defined in > > linux/sched.h, but we can't include linux/sched.h in a UAPI header, so > > we should specifically define it in the cn_proc.h. > [...] > > index db210625cee8..6dcccaed383f 100644 > > --- a/include/uapi/linux/cn_proc.h > > +++ b/include/uapi/linux/cn_proc.h > > @@ -21,6 +21,8 @@ > > > > #include <linux/types.h> > > > > +#define TASK_COMM_LEN_16 16 > > Hi, > > Since this is added to UAPI header, maybe you could make it a single > instance also used elsewhere? Even though this is constant and not > going to change I don't really like multiplying the sources of truth. > Hmm, what about defining it in include/uapi/linux/sched.h ? Then include "sched.h" in cn_proc.h And we also define it in tools/include/uapi/linux/sched.h for the usage in tools.
diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h index db210625cee8..6dcccaed383f 100644 --- a/include/uapi/linux/cn_proc.h +++ b/include/uapi/linux/cn_proc.h @@ -21,6 +21,8 @@ #include <linux/types.h> +#define TASK_COMM_LEN_16 16 + /* * Userspace sends this enum to register with the kernel that it is listening * for events on the connector. @@ -110,7 +112,7 @@ struct proc_event { struct comm_proc_event { __kernel_pid_t process_pid; __kernel_pid_t process_tgid; - char comm[16]; + char comm[TASK_COMM_LEN_16]; } comm; struct coredump_proc_event {