Re: [PATCH v3 4/4] samples: show race-free pidfd metadata access

2019-04-19 Thread Oleg Nesterov
On 04/19, Christian Brauner wrote: > > +int main(int argc, char *argv[]) > +{ > + int ret = EXIT_FAILURE; > + char buf[4096] = { 0 }; > + pid_t pid; > + int pidfd, procfd, statusfd; I think you need to initialize pidfd = 0 in this version ;) Otherwise, Reviewed-by: Oleg Nesterov

[PATCH v3 4/4] samples: show race-free pidfd metadata access

2019-04-19 Thread Christian Brauner
This is a sample program showing userspace how to get race-free access to process metadata from a pidfd. It is rather easy to do and userspace can actually simply reuse code that currently parses a process's status file in procfs. The program can easily be extended into a generic helper suitable

Re: [PATCH v3 4/4] samples: show race-free pidfd metadata access

2019-04-19 Thread Christian Brauner
On Fri, Apr 19, 2019 at 05:30:48PM +0200, Oleg Nesterov wrote: > On 04/19, Christian Brauner wrote: > > > > +int main(int argc, char *argv[]) > > +{ > > + int ret = EXIT_FAILURE; > > + char buf[4096] = { 0 }; > > + pid_t pid; > > + int pidfd, procfd, statusfd; > > I think you need to