Browse Source

update some headers

Sync some headers with glibc.
realpath is an XSI extension in SuSv4, add back guard and update comment,
since it seems to allow != NULL in second arg.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Peter S. Mazinger 13 years ago
parent
commit
a37f5fd553
3 changed files with 40 additions and 33 deletions
  1. 1 0
      include/stdint.h
  2. 26 16
      include/stdlib.h
  3. 13 17
      include/sys/wait.h

+ 1 - 0
include/stdint.h

@@ -238,6 +238,7 @@ typedef unsigned long long int	uintmax_t;
 #  define UINTPTR_MAX		(4294967295U)
 #  define UINTPTR_MAX		(4294967295U)
 # endif
 # endif
 
 
+
 #if !defined(__H8300H__) && !defined(__H8300S__)
 #if !defined(__H8300H__) && !defined(__H8300S__)
 /* Minimum for largest signed integral type.  */
 /* Minimum for largest signed integral type.  */
 # define INTMAX_MIN		(-__INT64_C(9223372036854775807)-1)
 # define INTMAX_MIN		(-__INT64_C(9223372036854775807)-1)

+ 26 - 16
include/stdlib.h

@@ -50,9 +50,9 @@ __BEGIN_DECLS
    as well as POSIX.1 use of `int' for the status word.  */
    as well as POSIX.1 use of `int' for the status word.  */
 
 
 #  if defined __GNUC__ && !defined __cplusplus
 #  if defined __GNUC__ && !defined __cplusplus
-#   define __WAIT_INT(status)						      \
-  (__extension__ ({ union { __typeof(status) __in; int __i; } __u;	      \
-		    __u.__in = (status); __u.__i; }))
+#   define __WAIT_INT(status) \
+  (__extension__ (((union { __typeof(status) __in; int __i; }) \
+		   { .__in = (status) }).__i))
 #  else
 #  else
 #   define __WAIT_INT(status)	(*(int *) &(status))
 #   define __WAIT_INT(status)	(*(int *) &(status))
 #  endif
 #  endif
@@ -244,14 +244,14 @@ __END_NAMESPACE_C99
 #if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
 #if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
 /* The concept of one static locale per category is not very well
 /* The concept of one static locale per category is not very well
    thought out.  Many applications will need to process its data using
    thought out.  Many applications will need to process its data using
-   information from several different locales.  Another application is
+   information from several different locales.  Another problem is
    the implementation of the internationalization handling in the
    the implementation of the internationalization handling in the
-   upcoming ISO C++ standard library.  To support this another set of
-   the functions using locale data exist which have an additional
+   ISO C++ standard library.  To support this another set of
+   the functions using locale data exist which take an additional
    argument.
    argument.
 
 
-   Attention: all these functions are *not* standardized in any form.
-   This is a proof-of-concept implementation.  */
+   Attention: even though several *_l interfaces are part of POSIX:2008,
+   these are not.  */
 
 
 /* Structure for reentrant locale using functions.  This is an
 /* Structure for reentrant locale using functions.  This is an
    (almost) opaque type for the user level programs.  */
    (almost) opaque type for the user level programs.  */
@@ -347,10 +347,16 @@ struct random_data
     int32_t *fptr;		/* Front pointer.  */
     int32_t *fptr;		/* Front pointer.  */
     int32_t *rptr;		/* Rear pointer.  */
     int32_t *rptr;		/* Rear pointer.  */
     int32_t *state;		/* Array of state values.  */
     int32_t *state;		/* Array of state values.  */
+#if 0
+    int rand_type;		/* Type of random number generator.  */
+    int rand_deg;		/* Degree of random number generator.  */
+    int rand_sep;		/* Distance between front and rear.  */
+#else
     /* random_r.c, TYPE_x, DEG_x, SEP_x - small enough for int8_t */
     /* random_r.c, TYPE_x, DEG_x, SEP_x - small enough for int8_t */
     int8_t rand_type;		/* Type of random number generator.  */
     int8_t rand_type;		/* Type of random number generator.  */
     int8_t rand_deg;		/* Degree of random number generator.  */
     int8_t rand_deg;		/* Degree of random number generator.  */
     int8_t rand_sep;		/* Distance between front and rear.  */
     int8_t rand_sep;		/* Distance between front and rear.  */
