about summary refs log tree commit diff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-08-10 15:53:27 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-08-10 15:53:27 +0000
commit121dce05fe25ed878088fa7351c840a303182c65 (patch)
treeb67c4ee7205ad5e59068608df8fd21a08d6ea3de /sysdeps/unix/sysv
parent77480c6ba52e49a70f37c6f49d59f2f72501aca0 (diff)
downloadglibc-121dce05fe25ed878088fa7351c840a303182c65.tar.gz
glibc-121dce05fe25ed878088fa7351c840a303182c65.tar.xz
glibc-121dce05fe25ed878088fa7351c840a303182c65.zip
Move Linux kernel version conditionals to kernel-features.h.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h7
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c12
2 files changed, 13 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 21fba884e8..bf81c4a07f 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -210,6 +210,13 @@
 # define __ASSUME_O_CLOEXEC	1
 #endif
 
+/* From 2.6.23 onwards the value of ARG_MAX depends on the stack
+   size.  */
+#define __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL	0x020617
+#if __LINUX_KERNEL_VERSION >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL
+# define __ASSUME_ARG_MAX_STACK_BASED	1
+#endif
+
 /* Support for ADJ_OFFSET_SS_READ was added in 2.6.24.  */
 #if __LINUX_KERNEL_VERSION >= 0x020618
 # define __ASSUME_ADJ_OFFSET_SS_READ	1
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 5c8f45d784..47ce5ef07c 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003,2004,2006 2008,2009,2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -88,11 +88,11 @@ __sysconf (int name)
       return HAS_CPUCLOCK (name);
 
     case _SC_ARG_MAX:
-#if __LINUX_KERNEL_VERSION < 0x020617
-      /* Determine whether this is a kernel 2.6.23 or later.  Only
-	 then do we have an argument limit determined by the stack
-	 size.  */
-      if (GLRO(dl_discover_osversion) () >= 0x020617)
+#if !__ASSUME_ARG_MAX_STACK_BASED
+      /* Determine whether this is a kernel with an argument limit
+	 determined by the stack size.  */
+      if (GLRO(dl_discover_osversion) ()
+	  >= __LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL)
 #endif
 	/* Use getrlimit to get the stack limit.  */
 	if (__getrlimit (RLIMIT_STACK, &rlimit) == 0)