netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libmnl] portability of getpagesize() in libmnl.h
@ 2015-02-24 20:45 Markus Teich
  2015-02-26 13:08 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Teich @ 2015-02-24 20:45 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libmnl] portability of getpagesize() in libmnl.h
  2015-02-24 20:45 [libmnl] portability of getpagesize() in libmnl.h Markus Teich
@ 2015-02-26 13:08 ` Pablo Neira Ayuso
  2015-02-26 13:38   ` [PATCH] header: use sysconf() instead of getpagesize() Markus Teich
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2015-02-26 13:08 UTC (permalink / raw)
  To: Markus Teich; +Cc: netfilter-devel

On Tue, Feb 24, 2015 at 09:45:50PM +0100, Markus Teich wrote:
> 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?

Go send a patch that I can apply via 'git am'. Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] header: use sysconf() instead of getpagesize()
  2015-02-26 13:08 ` Pablo Neira Ayuso
@ 2015-02-26 13:38   ` Markus Teich
  2015-03-02 11:06     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Teich @ 2015-02-26 13:38 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo Neira Ayuso

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(-)

diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h
index 0de6678..3a589bc 100644
--- a/include/libmnl/libmnl.h
+++ b/include/libmnl/libmnl.h
@@ -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;
 
-- 
2.0.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] header: use sysconf() instead of getpagesize()
  2015-02-26 13:38   ` [PATCH] header: use sysconf() instead of getpagesize() Markus Teich
@ 2015-03-02 11:06     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2015-03-02 11:06 UTC (permalink / raw)
  To: Markus Teich; +Cc: netfilter-devel

On Thu, Feb 26, 2015 at 02:38:03PM +0100, Markus Teich wrote:
> The sysconf(_SC_PAGESIZE) call is more portable since it does not need
> _BSD_SOURCE defined.

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-02 11:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 20:45 [libmnl] portability of getpagesize() in libmnl.h Markus Teich
2015-02-26 13:08 ` Pablo Neira Ayuso
2015-02-26 13:38   ` [PATCH] header: use sysconf() instead of getpagesize() Markus Teich
2015-03-02 11:06     ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).