summaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/cdefs.h24
-rw-r--r--include/sys/sysmacros.h29
-rw-r--r--include/sys/wait.h18
3 files changed, 49 insertions, 22 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 6f81b6a7c..4da981f9a 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -37,20 +37,33 @@
#ifdef __GNUC__
+/* All functions, except those with callbacks or those that
+ synchronize memory, are leaf functions. */
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# define __LEAF , __leaf__
+# define __LEAF_ATTR __attribute__ ((__leaf__))
+# else
+# define __LEAF
+# define __LEAF_ATTR
+# endif
+
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
-# define __THROW __attribute__ ((__nothrow__))
-# define __NTH(fct) __attribute__ ((__nothrow__)) fct
+# define __THROW __attribute__ ((__nothrow__ __LEAF))
+# define __THROWNL __attribute__ ((__nothrow__))
+# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
-# define __NTH(fct) fct throw ()
+# define __THROWNL throw ()
+# define __NTH(fct) __LEAF_ATTR fct throw ()
# else
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
# endif
# endif
@@ -60,6 +73,7 @@
# define __inline /* No inline functions. */
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
#endif /* GCC. */
@@ -165,9 +179,13 @@
# ifdef __cplusplus
# define __REDIRECT_NTH(name, proto, alias) \
name proto __THROW __asm__ (__ASMNAME (#alias))
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __THROWNL __asm__ (__ASMNAME (#alias))
# else
# define __REDIRECT_NTH(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROW
+# define __REDIRECT_NTHNL(name, proto, alias) \
+ name proto __asm__ (__ASMNAME (#alias)) __THROWNL
# endif
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index 7a5635edd..3addb7500 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -21,35 +21,39 @@
#include <features.h>
+__BEGIN_DECLS
+
/* If the compiler does not know long long it is out of luck. We are
not going to hack weird hacks to support the dev_t representation
they need. */
-#if 1 /*def __GLIBC_HAVE_LONG_LONG uClibc note: always enable */
+
__extension__
-static __inline unsigned int gnu_dev_major (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_major (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_major)
__extension__
-static __inline unsigned int gnu_dev_minor (unsigned long long int __dev)
- __THROW;
+extern unsigned int gnu_dev_minor (unsigned long long int __dev)
+ __THROW __attribute__ ((__const__));
+libc_hidden_proto(gnu_dev_minor)
__extension__
-static __inline unsigned long long int gnu_dev_makedev (unsigned int __major,
+extern unsigned long long int gnu_dev_makedev (unsigned int __major,
unsigned int __minor)
- __THROW;
+ __THROW __attribute__ ((__const__));
-# if defined __GNUC__ && __GNUC__ >= 2
-__extension__ static __inline unsigned int
+# ifdef __USE_EXTERN_INLINES
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_major (unsigned long long int __dev))
{
return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
}
-__extension__ static __inline unsigned int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned int
__NTH (gnu_dev_minor (unsigned long long int __dev))
{
return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
}
-__extension__ static __inline unsigned long long int
+__extension__ __extern_inline __attribute__ ((__const__)) unsigned long long int
__NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
{
return ((__minor & 0xff) | ((__major & 0xfff) << 8)
@@ -57,12 +61,11 @@ __NTH (gnu_dev_makedev (unsigned int __major, unsigned int __minor))
| (((unsigned long long int) (__major & ~0xfff)) << 32));
}
# endif
-
+__END_DECLS
/* Access the functions with their traditional names. */
# define major(dev) gnu_dev_major (dev)
# define minor(dev) gnu_dev_minor (dev)
# define makedev(maj, min) gnu_dev_makedev (maj, min)
-#endif
#endif /* sys/sysmacros.h */
diff --git a/include/sys/wait.h b/include/sys/wait.h
index b3c2b973a..f7a420b93 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -28,10 +28,9 @@
__BEGIN_DECLS
#include <signal.h>
-#include <sys/resource.h>
/* These macros could also be defined in <stdlib.h>. */
-#if !defined _STDLIB_H || !defined __USE_XOPEN
+#if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8)
/* This will define the `W*' macros for the flag
bits to `waitpid', `wait3', and `wait4'. */
# include <bits/waitflags.h>
@@ -97,7 +96,7 @@ typedef union
#endif
/* The following values are used by the `waitid' function. */
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
typedef enum
{
P_ALL, /* Wait for any child. */
@@ -141,9 +140,15 @@ extern __typeof(waitpid) __waitpid_nocancel attribute_hidden;
libc_hidden_proto(waitpid)
#endif
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_SVID || defined __USE_XOPEN || defined __USE_XOPEN2K8
+# ifndef __id_t_defined
+# include <bits/types.h>
+ typedef __id_t id_t;
+# define __id_t_defined
+# endif
# define __need_siginfo_t
# include <bits/siginfo.h>
+
/* Wait for a childing matching IDTYPE and ID to change the status and
place appropriate information in *INFOP.
If IDTYPE is P_PID, match any process whose process ID is ID.
@@ -160,19 +165,20 @@ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+struct rusage;
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
return its process ID. For errors return (pid_t) -1. If USAGE is not
nil, store information about the child's resource usage there. If the
WUNTRACED bit is set in OPTIONS, return status for stopped children;
otherwise don't. */
extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
- struct rusage * __usage) __THROW;
+ struct rusage * __usage) __THROWNL;
#endif
#ifdef __USE_BSD
/* PID is like waitpid. Other args are like wait3. */
extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
- struct rusage *__usage) __THROW;
+ struct rusage *__usage) __THROWNL;
#endif /* Use BSD. */
#ifdef _LIBC