OSDN Git Service

openat*: use a static function with the different type and strong_alias_untyped
[uclinux-h8/uClibc.git] / include / stdio.h
index 68e2ba5..69c1603 100644 (file)
@@ -88,7 +88,7 @@ typedef __STDIO_fpos64_t fpos64_t;
 #endif
 
 /* The possibilities for the third argument to `setvbuf'.  */
-#define _IOFBF __STDIO_IOFBF           /* Fully buffered.  */
+#define _IOFBF __STDIO_IOFBF           /* Fully buffered.  */
 #define _IOLBF __STDIO_IOLBF           /* Line buffered.  */
 #define _IONBF __STDIO_IONBF           /* No buffering.  */
 
@@ -114,7 +114,7 @@ typedef __STDIO_fpos64_t fpos64_t;
 
 
 #if defined __USE_SVID || defined __USE_XOPEN
-/* Default path prefix for `tempnam' and `tmpnam'.  */
+/* Default path prefix for `mkstemp'.  */
 # define P_tmpdir      "/tmp"
 #endif
 
@@ -122,7 +122,7 @@ typedef __STDIO_fpos64_t fpos64_t;
 /* Get the values:
    L_tmpnam    How long an array of chars must be to be passed to `tmpnam'.
    TMP_MAX     The minimum number of unique filenames generated by tmpnam
-               (and tempnam when it uses tmpnam's name space),
+               (and tempnam when it uses tmpnam's name space),
                or tempnam (the two are separate).
    L_ctermid   How long an array to pass to `ctermid'.
    L_cuserid   How long an array to pass to `cuserid'.
@@ -143,10 +143,16 @@ extern FILE *stderr;        /* Standard error output stream.  */
 __BEGIN_NAMESPACE_STD
 /* Remove file FILENAME.  */
 extern int remove (__const char *__filename) __THROW;
+libc_hidden_proto(remove)
 /* Rename file OLD to NEW.  */
 extern int rename (__const char *__old, __const char *__new) __THROW;
 __END_NAMESPACE_STD
 
+#ifdef __USE_ATFILE
+/* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
+extern int renameat (int __oldfd, __const char *__old, int __newfd,
+                    __const char *__new) __THROW;
+#endif
 
 __BEGIN_NAMESPACE_STD
 /* Create a temporary file and open it read/write.
@@ -154,31 +160,33 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 #ifndef __USE_FILE_OFFSET64
-extern FILE *tmpfile (void);
+extern FILE *tmpfile (void) __wur;
 #else
 # ifdef __REDIRECT
-extern FILE *__REDIRECT (tmpfile, (void), tmpfile64);
+extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
 # else
 #  define tmpfile tmpfile64
 # endif
 #endif
 
 #ifdef __USE_LARGEFILE64
-extern FILE *tmpfile64 (void);
+extern FILE *tmpfile64 (void) __wur;
 #endif
 
+#ifdef __UCLIBC_SUSV4_LEGACY__
 /* Generate a temporary filename.  */
-extern char *tmpnam (char *__s) __THROW;
+extern char *tmpnam (char *__s) __THROW __wur;
+#endif
 __END_NAMESPACE_STD
 
-#ifdef __USE_MISC
+#if defined __USE_MISC && defined __UCLIBC_SUSV4_LEGACY__
 /* This is the reentrant variant of `tmpnam'.  The only difference is
    that it does not allow S to be NULL.  */
-extern char *tmpnam_r (char *__s) __THROW;
+extern char *tmpnam_r (char *__s) __THROW __wur;
 #endif
 
 
-#if defined __USE_SVID || defined __USE_XOPEN
+#if (defined __USE_SVID || defined __USE_XOPEN) && defined __UCLIBC_SUSV4_LEGACY__
 /* Generate a unique temporary filename using up to five characters of PFX
    if it is not NULL.  The directory to put this file in is searched for
    as follows: First the environment variable "TMPDIR" is checked.
@@ -187,7 +195,7 @@ extern char *tmpnam_r (char *__s) __THROW;
    P_tmpdir is tried and finally "/tmp".  The storage for the filename
    is allocated by `malloc'.  */
 extern char *tempnam (__const char *__dir, __const char *__pfx)
-     __THROW __attribute_malloc__;
+     __THROW __attribute_malloc__ __wur;
 #endif
 
 
