get_mempolicy(2)'s synopsis is: #include <numaif.h> int get_mempolicy(int *mode, unsigned long *nodemask, unsigned long maxnode, unsigned long addr, unsigned long flags); However, the actual prototype in numif.h (and implementation in numactl's syscall.c) is subtly different: long get_mempolicy(int *policy, const unsigned long *nmask, unsigned long maxnode, void *addr, int flags); The funny thing is, that prototype is isn't quite right either - it pretends nmask is a const pointer, but it most definitely isn't, and the data pointed by it get written to. But that isn't a man-page bug.
Andi, could you comment on this bug? Thanks, Michael On 22 April 2015 at 00:28, <bugzilla-daemon@bugzilla.kernel.org> wrote: > https://bugzilla.kernel.org/show_bug.cgi?id=97051 > > Bug ID: 97051 > Summary: get_mempolicy(2) inconsistent with numaif.h > Product: Documentation > Version: unspecified > Hardware: All > OS: Linux > Status: NEW > Severity: normal > Priority: P1 > Component: man-pages > Assignee: documentation_man-pages@kernel-bugs.osdl.org > Reporter: nyh@math.technion.ac.il > Regression: No > > get_mempolicy(2)'s synopsis is: > > #include <numaif.h> > > int get_mempolicy(int *mode, unsigned long *nodemask, > unsigned long maxnode, unsigned long addr, > unsigned long flags); > > However, the actual prototype in numif.h (and implementation in numactl's > syscall.c) is subtly different: > > long get_mempolicy(int *policy, const unsigned long *nmask, > unsigned long maxnode, void *addr, int flags); > > The funny thing is, that prototype is isn't quite right either - it pretends > nmask is a const pointer, but it most definitely isn't, and the data pointed > by > it get written to. But that isn't a man-page bug. > > -- > You are receiving this mail because: > You are watching the assignee of the bug.
Andi, Could you comment on this bug?
Yes the manpage version is better and the const is incorrect. Should probably fix the version in numactl
Sorry for the delay. I fixed numactl to drop the const from the get_mempolicy prototype, and also changed flags to unsigned. I didn't change the addr argument to unsigned long because that would cause warnings in existing code. I would recommend to change the manpage to this prototype to match numaif.h: long get_mempolicy(int *mode, unsigned long *nmask, unsigned long maxnode, void *addr, unsigned flags);
(In reply to Andi Kleen from comment #4) > Sorry for the delay. > > I fixed numactl to drop the const from the get_mempolicy prototype, and also > changed flags to unsigned. > > I didn't change the addr argument to unsigned long because that would cause > warnings in existing code. > > I would recommend to change the manpage to this prototype to match numaif.h: > > long get_mempolicy(int *mode, unsigned long *nmask, > unsigned long maxnode, void *addr, unsigned flags); Okay -- I've made that change to the man page. I'll close this bug now. Nadav Har'El, if you think someting is still wrong, please reopen. Thanks, Michael