+#endif
     int32_t *end_ptr;		/* Pointer behind state table.  */
     int32_t *end_ptr;		/* Pointer behind state table.  */
   };
   };
 
 
@@ -540,7 +546,7 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
 
 
 __BEGIN_NAMESPACE_STD
 __BEGIN_NAMESPACE_STD
 /* Call all functions registered with `atexit' and `on_exit',
 /* Call all functions registered with `atexit' and `on_exit',
-   in the reverse of the order in which they were registered
+   in the reverse of the order in which they were registered,
    perform stdio cleanup, and terminate program execution with STATUS.  */
    perform stdio cleanup, and terminate program execution with STATUS.  */
 extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
 extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
 libc_hidden_proto(exit)
 libc_hidden_proto(exit)
@@ -619,7 +625,7 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
    Returns a file descriptor open on the file for reading and writing,
    Returns a file descriptor open on the file for reading and writing,
    or -1 if it cannot create a uniquely-named file.
    or -1 if it cannot create a uniquely-named file.
 
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
    marked with __THROW.  */
 # ifndef __USE_FILE_OFFSET64
 # ifndef __USE_FILE_OFFSET64
 extern int mkstemp (char *__template) __nonnull ((1)) __wur;
 extern int mkstemp (char *__template) __nonnull ((1)) __wur;
@@ -636,7 +642,7 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
 # endif
 # endif
 #endif
 #endif
 
 
-#ifdef __USE_BSD
+#if defined __USE_BSD || defined __USE_XOPEN2K8
 /* Create a unique temporary directory from TEMPLATE.
 /* Create a unique temporary directory from TEMPLATE.
    The last six characters of TEMPLATE must be "XXXXXX";
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the directory name unique.
    they are replaced with a string that makes the directory name unique.
@@ -662,14 +668,17 @@ extern char *canonicalize_file_name (__const char *__name)
      __THROW __nonnull ((1)) __wur;
      __THROW __nonnull ((1)) __wur;
 #endif
 #endif
 
 
-/* Return the canonical absolute name of file NAME. If the
-   canonical name is PATH_MAX chars or more, returns null
-   with `errno' set to ENAMETOOLONG; if the name fits in
-	 fewer than PATH_MAX chars, returns the name in RESOLVED. */
-/* we choose to handle __resolved==NULL as crash :) */
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Return the canonical absolute name of file NAME.  If RESOLVED is
+   null, the result is malloc'd; otherwise, if the canonical name is
+   PATH_MAX chars or more, returns null with `errno' set to
+   ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
+   returns the name in RESOLVED.  */
 extern char *realpath (__const char *__restrict __name,
 extern char *realpath (__const char *__restrict __name,
 		       char *__restrict __resolved) __THROW __wur;
 		       char *__restrict __resolved) __THROW __wur;
 libc_hidden_proto(realpath)
 libc_hidden_proto(realpath)
+#endif
+
 
 
 /* Shorthand for type of comparison functions.  */
 /* Shorthand for type of comparison functions.  */
 #ifndef __COMPAR_FN_T
 #ifndef __COMPAR_FN_T
@@ -852,6 +861,7 @@ libc_hidden_proto(posix_openpt)
 #ifdef __USE_XOPEN
 #ifdef __USE_XOPEN
 /* The next four functions all take a master pseudo-tty fd and
 /* The next four functions all take a master pseudo-tty fd and
    perform an operation on the associated slave:  */
    perform an operation on the associated slave:  */
+
 #ifdef __UCLIBC_HAS_PTY__
 #ifdef __UCLIBC_HAS_PTY__
 /* Chown the slave to the calling user.  */
 /* Chown the slave to the calling user.  */
 extern int grantpt (int __fd) __THROW;
 extern int grantpt (int __fd) __THROW;

+ 13 - 17
include/sys/wait.h

@@ -1,5 +1,5 @@
-/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005
-	Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007,2009
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    This file is part of the GNU C Library.
 
 
    The GNU C Library is free software; you can redistribute it and/or
    The GNU C Library is free software; you can redistribute it and/or
@@ -51,7 +51,7 @@ __BEGIN_DECLS
 #  endif
 #  endif
 
 
 /* This is the type of the argument to `wait'.  The funky union
 /* This is the type of the argument to `wait'.  The funky union
-   causes redeclarations with ether `int *' or `union wait *' to be
+   causes redeclarations with either `int *' or `union wait *' to be
    allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
    allowed without complaint.  __WAIT_STATUS_DEFN is the type used in
    the actual function definitions.  */
    the actual function definitions.  */
 
 