@@ -197,11 +205,13 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fclose (FILE *__stream);
+libc_hidden_proto(fclose)
 /* Flush STREAM, or all streams if STREAM is NULL.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fflush (FILE *__stream);
+libc_hidden_proto(fflush)
 __END_NAMESPACE_STD
 
 #ifdef __USE_MISC
@@ -212,6 +222,7 @@ __END_NAMESPACE_STD
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
 extern int fflush_unlocked (FILE *__stream);
+libc_hidden_proto(fflush_unlocked)
 #endif
 
 #ifdef __USE_GNU
@@ -232,21 +243,24 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern FILE *fopen (__const char *__restrict __filename,
-                   __const char *__restrict __modes);
+                   __const char *__restrict __modes) __wur;
+libc_hidden_proto(fopen)
 /* Open a file, replacing an existing stream with it.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern FILE *freopen (__const char *__restrict __filename,
                      __const char *__restrict __modes,
-                     FILE *__restrict __stream);
+                     FILE *__restrict __stream) __wur;
 #else
 # ifdef __REDIRECT
 extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
-                                __const char *__restrict __modes), fopen64);
+                                __const char *__restrict __modes), fopen64)
+  __wur;
 extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
                                   __const char *__restrict __modes,
-                                  FILE *__restrict __stream), freopen64);
+                                  FILE *__restrict __stream), freopen64)
+  __wur;
 # else
 #  define fopen fopen64
 #  define freopen freopen64
@@ -255,33 +269,39 @@ extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
 __END_NAMESPACE_STD
 #ifdef __USE_LARGEFILE64
 extern FILE *fopen64 (__const char *__restrict __filename,
-                     __const char *__restrict __modes);
+                     __const char *__restrict __modes) __wur;
+libc_hidden_proto(fopen64)
 extern FILE *freopen64 (__const char *__restrict __filename,
                        __const char *__restrict __modes,
-                       FILE *__restrict __stream);
+                       FILE *__restrict __stream) __wur;
 #endif
 
 #ifdef __USE_POSIX
 /* Create a new stream that refers to an existing system file descriptor.  */
-extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
+extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
+libc_hidden_proto(fdopen)
 #endif
 
-#ifdef __USE_GNU
 #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__
+#ifdef __USE_GNU
 /* Create a new stream that refers to the given magic cookie,
    and uses the given functions for input and output.  */
 extern FILE *fopencookie (void *__restrict __magic_cookie,
                          __const char *__restrict __modes,
-                         _IO_cookie_io_functions_t __io_funcs) __THROW;
+                         _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
+libc_hidden_proto(fopencookie)
+#endif
 
+#ifdef __USE_XOPEN2K8
 /* Create a new stream that refers to a memory buffer.  */
-extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
+extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
+  __THROW __wur;
 
 /* Open a stream that writes into a malloc'd buffer that is expanded as
    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
    and the number of characters written on fflush or fclose.  */
-extern FILE *open_memstream (char **__restrict __bufloc,
-                            size_t *__restrict __sizeloc) __THROW;
+extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
+libc_hidden_proto(open_memstream)
 #endif
 #endif
 
@@ -295,6 +315,7 @@ extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
    else allocate an internal buffer N bytes long.  */
 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) __THROW;
+libc_hidden_proto(setvbuf)
 __END_NAMESPACE_STD
 
 #ifdef __USE_BSD
@@ -315,14 +336,18 @@ __BEGIN_NAMESPACE_STD
    marked with __THROW.  */
 extern int fprintf (FILE *__restrict __stream,
                    __const char *__restrict __format, ...);
+libc_hidden_proto(fprintf)
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int printf (__const char *__restrict __format, ...);
+libc_hidden_proto(printf)
 /* Write formatted output to S.  */
 extern int sprintf (char *__restrict __s,
-                   __const char *__restrict __format, ...) __THROW;
+                   __const char *__restrict __format, ...)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+libc_hidden_proto(sprintf)
 
 /* Write formatted output to S from argument list ARG.
 
@@ -330,6 +355,7 @@ extern int sprintf (char *__restrict __s,
    marked with __THROW.  */
 extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg);
+libc_hidden_proto(vfprintf)
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
@@ -337,7 +363,8 @@ extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
 /* Write formatted output to S from argument list ARG.  */
 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
-                    __gnuc_va_list __arg) __THROW;
+                    __gnuc_va_list __arg)
+     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
 __END_NAMESPACE_STD
 
 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
@@ -346,10 +373,12 @@ __BEGIN_NAMESPACE_C99
 extern int snprintf (char *__restrict __s, size_t __maxlen,
                     __const char *__restrict __format, ...)
      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+libc_hidden_proto(snprintf)
 
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                      __const char *__restrict __format, __gnuc_va_list __arg)
      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+libc_hidden_proto(vsnprintf)
 __END_NAMESPACE_C99
 #endif
 
