portability of getpagesize() in libmnl.h
Heyho,
the getpagesize() call in line
#define MNL_SOCKET_BUFFER_SIZE (getpagesize() < 8192L ? getpagesize() : 8192L)
of libmnl.h seems to be less portable than sysconf(_SC_PAGESIZE) as suggested by the getpagesize man page. getpagesize() needs e.g. _BSD_SOURCE while sysconf() does not.
Would you consider fixing this or should I write a patch?
(I'm not on the list, so please leave me a CC)
--Markus
Pablo Neira Ayuso
maintainerQuoted 11 lines · Markus Teich
Heyho,
the
getpagesize()call in line#define
MNL_SOCKET_BUFFER_SIZE(getpagesize()< 8192L ?getpagesize(): 8192L)of
libmnl.hseems to be less portable thansysconf(_SC_PAGESIZE)as suggested by the getpagesize man page.getpagesize()needs e.g._BSD_SOURCEwhilesysconf()does not.Would you consider fixing this or should I write a patch?
Go send a patch that I can apply via 'git am'. Thanks.
PATCH 1/1 header: use sysconf() instead of getpagesize()
The sysconf(_SC_PAGESIZE) call is more portable since it does not need _BSD_SOURCE defined.
--- include/libmnl/libmnl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/libmnl/libmnl.h +1 -1
@@ -17,7 +17,7 @@ extern "C" {*/ #define MNL_SOCKET_AUTOPID 0 -#define MNL_SOCKET_BUFFER_SIZE (getpagesize() < 8192L ? getpagesize() : 8192L) +#define MNL_SOCKET_BUFFER_SIZE (sysconf(_SC_PAGESIZE) < 8192L ? sysconf(_SC_PAGESIZE) : 8192L)struct mnl_socket ;
Signature · 1 line
2.0.5
Re: [PATCH] header: use sysconf() instead of getpagesize()
Quoted 2 lines · Markus Teich
The
sysconf(_SC_PAGESIZE)call is more portable since it does not need_BSD_SOURCEdefined.
Applied, thanks.