@@ -79,22 +79,22 @@ typedef union
 /* This will define all the `__W*' macros.  */
 /* This will define all the `__W*' macros.  */
 # include <bits/waitstatus.h>
 # include <bits/waitstatus.h>
 
 
-# define WEXITSTATUS(status)	__WEXITSTATUS(__WAIT_INT(status))
-# define WTERMSIG(status)	__WTERMSIG(__WAIT_INT(status))
-# define WSTOPSIG(status)	__WSTOPSIG(__WAIT_INT(status))
-# define WIFEXITED(status)	__WIFEXITED(__WAIT_INT(status))
-# define WIFSIGNALED(status)	__WIFSIGNALED(__WAIT_INT(status))
-# define WIFSTOPPED(status)	__WIFSTOPPED(__WAIT_INT(status))
+# define WEXITSTATUS(status)	__WEXITSTATUS (__WAIT_INT (status))
+# define WTERMSIG(status)	__WTERMSIG (__WAIT_INT (status))
+# define WSTOPSIG(status)	__WSTOPSIG (__WAIT_INT (status))
+# define WIFEXITED(status)	__WIFEXITED (__WAIT_INT (status))
+# define WIFSIGNALED(status)	__WIFSIGNALED (__WAIT_INT (status))
+# define WIFSTOPPED(status)	__WIFSTOPPED (__WAIT_INT (status))
 # ifdef __WIFCONTINUED
 # ifdef __WIFCONTINUED
-#  define WIFCONTINUED(status)	__WIFCONTINUED(__WAIT_INT(status))
+#  define WIFCONTINUED(status)	__WIFCONTINUED (__WAIT_INT (status))
 # endif
 # endif
 #endif	/* <stdlib.h> not included.  */
 #endif	/* <stdlib.h> not included.  */
 
 
 #ifdef	__USE_BSD
 #ifdef	__USE_BSD
 # define WCOREFLAG		__WCOREFLAG
 # define WCOREFLAG		__WCOREFLAG
-# define WCOREDUMP(status)	__WCOREDUMP(__WAIT_INT(status))
-# define W_EXITCODE(ret, sig)	__W_EXITCODE(ret, sig)
-# define W_STOPCODE(sig)	__W_STOPCODE(sig)
+# define WCOREDUMP(status)	__WCOREDUMP (__WAIT_INT (status))
+# define W_EXITCODE(ret, sig)	__W_EXITCODE (ret, sig)
+# define W_STOPCODE(sig)	__W_STOPCODE (sig)
 #endif
 #endif
 
 
 /* The following values are used by the `waitid' function.  */
 /* The following values are used by the `waitid' function.  */
@@ -172,10 +172,6 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options,
 #endif
 #endif
 
 
 #ifdef __USE_BSD
 #ifdef __USE_BSD
-/* This being here makes the prototypes valid whether or not
-   we have already included <sys/resource.h> to define `struct rusage'.  */
-struct rusage;
-
 /* PID is like waitpid.  Other args are like wait3.  */
 /* PID is like waitpid.  Other args are like wait3.  */
 extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
 extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options,
 		      struct rusage *__usage) __THROW;
 		      struct rusage *__usage) __THROW;