@@ -358,14 +387,20 @@ __END_NAMESPACE_C99
    Store the address of the string in *PTR.  */
 extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
                      __gnuc_va_list __arg)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+     __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+libc_hidden_proto(vasprintf)
+#if 0 /* uClibc: disabled */
 extern int __asprintf (char **__restrict __ptr,
                       __const char *__restrict __fmt, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+#endif
 extern int asprintf (char **__restrict __ptr,
                     __const char *__restrict __fmt, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+     __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+libc_hidden_proto(asprintf)
+#endif
 
+#ifdef __USE_XOPEN2K8
 /* Write formatted output to a file descriptor.
 
    These functions are not part of POSIX and therefore no official
@@ -375,6 +410,7 @@ extern int asprintf (char **__restrict __ptr,
 extern int vdprintf (int __fd, __const char *__restrict __fmt,
                     __gnuc_va_list __arg)
      __attribute__ ((__format__ (__printf__, 2, 0)));
+libc_hidden_proto(vdprintf)
 extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
      __attribute__ ((__format__ (__printf__, 2, 3)));
 #endif
@@ -386,15 +422,20 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fscanf (FILE *__restrict __stream,
-                  __const char *__restrict __format, ...);
+                  __const char *__restrict __format, ...)
+     __attribute__ ((__format__ (__scanf__, 2, 3))) __wur;
+libc_hidden_proto(fscanf)
 /* Read formatted input from stdin.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int scanf (__const char *__restrict __format, ...);
+extern int scanf (__const char *__restrict __format, ...)
+     __attribute__ ((__format__ (__scanf__, 1, 2))) __wur;
 /* Read formatted input from S.  */
 extern int sscanf (__const char *__restrict __s,
-                  __const char *__restrict __format, ...) __THROW;
+                  __const char *__restrict __format, ...)
+     __THROW __attribute__ ((__format__ (__scanf__, 2, 3)));
+libc_hidden_proto(sscanf)
 __END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
@@ -405,19 +446,21 @@ __BEGIN_NAMESPACE_C99
    marked with __THROW.  */
 extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
                    __gnuc_va_list __arg)
-     __attribute__ ((__format__ (__scanf__, 2, 0)));
+     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
+libc_hidden_proto(vfscanf)
 
 /* Read formatted input from stdin into argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
-     __attribute__ ((__format__ (__scanf__, 1, 0)));
+     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
 
 /* Read formatted input from S into argument list ARG.  */
 extern int vsscanf (__const char *__restrict __s,
                    __const char *__restrict __format, __gnuc_va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+libc_hidden_proto(vsscanf)
 __END_NAMESPACE_C99
 #endif /* Use ISO C9x.  */
 
@@ -428,6 +471,7 @@ __BEGIN_NAMESPACE_STD
    These functions are possible cancellation points and therefore not
    marked with __THROW.  */
 extern int fgetc (FILE *__stream);
+libc_hidden_proto(fgetc)
 extern int getc (FILE *__stream);
 
 /* Read a character from stdin.
@@ -447,10 +491,9 @@ __END_NAMESPACE_STD
    These functions are possible cancellation points and therefore not
    marked with __THROW.  */
 extern int getc_unlocked (FILE *__stream);
+libc_hidden_proto(getc_unlocked)
 extern int getchar_unlocked (void);
-
-/* SUSv3 allows getc_unlocked to be a macro */
-#define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
+libc_hidden_proto(getchar_unlocked)
 #endif /* Use POSIX or MISC.  */
 
 #ifdef __USE_MISC
@@ -461,6 +504,7 @@ extern int getchar_unlocked (void);
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
 extern int fgetc_unlocked (FILE *__stream);
+libc_hidden_proto(fgetc_unlocked)
 #endif /* Use MISC.  */
 
 
@@ -473,6 +517,7 @@ __BEGIN_NAMESPACE_STD
    These functions is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fputc (int __c, FILE *__stream);
+libc_hidden_proto(fputc)
 extern int putc (int __c, FILE *__stream);
 
 /* Write a character to stdout.
@@ -503,9 +548,6 @@ extern int fputc_unlocked (int __c, FILE *__stream);
    marked with __THROW.  */
 extern int putc_unlocked (int __c, FILE *__stream);
 extern int putchar_unlocked (int __c);
-
-/* SUSv3 allows putc_unlocked to be a macro */
-#define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
 #endif /* Use POSIX or MISC.  */
 
 
@@ -524,14 +566,16 @@ __BEGIN_NAMESPACE_STD
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
+extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+     __wur;
+libc_hidden_proto(fgets)
 
 /* Get a newline-terminated string from stdin, removing the newline.
    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern char *gets (char *__s);
+extern char *gets (char *__s) __wur;
 __END_NAMESPACE_STD
 
 #ifdef __USE_GNU
@@ -542,11 +586,12 @@ __END_NAMESPACE_STD
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
 extern char *fgets_unlocked (char *__restrict __s, int __n,
-                            FILE *__restrict __stream);
+                            FILE *__restrict __stream) __wur;
+libc_hidden_proto(fgets_unlocked)
 #endif
 
 
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
    NULL), pointing to *N characters of space.  It is realloc'd as
@@ -557,12 +602,15 @@ extern char *fgets_unlocked (char *__restrict __s, int __n,
    cancellation point.  But due to similarity with an POSIX interface
    or due to the implementation they are cancellation points and
    therefore not marked with __THROW.  */
+#if 0 /* uClibc: disabled */
 extern __ssize_t __getdelim (char **__restrict __lineptr,
                               size_t *__restrict __n, int __delimiter,
-                              FILE *__restrict __stream);
+                              FILE *__restrict __stream) __wur;
+#endif
 extern __ssize_t getdelim (char **__restrict __lineptr,
                             size_t *__restrict __n, int __delimiter,
-                            FILE *__restrict __stream);
+                            FILE *__restrict __stream) __wur;
+libc_hidden_proto(getdelim)
 
 /* Like `getdelim', but reads up to a newline.
 
@@ -572,7 +620,8 @@ extern __ssize_t getdelim (char **__restrict __lineptr,
    therefore not marked with __THROW.  */
 extern __ssize_t getline (char **__restrict __lineptr,
                            size_t *__restrict __n,
-                           FILE *__restrict __stream);
+                           FILE *__restrict __stream) __wur;
+libc_hidden_proto(getline)
 #endif
 
 
@@ -582,6 +631,7 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
+libc_hidden_proto(fputs)
 
 /* Write a string, followed by a newline, to stdout.
 
@@ -595,6 +645,7 @@ extern int puts (__const char *__s);
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 extern int ungetc (int __c, FILE *__stream);
+libc_hidden_proto(ungetc)
 
 
 /* Read chunks of generic data from STREAM.
@@ -602,13 +653,15 @@ extern int ungetc (int __c, FILE *__stream);
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 extern size_t fread (void *__restrict __ptr, size_t __size,
-                    size_t __n, FILE *__restrict __stream);
+                    size_t __n, FILE *__restrict __stream) __wur;
+libc_hidden_proto(fread)
 /* Write chunks of generic data to STREAM.
 
    This function is a possible cancellation points and therefore not
    marked with __THROW.  */
 extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
-                     size_t __n, FILE *__restrict __s);
+                     size_t __n, FILE *__restrict __s) __wur;
+libc_hidden_proto(fwrite)
 __END_NAMESPACE_STD
 
 #ifdef __USE_GNU
@@ -620,6 +673,7 @@ __END_NAMESPACE_STD
    therefore not marked with __THROW.  */
 extern int fputs_unlocked (__const char *__restrict __s,
                           FILE *__restrict __stream);
+libc_hidden_proto(fputs_unlocked)
 #endif
 
 #ifdef __USE_MISC
@@ -630,9 +684,11 @@ extern int fputs_unlocked (__const char *__restrict __s,
    or due to the implementation they are cancellation points and
    therefore not marked with __THROW.  */
 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
-                             size_t __n, FILE *__restrict __stream);
+                             size_t __n, FILE *__restrict __stream) __wur;
+libc_hidden_proto(fread_unlocked)
 extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
-                              size_t __n, FILE *__restrict __stream);
+                              size_t __n, FILE *__restrict __stream) __wur;
+libc_hidden_proto(fwrite_unlocked)
 #endif
 
 
@@ -642,16 +698,19 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fseek (FILE *__stream, long int __off, int __whence);
+libc_hidden_proto(fseek)
 /* Return the current position of STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern long int ftell (FILE *__stream);
+extern long int ftell (FILE *__stream) __wur;
+libc_hidden_proto(ftell)
 /* Rewind to the beginning of STREAM.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern void rewind (FILE *__stream);
+libc_hidden_proto(rewind)
 __END_NAMESPACE_STD
 
 /* The Single Unix Specification, Version 2, specifies an alternative,
@@ -670,7 +729,7 @@ extern int fseeko (FILE *__stream, __off_t __off, int __whence);
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern __off_t ftello (FILE *__stream);
+extern __off_t ftello (FILE *__stream) __wur;
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT (fseeko,
@@ -711,7 +770,9 @@ __END_NAMESPACE_STD
 
 #ifdef __USE_LARGEFILE64
 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
-extern __off64_t ftello64 (FILE *__stream);
+libc_hidden_proto(fseeko64)
+extern __off64_t ftello64 (FILE *__stream) __wur;
+libc_hidden_proto(ftello64)
 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
 extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
 #endif
@@ -720,16 +781,16 @@ __BEGIN_NAMESPACE_STD
 /* Clear the error and EOF indicators for STREAM.  */
 extern void clearerr (FILE *__stream) __THROW;
 /* Return the EOF indicator for STREAM.  */
-extern int feof (FILE *__stream) __THROW;
+extern int feof (FILE *__stream) __THROW __wur;
 /* Return the error indicator for STREAM.  */
-extern int ferror (FILE *__stream) __THROW;
+extern int ferror (FILE *__stream) __THROW __wur;
 __END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* Faster versions when locking is not required.  */
 extern void clearerr_unlocked (FILE *__stream) __THROW;
-extern int feof_unlocked (FILE *__stream) __THROW;
-extern int ferror_unlocked (FILE *__stream) __THROW;
+extern int feof_unlocked (FILE *__stream) __THROW __wur;
+extern int ferror_unlocked (FILE *__stream) __THROW __wur;
 #endif
 
 
@@ -739,6 +800,7 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern void perror (__const char *__s);
+libc_hidden_proto(perror)
 __END_NAMESPACE_STD
 
 #ifdef __UCLIBC_HAS_SYS_ERRLIST__
@@ -753,12 +815,14 @@ extern __const char *__const sys_errlist[];
 
 #ifdef __USE_POSIX
 /* Return the system file descriptor for STREAM.  */
-extern int fileno (FILE *__stream) __THROW;
+extern int fileno (FILE *__stream) __THROW __wur;
+libc_hidden_proto(fileno)
 #endif /* Use POSIX.  */
 
 #ifdef __USE_MISC
 /* Faster version when locking is not required.  */
-extern int fileno_unlocked (FILE *__stream) __THROW;
+extern int fileno_unlocked (FILE *__stream) __THROW __wur;
+libc_hidden_proto(fileno_unlocked)
 #endif
 
 
@@ -768,7 +832,7 @@ extern int fileno_unlocked (FILE *__stream) __THROW;
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern FILE *popen (__const char *__command, __const char *__modes);
+extern FILE *popen (__const char *__command, __const char *__modes) __wur;
 
 /* Close a stream opened by popen and return the status of its child.
 
@@ -812,7 +876,7 @@ extern void flockfile (FILE *__stream) __THROW;
 
 /* Try to acquire ownership of STREAM but do not block if it is not
    possible.  */
-extern int ftrylockfile (FILE *__stream) __THROW;
+extern int ftrylockfile (FILE *__stream) __THROW __wur;
 
 /* Relinquish the ownership granted for STREAM.  */
 extern void funlockfile (FILE *__stream) __THROW;
@@ -823,14 +887,25 @@ extern void funlockfile (FILE *__stream) __THROW;
    declared here which do not belong into this header.  But we have to
    follow.  In GNU mode we don't do this nonsense.  */
 # define __need_getopt
+/* keep this on uClibc in bits/, we need it when GNU_GETOPT is disabled */
 # include <bits/getopt.h>
 #endif /* X/Open, but not issue 6 and not for GNU.  */
 
 /* If we are compiling with optimizing read this file.  It contains
    several optimizing inline functions and macros.  */
+
+#ifdef __UCLIBC__
+
 #define fgetc(_fp)                   __FGETC(_fp)
 #define fputc(_ch, _fp)              __FPUTC(_ch, _fp)
 
+#if defined __USE_POSIX || defined __USE_MISC
+/* SUSv3 allows getc_unlocked to be a macro */
+#define getc_unlocked(_fp) __GETC_UNLOCKED(_fp)
+/* SUSv3 allows putc_unlocked to be a macro */
+#define putc_unlocked(_ch, _fp) __PUTC_UNLOCKED(_ch, _fp)
+#endif
+
 #ifdef __USE_MISC
 #define fgetc_unlocked(_fp)          __FGETC_UNLOCKED(_fp)
 #define fputc_unlocked(_ch, _fp)     __FPUTC_UNLOCKED(_ch, _fp)
@@ -855,6 +930,8 @@ extern void funlockfile (FILE *__stream) __THROW;
 #define ferror_unlocked(_fp)         __FERROR_UNLOCKED(_fp)
 #endif
 
+#endif
+
 __END_DECLS
 
 #endif /* <stdio.h> included.  */