summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/.gitignore50
-rw-r--r--include/a.out.h6
-rw-r--r--include/alloca.h40
-rw-r--r--include/ar.h5
-rw-r--r--include/argp.h566
-rw-r--r--include/arpa/inet.h37
-rw-r--r--include/arpa/nameser.h19
-rw-r--r--include/arpa/nameser_compat.h4
-rw-r--r--include/assert.h16
-rw-r--r--include/atomic.h628
-rw-r--r--include/byteswap.h5
-rw-r--r--include/cancel.h101
-rw-r--r--include/complex.h28
-rw-r--r--include/cpio.h5
-rw-r--r--include/crypt.h6
-rw-r--r--include/ctype.h308
-rw-r--r--include/dirent.h132
-rw-r--r--include/dlfcn.h40
-rw-r--r--include/elf.h402
-rw-r--r--include/endian.h54
-rw-r--r--include/err.h21
-rw-r--r--include/errno.h32
-rw-r--r--include/error.h5
-rw-r--r--include/execinfo.h43
-rw-r--r--include/fcntl.h133
-rw-r--r--include/features.h203
-rw-r--r--include/fenv.h11
-rw-r--r--include/fnmatch.h16
-rw-r--r--include/fts.h131
-rw-r--r--include/ftw.h51
-rw-r--r--include/getopt.h2
-rw-r--r--include/glob.h44
-rw-r--r--include/gnu-versions.h9
-rw-r--r--include/grp.h33
-rw-r--r--include/iconv.h11
-rw-r--r--include/ieee754.h13
-rw-r--r--include/ifaddrs.h7
-rw-r--r--include/internal/parse_config.h57
-rw-r--r--include/internal/utmp.h92
-rw-r--r--include/inttypes.h161
-rw-r--r--include/langinfo.h58
-rw-r--r--include/libc-internal.h67
-rw-r--r--include/libc-symbols.h355
-rw-r--r--include/libgen.h5
-rw-r--r--include/libintl.h57
-rw-r--r--include/limits.h28
-rw-r--r--include/link.h33
-rw-r--r--include/locale.h29
-rw-r--r--include/malloc.h20
-rw-r--r--include/math.h130
-rw-r--r--include/memory.h5
-rw-r--r--include/mntent.h16
-rw-r--r--include/mqueue.h5
-rw-r--r--include/net/ethernet.h15
-rw-r--r--include/net/if.h10
-rw-r--r--include/net/if_arp.h17
-rw-r--r--include/net/if_packet.h5
-rw-r--r--include/net/if_shaper.h5
-rw-r--r--include/net/if_slip.h5
-rw-r--r--include/net/route.h9
-rw-r--r--include/netax25/ax25.h5
-rw-r--r--include/netdb.h206
-rw-r--r--include/neteconet/ec.h5
-rw-r--r--include/netinet/ether.h26
-rw-r--r--include/netinet/icmp6.h21
-rw-r--r--include/netinet/if_ether.h5
-rw-r--r--include/netinet/if_fddi.h5
-rw-r--r--include/netinet/if_tr.h5
-rw-r--r--include/netinet/igmp.h5
-rw-r--r--include/netinet/in.h152
-rw-r--r--include/netinet/in_systm.h5
-rw-r--r--include/netinet/ip.h85
-rw-r--r--include/netinet/ip6.h13
-rw-r--r--include/netinet/ip_icmp.h5
-rw-r--r--include/netinet/protocols.h62
-rw-r--r--include/netinet/tcp.h10
-rw-r--r--include/netinet/udp.h17
-rw-r--r--include/netipx/ipx.h5
-rw-r--r--include/netpacket/packet.h5
-rw-r--r--include/nl_types.h15
-rw-r--r--include/obstack.h324
-rw-r--r--include/paths.h2
-rw-r--r--include/printf.h27
-rw-r--r--include/protocols/timed.h5
-rw-r--r--include/pty.h6
-rw-r--r--include/pwd.h16
-rw-r--r--include/regex.h155
-rw-r--r--include/regexp.h35
-rw-r--r--include/resolv.h159
-rw-r--r--include/rpc/auth.h33
-rw-r--r--include/rpc/auth_des.h17
-rw-r--r--include/rpc/auth_unix.h1
-rw-r--r--include/rpc/clnt.h40
-rw-r--r--include/rpc/netdb.h9
-rw-r--r--include/rpc/pmap_clnt.h23
-rw-r--r--include/rpc/pmap_prot.h2
-rw-r--r--include/rpc/pmap_rmt.h3
-rw-r--r--include/rpc/rpc.h20
-rw-r--r--include/rpc/rpc_msg.h24
-rw-r--r--include/rpc/svc.h16
-rw-r--r--include/rpc/svc_auth.h1
-rw-r--r--include/rpc/types.h13
-rw-r--r--include/rpc/xdr.h48
-rw-r--r--include/sched.h67
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_ioctl.h5
-rw-r--r--include/scsi/sg.h5
-rw-r--r--include/search.h28
-rw-r--r--include/setjmp.h58
-rw-r--r--include/sgtty.h13
-rw-r--r--include/shadow.h19
-rw-r--r--include/signal.h210
-rw-r--r--include/spawn.h295
-rw-r--r--include/stdint.h22
-rw-r--r--include/stdio.h266
-rw-r--r--include/stdio_ext.h6
-rw-r--r--include/stdlib.h305
-rw-r--r--include/string.h214
-rw-r--r--include/strings.h48
-rw-r--r--include/sys/cdefs.h47
-rw-r--r--include/sys/dir.h5
-rw-r--r--include/sys/file.h7
-rw-r--r--include/sys/fsuid.h5
-rw-r--r--include/sys/ioctl.h6
-rw-r--r--include/sys/ipc.h7
-rw-r--r--include/sys/kd.h5
-rw-r--r--include/sys/kdaemon.h5
-rw-r--r--include/sys/klog.h5
-rw-r--r--include/sys/mman.h30
-rw-r--r--include/sys/mount.h67
-rw-r--r--include/sys/msg.h17
-rw-r--r--include/sys/mtio.h5
-rw-r--r--include/sys/param.h23
-rw-r--r--include/sys/personality.h5
-rw-r--r--include/sys/poll.h12
-rw-r--r--include/sys/queue.h842
-rw-r--r--include/sys/quota.h96
-rw-r--r--include/sys/reboot.h5
-rw-r--r--include/sys/resource.h15
-rw-r--r--include/sys/select.h9
-rw-r--r--include/sys/sem.h7
-rw-r--r--include/sys/sendfile.h6
-rw-r--r--include/sys/shm.h12
-rw-r--r--include/sys/socket.h58
-rw-r--r--include/sys/stat.h87
-rw-r--r--include/sys/statfs.h16
-rw-r--r--include/sys/statvfs.h21
-rw-r--r--include/sys/swap.h9
-rw-r--r--include/sys/syscall.h16
-rw-r--r--include/sys/sysctl.h5
-rw-r--r--include/sys/sysinfo.h14
-rw-r--r--include/sys/syslog.h7
-rw-r--r--include/sys/sysmacros.h34
-rw-r--r--include/sys/time.h36
-rw-r--r--include/sys/timeb.h5
-rw-r--r--include/sys/times.h6
-rw-r--r--include/sys/timex.h19
-rw-r--r--include/sys/ttydefaults.h6
-rw-r--r--include/sys/types.h11
-rw-r--r--include/sys/uio.h9
-rw-r--r--include/sys/un.h5
-rw-r--r--include/sys/ustat.h5
-rw-r--r--include/sys/utsname.h29
-rw-r--r--include/sys/wait.h67
-rw-r--r--include/sys/xattr.h31
-rw-r--r--include/tar.h5
-rw-r--r--include/termios.h15
-rw-r--r--include/tgmath.h329
-rw-r--r--include/time.h92
-rw-r--r--include/tls.h19
-rw-r--r--include/ttyent.h7
-rw-r--r--include/ucontext.h37
-rw-r--r--include/ulimit.h5
-rw-r--r--include/unistd.h362
-rw-r--r--include/utime.h10
-rw-r--r--include/utmp.h31
-rw-r--r--include/utmpx.h126
-rw-r--r--include/values.h7
-rw-r--r--include/wchar-stub.h13
-rw-r--r--include/wchar.h225
-rw-r--r--include/wctype.h30
-rw-r--r--include/wordexp.h8
-rw-r--r--include/xlocale.h36
183 files changed, 7204 insertions, 3495 deletions
diff --git a/include/.gitignore b/include/.gitignore
new file mode 100644
index 000000000..8f86c4c80
--- /dev/null
+++ b/include/.gitignore
@@ -0,0 +1,50 @@
+#
+# Never ignore these
+#
+!.gitignore
+
+#
+# Generated files
+#
+/bits/
+/config/
+/generated/
+
+/bfin_fixed_code.h
+/bfin_l1layout.h
+/bfin_sram.h
+/dl-osinfo.h
+/fpu_control.h
+/hp-timing.h
+/jmpbuf-offsets.h
+/jmpbuf-unwind.h
+/not-cancel.h
+/pthread.h
+/semaphore.h
+/thread_db.h
+/sgidefs.h
+
+/sys/acct.h
+/sys/asm.h
+/sys/cachectl.h
+/sys/debugreg.h
+/sys/elf.h
+/sys/epoll.h
+/sys/eventfd.h
+/sys/fpregdef.h
+/sys/inotify.h
+/sys/io.h
+/sys/perm.h
+/sys/prctl.h
+/sys/procfs.h
+/sys/ptrace.h
+/sys/random.h
+/sys/reg.h
+/sys/regdef.h
+/sys/signalfd.h
+/sys/sysmips.h
+/sys/tas.h
+/sys/timerfd.h
+/sys/ucontext.h
+/sys/user.h
+/sys/vm86.h
diff --git a/include/a.out.h b/include/a.out.h
index d963de74c..50a9f0735 100644
--- a/include/a.out.h
+++ b/include/a.out.h
@@ -1,5 +1 @@
-#ifdef _LIBC
-# include_next <linux/a.out.h>
-#else
-# include <linux/a.out.h>
-#endif
+#define __NO_A_OUT_SUPPORT 1
diff --git a/include/alloca.h b/include/alloca.h
index b4fc31738..b3a1e4a6a 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ALLOCA_H
#define _ALLOCA_H 1
@@ -36,7 +35,40 @@ extern void *alloca (size_t __size) __THROW;
# define alloca(size) __builtin_alloca (size)
#endif /* GCC. */
-#define __MAX_ALLOCA_CUTOFF 65536
+#ifdef _LIBC
+# define __MAX_ALLOCA_CUTOFF 65536
+
+# include <bits/stackinfo.h>
+# ifdef _STACK_GROWS_DOWN
+# define extend_alloca(buf, len, newlen) \
+ (__typeof (buf)) ({ size_t __newlen = (newlen); \
+ char *__newbuf = alloca (__newlen); \
+ if (__newbuf + __newlen == (char *) buf) \
+ len += __newlen; \
+ else \
+ len = __newlen; \
+ __newbuf; })
+# elif defined _STACK_GROWS_UP
+# define extend_alloca(buf, len, newlen) \
+ (__typeof (buf)) ({ size_t __newlen = (newlen); \
+ char *__newbuf = alloca (__newlen); \
+ char *__buf = (buf); \
+ if (__buf + __newlen == __newbuf) \
+ { \
+ len += __newlen; \
+ __newbuf = __buf; \
+ } \
+ else \
+ len = __newlen; \
+ __newbuf; })
+# else
+# error unknown stack
+# define extend_alloca(buf, len, newlen) \
+ alloca (((len) = (newlen)))
+# endif
+
+extern int __libc_alloca_cutoff (size_t size);
+#endif
__END_DECLS
diff --git a/include/ar.h b/include/ar.h
index 5d157eca9..30c3fc6a9 100644
--- a/include/ar.h
+++ b/include/ar.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _AR_H
#define _AR_H 1
diff --git a/include/argp.h b/include/argp.h
new file mode 100644
index 000000000..9d5372890
--- /dev/null
+++ b/include/argp.h
@@ -0,0 +1,566 @@
+/* Hierarchial argument parsing, layered over getopt.
+ Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
+*/
+
+#ifndef _ARGP_H
+#define _ARGP_H
+
+#include <stdio.h>
+#include <ctype.h>
+#include <limits.h>
+
+#define __need_error_t
+#include <errno.h>
+
+#ifndef __const
+# define __const const
+#endif
+
+#ifndef __THROW
+# define __THROW
+#endif
+#ifndef __NTH
+# define __NTH(fct) fct __THROW
+#endif
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
+# define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
+# define __format__ format
+# define __printf__ printf
+# endif
+#endif
+
+/* GCC 2.95 and later have "__restrict"; C99 compilers have
+ "restrict", and "configure" may have defined "restrict". */
+#ifndef __restrict
+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
+# if defined restrict || 199901L <= __STDC_VERSION__
+# define __restrict restrict
+# else
+# define __restrict
+# endif
+# endif
+#endif
+
+#ifndef __error_t_defined
+typedef int error_t;
+# define __error_t_defined
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A description of a particular option. A pointer to an array of
+ these is passed in the OPTIONS field of an argp structure. Each option
+ entry can correspond to one long option and/or one short option; more
+ names for the same option can be added by following an entry in an option
+ array with options having the OPTION_ALIAS flag set. */
+struct argp_option
+{
+ /* The long option name. For more than one name for the same option, you
+ can use following options with the OPTION_ALIAS flag set. */
+ __const char *name;
+
+ /* What key is returned for this option. If > 0 and printable, then it's
+ also accepted as a short option. */
+ int key;
+
+ /* If non-NULL, this is the name of the argument associated with this
+ option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
+ __const char *arg;
+
+ /* OPTION_ flags. */
+ int flags;
+
+ /* The doc string for this option. If both NAME and KEY are 0, This string
+ will be printed outdented from the normal option column, making it
+ useful as a group header (it will be the first thing printed in its
+ group); in this usage, it's conventional to end the string with a `:'. */
+ __const char *doc;
+
+ /* The group this option is in. In a long help message, options are sorted
+ alphabetically within each group, and the groups presented in the order
+ 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with
+ if this field 0 will inherit the group number of the previous entry, or
+ zero if it's the first one, unless its a group header (NAME and KEY both
+ 0), in which case, the previous entry + 1 is the default. Automagic
+ options such as --help are put into group -1. */
+ int group;
+};
+
+/* The argument associated with this option is optional. */
+#define OPTION_ARG_OPTIONAL 0x1
+
+/* This option isn't displayed in any help messages. */
+#define OPTION_HIDDEN 0x2
+
+/* This option is an alias for the closest previous non-alias option. This
+ means that it will be displayed in the same help entry, and will inherit
+ fields other than NAME and KEY from the aliased option. */
+#define OPTION_ALIAS 0x4
+
+/* This option isn't actually an option (and so should be ignored by the
+ actual option parser), but rather an arbitrary piece of documentation that
+ should be displayed in much the same manner as the options. If this flag
+ is set, then the option NAME field is displayed unmodified (e.g., no `--'
+ prefix is added) at the left-margin (where a *short* option would normally
+ be displayed), and the documentation string in the normal place. For
+ purposes of sorting, any leading whitespace and punctuation is ignored,
+ except that if the first non-whitespace character is not `-', this entry
+ is displayed after all options (and OPTION_DOC entries with a leading `-')
+ in the same group. */
+#define OPTION_DOC 0x8
+
+/* This option shouldn't be included in `long' usage messages (but is still
+ included in help messages). This is mainly intended for options that are
+ completely documented in an argp's ARGS_DOC field, in which case including
+ the option in the generic usage list would be redundant. For instance,
+ if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
+ distinguish these two cases, -x should probably be marked
+ OPTION_NO_USAGE. */
+#define OPTION_NO_USAGE 0x10
+
+struct argp; /* fwd declare this type */
+struct argp_state; /* " */
+struct argp_child; /* " */
+
+/* The type of a pointer to an argp parsing function. */
+typedef error_t (*argp_parser_t) (int __key, char *__arg,
+ struct argp_state *__state);
+
+/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
+ returns will simply be ignored. For user keys, this error will be turned
+ into EINVAL (if the call to argp_parse is such that errors are propagated
+ back to the user instead of exiting); returning EINVAL itself would result
+ in an immediate stop to parsing in *all* cases. */
+#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */
+
+/* Special values for the KEY argument to an argument parsing function.
+ ARGP_ERR_UNKNOWN should be returned if they aren't understood.
+
+ The sequence of keys to a parsing function is either (where each
+ uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
+
+ INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all
+ or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed
+ or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized
+
+ The third case is where every parser returned ARGP_KEY_UNKNOWN for an
+ argument, in which case parsing stops at that argument (returning the
+ unparsed arguments to the caller of argp_parse if requested, or stopping
+ with an error message if not).
+
+ If an error occurs (either detected by argp, or because the parsing
+ function returned an error value), then the parser is called with
+ ARGP_KEY_ERROR, and no further calls are made. */
+
+/* This is not an option at all, but rather a command line argument. If a
+ parser receiving this key returns success, the fact is recorded, and the
+ ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the
+ argument, a parser function decrements the NEXT field of the state it's
+ passed, the option won't be considered processed; this is to allow you to
+ actually modify the argument (perhaps into an option), and have it
+ processed again. */
+#define ARGP_KEY_ARG 0
+/* There are remaining arguments not parsed by any parser, which may be found
+ starting at (STATE->argv + STATE->next). If success is returned, but
+ STATE->next left untouched, it's assumed that all arguments were consume,
+ otherwise, the parser should adjust STATE->next to reflect any arguments
+ consumed. */
+#define ARGP_KEY_ARGS 0x1000006
+/* There are no more command line arguments at all. */
+#define ARGP_KEY_END 0x1000001
+/* Because it's common to want to do some special processing if there aren't
+ any non-option args, user parsers are called with this key if they didn't
+ successfully process any non-option arguments. Called just before
+ ARGP_KEY_END (where more general validity checks on previously parsed
+ arguments can take place). */
+#define ARGP_KEY_NO_ARGS 0x1000002
+/* Passed in before any parsing is done. Afterwards, the values of each
+ element of the CHILD_INPUT field, if any, in the state structure is
+ copied to each child's state to be the initial value of the INPUT field. */
+#define ARGP_KEY_INIT 0x1000003
+/* Use after all other keys, including SUCCESS & END. */
+#define ARGP_KEY_FINI 0x1000007
+/* Passed in when parsing has successfully been completed (even if there are
+ still arguments remaining). */
+#define ARGP_KEY_SUCCESS 0x1000004
+/* Passed in if an error occurs. */
+#define ARGP_KEY_ERROR 0x1000005
+
+/* An argp structure contains a set of options declarations, a function to
+ deal with parsing one, documentation string, a possible vector of child
+ argp's, and perhaps a function to filter help output. When actually
+ parsing options, getopt is called with the union of all the argp
+ structures chained together through their CHILD pointers, with conflicts
+ being resolved in favor of the first occurrence in the chain. */
+struct argp
+{
+ /* An array of argp_option structures, terminated by an entry with both
+ NAME and KEY having a value of 0. */
+ __const struct argp_option *options;
+
+ /* What to do with an option from this structure. KEY is the key
+ associated with the option, and ARG is any associated argument (NULL if
+ none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be
+ returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
+ parsing is stopped immediately, and that value is returned from
+ argp_parse(). For special (non-user-supplied) values of KEY, see the
+ ARGP_KEY_ definitions below. */
+ argp_parser_t parser;
+
+ /* A string describing what other arguments are wanted by this program. It
+ is only used by argp_usage to print the `Usage:' message. If it
+ contains newlines, the strings separated by them are considered
+ alternative usage patterns, and printed on separate lines (lines after
+ the first are prefix by ` or: ' instead of `Usage:'). */
+ __const char *args_doc;
+
+ /* If non-NULL, a string containing extra text to be printed before and
+ after the options in a long help message (separated by a vertical tab
+ `\v' character). */
+ __const char *doc;
+
+ /* A vector of argp_children structures, terminated by a member with a 0
+ argp field, pointing to child argps should be parsed with this one. Any
+ conflicts are resolved in favor of this argp, or early argps in the
+ CHILDREN list. This field is useful if you use libraries that supply
+ their own argp structure, which you want to use in conjunction with your
+ own. */
+ __const struct argp_child *children;
+
+ /* If non-zero, this should be a function to filter the output of help
+ messages. KEY is either a key from an option, in which case TEXT is
+ that option's help text, or a special key from the ARGP_KEY_HELP_
+ defines, below, describing which other help text TEXT is. The function
+ should return either TEXT, if it should be used as-is, a replacement
+ string, which should be malloced, and will be freed by argp, or NULL,
+ meaning `print nothing'. The value for TEXT is *after* any translation
+ has been done, so if any of the replacement text also needs translation,
+ that should be done by the filter function. INPUT is either the input
+ supplied to argp_parse, or NULL, if argp_help was called directly. */
+ char *(*help_filter) (int __key, __const char *__text, void *__input);
+
+ /* If non-zero the strings used in the argp library are translated using
+ the domain described by this string. Otherwise the currently installed
+ default domain is used. */
+ const char *argp_domain;
+};
+
+/* Possible KEY arguments to a help filter function. */
+#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */
+#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */
+#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */
+#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation;
+ TEXT is NULL for this key. */
+/* Explanatory note emitted when duplicate option arguments have been
+ suppressed. */
+#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
+#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
+
+/* When an argp has a non-zero CHILDREN field, it should point to a vector of
+ argp_child structures, each of which describes a subsidiary argp. */
+struct argp_child
+{
+ /* The child parser. */
+ __const struct argp *argp;
+
+ /* Flags for this child. */
+ int flags;
+
+ /* If non-zero, an optional header to be printed in help output before the
+ child options. As a side-effect, a non-zero value forces the child
+ options to be grouped together; to achieve this effect without actually
+ printing a header string, use a value of "". */
+ __const char *header;
+
+ /* Where to group the child options relative to the other (`consolidated')
+ options in the parent argp; the values are the same as the GROUP field
+ in argp_option structs, but all child-groupings follow parent options at
+ a particular group level. If both this field and HEADER are zero, then
+ they aren't grouped at all, but rather merged with the parent options
+ (merging the child's grouping levels with the parents). */
+ int group;
+};
+
+/* Parsing state. This is provided to parsing functions called by argp,
+ which may examine and, as noted, modify fields. */
+struct argp_state
+{
+ /* The top level ARGP being parsed. */
+ __const struct argp *root_argp;
+
+ /* The argument vector being parsed. May be modified. */
+ int argc;
+ char **argv;
+
+ /* The index in ARGV of the next arg that to be parsed. May be modified. */
+ int next;
+
+ /* The flags supplied to argp_parse. May be modified. */
+ unsigned flags;
+
+ /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
+ number of the current arg, starting at zero, and incremented after each
+ such call returns. At all other times, this is the number of such
+ arguments that have been processed. */
+ unsigned arg_num;
+
+ /* If non-zero, the index in ARGV of the first argument following a special
+ `--' argument (which prevents anything following being interpreted as an
+ option). Only set once argument parsing has proceeded past this point. */
+ int quoted;
+
+ /* An arbitrary pointer passed in from the user. */
+ void *input;
+ /* Values to pass to child parsers. This vector will be the same length as
+ the number of children for the current parser. */
+ void **child_inputs;
+
+ /* For the parser's use. Initialized to 0. */
+ void *hook;
+
+ /* The name used when printing messages. This is initialized to ARGV[0],
+ or PROGRAM_INVOCATION_NAME if that is unavailable. */
+ char *name;
+
+ /* Streams used when argp prints something. */
+ FILE *err_stream; /* For errors; initialized to stderr. */
+ FILE *out_stream; /* For information; initialized to stdout. */
+
+ void *pstate; /* Private, for use by argp. */
+};
+
+/* Flags for argp_parse (note that the defaults are those that are
+ convenient for program command line parsing): */
+
+/* Don't ignore the first element of ARGV. Normally (and always unless
+ ARGP_NO_ERRS is set) the first element of the argument vector is
+ skipped for option parsing purposes, as it corresponds to the program name
+ in a command line. */
+#define ARGP_PARSE_ARGV0 0x01
+
+/* Don't print error messages for unknown options to stderr; unless this flag
+ is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
+ name in the error messages. This flag implies ARGP_NO_EXIT (on the
+ assumption that silent exiting upon errors is bad behaviour). */
+#define ARGP_NO_ERRS 0x02
+
+/* Don't parse any non-option args. Normally non-option args are parsed by
+ calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
+ as the value. Since it's impossible to know which parse function wants to
+ handle it, each one is called in turn, until one returns 0 or an error
+ other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
+ argp_parse returns prematurely (but with a return value of 0). If all
+ args have been parsed without error, all parsing functions are called one
+ last time with a key of ARGP_KEY_END. This flag needn't normally be set,
+ as the normal behavior is to stop parsing as soon as some argument can't
+ be handled. */
+#define ARGP_NO_ARGS 0x04
+
+/* Parse options and arguments in the same order they occur on the command
+ line -- normally they're rearranged so that all options come first. */
+#define ARGP_IN_ORDER 0x08
+
+/* Don't provide the standard long option --help, which causes usage and
+ option help information to be output to stdout, and exit (0) called. */
+#define ARGP_NO_HELP 0x10
+
+/* Don't exit on errors (they may still result in error messages). */
+#define ARGP_NO_EXIT 0x20
+
+/* Use the gnu getopt `long-only' rules for parsing arguments. */
+#define ARGP_LONG_ONLY 0x40
+
+/* Turns off any message-printing/exiting options. */
+#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
+
+/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
+ FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the
+ index in ARGV of the first unparsed option is returned in it. If an
+ unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
+ routine returned a non-zero value, it is returned; otherwise 0 is
+ returned. This function may also call exit unless the ARGP_NO_HELP flag
+ is set. INPUT is a pointer to a value to be passed in to the parser. */
+extern error_t argp_parse (__const struct argp *__restrict __argp,
+ int __argc, char **__restrict __argv,
+ unsigned __flags, int *__restrict __arg_index,
+ void *__restrict __input);
+
+/* Global variables. */
+
+/* If defined or set by the user program to a non-zero value, then a default
+ option --version is added (unless the ARGP_NO_HELP flag is used), which
+ will print this string followed by a newline and exit (unless the
+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
+extern __const char *argp_program_version;
+
+/* If defined or set by the user program to a non-zero value, then a default
+ option --version is added (unless the ARGP_NO_HELP flag is used), which
+ calls this function with a stream to print the version to and a pointer to
+ the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
+extern void (*argp_program_version_hook) (FILE *__restrict __stream,
+ struct argp_state *__restrict
+ __state);
+
+/* If defined or set by the user program, it should point to string that is
+ the bug-reporting address for the program. It will be printed by
+ argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
+ standard help messages), embedded in a sentence that says something like
+ `Report bugs to ADDR.'. */
+extern __const char *argp_program_bug_address;
+
+/* The exit status that argp will use when exiting due to a parsing error.
+ If not defined or set by the user program, this defaults to EX_USAGE from
+ <sysexits.h>. */
+extern error_t argp_err_exit_status;
+
+/* Flags for argp_help. */
+#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
+#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
+#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */
+#define ARGP_HELP_LONG 0x08 /* a long help message. */
+#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */
+#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */
+#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
+#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */
+#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to
+ reflect ARGP_LONG_ONLY mode. */
+
+/* These ARGP_HELP flags are only understood by argp_state_help. */
+#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */
+#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */
+
+/* The standard thing to do after a program command line parsing error, if an
+ error message has already been printed. */
+#define ARGP_HELP_STD_ERR \
+ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
+/* The standard thing to do after a program command line parsing error, if no
+ more specific error message has been printed. */
+#define ARGP_HELP_STD_USAGE \
+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
+/* The standard thing to do in response to a --help option. */
+#define ARGP_HELP_STD_HELP \
+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
+ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
+
+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
+ ARGP_HELP_*. */
+extern void argp_help (__const struct argp *__restrict __argp,
+ FILE *__restrict __stream,
+ unsigned __flags, char *__restrict __name);
+
+/* The following routines are intended to be called from within an argp
+ parsing routine (thus taking an argp_state structure as the first
+ argument). They may or may not print an error message and exit, depending
+ on the flags in STATE -- in any case, the caller should be prepared for
+ them *not* to exit, and should return an appropiate error after calling
+ them. [argp_usage & argp_error should probably be called argp_state_...,
+ but they're used often enough that they should be short] */
+
+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
+ from the set ARGP_HELP_*. */
+extern void argp_state_help (__const struct argp_state *__restrict __state,
+ FILE *__restrict __stream,
+ unsigned int __flags);
+/* Possibly output the standard usage message for ARGP to stderr and exit. */
+extern void argp_usage (__const struct argp_state *__state);
+
+/* If appropriate, print the printf string FMT and following args, preceded
+ by the program name and `:', to stderr, and followed by a `Try ... --help'
+ message, then exit (1). */
+extern void argp_error (__const struct argp_state *__restrict __state,
+ __const char *__restrict __fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+/* Similar to the standard gnu error-reporting function error(), but will
+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
+ to STATE->err_stream. This is useful for argument parsing code that is
+ shared between program startup (when exiting is desired) and runtime
+ option parsing (when typically an error code is returned instead). The
+ difference between this function and argp_error is that the latter is for
+ *parsing errors*, and the former is for other problems that occur during
+ parsing but don't reflect a (syntactic) problem with the input. */
+extern void argp_failure (__const struct argp_state *__restrict __state,
+ int __status, int __errnum,
+ __const char *__restrict __fmt, ...)
+ __attribute__ ((__format__ (__printf__, 4, 5)));
+/* Returns true if the option OPT is a valid short option. */
+extern int _option_is_short (__const struct argp_option *__opt) __THROW;
+extern int __option_is_short (__const struct argp_option *__opt) __THROW;
+
+/* Returns true if the option OPT is in fact the last (unused) entry in an
+ options array. */
+extern int _option_is_end (__const struct argp_option *__opt) __THROW;
+extern int __option_is_end (__const struct argp_option *__opt) __THROW;
+
+/* Return the input field for ARGP in the parser corresponding to STATE; used
+ by the help routines. */
+/* We think this should not be exported */
+extern void *__argp_input (__const struct argp *__restrict __argp,
+ __const struct argp_state *__restrict __state)
+ __THROW;
+
+#ifdef __USE_EXTERN_INLINES
+
+# ifndef ARGP_EI
+# define ARGP_EI __extern_inline
+# endif
+
+ARGP_EI void
+argp_usage (__const struct argp_state *__state)
+{
+ argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
+}
+
+ARGP_EI int
+__NTH (__option_is_short (__const struct argp_option *__opt))
+{
+ if (__opt->flags & OPTION_DOC)
+ return 0;
+ else
+ {
+ int __key = __opt->key;
+ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
+ }
+}
+
+ARGP_EI int
+__NTH (__option_is_end (__const struct argp_option *__opt))
+{
+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
+}
+#endif /* Use extern inlines. */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* argp.h */
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 02233d4e7..4a90cf2cf 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2001, 2004 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ARPA_INET_H
#define _ARPA_INET_H 1
@@ -32,7 +31,8 @@ __BEGIN_DECLS
/* Convert Internet host address from numbers-and-dots notation in CP
into binary data in network byte order. */
-extern in_addr_t inet_addr (__const char *__cp) __THROW;
+extern in_addr_t inet_addr (const char *__cp) __THROW;
+libc_hidden_proto(inet_addr)
/* Return the local host address part of the Internet address in IN. */
extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
@@ -41,40 +41,50 @@ extern in_addr_t inet_lnaof (struct in_addr __in) __THROW;
network number NET with the local address HOST. */
extern struct in_addr inet_makeaddr (in_addr_t __net, in_addr_t __host)
__THROW;
+libc_hidden_proto(inet_makeaddr)
/* Return network number part of the Internet address IN. */
extern in_addr_t inet_netof (struct in_addr __in) __THROW;
+libc_hidden_proto(inet_netof)
/* Extract the network number in network byte order from the address
in numbers-and-dots natation starting at CP. */
-extern in_addr_t inet_network (__const char *__cp) __THROW;
+extern in_addr_t inet_network (const char *__cp) __THROW;
+libc_hidden_proto(inet_network)
/* Convert Internet number in IN to ASCII representation. The return value
is a pointer to an internal array containing the string. */
extern char *inet_ntoa (struct in_addr __in) __THROW;
+libc_hidden_proto(inet_ntoa)
+#ifdef __UCLIBC__
/* Recursion-safe flavor */
extern char *inet_ntoa_r (struct in_addr __in, char *__buf) __THROW;
+#endif
/* Convert from presentation format of an Internet number in buffer
starting at CP to the binary network format and store result for
interface type AF in buffer starting at BUF. */
-extern int inet_pton (int __af, __const char *__restrict __cp,
+extern int inet_pton (int __af, const char *__restrict __cp,
void *__restrict __buf) __THROW;
+libc_hidden_proto(inet_pton)
/* Convert a Internet address in binary network format for interface
type AF in buffer starting at CP to presentation form and place
result in buffer of length LEN astarting at BUF. */
-extern __const char *inet_ntop (int __af, __const void *__restrict __cp,
+extern const char *inet_ntop (int __af, const void *__restrict __cp,
char *__restrict __buf, socklen_t __len)
__THROW;
+libc_hidden_proto(inet_ntop)
/* The following functions are not part of XNS 5.2. */
#ifdef __USE_MISC
/* Convert Internet host address from numbers-and-dots notation in CP
into binary data and store the result in the structure INP. */
-extern int inet_aton (__const char *__cp, struct in_addr *__inp) __THROW;
+extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW;
+libc_hidden_proto(inet_aton)
+#if 0
/* Format a network number NET into presentation format and place result
in buffer starting at BUF with length of LEN bytes. */
extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
@@ -82,26 +92,27 @@ extern char *inet_neta (in_addr_t __net, char *__buf, size_t __len) __THROW;
/* Convert network number for interface type AF in buffer starting at
CP to presentation format. The result will specifiy BITS bits of
the number. */
-extern char *inet_net_ntop (int __af, __const void *__cp, int __bits,
+extern char *inet_net_ntop (int __af, const void *__cp, int __bits,
char *__buf, size_t __len) __THROW;
/* Convert network number for interface type AF from presentation in
buffer starting at CP to network format and store result int
buffer starting at BUF of size LEN. */
-extern int inet_net_pton (int __af, __const char *__cp,
+extern int inet_net_pton (int __af, const char *__cp,
void *__buf, size_t __len) __THROW;
/* Convert ASCII representation in hexadecimal form of the Internet
address to binary form and place result in buffer of length LEN
starting at BUF. */
-extern unsigned int inet_nsap_addr (__const char *__cp,
+extern unsigned int inet_nsap_addr (const char *__cp,
unsigned char *__buf, int __len) __THROW;
/* Convert internet address in binary form in LEN bytes starting at CP
a presentation form and place result in BUF. */
-extern char *inet_nsap_ntoa (int __len, __const unsigned char *__cp,
+extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp,
char *__buf) __THROW;
#endif
+#endif
__END_DECLS
diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h
index 496c8dbe8..17c68f595 100644
--- a/include/arpa/nameser.h
+++ b/include/arpa/nameser.h
@@ -118,15 +118,7 @@ typedef struct __ns_msg {
const u_char *_ptr;
} ns_msg;
-/* Private data structure - do not use from outside library. */
-struct _ns_flagdata { int mask, shift; };
-extern struct _ns_flagdata _ns_flagdata[];
-
/* Accessor macros - this is part of the public interface. */
-#define ns_msg_getflag(handle, flag) ( \
- ((handle)._flags & _ns_flagdata[flag].mask) \
- >> _ns_flagdata[flag].shift \
- )
#define ns_msg_id(handle) ((handle)._id + 0)
#define ns_msg_base(handle) ((handle)._msg + 0)
#define ns_msg_end(handle) ((handle)._eom + 0)
@@ -287,7 +279,7 @@ typedef enum __ns_type {
ns_t_naptr = 35, /* Naming Authority PoinTeR */
ns_t_kx = 36, /* Key Exchange */
ns_t_cert = 37, /* Certification record */
- ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
+ ns_t_a6 = 38, /* IPv6 address (deprecated, use ns_t_aaaa) */
ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
ns_t_sink = 40, /* Kitchen sink (experimentatl) */
ns_t_opt = 41, /* EDNS0 option (meta-RR) */
@@ -499,6 +491,7 @@ typedef enum __ns_cert_types {
#define ns_samename __ns_samename
__BEGIN_DECLS
+int ns_msg_getflag (ns_msg, int) __THROW;
u_int ns_get16 (const u_char *) __THROW;
u_long ns_get32 (const u_char *) __THROW;
void ns_put16 (u_int, u_char *) __THROW;
@@ -506,6 +499,7 @@ void ns_put32 (u_long, u_char *) __THROW;
int ns_initparse (const u_char *, int, ns_msg *) __THROW;
int ns_skiprr (const u_char *, const u_char *, ns_sect, int)
__THROW;
+libc_hidden_proto(ns_skiprr)
int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __THROW;
int ns_sprintrr (const ns_msg *, const ns_rr *,
const char *, const char *, char *, size_t)
@@ -519,16 +513,23 @@ int ns_parse_ttl (const char *, u_long *) __THROW;
u_int32_t ns_datetosecs (const char *cp, int *errp) __THROW;
int ns_name_ntol (const u_char *, u_char *, size_t) __THROW;
int ns_name_ntop (const u_char *, char *, size_t) __THROW;
+libc_hidden_proto(ns_name_ntop)
int ns_name_pton (const char *, u_char *, size_t) __THROW;
+libc_hidden_proto(ns_name_pton)
int ns_name_unpack (const u_char *, const u_char *,
const u_char *, u_char *, size_t) __THROW;
+libc_hidden_proto(ns_name_unpack)
int ns_name_pack (const u_char *, u_char *, int,
const u_char **, const u_char **) __THROW;
+libc_hidden_proto(ns_name_pack)
int ns_name_uncompress (const u_char *, const u_char *,
const u_char *, char *, size_t) __THROW;
+libc_hidden_proto(ns_name_uncompress)
int ns_name_compress (const char *, u_char *, size_t,
const u_char **, const u_char **) __THROW;
+libc_hidden_proto(ns_name_compress)
int ns_name_skip (const u_char **, const u_char *) __THROW;
+libc_hidden_proto(ns_name_skip)
void ns_name_rollback (const u_char *, const u_char **,
const u_char **) __THROW;
int ns_sign (u_char *, int *, int, int, void *,
diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h
index e3ef864cd..7fe46a16d 100644
--- a/include/arpa/nameser_compat.h
+++ b/include/arpa/nameser_compat.h
@@ -47,7 +47,7 @@
typedef struct {
unsigned id :16; /* query identification number */
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
/* fields in third byte */
unsigned qr: 1; /* response flag */
unsigned opcode: 4; /* purpose of message */
@@ -61,7 +61,7 @@ typedef struct {
unsigned cd: 1; /* checking disabled by resolver */
unsigned rcode :4; /* response code */
#endif
-#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
/* fields in third byte */
unsigned rd :1; /* recursion desired */
unsigned tc :1; /* truncated message */
diff --git a/include/assert.h b/include/assert.h
index 9b9d1b796..ee8e85fa2 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.2 Diagnostics <assert.h>
@@ -51,14 +50,15 @@
__BEGIN_DECLS
/* This prints an "Assertion failed" message and aborts. */
-extern void __assert __P((const char *, const char *, int, const char *));
+extern void __assert(const char *, const char *, unsigned int, const char *)
+ __THROW __attribute__ ((__noreturn__));
+libc_hidden_proto(__assert)
__END_DECLS
# define assert(expr) \
- (__ASSERT_VOID_CAST ((expr) ? 0 : \
- (__assert (__STRING(expr), __FILE__, __LINE__, \
- __ASSERT_FUNCTION), 0)))
+ (__ASSERT_VOID_CAST ((expr) ? 0 : \
+ (__assert (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION), 0)))
/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__'
which contains the name of the function currently being defined.
@@ -71,7 +71,7 @@ __END_DECLS
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNCTION __func__
# else
-# define __ASSERT_FUNCTION ((__const char *) 0)
+# define __ASSERT_FUNCTION ((const char *) 0)
# endif
# endif
diff --git a/include/atomic.h b/include/atomic.h
index aff41202e..3680d8714 100644
--- a/include/atomic.h
+++ b/include/atomic.h
@@ -1,5 +1,5 @@
/* Internal macros for atomic operations for GNU C Library.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -14,13 +14,37 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ATOMIC_H
#define _ATOMIC_H 1
+/* This header defines three types of macros:
+
+ - atomic arithmetic and logic operation on memory. They all
+ have the prefix "atomic_".
+
+ - conditionally atomic operations of the same kinds. These
+ always behave identical but can be faster when atomicity
+ is not really needed since only one thread has access to
+ the memory location. In that case the code is slower in
+ the multi-thread case. The interfaces have the prefix
+ "catomic_".
+
+ - support functions like barriers. They also have the prefix
+ "atomic_".
+
+ Architectures must provide a few lowlevel macros (the compare
+ and exchange definitions). All others are optional. They
+ should only be provided if the architecture has specific
+ support for the operation.
+
+ As <atomic.h> macros are usually heavily nested and often use local
+ variables to make sure side-effects are evaluated properly, use for
+ macro local variables a per-macro unique prefix. This file uses
+ __atgN_ prefix where N is different in each macro. */
+
#include <stdlib.h>
#include <bits/atomic.h>
@@ -30,33 +54,33 @@
and following args. */
#define __atomic_val_bysize(pre, post, mem, ...) \
({ \
- __typeof (*mem) __result; \
+ __typeof (*mem) __atg1_result; \
if (sizeof (*mem) == 1) \
- __result = pre##_8_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg1_result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
- __result; \
+ __atg1_result; \
})
#define __atomic_bool_bysize(pre, post, mem, ...) \
({ \
- int __result; \
+ int __atg2_result; \
if (sizeof (*mem) == 1) \
- __result = pre##_8_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_8_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 2) \
- __result = pre##_16_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_16_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 4) \
- __result = pre##_32_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_32_##post (mem, __VA_ARGS__); \
else if (sizeof (*mem) == 8) \
- __result = pre##_64_##post (mem, __VA_ARGS__); \
+ __atg2_result = pre##_64_##post (mem, __VA_ARGS__); \
else \
abort (); \
- __result; \
+ __atg2_result; \
})
@@ -70,6 +94,29 @@
#endif
+#ifndef catomic_compare_and_exchange_val_acq
+# ifdef __arch_c_compare_and_exchange_val_32_acq
+# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+ __atomic_val_bysize (__arch_c_compare_and_exchange_val,acq, \
+ mem, newval, oldval)
+# else
+# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+ atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+# endif
+#endif
+
+
+#ifndef catomic_compare_and_exchange_val_rel
+# ifndef atomic_compare_and_exchange_val_rel
+# define catomic_compare_and_exchange_val_rel(mem, newval, oldval) \
+ catomic_compare_and_exchange_val_acq (mem, newval, oldval)
+# else
+# define catomic_compare_and_exchange_val_rel(mem, newval, oldval) \
+ atomic_compare_and_exchange_val_rel (mem, newval, oldval)
+# endif
+#endif
+
+
#ifndef atomic_compare_and_exchange_val_rel
# define atomic_compare_and_exchange_val_rel(mem, newval, oldval) \
atomic_compare_and_exchange_val_acq (mem, newval, oldval)
@@ -83,17 +130,46 @@
# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
__atomic_bool_bysize (__arch_compare_and_exchange_bool,acq, \
mem, newval, oldval)
-# else
-# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+# else
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
({ /* Cannot use __oldval here, because macros later in this file might \
call this macro with __oldval argument. */ \
- __typeof (oldval) __old = (oldval); \
- atomic_compare_and_exchange_val_acq (mem, newval, __old) != __old; \
+ __typeof (oldval) __atg3_old = (oldval); \
+ atomic_compare_and_exchange_val_acq (mem, newval, __atg3_old) \
+ != __atg3_old; \
})
# endif
#endif
+#ifndef catomic_compare_and_exchange_bool_acq
+# ifdef __arch_c_compare_and_exchange_bool_32_acq
+# define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ __atomic_bool_bysize (__arch_c_compare_and_exchange_bool,acq, \
+ mem, newval, oldval)
+# else
+# define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+ ({ /* Cannot use __oldval here, because macros later in this file might \
+ call this macro with __oldval argument. */ \
+ __typeof (oldval) __atg4_old = (oldval); \
+ catomic_compare_and_exchange_val_acq (mem, newval, __atg4_old) \
+ != __atg4_old; \
+ })
+# endif
+#endif
+
+
+#ifndef catomic_compare_and_exchange_bool_rel
+# ifndef atomic_compare_and_exchange_bool_rel
+# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
+ catomic_compare_and_exchange_bool_acq (mem, newval, oldval)
+# else
+# define catomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
+ atomic_compare_and_exchange_bool_rel (mem, newval, oldval)
+# endif
+#endif
+
+
#ifndef atomic_compare_and_exchange_bool_rel
# define atomic_compare_and_exchange_bool_rel(mem, newval, oldval) \
atomic_compare_and_exchange_bool_acq (mem, newval, oldval)
@@ -103,18 +179,17 @@
/* Store NEWVALUE in *MEM and return the old value. */
#ifndef atomic_exchange_acq
# define atomic_exchange_acq(mem, newvalue) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (newvalue); \
+ ({ __typeof (*(mem)) __atg5_oldval; \
+ __typeof (mem) __atg5_memp = (mem); \
+ __typeof (*(mem)) __atg5_value = (newvalue); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __value, \
- __oldval),\
- 0)); \
+ __atg5_oldval = *__atg5_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg5_memp, __atg5_value, \
+ __atg5_oldval), 0)); \
\
- __oldval; })
+ __atg5_oldval; })
#endif
#ifndef atomic_exchange_rel
@@ -123,21 +198,106 @@
/* Add VALUE to *MEM and return the old value of *MEM. */
+#ifndef atomic_exchange_and_add_acq
+# ifdef atomic_exchange_and_add
+# define atomic_exchange_and_add_acq(mem, value) \
+ atomic_exchange_and_add (mem, value)
+# else
+# define atomic_exchange_and_add_acq(mem, value) \
+ ({ __typeof (*(mem)) __atg6_oldval; \
+ __typeof (mem) __atg6_memp = (mem); \
+ __typeof (*(mem)) __atg6_value = (value); \
+ \
+ do \
+ __atg6_oldval = *__atg6_memp; \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg6_memp, \
+ __atg6_oldval \
+ + __atg6_value, \
+ __atg6_oldval), 0)); \
+ \
+ __atg6_oldval; })
+# endif
+#endif
+
+#ifndef atomic_exchange_and_add_rel
+# define atomic_exchange_and_add_rel(mem, value) \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
#ifndef atomic_exchange_and_add
# define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __value = (value); \
+ atomic_exchange_and_add_acq(mem, value)
+#endif
+
+#ifndef catomic_exchange_and_add
+# define catomic_exchange_and_add(mem, value) \
+ ({ __typeof (*(mem)) __atg7_oldv; \
+ __typeof (mem) __atg7_memp = (mem); \
+ __typeof (*(mem)) __atg7_value = (value); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- + __value,\
- __oldval),\
- 0)); \
+ __atg7_oldv = *__atg7_memp; \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg7_memp, \
+ __atg7_oldv \
+ + __atg7_value, \
+ __atg7_oldv), 0)); \
\
- __oldval; })
+ __atg7_oldv; })
+#endif
+
+
+#ifndef atomic_max
+# define atomic_max(mem, value) \
+ do { \
+ __typeof (*(mem)) __atg8_oldval; \
+ __typeof (mem) __atg8_memp = (mem); \
+ __typeof (*(mem)) __atg8_value = (value); \
+ do { \
+ __atg8_oldval = *__atg8_memp; \
+ if (__atg8_oldval >= __atg8_value) \
+ break; \
+ } while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg8_memp, __atg8_value,\
+ __atg8_oldval), 0)); \
+ } while (0)
+#endif
+
+
+#ifndef catomic_max
+# define catomic_max(mem, value) \
+ do { \
+ __typeof (*(mem)) __atg9_oldv; \
+ __typeof (mem) __atg9_memp = (mem); \
+ __typeof (*(mem)) __atg9_value = (value); \
+ do { \
+ __atg9_oldv = *__atg9_memp; \
+ if (__atg9_oldv >= __atg9_value) \
+ break; \
+ } while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg9_memp, \
+ __atg9_value, \
+ __atg9_oldv), 0)); \
+ } while (0)
+#endif
+
+
+#ifndef atomic_min
+# define atomic_min(mem, value) \
+ do { \
+ __typeof (*(mem)) __atg10_oldval; \
+ __typeof (mem) __atg10_memp = (mem); \
+ __typeof (*(mem)) __atg10_value = (value); \
+ do { \
+ __atg10_oldval = *__atg10_memp; \
+ if (__atg10_oldval <= __atg10_value) \
+ break; \
+ } while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg10_memp, \
+ __atg10_value, \
+ __atg10_oldval), 0)); \
+ } while (0)
#endif
@@ -146,16 +306,32 @@
#endif
+#ifndef catomic_add
+# define catomic_add(mem, value) \
+ (void) catomic_exchange_and_add ((mem), (value))
+#endif
+
+
#ifndef atomic_increment
# define atomic_increment(mem) atomic_add ((mem), 1)
#endif
+#ifndef catomic_increment
+# define catomic_increment(mem) catomic_add ((mem), 1)
+#endif
+
+
#ifndef atomic_increment_val
# define atomic_increment_val(mem) (atomic_exchange_and_add ((mem), 1) + 1)
#endif
+#ifndef catomic_increment_val
+# define catomic_increment_val(mem) (catomic_exchange_and_add ((mem), 1) + 1)
+#endif
+
+
/* Add one to *MEM and return true iff it's now zero. */
#ifndef atomic_increment_and_test
# define atomic_increment_and_test(mem) \
@@ -168,11 +344,21 @@
#endif
+#ifndef catomic_decrement
+# define catomic_decrement(mem) catomic_add ((mem), -1)
+#endif
+
+
#ifndef atomic_decrement_val
# define atomic_decrement_val(mem) (atomic_exchange_and_add ((mem), -1) - 1)
#endif
+#ifndef catomic_decrement_val
+# define catomic_decrement_val(mem) (catomic_exchange_and_add ((mem), -1) - 1)
+#endif
+
+
/* Subtract 1 from *MEM and return true iff it's now zero. */
#ifndef atomic_decrement_and_test
# define atomic_decrement_and_test(mem) \
@@ -183,35 +369,34 @@
/* Decrement *MEM if it is > 0, and return the old value. */
#ifndef atomic_decrement_if_positive
# define atomic_decrement_if_positive(mem) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
+ ({ __typeof (*(mem)) __atg11_oldval; \
+ __typeof (mem) __atg11_memp = (mem); \
\
do \
{ \
- __oldval = *__memp; \
- if (__builtin_expect (__oldval <= 0, 0)) \
+ __atg11_oldval = *__atg11_memp; \
+ if (__builtin_expect (__atg11_oldval <= 0, 0)) \
break; \
} \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- - 1, \
- __oldval),\
- 0));\
- __oldval; })
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg11_memp, \
+ __atg11_oldval - 1, \
+ __atg11_oldval), 0)); \
+ __atg11_oldval; })
#endif
#ifndef atomic_add_negative
# define atomic_add_negative(mem, value) \
- ({ __typeof (value) __aan_value = (value); \
- atomic_exchange_and_add (mem, __aan_value) < -__aan_value; })
+ ({ __typeof (value) __atg12_value = (value); \
+ atomic_exchange_and_add (mem, __atg12_value) < -__atg12_value; })
#endif
#ifndef atomic_add_zero
# define atomic_add_zero(mem, value) \
- ({ __typeof (value) __aaz_value = (value); \
- atomic_exchange_and_add (mem, __aaz_value) == -__aaz_value; })
+ ({ __typeof (value) __atg13_value = (value); \
+ atomic_exchange_and_add (mem, __atg13_value) == -__atg13_value; })
#endif
@@ -223,21 +408,119 @@
#ifndef atomic_bit_test_set
# define atomic_bit_test_set(mem, bit) \
- ({ __typeof (*(mem)) __oldval; \
- __typeof (mem) __memp = (mem); \
- __typeof (*(mem)) __mask = ((__typeof (*(mem))) 1 << (bit)); \
+ ({ __typeof (*(mem)) __atg14_old; \
+ __typeof (mem) __atg14_memp = (mem); \
+ __typeof (*(mem)) __atg14_mask = ((__typeof (*(mem))) 1 << (bit)); \
\
do \
- __oldval = (*__memp); \
- while (__builtin_expect (atomic_compare_and_exchange_bool_acq (__memp, \
- __oldval \
- | __mask, \
- __oldval),\
- 0)); \
+ __atg14_old = (*__atg14_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg14_memp, \
+ __atg14_old | __atg14_mask,\
+ __atg14_old), 0)); \
+ \
+ __atg14_old & __atg14_mask; })
+#endif
+
+/* Atomically *mem &= mask. */
+#ifndef atomic_and
+# define atomic_and(mem, mask) \
+ do { \
+ __typeof (*(mem)) __atg15_old; \
+ __typeof (mem) __atg15_memp = (mem); \
+ __typeof (*(mem)) __atg15_mask = (mask); \
+ \
+ do \
+ __atg15_old = (*__atg15_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg15_memp, \
+ __atg15_old & __atg15_mask, \
+ __atg15_old), 0)); \
+ } while (0)
+#endif
+
+#ifndef catomic_and
+# define catomic_and(mem, mask) \
+ do { \
+ __typeof (*(mem)) __atg20_old; \
+ __typeof (mem) __atg20_memp = (mem); \
+ __typeof (*(mem)) __atg20_mask = (mask); \
+ \
+ do \
+ __atg20_old = (*__atg20_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg20_memp, \
+ __atg20_old & __atg20_mask,\
+ __atg20_old), 0)); \
+ } while (0)
+#endif
+
+/* Atomically *mem &= mask and return the old value of *mem. */
+#ifndef atomic_and_val
+# define atomic_and_val(mem, mask) \
+ ({ __typeof (*(mem)) __atg16_old; \
+ __typeof (mem) __atg16_memp = (mem); \
+ __typeof (*(mem)) __atg16_mask = (mask); \
+ \
+ do \
+ __atg16_old = (*__atg16_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg16_memp, \
+ __atg16_old & __atg16_mask,\
+ __atg16_old), 0)); \
+ \
+ __atg16_old; })
+#endif
+
+/* Atomically *mem |= mask and return the old value of *mem. */
+#ifndef atomic_or
+# define atomic_or(mem, mask) \
+ do { \
+ __typeof (*(mem)) __atg17_old; \
+ __typeof (mem) __atg17_memp = (mem); \
+ __typeof (*(mem)) __atg17_mask = (mask); \
\
- __oldval & __mask; })
+ do \
+ __atg17_old = (*__atg17_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg17_memp, \
+ __atg17_old | __atg17_mask, \
+ __atg17_old), 0)); \
+ } while (0)
#endif
+#ifndef catomic_or
+# define catomic_or(mem, mask) \
+ do { \
+ __typeof (*(mem)) __atg18_old; \
+ __typeof (mem) __atg18_memp = (mem); \
+ __typeof (*(mem)) __atg18_mask = (mask); \
+ \
+ do \
+ __atg18_old = (*__atg18_memp); \
+ while (__builtin_expect \
+ (catomic_compare_and_exchange_bool_acq (__atg18_memp, \
+ __atg18_old | __atg18_mask,\
+ __atg18_old), 0)); \
+ } while (0)
+#endif
+
+/* Atomically *mem |= mask and return the old value of *mem. */
+#ifndef atomic_or_val
+# define atomic_or_val(mem, mask) \
+ ({ __typeof (*(mem)) __atg19_old; \
+ __typeof (mem) __atg19_memp = (mem); \
+ __typeof (*(mem)) __atg19_mask = (mask); \
+ \
+ do \
+ __atg19_old = (*__atg19_memp); \
+ while (__builtin_expect \
+ (atomic_compare_and_exchange_bool_acq (__atg19_memp, \
+ __atg19_old | __atg19_mask,\
+ __atg19_old), 0)); \
+ \
+ __atg19_old; })
+#endif
#ifndef atomic_full_barrier
# define atomic_full_barrier() __asm__ ("" ::: "memory")
@@ -254,6 +537,225 @@
#endif
+#ifndef atomic_forced_read
+# define atomic_forced_read(x) \
+ ({ __typeof (x) __x; __asm__ ("" : "=r" (__x) : "0" (x)); __x; })
+#endif
+
+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#define __HAVE_64B_ATOMICS 0 /* TODO: not yet used - Add these to arch bits! */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
+#endif
+
+/* The following functions are a subset of the atomic operations provided by
+ C11. Usually, a function named atomic_OP_MO(args) is equivalent to C11's
+ atomic_OP_explicit(args, memory_order_MO); exceptions noted below. */
+
+/* Each arch can request to use compiler built-ins for C11 atomics. If it
+ does, all atomics will be based on these. */
+#if 0 /* not yet used USE_ATOMIC_COMPILER_BUILTINS */
+
+/* We require 32b atomic operations; some archs also support 64b atomic
+ operations. */
+void __atomic_link_error (void);
+# if __HAVE_64B_ATOMICS == 1
+# define __atomic_check_size(mem) \
+ if ((sizeof (*mem) != 4) && (sizeof (*mem) != 8)) \
+ __atomic_link_error ();
+# else
+# define __atomic_check_size(mem) \
+ if (sizeof (*mem) != 4) \
+ __atomic_link_error ();
+# endif
+
+# define atomic_thread_fence_acquire() \
+ __atomic_thread_fence (__ATOMIC_ACQUIRE)
+# define atomic_thread_fence_release() \
+ __atomic_thread_fence (__ATOMIC_RELEASE)
+# define atomic_thread_fence_seq_cst() \
+ __atomic_thread_fence (__ATOMIC_SEQ_CST)
+
+# define atomic_load_relaxed(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_RELAXED); })
+# define atomic_load_acquire(mem) \
+ ({ __atomic_check_size((mem)); __atomic_load_n ((mem), __ATOMIC_ACQUIRE); })
+
+# define atomic_store_relaxed(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELAXED); \
+ } while (0)
+# define atomic_store_release(mem, val) \
+ do { \
+ __atomic_check_size((mem)); \
+ __atomic_store_n ((mem), (val), __ATOMIC_RELEASE); \
+ } while (0)
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); })
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \
+ __ATOMIC_RELEASE, __ATOMIC_RELAXED); })
+
+# define atomic_exchange_acquire(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); })
+# define atomic_exchange_release(mem, desired) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELEASE); })
+
+# define atomic_fetch_add_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_add_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQUIRE); })
+# define atomic_fetch_add_release(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_RELEASE); })
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); })
+
+# define atomic_fetch_and_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+# define atomic_fetch_or_relaxed(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELAXED); })
+# define atomic_fetch_or_acquire(mem, operand) \
+ ({ __atomic_check_size((mem)); \
+ __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); })
+
+#else /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+/* By default, we assume that read, write, and full barriers are equivalent
+ to acquire, release, and seq_cst barriers. Archs for which this does not
+ hold have to provide custom definitions of the fences. */
+# ifndef atomic_thread_fence_acquire
+# define atomic_thread_fence_acquire() atomic_read_barrier ()
+# endif
+# ifndef atomic_thread_fence_release
+# define atomic_thread_fence_release() atomic_write_barrier ()
+# endif
+# ifndef atomic_thread_fence_seq_cst
+# define atomic_thread_fence_seq_cst() atomic_full_barrier ()
+# endif
+
+# ifndef atomic_load_relaxed
+# define atomic_load_relaxed(mem) \
+ ({ __typeof (*(mem)) __atg100_val; \
+ __asm__ ("" : "=r" (__atg100_val) : "0" (*(mem))); \
+ __atg100_val; })
+# endif
+# ifndef atomic_load_acquire
+# define atomic_load_acquire(mem) \
+ ({ __typeof (*(mem)) __atg101_val = atomic_load_relaxed (mem); \
+ atomic_thread_fence_acquire (); \
+ __atg101_val; })
+# endif
+
+# ifndef atomic_store_relaxed
+/* XXX Use inline asm here? */
+# define atomic_store_relaxed(mem, val) do { *(mem) = (val); } while (0)
+# endif
+# ifndef atomic_store_release
+# define atomic_store_release(mem, val) \
+ do { \
+ atomic_thread_fence_release (); \
+ atomic_store_relaxed ((mem), (val)); \
+ } while (0)
+# endif
+
+/* On failure, this CAS has memory_order_relaxed semantics. */
+/* XXX This potentially has one branch more than necessary, but archs
+ currently do not define a CAS that returns both the previous value and
+ the success flag. */
+# ifndef atomic_compare_exchange_weak_acquire
+# define atomic_compare_exchange_weak_acquire(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg102_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_acq ((mem), (desired), *(expected)); \
+ *(expected) == __atg102_expected; })
+# endif
+# ifndef atomic_compare_exchange_weak_relaxed
+/* XXX Fall back to CAS with acquire MO because archs do not define a weaker
+ CAS. */
+# define atomic_compare_exchange_weak_relaxed(mem, expected, desired) \
+ atomic_compare_exchange_weak_acquire ((mem), (expected), (desired))
+# endif
+# ifndef atomic_compare_exchange_weak_release
+# define atomic_compare_exchange_weak_release(mem, expected, desired) \
+ ({ __typeof (*(expected)) __atg103_expected = *(expected); \
+ *(expected) = \
+ atomic_compare_and_exchange_val_rel ((mem), (desired), *(expected)); \
+ *(expected) == __atg103_expected; })
+# endif
+
+# ifndef atomic_exchange_acquire
+# define atomic_exchange_acquire(mem, val) \
+ atomic_exchange_acq ((mem), (val))
+# endif
+# ifndef atomic_exchange_release
+# define atomic_exchange_release(mem, val) \
+ atomic_exchange_rel ((mem), (val))
+# endif
+
+# ifndef atomic_fetch_add_acquire
+# define atomic_fetch_add_acquire(mem, operand) \
+ atomic_exchange_and_add_acq ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_relaxed
+/* XXX Fall back to acquire MO because the MO semantics of
+ atomic_exchange_and_add are not documented; the generic version falls back
+ to atomic_exchange_and_add_acq if atomic_exchange_and_add is not defined,
+ and vice versa. */
+# define atomic_fetch_add_relaxed(mem, operand) \
+ atomic_fetch_add_acquire ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_release
+# define atomic_fetch_add_release(mem, operand) \
+ atomic_exchange_and_add_rel ((mem), (operand))
+# endif
+# ifndef atomic_fetch_add_acq_rel
+# define atomic_fetch_add_acq_rel(mem, operand) \
+ ({ atomic_thread_fence_release (); \
+ atomic_exchange_and_add_acq ((mem), (operand)); })
+# endif
+
+/* XXX The default for atomic_and_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_and_acquire
+# define atomic_fetch_and_acquire(mem, operand) \
+ atomic_and_val ((mem), (operand))
+# endif
+
+/* XXX The default for atomic_or_val has acquire semantics, but this is not
+ documented. */
+# ifndef atomic_fetch_or_acquire
+# define atomic_fetch_or_acquire(mem, operand) \
+ atomic_or_val ((mem), (operand))
+# endif
+/* XXX Fall back to acquire MO because archs do not define a weaker
+ atomic_or_val. */
+# ifndef atomic_fetch_or_relaxed
+# define atomic_fetch_or_relaxed(mem, operand) \
+ atomic_fetch_or_acquire ((mem), (operand))
+# endif
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+
+
#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)
#endif
diff --git a/include/byteswap.h b/include/byteswap.h
index b61d4dda8..18ca95d37 100644
--- a/include/byteswap.h
+++ b/include/byteswap.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _BYTESWAP_H
#define _BYTESWAP_H 1
diff --git a/include/cancel.h b/include/cancel.h
new file mode 100644
index 000000000..ac6f6b64d
--- /dev/null
+++ b/include/cancel.h
@@ -0,0 +1,101 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2000-2011 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _CANCEL_H
+#define _CANCEL_H
+
+/*
+ * Usage of this header:
+ * 1. define a static or hidden function __NC(NAME) - expands to __NAME_nocancel
+ * 2. if it is hidden, add the prototype to the appropiate header where NAME has
+ * it's prototype (guarded by _LIBC)
+ * 3. add a CANCELLABLE_SYSCALL(...) line at the end, this will create the function
+ * NAME (as weak) with enabled cancellation for NPTL (and later for new LT), for
+ * LT_OLD it will also create a strong_alias to __libc_NAME to be used in libpthread
+ * 4. if you need libc_hidden_(weak|def) line, use instead lt_libc_hidden, this will
+ * take care of the correct type, weak or strong depending on the THREADS type
+ * 5. If the implementation can't be done using CANCELLABLE_SYSCALL (like for fcntl)
+ * you need to manually add lt_strong_alias() line too, to optionally create the
+ * __libc_NAME alias
+ * 6. if functions are needed to implement __NC(NAME), that themselves are cancellable,
+ * decide how the cancellation should be solved, two variants are possible:
+ * a. use the other function as __NC(FUNC), this way you access the non-cancellable
+ * variant and provide by CANCELLABLE_SYSCALL(...) the dedicated cancellation for NAME.
+ * be aware, that for this case __NC(FUNC) has to be hidden (not static)
+ * b. use the other function with it's name (FUNC) and add LIBC_CANCEL_HANDLED(); at
+ * the end of file with a comment telling us which function took care of the cancellation
+ * Note: LIBC_CANCEL_HANDLED() is noop on uClibc, glibc uses it only for tests, we use
+ * it only for "documentation".
+ *
+ * For now the use of this file is limited to libc, will expand later to support libpthread
+ * and librt as well.
+ */
+
+#include <features.h>
+
+#ifndef NOT_IN_libc
+
+#define __NC(name) _NC(name)
+#define _NC(name) __##name##_nocancel
+
+#define __NC_OLD(name) _NC_OLD(name)
+#define _NC_OLD(name) __libc_##name
+
+#define __NC_PROTO(name) extern __typeof(name) __NC(name) attribute_hidden;
+#define __NC_OLD_PROTO(name) extern __typeof(name) __NC_OLD(name);
+
+#if defined __UCLIBC_HAS_THREADS__ && !defined __LINUXTHREADS_OLD__
+# define __NEW_THREADS 1
+#else
+# define SINGLE_THREAD_P 1
+#endif
+
+#ifdef __NEW_THREADS
+# include <sysdep-cancel.h>
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+res_type weak_function name param_list \
+{ \
+ if (SINGLE_THREAD_P) \
+ return __NC(name) params; \
+ int oldtype = LIBC_CANCEL_ASYNC(); \
+ res_type result = __NC(name) params; \
+ LIBC_CANCEL_RESET(oldtype); \
+ return result; \
+}
+
+# define lt_strong_alias(name)
+# define lt_libc_hidden(name) libc_hidden_def(name)
+
+#elif defined __LINUXTHREADS_OLD__
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+weak_alias(__NC(name),name) \
+lt_strong_alias(name)
+
+# define lt_strong_alias(name) \
+__NC_OLD_PROTO(name) \
+strong_alias(name,__NC_OLD(name))
+# define lt_libc_hidden(name) libc_hidden_weak(name)
+
+#else
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+strong_alias(__NC(name),name)
+
+# define lt_strong_alias(name)
+# define lt_libc_hidden(name) libc_hidden_def(name)
+
+#endif
+
+/* disable it, useless, glibc uses it only for tests */
+# undef LIBC_CANCEL_HANDLED
+# define LIBC_CANCEL_HANDLED()
+
+#endif /* NOT_IN_libc */
+
+#endif
diff --git a/include/complex.h b/include/complex.h
index f005a9391..ed7e502b7 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2006 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99: 7.3 Complex arithmetic <complex.h>
@@ -54,15 +53,15 @@ __BEGIN_DECLS
so we can easily declare each function as both `name' and `__name',
and can declare the float versions `namef' and `__namef'. */
-#define __MATHCALL(function, args) \
- __MATHDECL (_Mdouble_complex_,function, args)
+#define __MATHCALL(function, args) \
+ __MATHDECL(_Mdouble_complex_,function, args)
#define __MATHDECL(type, function, args) \
- __MATHDECL_1(type, function, args); \
- __MATHDECL_1(type, __CONCAT(__,function), args)
+ __MATHDECL_1(type, function, args); \
+ __MATHDECL_1(type, __CONCAT(__,function), args)
#define __MATHDECL_1(type, function, args) \
- extern type __MATH_PRECNAME(function) args __THROW
+ extern type __MATH_PRECNAME(function) args __THROW
-#define _Mdouble_ double
+#define _Mdouble_ double
#define __MATH_PRECNAME(name) name
#include <bits/cmathcalls.h>
#undef _Mdouble_
@@ -72,7 +71,7 @@ __BEGIN_DECLS
#ifndef _Mfloat_
# define _Mfloat_ float
#endif
-#define _Mdouble_ _Mfloat_
+#define _Mdouble_ _Mfloat_
#ifdef __STDC__
# define __MATH_PRECNAME(name) name##f
#else
@@ -80,15 +79,17 @@ __BEGIN_DECLS
#endif
#include <bits/cmathcalls.h>
#undef _Mdouble_
+#undef _Mfloat_
#undef __MATH_PRECNAME
/* And the long double versions. It is non-critical to define them
here unconditionally since `long double' is required in ISO C99. */
-#if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH
+#if (__STDC__ - 0 || __GNUC__ - 0) \
+ && defined __UCLIBC_HAS_LONG_DOUBLE_MATH__
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
-# define _Mdouble_ _Mlong_double_
+# define _Mdouble_ _Mlong_double_
# ifdef __STDC__
# define __MATH_PRECNAME(name) name##l
# else
@@ -97,6 +98,7 @@ __BEGIN_DECLS
# include <bits/cmathcalls.h>
#endif
#undef _Mdouble_
+#undef _Mlong_double_
#undef __MATH_PRECNAME
#undef __MATHDECL_1
#undef __MATHDECL
diff --git a/include/cpio.h b/include/cpio.h
index fae32752a..00be7650e 100644
--- a/include/cpio.h
+++ b/include/cpio.h
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _CPIO_H
#define _CPIO_H 1
diff --git a/include/crypt.h b/include/crypt.h
index f62a03056..825e7eb57 100644
--- a/include/crypt.h
+++ b/include/crypt.h
@@ -12,10 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with the GNU C Library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- * 02111-1307 USA.
- *
+ * License along with the GNU C Library; see the file COPYING.LIB. If
+ * not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CRYPT_H
diff --git a/include/ctype.h b/include/ctype.h
index 184b47b51..ecd5e7308 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,5 +1,5 @@
/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,02
- Free Software Foundation, Inc.
+ 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard 7.4: Character handling <ctype.h>
@@ -27,7 +26,77 @@
#include <features.h>
#include <bits/types.h>
-#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+__BEGIN_DECLS
+__BEGIN_NAMESPACE_STD
+
+/* The following names are all functions:
+ int isCHARACTERISTIC(int c);
+ which return nonzero iff C has CHARACTERISTIC.
+ For the meaning of the characteristic names, see the `enum' above. */
+extern int isalnum(int __c) __THROW;
+libc_hidden_proto(isalnum)
+extern int isalpha(int __c) __THROW;
+libc_hidden_proto(isalpha)
+extern int iscntrl(int __c) __THROW;
+libc_hidden_proto(iscntrl)
+extern int isdigit(int __c) __THROW;
+libc_hidden_proto(isdigit)
+extern int islower(int __c) __THROW;
+libc_hidden_proto(islower)
+extern int isgraph(int __c) __THROW;
+libc_hidden_proto(isgraph)
+extern int isprint(int __c) __THROW;
+libc_hidden_proto(isprint)
+extern int ispunct(int __c) __THROW;
+libc_hidden_proto(ispunct)
+extern int isspace(int __c) __THROW;
+libc_hidden_proto(isspace)
+extern int isupper(int __c) __THROW;
+libc_hidden_proto(isupper)
+extern int isxdigit(int __c) __THROW;
+libc_hidden_proto(isxdigit)
+
+
+/* Return the lowercase version of C. */
+extern int tolower(int __c) __THROW;
+libc_hidden_proto(tolower)
+
+/* Return the uppercase version of C. */
+extern int toupper(int __c) __THROW;
+libc_hidden_proto(toupper)
+
+#if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) && \
+ defined __UCLIBC_SUSV4_LEGACY__
+/* Return nonzero iff C is in the ASCII set
+ (i.e., is no more than 7 bits wide). */
+extern int isascii(int __c) __THROW;
+libc_hidden_proto(isascii)
+/* Return the part of C that is in the ASCII set
+ (i.e., the low-order 7 bits of C). */
+extern int toascii(int __c) __THROW;
+#endif
+
+__END_NAMESPACE_STD
+
+
+/* ISO C99 introduced one new function. */
+#ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+
+extern int isblank(int __c) __THROW;
+libc_hidden_proto(isblank)
+
+__END_NAMESPACE_C99
+#endif
+__END_DECLS
+
+#ifndef __UCLIBC_HAS_CTYPE_TABLES__
+
+/* "Stub locale": we are permanently in C/POSIX locale.
+ * Using simple(r) ctype.h machinery in this header instead: */
+#include <bits/uClibc_ctype.h>
+
+#else
__BEGIN_DECLS
@@ -36,6 +105,7 @@ __BEGIN_DECLS
If there get to be more than 16 distinct characteristics,
__ctype_mask_t will need to be adjusted. */
+/* libstdc++ from gcc toolchain needs this macro. */
# define _ISbit(bit) (1 << (bit))
enum
@@ -57,15 +127,14 @@ enum
#error _ISbit already defined!
#endif /* ! _ISbit */
+/* __ctype_XXX_t types and __UCLIBC_CTYPE_x_TBL_OFFSET constants */
#include <bits/uClibc_touplow.h>
#ifdef __UCLIBC_HAS_CTYPE_SIGNED__
# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)((c) + 128)) < 384)
-
-#else /* __UCLIBC_HAS_CTYPE_SIGNED__ */
+#else
# define __UCLIBC_CTYPE_IN_TO_DOMAIN(c) (((unsigned int)(c)) < 256)
-
-#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */
+#endif
/* In the thread-specific locale model (see `uselocale' in <locale.h>)
we cannot use global variables for these as was done in the past.
@@ -101,18 +170,20 @@ enum
/* Pointers to the default C-locale data. */
extern const __ctype_mask_t *__C_ctype_b;
+libc_hidden_proto(__C_ctype_b)
extern const __ctype_touplow_t *__C_ctype_toupper;
+libc_hidden_proto(__C_ctype_toupper)
extern const __ctype_touplow_t *__C_ctype_tolower;
+libc_hidden_proto(__C_ctype_tolower)
#ifdef __UCLIBC_HAS_XLOCALE__
-extern __const __ctype_mask_t **__ctype_b_loc (void)
- __attribute__ ((__const));
-extern __const __ctype_touplow_t **__ctype_tolower_loc (void)
- __attribute__ ((__const));
-extern __const __ctype_touplow_t **__ctype_toupper_loc (void)
- __attribute__ ((__const));
-
+const __ctype_mask_t **__ctype_b_loc(void) __attribute__ ((const));
+libc_hidden_proto(__ctype_b_loc)
+const __ctype_touplow_t **__ctype_tolower_loc(void) __attribute__ ((const));
+libc_hidden_proto(__ctype_tolower_loc)
+const __ctype_touplow_t **__ctype_toupper_loc(void) __attribute__ ((const));
+libc_hidden_proto(__ctype_toupper_loc)
#define __UCLIBC_CTYPE_B (*__ctype_b_loc())
#define __UCLIBC_CTYPE_TOLOWER (*__ctype_tolower_loc())
#define __UCLIBC_CTYPE_TOUPPER (*__ctype_toupper_loc())
@@ -121,107 +192,60 @@ extern __const __ctype_touplow_t **__ctype_toupper_loc (void)
/* Pointers to the current global locale data in use. */
extern const __ctype_mask_t *__ctype_b;
+libc_hidden_proto(__ctype_b)
extern const __ctype_touplow_t *__ctype_toupper;
+libc_hidden_proto(__ctype_toupper)
extern const __ctype_touplow_t *__ctype_tolower;
-
+libc_hidden_proto(__ctype_tolower)
#define __UCLIBC_CTYPE_B (__ctype_b)
#define __UCLIBC_CTYPE_TOLOWER (__ctype_tolower)
#define __UCLIBC_CTYPE_TOUPPER (__ctype_toupper)
#endif /* __UCLIBC_HAS_XLOCALE__ */
-#define __isctype(c, type) \
- ((__UCLIBC_CTYPE_B)[(int) (c)] & (__ctype_mask_t) type)
-
+#ifdef __UCLIBC_SUSV4_LEGACY__
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
+#endif
-#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
-/* isdigit() is really locale-invariant, so provide some small fast macros.
- * These are uClibc-specific. */
+#ifdef _LIBC
+/* These are uClibc-specific. */
#define __isdigit_char(C) (((unsigned char)((C) - '0')) <= 9)
#define __isdigit_int(C) (((unsigned int)((C) - '0')) <= 9)
#endif
-#define __exctype(name) extern int name (int) __THROW
-
-__BEGIN_NAMESPACE_STD
-
-/* The following names are all functions:
- int isCHARACTERISTIC(int c);
- which return nonzero iff C has CHARACTERISTIC.
- For the meaning of the characteristic names, see the `enum' above. */
-__exctype (isalnum);
-__exctype (isalpha);
-__exctype (iscntrl);
-__exctype (isdigit);
-__exctype (islower);
-__exctype (isgraph);
-__exctype (isprint);
-__exctype (ispunct);
-__exctype (isspace);
-__exctype (isupper);
-__exctype (isxdigit);
-
-
-/* Return the lowercase version of C. */
-extern int tolower (int __c) __THROW;
-
-/* Return the uppercase version of C. */
-extern int toupper (int __c) __THROW;
-
-__END_NAMESPACE_STD
-
-
-/* ISO C99 introduced one new function. */
-#ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-
-__exctype (isblank);
-
-__END_NAMESPACE_C99
-#endif
-
#ifdef __USE_GNU
/* Test C for a set of character classes according to MASK. */
-extern int isctype (int __c, int __mask) __THROW;
+extern int isctype(int __c, int __mask) __THROW;
#endif
-#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
-
-/* Return nonzero iff C is in the ASCII set
- (i.e., is no more than 7 bits wide). */
-extern int isascii (int __c) __THROW;
-
-/* Return the part of C that is in the ASCII set
- (i.e., the low-order 7 bits of C). */
-extern int toascii (int __c) __THROW;
-
+#if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+ && defined __UCLIBC_SUSV4_LEGACY__
/* These are the same as `toupper' and `tolower' except that they do not
check the argument for being in the range of a `char'. */
-__exctype (_toupper);
-__exctype (_tolower);
+extern int _toupper(int __c) __THROW;
+extern int _tolower(int __c) __THROW;
#endif /* Use SVID or use misc. */
/* This code is needed for the optimized mapping functions. */
-#define __tobody(c, f, a, args) \
- (__extension__ \
- ({ int __res; \
- if (sizeof (c) > 1) \
- { \
- if (__builtin_constant_p (c)) \
- { \
- int __c = (c); \
- __res = __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (a)[__c] : __c; \
- } \
- else \
- __res = f args; \
- } \
- else \
- __res = (a)[(int) (c)]; \
- __res; }))
-
-#if !defined __NO_CTYPE && !defined __cplusplus
+#define __tobody(c, f, table, args) \
+(__extension__ ({ \
+ int __res; \
+ if (sizeof(c) > 1) { \
+ if (__builtin_constant_p(c)) { \
+ int __c = (c); \
+ __res = __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (table)[__c] : __c; \
+ } else \
+ __res = f args; \
+ } else \
+ __res = (table)[(int) (c)]; \
+ __res; \
+}))
+
+#define __isctype(c, type) ((__UCLIBC_CTYPE_B)[(int)(c)] & (__ctype_mask_t)type)
+/* Do not combine in one #if - unifdef tool is not that clever */
+#ifndef __NO_CTYPE
+#ifndef __cplusplus
# define isalnum(c) __isctype((c), _ISalnum)
# define isalpha(c) __isctype((c), _ISalpha)
# define iscntrl(c) __isctype((c), _IScntrl)
@@ -233,7 +257,6 @@ __exctype (_tolower);
# define isspace(c) __isctype((c), _ISspace)
# define isupper(c) __isctype((c), _ISupper)
# define isxdigit(c) __isctype((c), _ISxdigit)
-
# ifdef __USE_ISOC99
# define isblank(c) __isctype((c), _ISblank)
# endif
@@ -244,7 +267,6 @@ __NTH (tolower (int __c))
{
return __UCLIBC_CTYPE_IN_TO_DOMAIN(__c) ? (__UCLIBC_CTYPE_TOLOWER)[__c] : __c;
}
-
__extern_inline int
__NTH (toupper (int __c))
{
@@ -253,22 +275,23 @@ __NTH (toupper (int __c))
# endif
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
-# define tolower(c) __tobody (c, tolower, __UCLIBC_CTYPE_TOLOWER, (c))
-# define toupper(c) __tobody (c, toupper, __UCLIBC_CTYPE_TOUPPER, (c))
+# define tolower(c) __tobody(c, tolower, __UCLIBC_CTYPE_TOLOWER, (c))
+# define toupper(c) __tobody(c, toupper, __UCLIBC_CTYPE_TOUPPER, (c))
# endif /* Optimizing gcc */
-# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+ && defined __UCLIBC_SUSV4_LEGACY__
# define isascii(c) __isascii (c)
# define toascii(c) __toascii (c)
-
# define _tolower(c) ((int) (__UCLIBC_CTYPE_TOLOWER)[(int) (c)])
# define _toupper(c) ((int) (__UCLIBC_CTYPE_TOUPPER)[(int) (c)])
# endif
-#endif /* Not __NO_CTYPE. */
+#endif /* not __cplusplus */
+#endif /* not __NO_CTYPE */
-#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
thought out. Many applications will need to process its data using
information from several different locales. Another application is
@@ -286,49 +309,54 @@ __NTH (toupper (int __c))
/* These definitions are similar to the ones above but all functions
take as an argument a handle for the locale which shall be used. */
-# define __isctype_l(c, type, locale) \
- ((locale)->__ctype_b[(int) (c)] & (__ctype_mask_t) type)
-
-# define __exctype_l(name) \
- extern int name (int, __locale_t) __THROW
-
-/* The following names are all functions:
- int isCHARACTERISTIC(int c, locale_t *locale);
- which return nonzero iff C has CHARACTERISTIC.
- For the meaning of the characteristic names, see the `enum' above. */
-__exctype_l (isalnum_l);
-__exctype_l (isalpha_l);
-__exctype_l (iscntrl_l);
-__exctype_l (isdigit_l);
-__exctype_l (islower_l);
-__exctype_l (isgraph_l);
-__exctype_l (isprint_l);
-__exctype_l (ispunct_l);
-__exctype_l (isspace_l);
-__exctype_l (isupper_l);
-__exctype_l (isxdigit_l);
-
-__exctype_l (isblank_l);
+extern int isalnum_l(int, __locale_t) __THROW;
+libc_hidden_proto(isalnum_l)
+extern int isalpha_l(int, __locale_t) __THROW;
+libc_hidden_proto(isalpha_l)
+extern int iscntrl_l(int, __locale_t) __THROW;
+libc_hidden_proto(iscntrl_l)
+extern int isdigit_l(int, __locale_t) __THROW;
+libc_hidden_proto(isdigit_l)
+extern int islower_l(int, __locale_t) __THROW;
+libc_hidden_proto(islower_l)
+extern int isgraph_l(int, __locale_t) __THROW;
+libc_hidden_proto(isgraph_l)
+extern int isprint_l(int, __locale_t) __THROW;
+libc_hidden_proto(isprint_l)
+extern int ispunct_l(int, __locale_t) __THROW;
+libc_hidden_proto(ispunct_l)
+extern int isspace_l(int, __locale_t) __THROW;
+libc_hidden_proto(isspace_l)
+extern int isupper_l(int, __locale_t) __THROW;
+libc_hidden_proto(isupper_l)
+extern int isxdigit_l(int, __locale_t) __THROW;
+libc_hidden_proto(isxdigit_l)
+extern int isblank_l(int, __locale_t) __THROW;
+libc_hidden_proto(isblank_l)
+
+# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+ && defined __UCLIBC_SUSV4_LEGACY__
+/* Return nonzero iff C is in the ASCII set
+ (i.e., is no more than 7 bits wide). */
+extern int isascii_l (int __c) __THROW;
+libc_hidden_proto(isascii_l)
+# endif
/* Return the lowercase version of C in locale L. */
-extern int __tolower_l (int __c, __locale_t __l) __THROW;
extern int tolower_l (int __c, __locale_t __l) __THROW;
+libc_hidden_proto(tolower_l)
/* Return the uppercase version of C. */
-extern int __toupper_l (int __c, __locale_t __l) __THROW;
extern int toupper_l (int __c, __locale_t __l) __THROW;
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
-# define __tolower_l(c, locale) \
- __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale))
-# define __toupper_l(c, locale) \
- __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale))
-# define tolower_l(c, locale) __tolower_l ((c), (locale))
-# define toupper_l(c, locale) __toupper_l ((c), (locale))
+# define tolower_l(c, locale) __tobody(c, tolower_l, (locale)->__ctype_tolower, (c, locale))
+# define toupper_l(c, locale) __tobody(c, toupper_l, (locale)->__ctype_toupper, (c, locale))
# endif /* Optimizing gcc */
+# define __isctype_l(c, type, locale) ((locale)->__ctype_b[(int) (c)] & (__ctype_mask_t) type)
# ifndef __NO_CTYPE
# define __isalnum_l(c,l) __isctype_l((c), _ISalnum, (l))
# define __isalpha_l(c,l) __isctype_l((c), _ISalpha, (l))
@@ -341,10 +369,10 @@ extern int toupper_l (int __c, __locale_t __l) __THROW;
# define __isspace_l(c,l) __isctype_l((c), _ISspace, (l))
# define __isupper_l(c,l) __isctype_l((c), _ISupper, (l))
# define __isxdigit_l(c,l) __isctype_l((c), _ISxdigit, (l))
-
# define __isblank_l(c,l) __isctype_l((c), _ISblank, (l))
-# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+ && defined __UCLIBC_SUSV4_LEGACY__
# define __isascii_l(c,l) ((l), __isascii (c))
# define __toascii_l(c,l) ((l), __toascii (c))
# endif
@@ -360,10 +388,10 @@ extern int toupper_l (int __c, __locale_t __l) __THROW;
# define isspace_l(c,l) __isspace_l ((c), (l))
# define isupper_l(c,l) __isupper_l ((c), (l))
# define isxdigit_l(c,l) __isxdigit_l ((c), (l))
-
# define isblank_l(c,l) __isblank_l ((c), (l))
-# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
+# if (defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN) \
+ && defined __UCLIBC_SUSV4_LEGACY__
# define isascii_l(c,l) __isascii_l ((c), (l))
# define toascii_l(c,l) __toascii_l ((c), (l))
# endif
@@ -374,10 +402,12 @@ extern int toupper_l (int __c, __locale_t __l) __THROW;
__END_DECLS
-#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
-
-#include <bits/uClibc_ctype.h>
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+#if defined _LIBC && !defined __UCLIBC_SUSV4_LEGACY__
+/* We define {__,}isascii for internal use only */
+# define __isascii(c) (((c) & ~0x7f) == 0)
+# define isascii(c) __isascii (c)
#endif
#endif /* ctype.h */
diff --git a/include/dirent.h b/include/dirent.h
index 565a94dee..00aa0773e 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2000, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2000,2003-2005,2009,2010 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 5.1.2 Directory Operations <dirent.h>
@@ -132,7 +131,16 @@ typedef struct __dirstream DIR;
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern DIR *opendir (__const char *__name) __nonnull ((1));
+extern DIR *opendir (const char *__name) __nonnull ((1));
+libc_hidden_proto(opendir)
+
+#ifdef __USE_XOPEN2K8
+/* Same as opendir, but open the stream on the file descriptor FD.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern DIR *fdopendir (int __fd);
+#endif
/* Close the directory stream DIRP.
Return 0 if successful, -1 if not.
@@ -140,6 +148,7 @@ extern DIR *opendir (__const char *__name) __nonnull ((1));
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int closedir (DIR *__dirp) __nonnull ((1));
+libc_hidden_proto(closedir)
/* Read a directory entry from DIRP. Return a pointer to a `struct
dirent' describing the entry, or NULL for EOF or error. The
@@ -153,6 +162,7 @@ extern int closedir (DIR *__dirp) __nonnull ((1));
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern struct dirent *readdir (DIR *__dirp) __nonnull ((1));
+libc_hidden_proto(readdir)
#else
# ifdef __REDIRECT
extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64)
@@ -164,6 +174,7 @@ extern struct dirent *__REDIRECT (readdir, (DIR *__dirp), readdir64)
#ifdef __USE_LARGEFILE64
extern struct dirent64 *readdir64 (DIR *__dirp) __nonnull ((1));
+libc_hidden_proto(readdir64)
#endif
#if defined __USE_POSIX || defined __USE_MISC
@@ -177,6 +188,7 @@ extern int readdir_r (DIR *__restrict __dirp,
struct dirent *__restrict __entry,
struct dirent **__restrict __result)
__nonnull ((1, 2, 3));
+libc_hidden_proto(readdir_r)
# else
# ifdef __REDIRECT
extern int __REDIRECT (readdir_r,
@@ -194,6 +206,7 @@ extern int readdir64_r (DIR *__restrict __dirp,
struct dirent64 *__restrict __entry,
struct dirent64 **__restrict __result)
__nonnull ((1, 2, 3));
+libc_hidden_proto(readdir64_r)
# endif
#endif /* POSIX or misc */
@@ -210,24 +223,27 @@ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1));
extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_MISC
+#if defined __USE_BSD || defined __USE_MISC || defined __USE_XOPEN2K8
/* Return the file descriptor used by DIRP. */
extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
+libc_hidden_proto(dirfd)
# if 0 /* defined __OPTIMIZE__ && defined _DIR_dirfd */
# define dirfd(dirp) _DIR_dirfd (dirp)
# endif
-# ifndef MAXNAMLEN
+# if defined __USE_BSD || defined __USE_MISC
+# ifndef MAXNAMLEN
/* Get the definitions of the POSIX.1 limits. */
# include <bits/posix1_lim.h>
/* `MAXNAMLEN' is the BSD name for what POSIX calls `NAME_MAX'. */
-# ifdef NAME_MAX
-# define MAXNAMLEN NAME_MAX
-# else
-# define MAXNAMLEN 255
+# ifdef NAME_MAX
+# define MAXNAMLEN NAME_MAX
+# else
+# define MAXNAMLEN 255
+# endif
# endif
# endif
@@ -239,18 +255,20 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1));
sorted using qsort with CMP, and collected in a malloc'd array in
*NAMELIST. Returns the number of entries selected, or -1 on error. */
# ifndef __USE_FILE_OFFSET64
-extern int scandir (__const char *__restrict __dir,
+extern int scandir (const char *__restrict __dir,
struct dirent ***__restrict __namelist,
- int (*__selector) (__const struct dirent *),
- int (*__cmp) (__const void *, __const void *))
+ int (*__selector) (const struct dirent *),
+ int (*__cmp) (const struct dirent **,
+ const struct dirent **))
__nonnull ((1, 2));
# else
# ifdef __REDIRECT
extern int __REDIRECT (scandir,
- (__const char *__restrict __dir,
+ (const char *__restrict __dir,
struct dirent ***__restrict __namelist,
- int (*__selector) (__const struct dirent *),
- int (*__cmp) (__const void *, __const void *)),
+ int (*__selector) (const struct dirent *),
+ int (*__cmp) (const struct dirent **,
+ const struct dirent **)),
scandir64) __nonnull ((1, 2));
# else
# define scandir scandir64
@@ -260,21 +278,24 @@ extern int __REDIRECT (scandir,
# if defined __USE_GNU && defined __USE_LARGEFILE64
/* This function is like `scandir' but it uses the 64bit dirent structure.
Please note that the CMP function must now work with struct dirent64 **. */
-extern int scandir64 (__const char *__restrict __dir,
+extern int scandir64 (const char *__restrict __dir,
struct dirent64 ***__restrict __namelist,
- int (*__selector) (__const struct dirent64 *),
- int (*__cmp) (__const void *, __const void *))
+ int (*__selector) (const struct dirent64 *),
+ int (*__cmp) (const struct dirent64 **,
+ const struct dirent64 **))
__nonnull ((1, 2));
# endif
/* Function to compare two `struct dirent's alphabetically. */
# ifndef __USE_FILE_OFFSET64
-extern int alphasort (__const void *__e1, __const void *__e2)
+extern int alphasort (const struct dirent **__e1,
+ const struct dirent **__e2)
__THROW __attribute_pure__ __nonnull ((1, 2));
# else
# ifdef __REDIRECT
-extern int __REDIRECT (alphasort,
- (__const void *__e1, __const void *__e2),
+extern int __REDIRECT_NTH (alphasort,
+ (const struct dirent **__e1,
+ const struct dirent **__e2),
alphasort64) __attribute_pure__ __nonnull ((1, 2));
# else
# define alphasort alphasort64
@@ -282,12 +303,75 @@ extern int __REDIRECT (alphasort,
# endif
# if defined __USE_GNU && defined __USE_LARGEFILE64
-extern int alphasort64 (__const void *__e1, __const void *__e2)
+extern int alphasort64 (const struct dirent64 **__e1,
+ const struct dirent64 **__e2)
__THROW __attribute_pure__ __nonnull ((1, 2));
# endif
+#endif /* Use BSD or misc or XPG7. */
+
+
+#if 0 /* defined __USE_BSD || defined __USE_MISC */
+/* Read directory entries from FD into BUF, reading at most NBYTES.
+ Reading starts at offset *BASEP, and *BASEP is updated with the new
+ position after reading. Returns the number of bytes read; zero when at
+ end of directory; or -1 for errors. */
+# ifndef __USE_FILE_OFFSET64
+extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off_t *__restrict __basep)
+ __THROW __nonnull ((2, 4));
+# else
+# ifdef __REDIRECT
+extern __ssize_t __REDIRECT_NTH (getdirentries,
+ (int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off64_t *__restrict __basep),
+ getdirentries64) __nonnull ((2, 4));
+# else
+# define getdirentries getdirentries64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern __ssize_t getdirentries64 (int __fd, char *__restrict __buf,
+ size_t __nbytes,
+ __off64_t *__restrict __basep)
+ __THROW __nonnull ((2, 4));
+# endif
#endif /* Use BSD or misc. */
+#ifdef __USE_GNU
+/* Function to compare two `struct dirent's by name & version. */
+# ifndef __USE_FILE_OFFSET64
+extern int versionsort (const struct dirent **__e1,
+ const struct dirent **__e2)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT_NTH (versionsort,
+ (const struct dirent **__e1,
+ const struct dirent **__e2),
+ versionsort64)
+ __attribute_pure__ __nonnull ((1, 2));
+# else
+# define versionsort versionsort64
+# endif
+# endif
+
+# ifdef __USE_LARGEFILE64
+extern int versionsort64 (const struct dirent64 **__e1,
+ const struct dirent64 **__e2)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
+# endif
+#endif /* Use GNU. */
+
__END_DECLS
+#ifdef _LIBC
+extern __ssize_t __getdents(int fd, char *buf, size_t count) attribute_hidden;
+# ifdef __UCLIBC_HAS_LFS__
+extern __ssize_t __getdents64 (int fd, char *buf, size_t count) attribute_hidden;
+# endif
+#endif
+
#endif /* dirent.h */
diff --git a/include/dlfcn.h b/include/dlfcn.h
index 2348e436d..74825aaf0 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -1,6 +1,5 @@
/* User functions for run-time dynamic loading.
- Copyright (C) 1995-1999,2000,2001,2003,2004,2006
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2001,2003,2004,2006,2009 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
@@ -14,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _DLFCN_H
#define _DLFCN_H 1
@@ -28,6 +26,9 @@
/* Collect various system dependent definitions and declarations. */
#include <bits/dlfcn.h>
+/* Internally used flag. */
+#define __RTLD_SECURE 0x04000000 /* Apply additional security checks. */
+
#ifdef __USE_GNU
/* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT
@@ -52,30 +53,31 @@ typedef long int Lmid_t;
# endif
#endif
+
__BEGIN_DECLS
/* Open the shared object FILE and map it in; return a handle that can be
passed to `dlsym' to get symbol values from it. */
-extern void *dlopen (__const char *__file, int __mode) __THROW;
+extern void *dlopen (const char *__file, int __mode) __THROWNL;
/* Unmap and close a shared object opened by `dlopen'.
The handle cannot be used again after calling `dlclose'. */
-extern int dlclose (void *__handle) __THROW __nonnull ((1));
+extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME. */
extern void *dlsym (void *__restrict __handle,
- __const char *__restrict __name) __THROW __nonnull ((2));
+ const char *__restrict __name) __THROW __nonnull ((2));
#if 0 /*def __USE_GNU*/
/* Like `dlopen', but request object to be allocated in a new namespace. */
-extern void *dlmopen (Lmid_t __nsid, __const char *__file, int __mode) __THROW;
+extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
/* Find the run-time address in the shared object HANDLE refers to
of the symbol called NAME with VERSION. */
extern void *dlvsym (void *__restrict __handle,
- __const char *__restrict __name,
- __const char *__restrict __version)
+ const char *__restrict __name,
+ const char *__restrict __version)
__THROW __nonnull ((2, 3));
#endif
@@ -90,20 +92,20 @@ extern char *dlerror (void) __THROW;
`dladdr'. */
typedef struct
{
- __const char *dli_fname; /* File name of defining object. */
+ const char *dli_fname; /* File name of defining object. */
void *dli_fbase; /* Load address of that object. */
- __const char *dli_sname; /* Name of nearest symbol. */
+ const char *dli_sname; /* Name of nearest symbol. */
void *dli_saddr; /* Exact value of nearest symbol. */
} Dl_info;
/* Fill in *INFO with the following information about ADDRESS.
Returns 0 iff no shared object's segments contain that address. */
-extern int dladdr (__const void *__address, Dl_info *__info)
+extern int dladdr (const void *__address, Dl_info *__info)
__THROW __nonnull ((2));
#if 0 /* not supported by uClibc */
/* Same as `dladdr', but additionally sets *EXTRA_INFO according to FLAGS. */
-extern int dladdr1 (__const void *__address, Dl_info *__info,
+extern int dladdr1 (const void *__address, Dl_info *__info,
void **__extra_info, int __flags) __THROW __nonnull ((2));
/* These are the possible values for the FLAGS argument to `dladdr1'.
@@ -166,7 +168,7 @@ enum
segment, or if the calling thread has not allocated a block for it. */
RTLD_DI_TLS_DATA = 10,
- RTLD_DI_MAX = 10,
+ RTLD_DI_MAX = 10
};
@@ -186,12 +188,6 @@ typedef struct
unsigned int dls_cnt; /* Number of elements in `dls_serpath'. */
Dl_serpath dls_serpath[1]; /* Actually longer, dls_cnt elements. */
} Dl_serinfo;
-
-#else
-
-/* Get information about the shared objects currently loaded */
-extern int dlinfo (void);
-
#endif
#endif /* __USE_GNU */
diff --git a/include/elf.h b/include/elf.h
index 4c6d09012..5f47905f1 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -13,20 +13,21 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ELF_H
#define _ELF_H 1
-#include <features.h>
-
-__BEGIN_DECLS
+/* Avoid features.h here for portability. This stuff matches sys/cdefs.h. */
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Standard ELF types. */
#include <stdint.h>
+#include <endian.h>
/* Type for a 16-bit quantity. */
typedef uint16_t Elf32_Half;
@@ -120,6 +121,11 @@ typedef struct
/* Conglomeration of the identification bytes, for easy testing as a word. */
#define ELFMAG "\177ELF"
#define SELFMAG 4
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define ELFMAG_U32 ((uint32_t)(ELFMAG0 + 0x100 * (ELFMAG1 + (0x100 * (ELFMAG2 + 0x100 * ELFMAG3)))))
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define ELFMAG_U32 ((uint32_t)((((ELFMAG0 * 0x100) + ELFMAG1) * 0x100 + ELFMAG2) * 0x100 + ELFMAG3))
+#endif
#define EI_CLASS 4 /* File class byte index */
#define ELFCLASSNONE 0 /* Invalid class */
@@ -141,8 +147,8 @@ typedef struct
#define ELFOSABI_SYSV 0 /* Alias. */
#define ELFOSABI_HPUX 1 /* HP-UX */
#define ELFOSABI_NETBSD 2 /* NetBSD. */
-#define ELFOSABI_LINUX 3 /* Linux. */
-#define ELFOSABI_HURD 4 /* GNU/Hurd */
+#define ELFOSABI_GNU 3 /* Object uses GNU ELF extensions. */
+#define ELFOSABI_LINUX ELFOSABI_GNU /* Compatibility alias. */
#define ELFOSABI_SOLARIS 6 /* Sun Solaris. */
#define ELFOSABI_AIX 7 /* IBM AIX. */
#define ELFOSABI_IRIX 8 /* SGI Irix. */
@@ -251,8 +257,8 @@ typedef struct
#define EM_MN10300 89 /* Matsushita MN10300 */
#define EM_MN10200 90 /* Matsushita MN10200 */
#define EM_PJ 91 /* picoJava */
-#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */
-#define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */
+#define EM_OR1K 92 /* OpenRISC 32-bit embedded processor */
+#define EM_ARCOMPACT 93 /* ARCompact ISA based Cores: ARC 700 */
#define EM_XTENSA 94 /* Tensilica Xtensa Architecture */
#define EM_IP2K 101 /* Ubicom IP2022 micro controller */
#define EM_CR 103 /* National Semiconductor CompactRISC */
@@ -260,7 +266,13 @@ typedef struct
#define EM_BLACKFIN 106 /* Analog Devices Blackfin */
#define EM_ALTERA_NIOS2 113 /* Altera Nios II soft-core processor */
#define EM_CRX 114 /* National Semiconductor CRX */
-#define EM_NUM 95
+#define EM_TI_C6000 140
+#define EM_METAG 174 /* Imagination Technologies Meta */
+#define EM_MICROBLAZE 189 /* Xilinx Microblaze */
+#define EM_ARCV2 195 /* ARCv2 Cores */
+
+/* NEXT FREE NUMBER: Increment this after adding your official arch number */
+#define EM_NUM 196
/* If it is necessary to assign new unofficial EM_* values, please pick large
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
@@ -274,19 +286,9 @@ typedef struct
unofficial e_machine number should eventually ask registry@caldera.com for
an officially blessed number to be added to the list above. */
-/* picoJava */
-#define EM_PJ_OLD 99
-
/* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */
#define EM_CYGNUS_POWERPC 0x9025
-/* Old version of Sparc v9, from before the ABI; this should be
- removed shortly. */
-#define EM_OLD_SPARCV9 11
-
-/* Old version of PowerPC, this should be removed shortly. */
-#define EM_PPC_OLD 17
-
/* (Deprecated) Temporary number for the OpenRISC processor. */
#define EM_OR32 0x8472
@@ -360,6 +362,11 @@ typedef struct
/* V850 backend magic number. Written in the absense of an ABI. */
#define EM_CYGNUS_V850 0x9080
+/* Xilinx Microblaze (unofficial). Note that there is now an official microblaze
+ * magic number, but all the toolchains currently in existence use the old number
+ */
+#define EM_MICROBLAZE_OLD 0xbaab
+
/* Legal values for e_version (version). */
#define EV_NONE 0 /* Invalid ELF version */
@@ -546,6 +553,7 @@ typedef struct
#define STB_WEAK 2 /* Weak symbol */
#define STB_NUM 3 /* Number of defined types. */
#define STB_LOOS 10 /* Start of OS-specific */
+#define STB_GNU_UNIQUE 10 /* Unique symbol. */
#define STB_HIOS 12 /* End of OS-specific */
#define STB_LOPROC 13 /* Start of processor-specific */
#define STB_HIPROC 15 /* End of processor-specific */
@@ -561,6 +569,7 @@ typedef struct
#define STT_TLS 6 /* Symbol is thread-local data object*/
#define STT_NUM 7 /* Number of defined types. */
#define STT_LOOS 10 /* Start of OS-specific */
+#define STT_GNU_IFUNC 10 /* Symbol is indirect code object */
#define STT_HIOS 12 /* End of OS-specific */
#define STT_LOPROC 13 /* Start of processor-specific */
#define STT_HIPROC 15 /* End of processor-specific */
@@ -1259,26 +1268,26 @@ typedef struct
#define R_386_NUM 38
/* Blackfin specific definitions. */
-#define R_BFIN_unused0 0x00
-#define R_BFIN_pcrel5m2 0x01
-#define R_BFIN_unused1 0x02
-#define R_BFIN_pcrel10 0x03
-#define R_BFIN_pcrel12_jump 0x04
-#define R_BFIN_rimm16 0x05
-#define R_BFIN_luimm16 0x06
-#define R_BFIN_huimm16 0x07
-#define R_BFIN_pcrel12_jump_s 0x08
-#define R_BFIN_pcrel24_jump_x 0x09
-#define R_BFIN_pcrel24 0x0a
-#define R_BFIN_unusedb 0x0b
-#define R_BFIN_unusedc 0x0c
-#define R_BFIN_pcrel24_jump_l 0x0d
-#define R_BFIN_pcrel24_call_x 0x0e
+#define R_BFIN_UNUSED0 0x00
+#define R_BFIN_PCREL5M2 0x01
+#define R_BFIN_UNUSED1 0x02
+#define R_BFIN_PCREL10 0x03
+#define R_BFIN_PCREL12_JUMP 0x04
+#define R_BFIN_RIMM16 0x05
+#define R_BFIN_LUIMM16 0x06
+#define R_BFIN_HUIMM16 0x07
+#define R_BFIN_PCREL12_JUMP_S 0x08
+#define R_BFIN_PCREL24_JUMP_X 0x09
+#define R_BFIN_PCREL24 0x0a
+#define R_BFIN_UNUSEDB 0x0b
+#define R_BFIN_UNUSEDC 0x0c
+#define R_BFIN_PCREL24_JUMP_L 0x0d
+#define R_BFIN_PCREL24_CALL_X 0x0e
#define R_BFIN_var_eq_symb 0x0f
-#define R_BFIN_byte_data 0x10
-#define R_BFIN_byte2_data 0x11
-#define R_BFIN_byte4_data 0x12
-#define R_BFIN_pcrel11 0x13
+#define R_BFIN_BYTE_DATA 0x10
+#define R_BFIN_BYTE2_DATA 0x11
+#define R_BFIN_BYTE4_DATA 0x12
+#define R_BFIN_PCREL11 0x13
#define R_BFIN_GOT17M4 0x14
#define R_BFIN_GOTHI 0x15
@@ -1544,6 +1553,7 @@ typedef struct
#define STO_MIPS_INTERNAL 0x1
#define STO_MIPS_HIDDEN 0x2
#define STO_MIPS_PROTECTED 0x3
+#define STO_MIPS_PLT 0x8
#define STO_MIPS_SC_ALIGN_UNUSED 0xff
/* MIPS specific values for `st_info'. */
@@ -1689,8 +1699,11 @@ typedef struct
#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
+#define R_MIPS_GLOB_DAT 51
+#define R_MIPS_COPY 126
+#define R_MIPS_JUMP_SLOT 127
/* Keep this the last entry. */
-#define R_MIPS_NUM 51
+#define R_MIPS_NUM 128
/* Legal values for p_type field of Elf32_Phdr. */
@@ -1756,7 +1769,13 @@ typedef struct
#define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
#define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
#define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
-#define DT_MIPS_NUM 0x32
+/* The address of .got.plt in an executable using the new non-PIC ABI. */
+#define DT_MIPS_PLTGOT 0x70000032
+/* The base of the PLT in an executable using the new non-PIC ABI if that
+ PLT is writable. For a non-writable PLT, this is omitted or has a zero
+ value. */
+#define DT_MIPS_RWPLT 0x70000034
+#define DT_MIPS_NUM 0x35
/* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
@@ -2163,10 +2182,10 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
/* GNU relocs used in PIC code sequences. */
-#define R_PPC_REL16 249 /* word32 (sym-.) */
-#define R_PPC_REL16_LO 250 /* half16 (sym-.)@l */
-#define R_PPC_REL16_HI 251 /* half16 (sym-.)@h */
-#define R_PPC_REL16_HA 252 /* half16 (sym-.)@ha */
+#define R_PPC_REL16 249 /* word32 (sym+add-.) */
+#define R_PPC_REL16_LO 250 /* half16 (sym+add-.)@l */
+#define R_PPC_REL16_HI 251 /* half16 (sym+add-.)@h */
+#define R_PPC_REL16_HA 252 /* half16 (sym+add-.)@ha */
/* This is a phony reloc to handle any old fashioned TOC16 references
that may still be in object files. */
@@ -2331,6 +2350,11 @@ typedef Elf32_Addr Elf32_Conflict;
#define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
in the input to a link step */
+#define SHT_ARM_EXIDX (SHT_LOPROC + 1) /* ARM unwind section. */
+#define SHT_ARM_PREEMPTMAP (SHT_LOPROC + 2) /* Preemption details. */
+#define SHT_ARM_ATTRIBUTES (SHT_LOPROC + 3) /* ARM attributes section. */
+
+
/* ARM-specific program header flags */
#define PF_ARM_SB 0x10000000 /* Segment contains the location
addressed by the static base */
@@ -2357,6 +2381,9 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_ARM_THM_SWI8 14
#define R_ARM_XPC25 15
#define R_ARM_THM_XPC22 16
+#define R_ARM_TLS_DTPMOD32 17
+#define R_ARM_TLS_DTPOFF32 18
+#define R_ARM_TLS_TPOFF32 19
#define R_ARM_COPY 20 /* Copy symbol at runtime */
#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
@@ -2375,6 +2402,14 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_ARM_GNU_VTINHERIT 101
#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
#define R_ARM_THM_PC9 103 /* thumb conditional branch */
+#define R_ARM_TLS_GD32 104
+#define R_ARM_TLS_LDM32 105
+#define R_ARM_TLS_LDO32 106
+#define R_ARM_TLS_IE32 107
+#define R_ARM_TLS_LE32 108
+#define R_ARM_TLS_LDO12 109
+#define R_ARM_TLS_LE12 110
+#define R_ARM_TLS_IE12GP 111
#define R_ARM_RXPC25 249
#define R_ARM_RSBREL32 250
#define R_ARM_THM_RPC22 251
@@ -2786,53 +2821,6 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_M32R_GOTOFF_LO 64 /* Low 16 bit offset to GOT */
#define R_M32R_NUM 256 /* Keep this the last entry. */
-/* i960 Relocations */
-#define R_960_NONE 0
-#define R_960_12 1
-#define R_960_32 2
-#define R_960_IP24 3
-#define R_960_SUB 4
-#define R_960_OPTCALL 5
-#define R_960_OPTCALLX 6
-#define R_960_OPTCALLXA 7
-/* Keep this the last entry. */
-#define R_960_NUM 8
-
-
-/* v850 relocations. */
-#define R_V850_NONE 0
-#define R_V850_9_PCREL 1
-#define R_V850_22_PCREL 2
-#define R_V850_HI16_S 3
-#define R_V850_HI16 4
-#define R_V850_LO16 5
-#define R_V850_32 6
-#define R_V850_16 7
-#define R_V850_8 8
-#define R_V850_SDA_16_16_OFFSET 9 /* For ld.b, st.b, set1, clr1,
- not1, tst1, movea, movhi */
-#define R_V850_SDA_15_16_OFFSET 10 /* For ld.w, ld.h, ld.hu, st.w, st.h */
-#define R_V850_ZDA_16_16_OFFSET 11 /* For ld.b, st.b, set1, clr1,
- not1, tst1, movea, movhi */
-#define R_V850_ZDA_15_16_OFFSET 12 /* For ld.w, ld.h, ld.hu, st.w, st.h */
-#define R_V850_TDA_6_8_OFFSET 13 /* For sst.w, sld.w */
-#define R_V850_TDA_7_8_OFFSET 14 /* For sst.h, sld.h */
-#define R_V850_TDA_7_7_OFFSET 15 /* For sst.b, sld.b */
-#define R_V850_TDA_16_16_OFFSET 16 /* For set1, clr1, not1, tst1,
- movea, movhi */
-/* CYGNUS LOCAL v850e */
-#define R_V850_TDA_4_5_OFFSET 17 /* For sld.hu */
-#define R_V850_TDA_4_4_OFFSET 18 /* For sld.bu */
-#define R_V850_SDA_16_16_SPLIT_OFFSET 19 /* For ld.bu */
-#define R_V850_ZDA_16_16_SPLIT_OFFSET 20 /* For ld.bu */
-#define R_V850_CALLT_6_7_OFFSET 21 /* For callt */
-#define R_V850_CALLT_16_16_OFFSET 22 /* For callt */
-/* END CYGNUS LOCAL */
-#define R_V850_GNU_VTINHERIT 23
-#define R_V850_GNU_VTENTRY 24
-/* Keep this the last entry. */
-#define R_V850_NUM 25
-
/* Atmel AVR32 relocations. */
#define R_AVR32_NONE 0
#define R_AVR32_32 1
@@ -2958,18 +2946,18 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_NIOS2_PCREL16 3
#define R_NIOS2_CALL26 4
#define R_NIOS2_IMM5 5
-#define R_NIOS2_CACHE_OPX 6
+#define R_NIOS2_CACHE_OPX 6
#define R_NIOS2_IMM6 7
#define R_NIOS2_IMM8 8
#define R_NIOS2_HI16 9
#define R_NIOS2_LO16 10
-#define R_NIOS2_HIADJ16 11
+#define R_NIOS2_HIADJ16 11
#define R_NIOS2_BFD_RELOC_32 12
#define R_NIOS2_BFD_RELOC_16 13
-#define R_NIOS2_BFD_RELOC_8 14
+#define R_NIOS2_BFD_RELOC_8 14
#define R_NIOS2_GPREL 15
-#define R_NIOS2_GNU_VTINHERIT 16
-#define R_NIOS2_GNU_VTENTRY 17
+#define R_NIOS2_GNU_VTINHERIT 16
+#define R_NIOS2_GNU_VTENTRY 17
#define R_NIOS2_UJMP 18
#define R_NIOS2_CJMP 19
#define R_NIOS2_CALLR 20
@@ -3032,9 +3020,221 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_XTENSA_SLOT12_ALT 47
#define R_XTENSA_SLOT13_ALT 48
#define R_XTENSA_SLOT14_ALT 49
+#define R_XTENSA_TLSDESC_FN 50
+#define R_XTENSA_TLSDESC_ARG 51
+#define R_XTENSA_TLS_TPOFF 53
/* Keep this the last entry. */
-#define R_XTENSA_NUM 50
-
-__END_DECLS
+#define R_XTENSA_NUM 54
+
+/* C6X specific relocs */
+#define R_C6000_NONE 0
+#define R_C6000_ABS32 1
+#define R_C6000_ABS16 2
+#define R_C6000_ABS8 3
+#define R_C6000_PCR_S21 4
+#define R_C6000_PCR_S12 5
+#define R_C6000_PCR_S10 6
+#define R_C6000_PCR_S7 7
+#define R_C6000_ABS_S16 8
+#define R_C6000_ABS_L16 9
+#define R_C6000_ABS_H16 10
+#define R_C6000_SBR_U15_B 11
+#define R_C6000_SBR_U15_H 12
+#define R_C6000_SBR_U15_W 13
+#define R_C6000_SBR_S16 14
+#define R_C6000_SBR_L16_B 15
+#define R_C6000_SBR_L16_H 16
+#define R_C6000_SBR_L16_W 17
+#define R_C6000_SBR_H16_B 18
+#define R_C6000_SBR_H16_H 19
+#define R_C6000_SBR_H16_W 20
+#define R_C6000_SBR_GOT_U15_W 21
+#define R_C6000_SBR_GOT_L16_W 22
+#define R_C6000_SBR_GOT_H16_W 23
+#define R_C6000_DSBT_INDEX 24
+#define R_C6000_PREL31 25
+#define R_C6000_COPY 26
+#define R_C6000_JUMP_SLOT 27
+#define R_C6000_SBR_GOT32 28
+#define R_C6000_PCR_H16 29
+#define R_C6000_PCR_L16 30
+#define R_C6000_ALIGN 253
+#define R_C6000_FPHEAD 254
+#define R_C6000_NOCMP 255
+
+/* C6x specific values for the Dyn d_tag field. */
+#define DT_C6000_DSBT_BASE (DT_LOPROC + 0)
+#define DT_C6000_DSBT_SIZE (DT_LOPROC + 1)
+#define DT_C6000_PREEMPTMAP (DT_LOPROC + 2)
+#define DT_C6000_DSBT_INDEX (DT_LOPROC + 3)
+
+#define DT_C6000_NUM 4
+
+/* microblaze specific relocs */
+#define R_MICROBLAZE_NONE 0
+#define R_MICROBLAZE_32 1
+#define R_MICROBLAZE_32_PCREL 2
+#define R_MICROBLAZE_64_PCREL 3
+#define R_MICROBLAZE_32_PCREL_LO 4
+#define R_MICROBLAZE_64 5
+#define R_MICROBLAZE_32_LO 6
+#define R_MICROBLAZE_SRO32 7
+#define R_MICROBLAZE_SRW32 8
+#define R_MICROBLAZE_64_NONE 9
+#define R_MICROBLAZE_32_SYM_OP_SYM 10
+#define R_MICROBLAZE_GNU_VTINHERIT 11
+#define R_MICROBLAZE_GNU_VTENTRY 12
+#define R_MICROBLAZE_GOTPC_64 13 /* PC-relative GOT offset */
+#define R_MICROBLAZE_GOT_64 14 /* GOT entry offset */
+#define R_MICROBLAZE_PLT_64 15 /* PLT offset (PC-relative */
+#define R_MICROBLAZE_REL 16 /* adjust by program base */
+#define R_MICROBLAZE_JUMP_SLOT 17 /* create PLT entry */
+#define R_MICROBLAZE_GLOB_DAT 18 /* create GOT entry */
+#define R_MICROBLAZE_GOTOFF_64 19 /* offset relative to GOT */
+#define R_MICROBLAZE_GOTOFF_32 20 /* offset relative to GOT */
+#define R_MICROBLAZE_COPY 21 /* runtime copy */
+#define R_MICROBLAZE_NUM 22
+
+/* Meta relocations */
+#define R_METAG_HIADDR16 0
+#define R_METAG_LOADDR16 1
+#define R_METAG_ADDR32 2
+#define R_METAG_NONE 3
+#define R_METAG_RELBRANCH 4
+#define R_METAG_GETSETOFF 5
+
+/* Backward compatability */
+#define R_METAG_REG32OP1 6
+#define R_METAG_REG32OP2 7
+#define R_METAG_REG32OP3 8
+#define R_METAG_REG16OP1 9
+#define R_METAG_REG16OP2 10
+#define R_METAG_REG16OP3 11
+#define R_METAG_REG32OP4 12
+
+#define R_METAG_HIOG 13
+#define R_METAG_LOOG 14
+
+/* GNU */
+#define R_METAG_GNU_VTINHERIT 30
+#define R_METAG_GNU_VTENTRY 31
+
+/* PIC relocations */
+#define R_METAG_HI16_GOTOFF 32
+#define R_METAG_LO16_GOTOFF 33
+#define R_METAG_GETSET_GOTOFF 34
+#define R_METAG_GETSET_GOT 35
+#define R_METAG_HI16_GOTPC 36
+#define R_METAG_LO16_GOTPC 37
+#define R_METAG_HI16_PLT 38
+#define R_METAG_LO16_PLT 39
+#define R_METAG_RELBRANCH_PLT 40
+#define R_METAG_GOTOFF 41
+#define R_METAG_PLT 42
+#define R_METAG_COPY 43
+#define R_METAG_JMP_SLOT 44
+#define R_METAG_RELATIVE 45
+#define R_METAG_GLOB_DAT 46
+
+/* TLS relocations */
+#define R_METAG_TLS_TPOFF 56
+#define R_METAG_TLS_DTPMOD 57
+#define R_METAG_TLS_DTPOFF 58
+
+/* OpenRISC 1000 specific relocs */
+#define R_OR1K_NONE 0
+#define R_OR1K_32 1
+#define R_OR1K_16 2
+#define R_OR1K_8 3
+#define R_OR1K_LO_16_IN_INSN 4
+#define R_OR1K_HI_16_IN_INSN 5
+#define R_OR1K_INSN_REL_26 6
+#define R_OR1K_GNU_VTENTRY 7
+#define R_OR1K_GNU_VTINHERIT 8
+#define R_OR1K_32_PCREL 9
+#define R_OR1K_16_PCREL 10
+#define R_OR1K_8_PCREL 11
+#define R_OR1K_GOTPC_HI16 12
+#define R_OR1K_GOTPC_LO16 13
+#define R_OR1K_GOT16 14
+#define R_OR1K_PLT26 15
+#define R_OR1K_GOTOFF_HI16 16
+#define R_OR1K_GOTOFF_LO16 17
+#define R_OR1K_COPY 18
+#define R_OR1K_GLOB_DAT 19
+#define R_OR1K_JMP_SLOT 20
+#define R_OR1K_RELATIVE 21
+
+/* ARCompact specific relocs */
+#define R_ARC_NONE 0x0
+#define R_ARC_8 0x1
+#define R_ARC_16 0x2
+#define R_ARC_24 0x3
+#define R_ARC_32 0x4
+#define R_ARC_B26 0x5
+#define R_ARC_B22_PCREL 0x6
+#define R_ARC_H30 0x7
+#define R_ARC_N8 0x8
+#define R_ARC_N16 0x9
+#define R_ARC_N24 0xA
+#define R_ARC_N32 0xB
+#define R_ARC_SDA 0xC
+#define R_ARC_SECTOFF 0xD
+#define R_ARC_S21H_PCREL 0xE
+#define R_ARC_S21W_PCREL 0xF
+#define R_ARC_S25H_PCREL 0x10
+#define R_ARC_S25W_PCREL 0x11
+#define R_ARC_SDA32 0x12
+#define R_ARC_SDA_LDST 0x13
+#define R_ARC_SDA_LDST1 0x14
+#define R_ARC_SDA_LDST2 0x15
+#define R_ARC_SDA16_LD 0x16
+#define R_ARC_SDA16_LD1 0x17
+#define R_ARC_SDA16_LD2 0x18
+#define R_ARC_S13_PCREL 0x19
+#define R_ARC_W 0x1A
+#define R_ARC_32_ME 0x1B
+#define R_ARC_N32_ME 0x1C
+#define R_ARC_SECTOFF_ME 0x1D
+#define R_ARC_SDA32_ME 0x1E
+#define R_ARC_W_ME 0x1F
+#define R_ARC_H30_ME 0x20
+#define R_ARC_SECTOFF_U8 0x21
+#define R_ARC_SECTOFF_S9 0x22
+#define R_AC_SECTOFF_U8 0x23
+#define R_AC_SECTOFF_U8_1 0x24
+#define R_AC_SECTOFF_U8_2 0x25
+#define R_AC_SECTOFF_S9 0x26
+#define R_AC_SECTOFF_S9_1 0x27
+#define R_AC_SECTOFF_S9_2 0x28
+#define R_ARC_SECTOFF_ME_1 0x29
+#define R_ARC_SECTOFF_ME_2 0x2A
+#define R_ARC_SECTOFF_1 0x2B
+#define R_ARC_SECTOFF_2 0x2C
+#define R_ARC_PC32 0x32
+#define R_ARC_GOTPC32 0x33
+#define R_ARC_PLT32 0x34
+#define R_ARC_COPY 0x35
+#define R_ARC_GLOB_DAT 0x36
+#define R_ARC_JMP_SLOT 0x37
+#define R_ARC_RELATIVE 0x38
+#define R_ARC_GOTOFF 0x39
+#define R_ARC_GOTPC 0x3A
+#define R_ARC_GOT32 0x3B
+
+#define R_ARC_TLS_DTPMOD 0x42
+#define R_ARC_TLS_DTPOFF 0x43
+#define R_ARC_TLS_TPOFF 0x44
+#define R_ARC_TLS_GD_GOT 0x45
+#define R_ARC_TLS_GD_LD 0x46
+#define R_ARC_TLS_GD_CALL 0x47
+#define R_ARC_TLS_IE_GOT 0x48
+#define R_ARC_TLS_DTPOFF_S9 0x4a
+#define R_ARC_TLS_LE_S9 0x4a
+#define R_ARC_TLS_LE_32 0x4b
+
+#ifdef __cplusplus
+}
+#endif
#endif /* elf.h */
diff --git a/include/endian.h b/include/endian.h
index 2f7bce100..23a265485 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ENDIAN_H
#define _ENDIAN_H 1
@@ -55,4 +54,53 @@
# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
+#ifdef _LIBC
+# ifndef __ASSEMBLER__
+# include <stdint.h>
+# define OFF_HI(offset) (offset >> 31)
+# define OFF_LO(offset) (offset)
+# define OFF64_HI(offset) (uint32_t)(offset >> 32)
+# define OFF64_LO(offset) (uint32_t)(offset & 0xffffffff)
+# define OFF_HI_LO(offset) __LONG_LONG_PAIR(OFF_HI(offset), OFF_LO(offset))
+# define OFF64_HI_LO(offset) __LONG_LONG_PAIR(OFF64_HI(offset), OFF64_LO(offset))
+# endif
+#endif
+
+#ifdef __USE_BSD
+/* Conversion interfaces. */
+# include <byteswap.h>
+
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define htobe16(x) __bswap_16 (x)
+# define htole16(x) (x)
+# define be16toh(x) __bswap_16 (x)
+# define le16toh(x) (x)
+
+# define htobe32(x) __bswap_32 (x)
+# define htole32(x) (x)
+# define be32toh(x) __bswap_32 (x)
+# define le32toh(x) (x)
+
+# define htobe64(x) __bswap_64 (x)
+# define htole64(x) (x)
+# define be64toh(x) __bswap_64 (x)
+# define le64toh(x) (x)
+# else
+# define htobe16(x) (x)
+# define htole16(x) __bswap_16 (x)
+# define be16toh(x) (x)
+# define le16toh(x) __bswap_16 (x)
+
+# define htobe32(x) (x)
+# define htole32(x) __bswap_32 (x)
+# define be32toh(x) (x)
+# define le32toh(x) __bswap_32 (x)
+
+# define htobe64(x) (x)
+# define htole64(x) __bswap_64 (x)
+# define be64toh(x) (x)
+# define le64toh(x) __bswap_64 (x)
+# endif
+#endif
+
#endif /* endian.h */
diff --git a/include/err.h b/include/err.h
index 7ff3553ab..25ff4e957 100644
--- a/include/err.h
+++ b/include/err.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ERR_H
#define _ERR_H 1
@@ -32,25 +31,25 @@ __BEGIN_DECLS
/* Print "program: ", FORMAT, ": ", the standard error string for errno,
and a newline, on stderr. */
-extern void warn (__const char *__format, ...)
+extern void warn (const char *__format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
-extern void vwarn (__const char *__format, __gnuc_va_list)
+extern void vwarn (const char *__format, __gnuc_va_list)
__attribute__ ((__format__ (__printf__, 1, 0)));
/* Likewise, but without ": " and the standard error string. */
-extern void warnx (__const char *__format, ...)
+extern void warnx (const char *__format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
-extern void vwarnx (__const char *__format, __gnuc_va_list)
+extern void vwarnx (const char *__format, __gnuc_va_list)
__attribute__ ((__format__ (__printf__, 1, 0)));
/* Likewise, and then exit with STATUS. */
-extern void err (int __status, __const char *__format, ...)
+extern void err (int __status, const char *__format, ...)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
-extern void verr (int __status, __const char *__format, __gnuc_va_list)
+extern void verr (int __status, const char *__format, __gnuc_va_list)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
-extern void errx (int __status, __const char *__format, ...)
+extern void errx (int __status, const char *__format, ...)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 3)));
-extern void verrx (int __status, __const char *, __gnuc_va_list)
+extern void verrx (int __status, const char *, __gnuc_va_list)
__attribute__ ((__noreturn__, __format__ (__printf__, 2, 0)));
__END_DECLS
diff --git a/include/errno.h b/include/errno.h
index b2315b90a..4e3a81689 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.5 Errors <errno.h>
@@ -47,6 +46,11 @@ __BEGIN_DECLS
extern int errno;
#endif
+#ifdef _LIBC
+# ifdef __UCLIBC_HAS___PROGNAME__
+extern const char *__progname, *__progname_full;
+# endif
+#endif
#if defined __USE_GNU && defined __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
/* The full and simple forms of the name with which the program was
@@ -58,9 +62,27 @@ extern const char *program_invocation_name, *program_invocation_short_name;
__END_DECLS
-#if defined _LIBC && ( defined IS_IN_libc || defined NOT_IN_libc )
-#include <bits/uClibc_errno.h>
+#ifdef _LIBC
+#ifdef IS_IN_rtld
+# undef errno
+# define errno _dl_errno
+extern int _dl_errno; /* attribute_hidden */
+#elif defined __UCLIBC_HAS_TLS__
+# if !defined NOT_IN_libc || defined IS_IN_libpthread
+# undef errno
+# ifndef NOT_IN_libc
+# define errno __libc_errno
+# else
+# define errno errno /* For #ifndef errno tests. */
+# endif
+extern __thread int errno attribute_tls_model_ie;
+# endif
+#endif
+
+#ifndef __set_errno
+#define __set_errno(val) (errno = (val))
#endif
+#endif /* _LIBC */
#endif /* _ERRNO_H */
diff --git a/include/error.h b/include/error.h
index b553caeb9..867a36658 100644
--- a/include/error.h
+++ b/include/error.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ERROR_H
#define _ERROR_H 1
diff --git a/include/execinfo.h b/include/execinfo.h
new file mode 100644
index 000000000..503c84662
--- /dev/null
+++ b/include/execinfo.h
@@ -0,0 +1,43 @@
+/* Copyright (C) 1998, 1999, 2004, 2005 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _EXECINFO_H
+#define _EXECINFO_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Store up to SIZE return address of the current program state in
+ ARRAY and return the exact number of values stored. */
+extern int backtrace (void **__array, int __size) __nonnull ((1));
+
+
+/* Return names of functions from the backtrace list in ARRAY in a newly
+ malloc()ed memory block. */
+extern char **backtrace_symbols (void *const *__array, int __size)
+ __THROW __nonnull ((1));
+
+
+/* This function is similar to backtrace_symbols() but it writes the result
+ immediately to a file. */
+extern void backtrace_symbols_fd (void *const *__array, int __size, int __fd)
+ __THROW __nonnull ((1));
+
+__END_DECLS
+
+#endif /* execinfo.h */
diff --git a/include/fcntl.h b/include/fcntl.h
index adeabaebb..adcd7ef4b 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005
- Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1994-2001,2003,2004,2005,2006,2007, 2009
+ 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 6.5 File Control Operations <fcntl.h>
@@ -56,13 +55,21 @@ __BEGIN_DECLS
# define SEEK_END 2 /* Seek from end of file. */
#endif /* XPG */
-#if 0 /*def __USE_GNU*/
+#ifdef __USE_ATFILE
# define AT_FDCWD -100 /* Special value used to indicate
- openat should use the current
- working directory. */
+ the *at functions should use the
+ current working directory. */
# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
# define AT_REMOVEDIR 0x200 /* Remove directory instead of
unlinking file. */
+# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
+# ifdef __USE_GNU
+# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
+ traversal. */
+# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
+# endif
+# define AT_EACCESS 0x200 /* Test access permitted for
+ effective IDs, not real IDs. */
#endif
/* Do the file control operation described by CMD on FD.
@@ -70,8 +77,12 @@ __BEGIN_DECLS
This function is a cancellation point and therefore not marked with
__THROW. */
-#ifndef __USE_FILE_OFFSET64
+#if !defined(__USE_FILE_OFFSET64) || defined(__LP64__)
extern int fcntl (int __fd, int __cmd, ...);
+# ifdef _LIBC
+extern int __fcntl_nocancel(int, int, long) attribute_hidden;
+libc_hidden_proto(fcntl)
+# endif
#else
# ifdef __REDIRECT
extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
@@ -79,8 +90,12 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
# define fcntl fcntl64
# endif
#endif
-#ifdef __USE_LARGEFILE64
+#if defined(__USE_LARGEFILE64) && !defined(__LP64__)
extern int fcntl64 (int __fd, int __cmd, ...);
+# ifdef _LIBC
+extern int __fcntl64_nocancel(int, int, long) attribute_hidden;
+libc_hidden_proto(fcntl64)
+# endif
#endif
/* Open FILE and return a new file descriptor for it, or -1 on error.
@@ -90,42 +105,49 @@ extern int fcntl64 (int __fd, int __cmd, ...);
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
-extern int open (__const char *__file, int __oflag, ...) __nonnull ((1));
+extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
+libc_hidden_proto(open)
+# ifdef _LIBC
+extern int __open2_nocancel(const char *, int) __nonnull ((1)) attribute_hidden;
+extern int __open_nocancel(const char *, int, mode_t) __nonnull ((1)) attribute_hidden;
+# endif
#else
# ifdef __REDIRECT
-extern int __REDIRECT (open, (__const char *__file, int __oflag, ...), open64)
+extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
__nonnull ((1));
# else
# define open open64
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1));
+extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
+libc_hidden_proto(open64)
#endif
-#if 0 /*def __USE_GNU*/
-/* Similar to OPEN but a relative path name is interpreted relative to
+#ifdef __USE_ATFILE
+/* Similar to `open' but a relative path name is interpreted relative to
the directory for which FD is a descriptor.
- NOTE: some other OPENAT implementation support additional functionality
+ NOTE: some other `openat' implementation support additional functionality
through this interface, especially using the O_XATTR flag. This is not
yet supported here.
This function is a cancellation point and therefore not marked with
__THROW. */
# ifndef __USE_FILE_OFFSET64
-extern int openat (int __fd, __const char *__file, int __oflag, ...)
+extern int openat (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
+libc_hidden_proto(openat)
# else
# ifdef __REDIRECT
-extern int __REDIRECT (openat, (int __fd, __const char *__file, int __oflag,
+extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
...), openat64) __nonnull ((2));
# else
# define openat openat64
# endif
# endif
-extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
+extern int openat64 (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
#endif
@@ -135,17 +157,17 @@ extern int openat64 (int __fd, __const char *__file, int __oflag, ...)
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
-extern int creat (__const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat (const char *__file, __mode_t __mode) __nonnull ((1));
#else
# ifdef __REDIRECT
-extern int __REDIRECT (creat, (__const char *__file, __mode_t __mode),
+extern int __REDIRECT (creat, (const char *__file, __mode_t __mode),
creat64) __nonnull ((1));
# else
# define creat creat64
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int creat64 (__const char *__file, __mode_t __mode) __nonnull ((1));
+extern int creat64 (const char *__file, __mode_t __mode) __nonnull ((1));
#endif
#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
@@ -165,12 +187,13 @@ extern int creat64 (__const char *__file, __mode_t __mode) __nonnull ((1));
# ifndef __USE_FILE_OFFSET64
extern int lockf (int __fd, int __cmd, __off_t __len);
+libc_hidden_proto(lockf)
# else
-# ifdef __REDIRECT
+# ifdef __REDIRECT
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
-# else
-# define lockf lockf64
-# endif
+# else
+# define lockf lockf64
+# endif
# endif
# ifdef __USE_LARGEFILE64
extern int lockf64 (int __fd, int __cmd, __off64_t __len);
@@ -184,13 +207,13 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len);
extern int posix_fadvise (int __fd, __off_t __offset, __off_t __len,
int __advise) __THROW;
# else
-# ifdef __REDIRECT_NTH
+# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
- __off64_t __len, int __advise),
- posix_fadvise64);
-# else
-# define posix_fadvise posix_fadvise64
-# endif
+ __off64_t __len, int __advise),
+ posix_fadvise64);
+# else
+# define posix_fadvise posix_fadvise64
+# endif
# endif
# ifdef __USE_LARGEFILE64
extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
@@ -199,30 +222,60 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
#endif
-#if 0 // && defined __UCLIBC_HAS_ADVANCED_REALTIME__
-
-/* FIXME -- uClibc should probably implement these... */
+#if defined __UCLIBC_HAS_ADVANCED_REALTIME__
/* Reserve storage for the data of the file associated with FD.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
# else
-# ifdef __REDIRECT
+# ifdef __REDIRECT
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
__off64_t __len),
posix_fallocate64);
-# else
-# define posix_fallocate posix_fallocate64
-# endif
+# else
+# define posix_fallocate posix_fallocate64
+# endif
# endif
# ifdef __USE_LARGEFILE64
extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
# endif
#endif
+#if (defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU) || defined _LIBC
+/* Reserve storage for the data of a file associated with FD. This function
+ is Linux-specific. For the portable version, use posix_fallocate().
+ Unlike the latter, fallocate can operate in different modes. The default
+ mode = 0 is equivalent to posix_fallocate().
+
+ Note: These declarations are used in posix_fallocate.c and
+ posix_fallocate64.c, so we expose them internally.
+ */
+
+/* Flags for fallocate's mode. */
+# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
+ even if offset + len is
+ greater than file size. */
+# define FALLOC_FL_PUNCH_HOLE 2 /* Create a hole in the file. */
+
+# ifndef __USE_FILE_OFFSET64
+extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
+ __off64_t __len),
+ fallocate64);
+# else
+# define fallocate fallocate64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
+# endif
+#endif
+
__END_DECLS
#endif /* fcntl.h */
diff --git a/include/features.h b/include/features.h
index defdd04c6..dcf1348d8 100644
--- a/include/features.h
+++ b/include/features.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993,1995-2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2006,2007,2009 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
@@ -12,34 +12,12 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _FEATURES_H
#define _FEATURES_H 1
-/* This macro indicates that the installed library is uClibc. Use
- * __UCLIBC_MAJOR__ and __UCLIBC_MINOR__ to test for the features in
- * specific releases. */
-#define __UCLIBC__ 1
-
-/* Load up the current set of uClibc supported features along
- * with the current uClibc major and minor version numbers.
- * For uClibc release 0.9.26, these numbers would be:
- * #define __UCLIBC_MAJOR__ 0
- * #define __UCLIBC_MINOR__ 9
- * #define __UCLIBC_SUBLEVEL__ 26
- */
-#define __need_uClibc_config_h
-#include <bits/uClibc_config.h>
-#undef __need_uClibc_config_h
-#include <bits/uClibc_arch_features.h>
-
-/* For uClibc, always optimize for size -- this should disable
- * a lot of expensive inlining... */
-#define __OPTIMIZE_SIZE__ 1
-
/* These are defined by the user (or the compiler)
to specify the desired environment:
@@ -50,9 +28,10 @@
if >=199309L, add IEEE Std 1003.1b-1993;
if >=199506L, add IEEE Std 1003.1c-1995;
if >=200112L, all of IEEE 1003.1-2004
+ if >=200809L, all of IEEE 1003.1-2008
_XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
Single Unix conformance is wanted, to 600 for the
- upcoming sixth revision.
+ sixth revision, to 700 for the seventh revision.
_XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
_LARGEFILE_SOURCE Some more functions for correct standard I/O.
_LARGEFILE64_SOURCE Additional functionality from LFS for large files.
@@ -69,7 +48,7 @@
The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
If none of these are defined, the default is to have _SVID_SOURCE,
_BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
- 199506L. If more than one of these are defined, they accumulate.
+ 200112L. If more than one of these are defined, they accumulate.
For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
together give you ISO C, 1003.1, and 1003.2, but nothing else.
@@ -77,6 +56,7 @@
header files to decide what to declare or define:
__USE_ISOC99 Define ISO C99 things.
+ __USE_ISOC95 Define ISO C90 AMD1 (C95) things.
__USE_POSIX Define IEEE Std 1003.1 things.
__USE_POSIX2 Define IEEE Std 1003.2 things.
__USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
@@ -85,6 +65,7 @@
__USE_XOPEN_EXTENDED Define X/Open Unix things.
__USE_UNIX98 Define Single Unix V2 things.
__USE_XOPEN2K Define XPG6 things.
+ __USE_XOPEN2K8 Define XPG7 things.
__USE_LARGEFILE Define correct standard I/O things.
__USE_LARGEFILE64 Define LFS things with separate names.
__USE_FILE_OFFSET64 Define 64bit interface as default.
@@ -111,6 +92,7 @@
/* Undefine everything, so we get a clean slate. */
#undef __USE_ISOC99
+#undef __USE_ISOC95
#undef __USE_POSIX
#undef __USE_POSIX2
#undef __USE_POSIX199309
@@ -119,6 +101,7 @@
#undef __USE_XOPEN_EXTENDED
#undef __USE_UNIX98
#undef __USE_XOPEN2K
+#undef __USE_XOPEN2K8
#undef __USE_LARGEFILE
#undef __USE_LARGEFILE64
#undef __USE_FILE_OFFSET64
@@ -171,15 +154,13 @@
# undef _POSIX_SOURCE
# define _POSIX_SOURCE 1
# undef _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 199506L
+# define _POSIX_C_SOURCE 200809L
# undef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 600
+# define _XOPEN_SOURCE 700
# undef _XOPEN_SOURCE_EXTENDED
# define _XOPEN_SOURCE_EXTENDED 1
-# ifdef __UCLIBC_HAS_LFS__
-# undef _LARGEFILE64_SOURCE
-# define _LARGEFILE64_SOURCE 1
-# endif /* __UCLIBC_HAS_LFS__ */
+# undef _LARGEFILE64_SOURCE
+# define _LARGEFILE64_SOURCE 1
# undef _BSD_SOURCE
# define _BSD_SOURCE 1
# undef _SVID_SOURCE
@@ -188,6 +169,60 @@
# define _ATFILE_SOURCE 1
#endif
+/* This macro indicates that the installed library is uClibc. Use
+ * __UCLIBC_MAJOR__ and __UCLIBC_MINOR__ to test for the features in
+ * specific releases. */
+#define __UCLIBC__ 1
+
+#ifdef __UCLIBC__
+/* Load up the current set of uClibc supported features along
+ * with the current uClibc major and minor version numbers.
+ * For uClibc release 0.9.26, these numbers would be:
+ * #define __UCLIBC_MAJOR__ 0
+ * #define __UCLIBC_MINOR__ 9
+ * #define __UCLIBC_SUBLEVEL__ 26
+ */
+# define __need_uClibc_config_h
+# include <bits/uClibc_config.h>
+# undef __need_uClibc_config_h
+
+/* For uClibc, always optimize for size -- this should disable
+ * a lot of expensive inlining...
+ * TODO: this is wrong! __OPTIMIZE_SIZE__ is an indicator of
+ * gcc -Os compile. We should not mess with compiler inlines.
+ * We should instead disable __USE_EXTERN_INLINES unconditionally,
+ * or maybe actually audit and test uclibc to work correctly
+ * with __USE_EXTERN_INLINES on.
+ */
+# define __OPTIMIZE_SIZE__ 1
+
+/* disable unsupported features */
+# undef __LDBL_COMPAT
+
+# ifndef __UCLIBC_HAS_FORTIFY__
+# undef _FORTIFY_SOURCE
+# endif
+
+# ifndef __UCLIBC_HAS_THREADS__
+# if defined _REENTRANT || defined _THREAD_SAFE
+# warning requested reentrant code, but thread support was disabled
+# undef _REENTRANT
+# undef _THREAD_SAFE
+# endif
+# endif
+
+# ifndef __UCLIBC_HAS_LFS__
+# undef _LARGEFILE64_SOURCE
+/* NOTE: This is probably incorrect on a 64-bit arch... */
+# if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, \
+uClibc was built without large file support enabled.
+# endif
+# elif defined __BCC__
+# error BCC does not support LFS, please disable it
+# endif
+#endif /* __UCLIBC__ */
+
/* If nothing (other than _GNU_SOURCE) is defined,
define _BSD_SOURCE and _SVID_SOURCE. */
#if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
@@ -207,6 +242,12 @@
# define __USE_ISOC99 1
#endif
+/* This is to enable the ISO C90 Amendment 1:1995 extension. */
+#if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
+ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199409L))
+# define __USE_ISOC95 1
+#endif
+
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
(and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
#if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \
@@ -214,9 +255,14 @@
# define _POSIX_SOURCE 1
# if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
# define _POSIX_C_SOURCE 2
-# else
+# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 600
# define _POSIX_C_SOURCE 199506L
+# elif defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 700
+# define _POSIX_C_SOURCE 200112L
+# else
+# define _POSIX_C_SOURCE 200809L
# endif
+# define __USE_POSIX_IMPLICITLY 1
#endif
#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
@@ -237,6 +283,14 @@
#if (_POSIX_C_SOURCE - 0) >= 200112L
# define __USE_XOPEN2K 1
+# undef __USE_ISOC99
+# define __USE_ISOC99 1
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L
+# define __USE_XOPEN2K8 1
+# undef _ATFILE_SOURCE
+# define _ATFILE_SOURCE 1
#endif
#ifdef _XOPEN_SOURCE
@@ -247,6 +301,9 @@
# undef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# if (_XOPEN_SOURCE - 0) >= 600
+# if (_XOPEN_SOURCE - 0) >= 700
+# define __USE_XOPEN2K8 1
+# endif
# define __USE_XOPEN2K 1
# undef __USE_ISOC99
# define __USE_ISOC99 1
@@ -294,8 +351,6 @@
# define __USE_REENTRANT 1
#endif
-/* uClibc does not support _FORTIFY_SOURCE */
-#undef _FORTIFY_SOURCE
#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \
&& __GNUC_PREREQ (4, 1) && defined __OPTIMIZE__ && __OPTIMIZE__ > 0
# if _FORTIFY_SOURCE > 1
@@ -308,12 +363,14 @@
#endif
/* We do support the IEC 559 math functionality, real and complex. */
+#ifdef __UCLIBC_HAS_FLOATS__
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
+#endif
#ifdef __UCLIBC_HAS_WCHAR__
/* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */
-# define __STDC_ISO_10646__ 200009L
+#define __STDC_ISO_10646__ 200009L
#endif
/* There is an unwholesomely huge amount of code out there that depends on the
@@ -327,14 +384,16 @@
/* This macro indicates that the installed library is the GNU C Library.
For historic reasons the value now is 6 and this will stay from now
on. The use of this variable is deprecated. */
-# undef __GNU_LIBRARY__
-# define __GNU_LIBRARY__ 6
+/* uClibc WARNING: leave these aligned to the left, don't put a space after '#', else
+ * broken apps could fail the check. */
+#undef __GNU_LIBRARY__
+#define __GNU_LIBRARY__ 6
/* Major and minor version number of the GNU C library package. Use
these macros to test for features in specific releases. */
/* Don't do it, if you want to keep uClibc happy. */
-# define __GLIBC__ 2
-# define __GLIBC_MINOR__ 2
+#define __GLIBC__ 2
+#define __GLIBC_MINOR__ 2
#endif
#define __GLIBC_PREREQ(maj, min) \
@@ -360,66 +419,32 @@
__USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
# if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
# define __USE_LARGEFILE 1
+# ifdef __UCLIBC_HAS_LFS__
# define __USE_LARGEFILE64 1
+# endif
# endif
#endif /* !ASSEMBLER */
-/* Decide whether we can define 'extern inline' functions in headers. */
+/* Decide whether we can, and are willing to define extern inline
+ * functions in headers, even if this results in a slightly bigger
+ * code for user programs built against uclibc.
+ * Enabled only in -O2 compiles, not -Os.
+ * uclibc itself is usually built without __USE_EXTERN_INLINES,
+ * remove "&& !defined __OPTIMIZE_SIZE__" part to do otherwise.
+ */
#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \
- && (defined __extern_inline || defined __GNUC_GNU_INLINE__)
+ && (defined __extern_inline || defined __GNUC_GNU_INLINE__ || defined __GNUC_STDC_INLINE__)
# define __USE_EXTERN_INLINES 1
#endif
-
-/* Make sure users large file options agree with uClibc's configuration. */
-#ifndef __UCLIBC_HAS_LFS__
-
-/* If uClibc was built without large file support, output an error if
- * 64-bit file offsets were requested.
- * NOTE: This is probably incorrect on a 64-bit arch... */
-# ifdef __USE_FILE_OFFSET64
-# error It appears you have defined _FILE_OFFSET_BITS=64. Unfortunately, \
-uClibc was built without large file support enabled.
-# endif
-
-/* If uClibc was built without large file support and _LARGEFILE64_SOURCE
- * is defined, undefine it. */
-# ifdef _LARGEFILE64_SOURCE
-# undef _LARGEFILE64_SOURCE
-# undef __USE_LARGEFILE64
-# endif
-
-/* If we're actually building uClibc with large file support,
- * define __USE_LARGEFILE64 and __USE_LARGEFILE. */
-#elif defined _LIBC
-# undef _LARGEFILE_SOURCE
-# undef _LARGEFILE64_SOURCE
-# undef _FILE_OFFSET_BITS
-# undef __USE_LARGEFILE
-# undef __USE_LARGEFILE64
-# undef __USE_FILE_OFFSET64
-# define _LARGEFILE_SOURCE 1
-# define _LARGEFILE64_SOURCE 1
-# define __USE_LARGEFILE 1
-# define __USE_LARGEFILE64 1
-#endif
-
-/* uClibc does not support *at interfaces. */
-#undef _ATFILE_SOURCE
-#undef __USE_ATFILE
-
#ifdef _LIBC
+# ifdef __UCLIBC_HAS_LFS__
+# undef _FILE_OFFSET_BITS
+# undef __USE_FILE_OFFSET64
+# endif
# include <libc-internal.h>
#endif
-/* Some people like to build up uClibc with *-elf toolchains, so
- * a little grease here until we drop '#ifdef __linux__' checks
- * from our source code.
- */
-#ifndef __linux__
-# define __linux__ 1
-#endif
-
#endif /* features.h */
diff --git a/include/fenv.h b/include/fenv.h
index 8a06f024e..9ba384756 100644
--- a/include/fenv.h
+++ b/include/fenv.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 7.6: Floating-point environment <fenv.h>
@@ -73,7 +72,7 @@ extern int feraiseexcept (int __excepts) __THROW;
/* Set complete status for exceptions indicated by EXCEPTS according to
the representation in the object pointed to by FLAGP. */
-extern int fesetexceptflag (__const fexcept_t *__flagp, int __excepts) __THROW;
+extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts) __THROW;
/* Determine which of subset of the exceptions specified by EXCEPTS are
currently set. */
@@ -102,12 +101,12 @@ extern int feholdexcept (fenv_t *__envp) __THROW;
/* Establish the floating-point environment represented by the object
pointed to by ENVP. */
-extern int fesetenv (__const fenv_t *__envp) __THROW;
+extern int fesetenv (const fenv_t *__envp) __THROW;
/* Save current exceptions in temporary storage, install environment
represented by object pointed to by ENVP and raise exceptions
according to saved exceptions. */
-extern int feupdateenv (__const fenv_t *__envp) __THROW;
+extern int feupdateenv (const fenv_t *__envp) __THROW;
/* Include optimization. */
diff --git a/include/fnmatch.h b/include/fnmatch.h
index aefb007fb..d77e4b6b0 100644
--- a/include/fnmatch.h
+++ b/include/fnmatch.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
@@ -23,14 +22,6 @@
extern "C" {
#endif
-#ifndef const
-# if (defined __STDC__ && __STDC__) || defined __cplusplus
-# define __const const
-# else
-# define __const
-# endif
-#endif
-
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
@@ -62,8 +53,9 @@ extern "C" {
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
-extern int fnmatch (__const char *__pattern, __const char *__name,
+extern int fnmatch (const char *__pattern, const char *__name,
int __flags);
+libc_hidden_proto(fnmatch)
#ifdef __cplusplus
}
diff --git a/include/fts.h b/include/fts.h
new file mode 100644
index 000000000..0a070ba8d
--- /dev/null
+++ b/include/fts.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fts.h 8.3 (Berkeley) 8/14/94
+ */
+
+#ifndef _FTS_H
+#define _FTS_H 1
+
+#include <features.h>
+#include <sys/types.h>
+
+/* The fts interface is incompatible with the LFS interface which
+ transparently uses the 64-bit file access functions. */
+#ifdef __USE_FILE_OFFSET64
+# error "<fts.h> cannot be used with -D_FILE_OFFSET_BITS==64"
+#endif
+
+
+typedef struct {
+ struct _ftsent *fts_cur; /* current node */
+ struct _ftsent *fts_child; /* linked list of children */
+ struct _ftsent **fts_array; /* sort array */
+ dev_t fts_dev; /* starting device # */
+ char *fts_path; /* path for this descent */
+ int fts_rfd; /* fd for root */
+ int fts_pathlen; /* sizeof(path) */
+ int fts_nitems; /* elements in the sort array */
+ int (*fts_compar) (const void *, const void *); /* compare fn */
+
+#define FTS_COMFOLLOW 0x0001 /* follow command line symlinks */
+#define FTS_LOGICAL 0x0002 /* logical walk */
+#define FTS_NOCHDIR 0x0004 /* don't change directories */
+#define FTS_NOSTAT 0x0008 /* don't get stat info */
+#define FTS_PHYSICAL 0x0010 /* physical walk */
+#define FTS_SEEDOT 0x0020 /* return dot and dot-dot */
+#define FTS_XDEV 0x0040 /* don't cross devices */
+#define FTS_WHITEOUT 0x0080 /* return whiteout information */
+#define FTS_OPTIONMASK 0x00ff /* valid user option mask */
+
+#define FTS_NAMEONLY 0x0100 /* (private) child names only */
+#define FTS_STOP 0x0200 /* (private) unrecoverable error */
+ int fts_options; /* fts_open options, global flags */
+} FTS;
+
+typedef struct _ftsent {
+ struct _ftsent *fts_cycle; /* cycle node */
+ struct _ftsent *fts_parent; /* parent directory */
+ struct _ftsent *fts_link; /* next file in directory */
+ long fts_number; /* local numeric value */
+ void *fts_pointer; /* local address value */
+ char *fts_accpath; /* access path */
+ char *fts_path; /* root path */
+ int fts_errno; /* errno for this node */
+ int fts_symfd; /* fd for symlink */
+ u_short fts_pathlen; /* strlen(fts_path) */
+ u_short fts_namelen; /* strlen(fts_name) */
+
+ ino_t fts_ino; /* inode */
+ dev_t fts_dev; /* device */
+ nlink_t fts_nlink; /* link count */
+
+#define FTS_ROOTPARENTLEVEL -1
+#define FTS_ROOTLEVEL 0
+ short fts_level; /* depth (-1 to N) */
+
+#define FTS_D 1 /* preorder directory */
+#define FTS_DC 2 /* directory that causes cycles */
+#define FTS_DEFAULT 3 /* none of the above */
+#define FTS_DNR 4 /* unreadable directory */
+#define FTS_DOT 5 /* dot or dot-dot */
+#define FTS_DP 6 /* postorder directory */
+#define FTS_ERR 7 /* error; errno is set */
+#define FTS_F 8 /* regular file */
+#define FTS_INIT 9 /* initialized only */
+#define FTS_NS 10 /* stat(2) failed */
+#define FTS_NSOK 11 /* no stat(2) requested */
+#define FTS_SL 12 /* symbolic link */
+#define FTS_SLNONE 13 /* symbolic link without target */
+#define FTS_W 14 /* whiteout object */
+ u_short fts_info; /* user flags for FTSENT structure */
+
+#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
+#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
+ u_short fts_flags; /* private flags for FTSENT structure */
+
+#define FTS_AGAIN 1 /* read node again */
+#define FTS_FOLLOW 2 /* follow symbolic link */
+#define FTS_NOINSTR 3 /* no instructions */
+#define FTS_SKIP 4 /* discard node */
+ u_short fts_instr; /* fts_set() instructions */
+
+ struct stat *fts_statp; /* stat(2) information */
+ char fts_name[1]; /* file name */
+} FTSENT;
+
+__BEGIN_DECLS
+FTSENT *fts_children (FTS *, int);
+int fts_close (FTS *);
+FTS *fts_open (char * const *, int,
+ int (*)(const FTSENT **, const FTSENT **));
+FTSENT *fts_read (FTS *);
+int fts_set (FTS *, FTSENT *, int) __THROW;
+__END_DECLS
+
+#endif /* fts.h */
diff --git a/include/ftw.h b/include/ftw.h
index 4bdff88c6..528db404d 100644
--- a/include/ftw.h
+++ b/include/ftw.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* X/Open Portability Guide 4.2: ftw.h
@@ -112,55 +111,57 @@ struct FTW
/* Convenient types for callback functions. */
-typedef int (*__ftw_func_t) (__const char *__filename,
- __const struct stat *__status, int __flag);
+typedef int (*__ftw_func_t) (const char *__filename,
+ const struct stat *__status, int __flag);
#ifdef __USE_LARGEFILE64
-typedef int (*__ftw64_func_t) (__const char *__filename,
- __const struct stat64 *__status, int __flag);
+typedef int (*__ftw64_func_t) (const char *__filename,
+ const struct stat64 *__status, int __flag);
#endif
#ifdef __USE_XOPEN_EXTENDED
-typedef int (*__nftw_func_t) (__const char *__filename,
- __const struct stat *__status, int __flag,
+typedef int (*__nftw_func_t) (const char *__filename,
+ const struct stat *__status, int __flag,
struct FTW *__info);
# ifdef __USE_LARGEFILE64
-typedef int (*__nftw64_func_t) (__const char *__filename,
- __const struct stat64 *__status,
+typedef int (*__nftw64_func_t) (const char *__filename,
+ const struct stat64 *__status,
int __flag, struct FTW *__info);
# endif
#endif
+#ifdef __UCLIBC_HAS_FTW__
/* Call a function on every element in a directory tree.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-#ifndef __USE_FILE_OFFSET64
-extern int ftw (__const char *__dir, __ftw_func_t __func, int __descriptors)
+# ifndef __USE_FILE_OFFSET64
+extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors)
__nonnull ((1, 2));
-#else
-# ifdef __REDIRECT
-extern int __REDIRECT (ftw, (__const char *__dir, __ftw_func_t __func,
- int __descriptors), ftw64) __nonnull ((1, 2));
# else
-# define ftw ftw64
+# ifdef __REDIRECT
+extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func,
+ int __descriptors), ftw64) __nonnull ((1, 2));
+# else
+# define ftw ftw64
+# endif
# endif
-#endif
-#ifdef __USE_LARGEFILE64
-extern int ftw64 (__const char *__dir, __ftw64_func_t __func,
+# ifdef __USE_LARGEFILE64
+extern int ftw64 (const char *__dir, __ftw64_func_t __func,
int __descriptors) __nonnull ((1, 2));
+# endif
#endif
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __UCLIBC_HAS_NFTW__ && defined __USE_XOPEN_EXTENDED
/* Call a function on every element in a directory tree. FLAG allows
to specify the behaviour more detailed.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
-extern int nftw (__const char *__dir, __nftw_func_t __func, int __descriptors,
+extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors,
int __flag) __nonnull ((1, 2));
# else
# ifdef __REDIRECT
-extern int __REDIRECT (nftw, (__const char *__dir, __nftw_func_t __func,
+extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func,
int __descriptors, int __flag), nftw64)
__nonnull ((1, 2));
# else
@@ -168,7 +169,7 @@ extern int __REDIRECT (nftw, (__const char *__dir, __nftw_func_t __func,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int nftw64 (__const char *__dir, __nftw64_func_t __func,
+extern int nftw64 (const char *__dir, __nftw64_func_t __func,
int __descriptors, int __flag) __nonnull ((1, 2));
# endif
#endif
diff --git a/include/getopt.h b/include/getopt.h
index a682f9ca8..de9da2686 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -1,4 +1,4 @@
-/* This file will not be installed if not using gnu getopt. */
+/* This file will not be installed if not using getopt_long. */
#include <bits/getopt.h>
diff --git a/include/glob.h b/include/glob.h
index 68ea2cb9c..6d712e56d 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _GLOB_H
#define _GLOB_H 1
@@ -110,13 +109,13 @@ typedef struct
#else
void *(*gl_readdir) (void *);
#endif
- void *(*gl_opendir) (__const char *);
+ void *(*gl_opendir) (const char *);
#ifdef __USE_GNU
- int (*gl_lstat) (__const char *__restrict, struct stat *__restrict);
- int (*gl_stat) (__const char *__restrict, struct stat *__restrict);
+ int (*gl_lstat) (const char *__restrict, struct stat *__restrict);
+ int (*gl_stat) (const char *__restrict, struct stat *__restrict);
#else
- int (*gl_lstat) (__const char *__restrict, void *__restrict);
- int (*gl_stat) (__const char *__restrict, void *__restrict);
+ int (*gl_lstat) (const char *__restrict, void *__restrict);
+ int (*gl_stat) (const char *__restrict, void *__restrict);
#endif
#endif
#endif /* __UCLIBC_HAS_GNU_GLOB__ */
@@ -143,13 +142,13 @@ typedef struct
# else
void *(*gl_readdir) (void *);
# endif
- void *(*gl_opendir) (__const char *);
+ void *(*gl_opendir) (const char *);
# ifdef __USE_GNU
- int (*gl_lstat) (__const char *__restrict, struct stat64 *__restrict);
- int (*gl_stat) (__const char *__restrict, struct stat64 *__restrict);
+ int (*gl_lstat) (const char *__restrict, struct stat64 *__restrict);
+ int (*gl_stat) (const char *__restrict, struct stat64 *__restrict);
# else
- int (*gl_lstat) (__const char *__restrict, void *__restrict);
- int (*gl_stat) (__const char *__restrict, void *__restrict);
+ int (*gl_lstat) (const char *__restrict, void *__restrict);
+ int (*gl_stat) (const char *__restrict, void *__restrict);
# endif
#endif
#endif /* __UCLIBC_HAS_GNU_GLOB__ */
@@ -170,27 +169,31 @@ typedef struct
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2
-extern int glob (__const char *__restrict __pattern, int __flags,
- int (*__errfunc) (__const char *, int),
+extern int glob (const char *__restrict __pattern, int __flags,
+ int (*__errfunc) (const char *, int),
glob_t *__restrict __pglob) __THROW;
+libc_hidden_proto(glob)
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree (glob_t *__pglob) __THROW;
+libc_hidden_proto(globfree)
#else
-extern int __REDIRECT_NTH (glob, (__const char *__restrict __pattern,
+extern int __REDIRECT_NTH (glob, (const char *__restrict __pattern,
int __flags,
- int (*__errfunc) (__const char *, int),
+ int (*__errfunc) (const char *, int),
glob_t *__restrict __pglob), glob64);
extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
#endif
#ifdef __USE_LARGEFILE64
-extern int glob64 (__const char *__restrict __pattern, int __flags,
- int (*__errfunc) (__const char *, int),
+extern int glob64 (const char *__restrict __pattern, int __flags,
+ int (*__errfunc) (const char *, int),
glob64_t *__restrict __pglob) __THROW;
+libc_hidden_proto(glob64)
extern void globfree64 (glob64_t *__pglob) __THROW;
+libc_hidden_proto(globfree64)
#endif
@@ -200,7 +203,8 @@ extern void globfree64 (glob64_t *__pglob) __THROW;
This function is not part of the interface specified by POSIX.2
but several programs want to use it. */
-extern int glob_pattern_p (__const char *__pattern, int __quote) __THROW;
+extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
+libc_hidden_proto(glob_pattern_p)
#endif
__END_DECLS
diff --git a/include/gnu-versions.h b/include/gnu-versions.h
index 59e617c4b..6678c9bc0 100644
--- a/include/gnu-versions.h
+++ b/include/gnu-versions.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _GNU_VERSIONS_H
#define _GNU_VERSIONS_H 1
@@ -44,9 +43,13 @@
remember, if any of these versions change, the libc.so major version
number must change too (so avoid it)! */
+#ifdef __UCLIBC_HAS_OBSTACK__
#define _GNU_OBSTACK_INTERFACE_VERSION 1 /* vs malloc/obstack.c */
+#endif
#define _GNU_REGEX_INTERFACE_VERSION 1 /* vs posix/regex.c */
+#ifdef __UCLIBC_HAS_GNU_GLOB__
#define _GNU_GLOB_INTERFACE_VERSION 1 /* vs posix/glob.c */
+#endif
#define _GNU_GETOPT_INTERFACE_VERSION 2 /* vs posix/getopt.c and
posix/getopt1.c */
diff --git a/include/grp.h b/include/grp.h
index 6ad8be1dd..676100eb0 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 9.2.1 Group Database Access <grp.h>
@@ -92,7 +91,7 @@ extern struct group *fgetgrent (FILE *__stream);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int putgrent (__const struct group *__restrict __p,
+extern int putgrent (const struct group *__restrict __p,
FILE *__restrict __f);
#endif
@@ -106,7 +105,7 @@ extern struct group *getgrgid (__gid_t __gid);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct group *getgrnam (__const char *__name);
+extern struct group *getgrnam (const char *__name);
#if defined __USE_POSIX || defined __USE_MISC
@@ -133,6 +132,7 @@ extern struct group *getgrnam (__const char *__name);
extern int getgrent_r (struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
+libc_hidden_proto(getgrent_r)
# endif
/* Search for an entry with a matching group ID.
@@ -142,15 +142,17 @@ extern int getgrent_r (struct group *__restrict __resultbuf,
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
+libc_hidden_proto(getgrgid_r)
/* Search for an entry with a matching group name.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int getgrnam_r (__const char *__restrict __name,
+extern int getgrnam_r (const char *__restrict __name,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
+libc_hidden_proto(getgrnam_r)
# ifdef __USE_SVID
/* Read a group entry from STREAM. This function is not standardized
@@ -164,32 +166,37 @@ extern int fgetgrent_r (FILE *__restrict __stream,
struct group *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct group **__restrict __result);
+libc_hidden_proto(fgetgrent_r)
# endif
#endif /* POSIX or reentrant */
-#ifdef __USE_BSD
+#if defined __USE_BSD || defined __USE_GNU
# define __need_size_t
# include <stddef.h>
-/* Set the group set for the current user to GROUPS (N of them). */
-extern int setgroups (size_t __n, __const __gid_t *__groups) __THROW;
-
-#if 0
/* Store at most *NGROUPS members of the group set for USER into
*GROUPS. Also include GROUP. The actual number of groups found is
returned in *NGROUPS. Return -1 if the if *NGROUPS is too small.
+ In all cases the actual number of groups is stored in *NGROUPS.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int getgrouplist (__const char *__user, __gid_t __group,
+extern int getgrouplist (const char *__user, __gid_t __group,
__gid_t *__groups, int *__ngroups);
+
#endif
+#if defined __USE_BSD
+
+/* Set the group set for the current user to GROUPS (N of them). */
+extern int setgroups (size_t __n, const __gid_t *__groups) __THROW;
+libc_hidden_proto(setgroups)
+
/* Initialize the group set for the current user
by reading the group database and using all groups
of which USER is a member. Also include GROUP.
@@ -198,7 +205,7 @@ extern int getgrouplist (__const char *__user, __gid_t __group,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int initgroups (__const char *__user, __gid_t __group);
+extern int initgroups (const char *__user, __gid_t __group);
#endif /* Use BSD. */
diff --git a/include/iconv.h b/include/iconv.h
index 0a19c049d..5ab4c6cb9 100644
--- a/include/iconv.h
+++ b/include/iconv.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ICONV_H
#define _ICONV_H 1
@@ -37,9 +36,9 @@ typedef void *iconv_t;
/* Allocate descriptor for code conversion from codeset FROMCODE to
codeset TOCODE.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern iconv_t iconv_open (__const char *__tocode, __const char *__fromcode);
+extern iconv_t iconv_open (const char *__tocode, const char *__fromcode);
/* Convert at most *INBYTESLEFT bytes from *INBUF according to the
code conversion algorithm specified by CD and place up to
@@ -51,7 +50,7 @@ extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
/* Free resources allocated for descriptor CD for code conversion.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int iconv_close (iconv_t __cd);
diff --git a/include/ieee754.h b/include/ieee754.h
index 7131e5de6..43c1a1a56 100644
--- a/include/ieee754.h
+++ b/include/ieee754.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _IEEE754_H
@@ -80,7 +79,7 @@ union ieee754_double
unsigned int mantissa1:32;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
+# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
@@ -106,7 +105,7 @@ union ieee754_double
unsigned int mantissa0:19;
unsigned int mantissa1:32;
#else
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
+# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
@@ -142,7 +141,7 @@ union ieee854_long_double
unsigned int mantissa1:32;
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
+# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
@@ -171,7 +170,7 @@ union ieee854_long_double
unsigned int mantissa1:32;
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
-# if __FLOAT_WORD_ORDER == BIG_ENDIAN
+# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
diff --git a/include/ifaddrs.h b/include/ifaddrs.h
index ba6a1554b..0de7f5d9a 100644
--- a/include/ifaddrs.h
+++ b/include/ifaddrs.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _IFADDRS_H
#define _IFADDRS_H 1
@@ -65,9 +64,11 @@ struct ifaddrs
The storage returned in *IFAP is allocated dynamically and can
only be properly freed by passing it to `freeifaddrs'. */
extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
+libc_hidden_proto(getifaddrs)
/* Reclaim the storage allocated by a previous `getifaddrs' call. */
extern void freeifaddrs (struct ifaddrs *__ifa) __THROW;
+libc_hidden_proto(freeifaddrs)
__END_DECLS
diff --git a/include/internal/parse_config.h b/include/internal/parse_config.h
new file mode 100644
index 000000000..ebfb87e5f
--- /dev/null
+++ b/include/internal/parse_config.h
@@ -0,0 +1,57 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * config file parser helper
+ *
+ * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later.
+ */
+#ifndef __INTERNAL_PARSE_CONFIG_H
+#define __INTERNAL_PARSE_CONFIG_H
+
+#include <stdio.h>
+#ifndef FAST_FUNC
+# define FAST_FUNC
+#endif
+
+/*
+ * Config file parser
+ */
+enum {
+ PARSE_COLLAPSE = 0x00010000, /* treat consecutive delimiters as one */
+ PARSE_TRIM = 0x00020000, /* trim leading and trailing delimiters */
+/* TODO: COLLAPSE and TRIM seem to always go in pair */
+ PARSE_GREEDY = 0x00040000, /* last token takes entire remainder of the line */
+ PARSE_MIN_DIE = 0x00100000, /* die if < min tokens found */
+ /* keep a copy of current line */
+ PARSE_KEEP_COPY = 0x00200000 * 0, /*ENABLE_FEATURE_CROND_D, */
+/* PARSE_ESCAPE = 0x00400000,*/ /* process escape sequences in tokens */
+ /* NORMAL is:
+ * remove leading and trailing delimiters and collapse
+ multiple delimiters into one
+ * warn and continue if less than mintokens delimiters found
+ * grab everything into last token
+ */
+ PARSE_NORMAL = PARSE_COLLAPSE | PARSE_TRIM | PARSE_GREEDY,
+};
+
+typedef struct parser_t {
+ FILE *fp; /* input file */
+ char *data; /* pointer to data */
+ size_t data_len; /* offset into data of begin of line */
+ char *line; /* pointer to beginning of line */
+ size_t line_len; /* length of line */
+ smalluint allocated;
+} parser_t;
+
+parser_t* config_open(const char *filename) FAST_FUNC attribute_hidden;
+libc_hidden_proto(config_open)
+int config_read(parser_t *parser, char ***tokens, unsigned flags, const char *delims) FAST_FUNC attribute_hidden;
+libc_hidden_proto(config_read)
+#define config_read(parser, tokens, max, min, str, flags) \
+ config_read(parser, tokens, ((flags) | (((min) & 0xFF) << 8) | ((max) & 0xFF)), str)
+void config_close(parser_t *parser) FAST_FUNC attribute_hidden;
+libc_hidden_proto(config_close)
+
+#endif /* __INTERNAL_PARSE_CONFIG_H */
diff --git a/include/internal/utmp.h b/include/internal/utmp.h
new file mode 100644
index 000000000..49f96b4d8
--- /dev/null
+++ b/include/internal/utmp.h
@@ -0,0 +1,92 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * internal helper for utmp and utmpx handling
+ *
+ * Copyright (C) 2015 by Bernhard Reutner-Fischer
+ *
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ */
+#ifndef __INTERNAL_UTMP_H
+#define __INTERNAL_UTMP_H
+
+#include <utmpx.h>
+#include <utmp.h>
+
+/* Note: _PATH_UTMPX == _PATH_UTMP */
+
+#if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+/* implement the X and alias the non-X */
+# define __set_unlocked __setutxent_unlocked
+# define set setutxent
+# define __get_unlocked __getutxent_unlocked
+# define get getutxent
+# define end endutxent
+# define __getid_unlocked __getutxid_unlocked
+# define getid getutxid
+# define getline getutxline
+# define putline pututxline
+# define name utmpxname
+# define updw updwtmpx
+# define UT utmpx
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMPX
+# endif
+# if defined __UCLIBC_HAS_UTMP__
+# define other(n,a) strong_alias_untyped(n,a)
+# else
+# define other(n,a) /* nothing */
+# endif
+#elif defined __UCLIBC_HAS_UTMP__
+# define __set_unlocked __setutent_unlocked
+# define set setutent
+# define __get_unlocked __getutent_unlocked
+# define get getutent
+# define end endutent
+# define __getid_unlocked __getutid_unlocked
+# define getid getutid
+# define getline getutline
+# define putline pututline
+# define name utmpname
+# define updw updwtmp
+# define UT utmp
+# ifndef __DEFAULT_PATH_UTMP
+# define __DEFAULT_PATH_UTMP _PATH_UTMP
+# endif
+# define other(n,a) /* nothing */
+#else
+#error You are supposed to either have UTMP or UTMPX or both here
+#endif
+
+/* not used in libc_hidden_proto(setutxent) */
+/* not used in libc_hidden_proto(endutxent) */
+/* not used in libc_hidden_proto(getutxent) */
+/* not used in libc_hidden_proto(getutxid) */
+/* not used in libc_hidden_proto(getutxline) */
+/* not used in libc_hidden_proto(pututxline) */
+/* not used in libc_hidden_proto(utmpxname) */
+/* not used in libc_hidden_proto(updwtmpx) */
+
+/* not used in libc_hidden_proto(setutent) */
+/* not used in libc_hidden_proto(endutent) */
+/* not used in libc_hidden_proto(getutent) */
+/* not used in libc_hidden_proto(getutid) */
+/* not used in libc_hidden_proto(getutline) */
+/* not used in libc_hidden_proto(pututline) */
+/* not used in libc_hidden_proto(utmpname) */
+/* not used in libc_hidden_proto(updwtmp) */
+
+#ifdef IS_IN_libutil
+# if (defined __UCLIBC_HAS_UTMPX__ && defined __UCLIBC_HAS_UTMP__) \
+ || !defined __UCLIBC_HAS_UTMP__
+ /* monkey-patch to use the POSIX interface */
+# define setutent setutxent
+# define getutline getutxline
+# define pututline pututxline
+# define endutent endutxent
+# define updwtmp updwtmpx
+# endif
+#endif /* IS_IN_libutil */
+
+#endif /* __INTERNAL_UTMP_H */
+
diff --git a/include/inttypes.h b/include/inttypes.h
index b1d4302a2..fa6339869 100644
--- a/include/inttypes.h
+++ b/include/inttypes.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2001, 2004, 2007 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99: 7.8 Format conversion of integer types <inttypes.h>
@@ -70,8 +69,8 @@ typedef wchar_t __gwchar_t;
# define PRIdLEAST64 __PRI64_PREFIX "d"
# define PRIdFAST8 "d"
-# define PRIdFAST16 "d"
-# define PRIdFAST32 "d"
+# define PRIdFAST16 __PRIPTR_PREFIX "d"
+# define PRIdFAST32 __PRIPTR_PREFIX "d"
# define PRIdFAST64 __PRI64_PREFIX "d"
@@ -86,8 +85,8 @@ typedef wchar_t __gwchar_t;
# define PRIiLEAST64 __PRI64_PREFIX "i"
# define PRIiFAST8 "i"
-# define PRIiFAST16 "i"
-# define PRIiFAST32 "i"
+# define PRIiFAST16 __PRIPTR_PREFIX "i"
+# define PRIiFAST32 __PRIPTR_PREFIX "i"
# define PRIiFAST64 __PRI64_PREFIX "i"
/* Octal notation. */
@@ -102,8 +101,8 @@ typedef wchar_t __gwchar_t;
# define PRIoLEAST64 __PRI64_PREFIX "o"
# define PRIoFAST8 "o"
-# define PRIoFAST16 "o"
-# define PRIoFAST32 "o"
+# define PRIoFAST16 __PRIPTR_PREFIX "o"
+# define PRIoFAST32 __PRIPTR_PREFIX "o"
# define PRIoFAST64 __PRI64_PREFIX "o"
/* Unsigned integers. */
@@ -118,8 +117,8 @@ typedef wchar_t __gwchar_t;
# define PRIuLEAST64 __PRI64_PREFIX "u"
# define PRIuFAST8 "u"
-# define PRIuFAST16 "u"
-# define PRIuFAST32 "u"
+# define PRIuFAST16 __PRIPTR_PREFIX "u"
+# define PRIuFAST32 __PRIPTR_PREFIX "u"
# define PRIuFAST64 __PRI64_PREFIX "u"
/* lowercase hexadecimal notation. */
@@ -134,8 +133,8 @@ typedef wchar_t __gwchar_t;
# define PRIxLEAST64 __PRI64_PREFIX "x"
# define PRIxFAST8 "x"
-# define PRIxFAST16 "x"
-# define PRIxFAST32 "x"
+# define PRIxFAST16 __PRIPTR_PREFIX "x"
+# define PRIxFAST32 __PRIPTR_PREFIX "x"
# define PRIxFAST64 __PRI64_PREFIX "x"
/* UPPERCASE hexadecimal notation. */
@@ -150,8 +149,8 @@ typedef wchar_t __gwchar_t;
# define PRIXLEAST64 __PRI64_PREFIX "X"
# define PRIXFAST8 "X"
-# define PRIXFAST16 "X"
-# define PRIXFAST32 "X"
+# define PRIXFAST16 __PRIPTR_PREFIX "X"
+# define PRIXFAST32 __PRIPTR_PREFIX "X"
# define PRIXFAST64 __PRI64_PREFIX "X"
@@ -304,25 +303,145 @@ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
__THROW __attribute__ ((__const__));
/* Like `strtol' but convert to `intmax_t'. */
-extern intmax_t strtoimax (__const char *__restrict __nptr,
+extern intmax_t strtoimax (const char *__restrict __nptr,
char **__restrict __endptr, int __base) __THROW;
/* Like `strtoul' but convert to `uintmax_t'. */
-extern uintmax_t strtoumax (__const char *__restrict __nptr,
+extern uintmax_t strtoumax (const char *__restrict __nptr,
char ** __restrict __endptr, int __base) __THROW;
-#if defined __UCLIBC_HAS_WCHAR__ && __UCLIBC_HAS_WCHAR__
+#ifdef __UCLIBC_HAS_WCHAR__
/* Like `wcstol' but convert to `intmax_t'. */
-extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
+extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr,
__gwchar_t **__restrict __endptr, int __base)
__THROW;
/* Like `wcstoul' but convert to `uintmax_t'. */
-extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
+extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr,
__gwchar_t ** __restrict __endptr, int __base)
__THROW;
#endif
+#if 0 /*def __USE_EXTERN_INLINES*/
+
+# if __WORDSIZE == 64
+
+extern long int __strtol_internal (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'. */
+__extern_inline intmax_t
+__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
+ int base))
+{
+ return __strtol_internal (nptr, endptr, base, 0);
+}
+
+extern unsigned long int __strtoul_internal (const char *
+ __restrict __nptr,
+ char ** __restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'. */
+__extern_inline uintmax_t
+__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
+ int base))
+{
+ return __strtoul_internal (nptr, endptr, base, 0);
+}
+
+extern long int __wcstol_internal (const __gwchar_t * __restrict __nptr,
+ __gwchar_t **__restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'. */
+__extern_inline intmax_t
+__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
+ __gwchar_t **__restrict endptr, int base))
+{
+ return __wcstol_internal (nptr, endptr, base, 0);
+}
+
+extern unsigned long int __wcstoul_internal (const __gwchar_t *
+ __restrict __nptr,
+ __gwchar_t **
+ __restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'. */
+__extern_inline uintmax_t
+__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
+ __gwchar_t **__restrict endptr, int base))
+{
+ return __wcstoul_internal (nptr, endptr, base, 0);
+}
+
+# else /* __WORDSIZE == 32 */
+
+__extension__
+extern long long int __strtoll_internal (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `strtol' but convert to `intmax_t'. */
+__extern_inline intmax_t
+__NTH (strtoimax (const char *__restrict nptr, char **__restrict endptr,
+ int base))
+{
+ return __strtoll_internal (nptr, endptr, base, 0);
+}
+
+__extension__
+extern unsigned long long int __strtoull_internal (const char *
+ __restrict __nptr,
+ char **
+ __restrict __endptr,
+ int __base,
+ int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `strtoul' but convert to `uintmax_t'. */
+__extern_inline uintmax_t
+__NTH (strtoumax (const char *__restrict nptr, char **__restrict endptr,
+ int base))
+{
+ return __strtoull_internal (nptr, endptr, base, 0);
+}
+
+__extension__
+extern long long int __wcstoll_internal (const __gwchar_t *
+ __restrict __nptr,
+ __gwchar_t **__restrict __endptr,
+ int __base, int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `wcstol' but convert to `intmax_t'. */
+__extern_inline intmax_t
+__NTH (wcstoimax (const __gwchar_t *__restrict nptr,
+ __gwchar_t **__restrict endptr, int base))
+{
+ return __wcstoll_internal (nptr, endptr, base, 0);
+}
+
+
+__extension__
+extern unsigned long long int __wcstoull_internal (const __gwchar_t *
+ __restrict __nptr,
+ __gwchar_t **
+ __restrict __endptr,
+ int __base,
+ int __group)
+ __THROW __nonnull ((1)) __wur;
+/* Like `wcstoul' but convert to `uintmax_t'. */
+__extern_inline uintmax_t
+__NTH (wcstoumax (const __gwchar_t *__restrict nptr,
+ __gwchar_t **__restrict endptr, int base))
+{
+ return __wcstoull_internal (nptr, endptr, base, 0);
+}
+
+# endif /* __WORDSIZE == 32 */
+#endif /* Use extern inlines. */
+
__END_DECLS
#endif /* inttypes.h */
diff --git a/include/langinfo.h b/include/langinfo.h
index 12f008046..94a4d7e75 100644
--- a/include/langinfo.h
+++ b/include/langinfo.h
@@ -1,5 +1,5 @@
/* Access to locale-dependent parameters.
- Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2003,2004,2005,2009 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LANGINFO_H
#define _LANGINFO_H 1
@@ -32,13 +31,20 @@ __BEGIN_DECLS
(LC_*) and an item index within the category. Some code may depend on
the item values within a category increasing monotonically with the
indices. */
+#if 0
+#define _NL_ITEM(category, index) (((category) << 16) | (index))
+
+/* Extract the category and item index from a constructed `nl_item' value. */
+#define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16)
+#define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff)
+#else
#define _NL_ITEM(category, index) \
(((category) << __NL_ITEM_CATEGORY_SHIFT) | (index))
/* Extract the category and item index from a constructed `nl_item' value. */
#define _NL_ITEM_CATEGORY(item) ((int) (item) >> __NL_ITEM_CATEGORY_SHIFT)
#define _NL_ITEM_INDEX(item) ((int) (item) & __NL_ITEM_INDEX_MASK)
-
+#endif
/* Enumeration of locale items that can be queried with `nl_langinfo'. */
enum
@@ -312,6 +318,9 @@ enum
_NL_CTYPE_INDIGITS8_WC,
_NL_CTYPE_INDIGITS9_WC,
_NL_CTYPE_OUTDIGIT0_MB,
+#else
+ _NL_CTYPE_OUTDIGIT0_MB = _NL_ITEM (__LC_CTYPE, 0),
+#endif
_NL_CTYPE_OUTDIGIT1_MB,
_NL_CTYPE_OUTDIGIT2_MB,
_NL_CTYPE_OUTDIGIT3_MB,
@@ -321,6 +330,7 @@ enum
_NL_CTYPE_OUTDIGIT7_MB,
_NL_CTYPE_OUTDIGIT8_MB,
_NL_CTYPE_OUTDIGIT9_MB,
+#if 0
_NL_CTYPE_OUTDIGIT0_WC,
_NL_CTYPE_OUTDIGIT1_WC,
_NL_CTYPE_OUTDIGIT2_WC,
@@ -340,6 +350,8 @@ enum
_NL_CTYPE_TRANSLIT_DEFAULT_MISSING,
_NL_CTYPE_TRANSLIT_IGNORE_LEN,
_NL_CTYPE_TRANSLIT_IGNORE,
+ _NL_CTYPE_MAP_TO_NONASCII,
+ _NL_CTYPE_NONASCII_CASE,
_NL_CTYPE_EXTRA_MAP_1,
_NL_CTYPE_EXTRA_MAP_2,
_NL_CTYPE_EXTRA_MAP_3,
@@ -354,17 +366,7 @@ enum
_NL_CTYPE_EXTRA_MAP_12,
_NL_CTYPE_EXTRA_MAP_13,
_NL_CTYPE_EXTRA_MAP_14,
-#else /* 0 */
- _NL_CTYPE_OUTDIGIT0_MB = _NL_ITEM (__LC_CTYPE, 0),
- _NL_CTYPE_OUTDIGIT1_MB,
- _NL_CTYPE_OUTDIGIT2_MB,
- _NL_CTYPE_OUTDIGIT3_MB,
- _NL_CTYPE_OUTDIGIT4_MB,
- _NL_CTYPE_OUTDIGIT5_MB,
- _NL_CTYPE_OUTDIGIT6_MB,
- _NL_CTYPE_OUTDIGIT7_MB,
- _NL_CTYPE_OUTDIGIT8_MB,
- _NL_CTYPE_OUTDIGIT9_MB,
+#else /* 0 */
_NL_CTYPE_CODESET_NAME, /* uClibc note: MUST BE LAST ENTRY!!! */
CODESET = _NL_CTYPE_CODESET_NAME,
#define CODESET CODESET
@@ -434,6 +436,10 @@ enum
#ifdef __USE_GNU
# define N_SIGN_POSN __N_SIGN_POSN
#endif
+#if 0 /* moved below for some reason on uClibc */
+ _NL_MONETARY_CRNCYSTR,
+#define CRNCYSTR _NL_MONETARY_CRNCYSTR
+#endif
__INT_P_CS_PRECEDES,
#ifdef __USE_GNU
# define INT_P_CS_PRECEDES __INT_P_CS_PRECEDES
@@ -458,10 +464,10 @@ enum
#ifdef __USE_GNU
# define INT_N_SIGN_POSN __INT_N_SIGN_POSN
#endif
-
+#if 1 /* moved here from above */
_NL_MONETARY_CRNCYSTR,
#define CRNCYSTR _NL_MONETARY_CRNCYSTR
-
+#endif
#if 0
_NL_MONETARY_DUO_INT_CURR_SYMBOL,
_NL_MONETARY_DUO_CURRENCY_SYMBOL,
@@ -591,10 +597,18 @@ enum
_NL_IDENTIFICATION_CODESET,
_NL_NUM_LC_IDENTIFICATION,
#endif
+
/* This marks the highest value used. */
_NL_NUM
};
+/* This macro produces an item you can pass to `nl_langinfo' or
+ `nl_langinfo_l' to get the name of the locale in use for CATEGORY. */
+#define _NL_LOCALE_NAME(category) _NL_ITEM ((category), -1)
+#ifdef __USE_GNU
+# define NL_LOCALE_NAME(category) _NL_LOCALE_NAME (category)
+#endif
+
/* Return the current locale's value for ITEM.
If ITEM is invalid, an empty string is returned.
@@ -603,10 +617,10 @@ enum
it is usually in read-only memory and cannot be modified. */
extern char *nl_langinfo (nl_item __item) __THROW;
+libc_hidden_proto(nl_langinfo)
-#ifdef __UCLIBC_HAS_XLOCALE__
-#ifdef __USE_GNU
+#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_XLOCALE__
/* This interface is for the extended locale model. See <locale.h> for
more information. */
@@ -614,8 +628,8 @@ extern char *nl_langinfo (nl_item __item) __THROW;
# include <xlocale.h>
/* Just like nl_langinfo but get the information from the locale object L. */
-extern char *nl_langinfo_l (nl_item __item, __locale_t l);
-#endif
+extern char *nl_langinfo_l (nl_item __item, __locale_t __l);
+libc_hidden_proto(nl_langinfo_l)
#endif
__END_DECLS
diff --git a/include/libc-internal.h b/include/libc-internal.h
index 7b2566f74..87af07cc5 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LIBC_INTERNAL_H
#define _LIBC_INTERNAL_H 1
@@ -27,8 +26,11 @@
# define attribute_relro
#endif
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#ifdef __UCLIBC_HAS_TLS__
# define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
+#else
+# define attribute_tls_model_ie
+# define __thread
#endif
/* Pull in things like __attribute_used__ */
@@ -44,10 +46,12 @@
# include <stddef.h>
/* sources are built w/ _GNU_SOURCE, this gets undefined */
-#ifdef __USE_GNU
-extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
-#else
+#if defined __USE_XOPEN2K && !defined __USE_GNU
extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
+libc_hidden_proto(__glibc_strerror_r)
+#else
+extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
+libc_hidden_proto(__xpg_strerror_r)
#endif
/* #include <pthread.h> */
@@ -63,38 +67,27 @@ extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
/* internal access to program name */
extern const char *__uclibc_progname attribute_hidden;
-# endif /* IS_IN_libc */
+# ifdef __UCLIBC_HAS_FORTIFY__
+extern void __chk_fail(void) attribute_noreturn;
+libc_hidden_proto(__chk_fail)
+# endif
-/* #include <alloca.h> */
-#include <bits/stackinfo.h>
-#if defined(_STACK_GROWS_DOWN)
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = (newlen); \
- char *__newbuf = alloca (__newlen); \
- if (__newbuf + __newlen == (char *) buf) \
- len += __newlen; \
- else \
- len = __newlen; \
- __newbuf; })
-#elif defined(_STACK_GROWS_UP)
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = (newlen); \
- char *__newbuf = alloca (__newlen); \
- char *__buf = (buf); \
- if (__buf + __newlen == __newbuf) \
- { \
- len += __newlen; \
- __newbuf = __buf; \
- } \
- else \
- len = __newlen; \
- __newbuf; })
-#else
-# warning unknown stack
-# define extend_alloca(buf, len, newlen) \
- alloca (((len) = (newlen)))
-#endif
+# ifdef __UCLIBC_HAS_SSP__
+extern void __stack_chk_fail(void) attribute_noreturn __cold;
+# endif
+
+# endif /* IS_IN_libc */
#endif /* __ASSEMBLER__ */
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+/* Some people like to build up uClibc with *-elf toolchains, so
+ * a little grease here until we drop '#ifdef __linux__' checks
+ * from our source code.
+ */
+#ifndef __linux__
+# define __linux__ 1
+#endif
+
#endif /* _LIBC_INTERNAL_H */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index e491aff5f..fc129db5d 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -15,9 +15,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LIBC_SYMBOLS_H
#define _LIBC_SYMBOLS_H 1
@@ -39,7 +38,6 @@
It should define for us the following symbols:
* HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
- * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
* ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type,
or leave it undefined if there is no .type directive.
* HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
@@ -63,6 +61,21 @@
#ifndef unlikely
# define unlikely(x) __builtin_expect((!!(x)),0)
#endif
+#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+# ifndef __cold
+# define __cold __attribute__ ((__cold__))
+# endif
+# ifndef __hot
+# define __hot __attribute__ ((__hot__))
+# endif
+#else
+# ifndef __cold
+# define __cold
+# endif
+# ifndef __hot
+# define __hot
+# endif
+#endif
#ifndef __LINUX_COMPILER_H
# define __LINUX_COMPILER_H
#endif
@@ -70,6 +83,12 @@
# define __cast__(_to)
#endif
+#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+# define attribute_optimize(x) __attribute__ ((optimize(x)))
+#else
+# define attribute_optimize(x)
+#endif
+
#define attribute_unused __attribute__ ((unused))
#if defined __GNUC__ || defined __ICC
@@ -78,22 +97,28 @@
# define attribute_noreturn
#endif
+#define libc_freeres_ptr(decl) \
+ __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
+ decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
+#define __libc_freeres_fn_section \
+ __attribute__ ((section ("__libc_freeres_fn")))
+
#ifndef NOT_IN_libc
# define IS_IN_libc 1
#endif
+/* Indirect stringification. Doing two levels allows
+ * the parameter to be a macro itself.
+ */
+#define __stringify_1(x...) #x
+#define __stringify(x) __stringify_1(x)
+
#ifdef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
# define HAVE_ASM_SET_DIRECTIVE
#else
# undef HAVE_ASM_SET_DIRECTIVE
#endif
-#ifdef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-# define ASM_GLOBAL_DIRECTIVE __UCLIBC_ASM_GLOBAL_DIRECTIVE__
-#else
-# define ASM_GLOBAL_DIRECTIVE .global
-#endif
-
#ifdef __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
# define HAVE_ASM_WEAK_DIRECTIVE
#else
@@ -106,10 +131,10 @@
# undef HAVE_ASM_WEAKEXT_DIRECTIVE
#endif
-#ifdef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
-# define HAVE_ASM_GLOBAL_DOT_NAME
+#ifdef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
+# define HAVE_ASM_CFI_DIRECTIVES
#else
-# undef HAVE_ASM_GLOBAL_DOT_NAME
+# undef HAVE_ASM_CFI_DIRECTIVES
#endif
#if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE
@@ -131,17 +156,6 @@
# define ASM_LINE_SEP ;
#endif
-#ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# ifndef C_SYMBOL_DOT_NAME
-# if defined __GNUC__ && defined __GNUC_MINOR__ \
- && (__GNUC__ << 16) + __GNUC_MINOR__ >= (3 << 16) + 1
-# define C_SYMBOL_DOT_NAME(name) .name
-# else
-# define C_SYMBOL_DOT_NAME(name) .##name
-# endif
-# endif
-#endif
-
#ifndef __ASSEMBLER__
/* GCC understands weak symbols and aliases; use its interface where
possible, instead of embedded assembly language. */
@@ -150,13 +164,19 @@
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
+/* Same, but does not check for type match. Use sparingly.
+ Example: strong_alias(stat,stat64) may fail, this one works: */
+# define strong_alias_untyped(name, aliasname) \
+ _strong_alias_untyped(name, aliasname)
+# define _strong_alias_untyped(name, aliasname) \
+ extern __typeof (aliasname) aliasname __attribute__ ((alias (#name)));
+
+# ifdef HAVE_WEAK_SYMBOLS
/* This comes between the return type and function name in
a function definition to make that definition weak. */
-# define weak_function __attribute__ ((weak))
-# define weak_const_function __attribute__ ((weak, __const__))
-
-# ifdef HAVE_WEAK_SYMBOLS
+# define weak_function __attribute__ ((weak))
+# define weak_const_function __attribute__ ((weak, __const__))
/* Define ALIASNAME as a weak alias for NAME.
If weak aliases are not available, this defines a strong alias. */
@@ -170,6 +190,9 @@
# else
+# define weak_function /* empty */
+# define weak_const_function __attribute__ ((__const__))
+
# define weak_alias(name, aliasname) strong_alias(name, aliasname)
# define weak_extern(symbol) /* Nothing. */
@@ -178,81 +201,37 @@
#else /* __ASSEMBLER__ */
# ifdef HAVE_ASM_SET_DIRECTIVE
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original)
-# define strong_data_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
-# else
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
-# define strong_data_alias(original, alias) strong_alias(original, alias)
-# endif
+# define strong_alias(original, alias) \
+ .globl C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ .set C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
+# define strong_data_alias(original, alias) strong_alias(original, alias)
# else
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# define strong_data_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# else
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# define strong_data_alias(original, alias) strong_alias(original, alias)
-# endif
+# define strong_alias(original, alias) \
+ .globl C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
+# define strong_data_alias(original, alias) strong_alias(original, alias)
# endif
-# ifdef HAVE_WEAK_SYMBOLS
-# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define weak_alias(original, alias) \
- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \
- .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
-# else
-# define weak_alias(original, alias) \
- .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# endif
-# define weak_extern(symbol) \
- .weakext C_SYMBOL_NAME (symbol)
+# ifdef HAVE_WEAK_SYMBOLS
+# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
+# define weak_alias(original, alias) \
+ .weakext C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
+# define weak_extern(symbol) \
+ .weakext C_SYMBOL_NAME(symbol)
# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
# ifdef HAVE_ASM_SET_DIRECTIVE
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \
- .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
-# else
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# endif
+# define weak_alias(original, alias) \
+ .weak C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ .set C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
# else /* ! HAVE_ASM_SET_DIRECTIVE */
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
- .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# else
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# endif
+# define weak_alias(original, alias) \
+ .weak C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
# endif
-# define weak_extern(symbol) \
- .weak C_SYMBOL_NAME (symbol)
+# define weak_extern(symbol) \
+ .weak C_SYMBOL_NAME(symbol)
# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
@@ -264,6 +243,7 @@
#endif /* __ASSEMBLER__ */
+
/* On some platforms we can make internal function calls (i.e., calls of
functions not exported) a bit faster by using a different calling
convention. */
@@ -271,18 +251,21 @@
# define internal_function /* empty */
#endif
+
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
#define __make_section_unallocated(section_string) \
__asm__ (".section " section_string "\n\t.previous");
+
/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
section attributes on what looks like a comment to the assembler. */
-#ifdef __sparc__ //HAVE_SECTION_QUOTES
+#ifdef __sparc__ /* HAVE_SECTION_QUOTES */
# define __sec_comment "\"\n#APP\n\t#\""
#else
# define __sec_comment "\n#APP\n\t#"
#endif
+
/* When a reference to SYMBOL is encountered, the linker will emit a
warning message MSG. */
#define link_warning(symbol, msg) \
@@ -296,8 +279,7 @@
#ifdef SHARED
# define INTUSE(name) name##_internal
# define INTDEF(name) strong_alias (name, name##_internal)
-# define INTVARDEF(name) \
- _INTVARDEF (name, name##_internal)
+# define INTVARDEF(name) _INTVARDEF (name, name##_internal)
# if defined HAVE_VISIBILITY_ATTRIBUTE
# define _INTVARDEF(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name), \
@@ -316,65 +298,61 @@
# define INTVARDEF2(name, newname)
#endif
+
/* The following macros are used for PLT bypassing within libc.so
(and if needed other libraries similarly).
- First of all, you need to have the function prototyped somewhere,
- say in foo/foo.h:
-
- int foo (int __bar);
If calls to foo within libc.so should always go to foo defined in libc.so,
then in include/foo.h you add:
- libc_hidden_proto (foo)
+ int foo(int __bar);
+ libc_hidden_proto(foo)
line and after the foo function definition:
- int foo (int __bar)
- {
+ int foo(int __bar) {
return __bar;
}
- libc_hidden_def (foo)
+ libc_hidden_def(foo)
or
- int foo (int __bar)
- {
+ int foo(int __bar) {
return __bar;
}
- libc_hidden_weak (foo)
+ libc_hidden_weak(foo)
- Similarly for global data. If references to foo within libc.so should
- always go to foo defined in libc.so, then in include/foo.h you add:
+ Similarly for global data: if references to foo within libc.so
+ should always go to foo defined in libc.so, then in include/foo.h:
- libc_hidden_proto (foo)
+ extern int foo;
+ libc_hidden_proto(foo)
- line and after foo's definition:
+ and after foo's definition:
int foo = INITIAL_FOO_VALUE;
- libc_hidden_data_def (foo)
+ libc_hidden_data_def(foo)
or
int foo = INITIAL_FOO_VALUE;
- libc_hidden_data_weak (foo)
+ libc_hidden_data_weak(foo)
If foo is normally just an alias (strong or weak) to some other function,
you should use the normal strong_alias first, then add libc_hidden_def
or libc_hidden_weak:
- int baz (int __bar)
- {
+ int baz(int __bar) {
return __bar;
}
- strong_alias (baz, foo)
- libc_hidden_weak (foo)
+ strong_alias(baz, foo)
+ libc_hidden_weak(foo)
If the function should be internal to multiple objects, say ld.so and
libc.so, the best way is to use:
#if !defined NOT_IN_libc || defined IS_IN_rtld
- hidden_proto (foo)
+ hidden_proto(foo)
#endif
in include/foo.h and the normal macros at all function definitions
@@ -383,100 +361,95 @@
If versioned_symbol macro is used to define foo,
libc_hidden_ver macro should be used, as in:
- int __real_foo (int __bar)
- {
+ int __real_foo(int __bar) {
return __bar;
}
- versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
- libc_hidden_ver (__real_foo, foo) */
+ versioned_symbol(libc, __real_foo, foo, GLIBC_2_1);
+ libc_hidden_ver(__real_foo, foo)
+ */
/* uClibc specific (the above comment was copied from glibc):
- * a. when ppc64 will be supported, we need changes to support:
+ *
+ * when ppc64 will be supported, we need changes to support
* strong_data_alias (used by asm hidden_data_def)
- * b. libc_hidden_proto(foo) should be added after the header having foo's prototype
- * or after extern foo... to all source files that should use the internal version
- * of foo within libc, even to the file defining foo itself, libc_hidden_def does
- * not hide __GI_foo itself, although the name suggests it (hiding is done exclusively
- * by libc_hidden_proto). The reasoning to have it after the header w/ foo's prototype is
- * to get first the __REDIRECT from original header and then create the __GI_foo alias
- * c. no versioning support, hidden[_data]_ver are noop
- * d. hidden_def() in asm is _hidden_strong_alias (not strong_alias) */
-
-/* Arrange to hide uClibc internals */
-#if (defined __GNUC__ && \
- (defined __GNUC_MINOR__ && ( __GNUC__ >= 3 && __GNUC_MINOR__ >= 3 ) \
- || __GNUC__ >= 4)) || defined __ICC
+ *
+ * no versioning support, hidden[_data]_ver are noop
+ *
+ * hidden_def() in asm is _hidden_strong_alias (not strong_alias)
+ *
+ * libc_hidden_proto(foo) should be added after declaration
+ * in the header, or after extern foo... in all source files
+ * (this is discouraged).
+ * libc_hidden_def does not hide __GI_foo itself, although the name
+ * suggests it (hiding is done exclusively by libc_hidden_proto).
+
+FIXME! - ?
+ * The reasoning to have it after the header w/ foo's prototype is
+ * to get first the __REDIRECT from original header and then create
+ * the __GI_foo alias
+
+ * Hunt for references which still go through PLT (example for x86):
+ * build shared lib, then disassemble it and search for <xxx@plt>:
+ * $ objdump -drx libuClibc-*.so >disasm.txt
+ * $ grep -F '@plt>:' disasm.txt
+ *
+ * In uclibc, malloc/free and related functions should be called
+ * through PLT (making it possible to use alternative malloc),
+ * and possibly some __pthread_xxx functions can be called through PLT
+ * (why?). The rest should not use PLT.
+ */
+
+#if (defined __GNUC__ && defined __GNUC_MINOR__ \
+ && (( __GNUC__ >= 3 && __GNUC_MINOR__ >= 3) || __GNUC__ >= 4) \
+ ) || defined __ICC
# define attribute_hidden __attribute__ ((visibility ("hidden")))
+# define attribute_protected __attribute__ ((visibility ("protected")))
# define __hidden_proto_hiddenattr(attrs...) __attribute__ ((visibility ("hidden"), ##attrs))
#else
# define attribute_hidden
+# define attribute_protected
# define __hidden_proto_hiddenattr(attrs...)
#endif
#if /*!defined STATIC &&*/ !defined __BCC__
+
# ifndef __ASSEMBLER__
-# define hidden_proto(name, attrs...) __hidden_proto (name, __GI_##name, ##attrs)
+# define hidden_proto(name, attrs...) __hidden_proto(name, __GI_##name, ##attrs)
# define __hidden_proto(name, internal, attrs...) \
- extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
- __hidden_proto_hiddenattr (attrs);
+ extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
+ __hidden_proto_hiddenattr (attrs);
# define __hidden_asmname(name) __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
# define __hidden_ver1(local, internal, name) \
- extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
- extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
+ extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
+ extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
# define hidden_data_ver(local, name) hidden_ver(local, name)
# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
# define hidden_data_def(name) hidden_def(name)
-# define hidden_weak(name) \
+# define hidden_weak(name) \
__hidden_ver1(__GI_##name, name, name) __attribute__((weak));
# define hidden_data_weak(name) hidden_weak(name)
# else /* __ASSEMBLER__ */
-# ifdef HAVE_ASM_SET_DIRECTIVE
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define _hidden_strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original)
-# else
-# define _hidden_strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
-# endif
-# else
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define _hidden_strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# else
-# define _hidden_strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
-# endif
-# endif
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define _hidden_weak_alias(original, alias) \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .hidden C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- weak_alias(original, alias)
-# else
-# define _hidden_weak_alias(original, alias) \
- .hidden C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- weak_alias(original, alias)
+# ifdef HAVE_ASM_SET_DIRECTIVE
+# define _hidden_strong_alias(original, alias) \
+ .globl C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ .hidden C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ .set C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
+# else /* dont have .set directive */
+# define _hidden_strong_alias(original, alias) \
+ .globl C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ .hidden C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
# endif
+# define _hidden_weak_alias(original, alias) \
+ .hidden C_SYMBOL_NAME(alias) ASM_LINE_SEP \
+ weak_alias(original, alias)
+
/* For assembly, we need to do the opposite of what we do in C:
in assembly gcc __REDIRECT stuff is not in place, so functions
are defined by its normal name and we need to create the
@@ -492,25 +465,25 @@
# define hidden_data_def(name) _hidden_strong_alias (name, __GI_##name)
# define hidden_data_weak(name) _hidden_weak_alias (name, __GI_##name)
# define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define HIDDEN_JUMPTARGET(name) .__GI_##name
-# else
-# define HIDDEN_JUMPTARGET(name) __GI_##name
-# endif
+# define HIDDEN_JUMPTARGET(name) __GI_##name
# endif /* __ASSEMBLER__ */
-#else /* SHARED */
+
+#else /* not SHARED */
+
# ifndef __ASSEMBLER__
# define hidden_proto(name, attrs...)
# else
# define HIDDEN_JUMPTARGET(name) name
-# endif /* Not __ASSEMBLER__ */
+# endif /* not __ASSEMBLER__ */
# define hidden_weak(name)
# define hidden_def(name)
# define hidden_ver(local, name)
# define hidden_data_weak(name)
# define hidden_data_def(name)
# define hidden_data_ver(local, name)
-#endif /* SHARED */
+
+#endif /* SHARED / not SHARED */
+
/* uClibc does not support versioning yet. */
#define versioned_symbol(lib, local, symbol, version) /* weak_alias(local, symbol) */
diff --git a/include/libgen.h b/include/libgen.h
index b25254357..0a40c43f0 100644
--- a/include/libgen.h
+++ b/include/libgen.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LIBGEN_H
#define _LIBGEN_H 1
diff --git a/include/libintl.h b/include/libintl.h
index ba57f1698..0cbf758ed 100644
--- a/include/libintl.h
+++ b/include/libintl.h
@@ -14,15 +14,16 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LIBINTL_H
#define _LIBINTL_H 1
#include <features.h>
+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+
/* We define an additional symbol to signal that we use the GNU
implementation of gettext. */
#define __USE_GNU_GETTEXT 1
@@ -34,54 +35,49 @@
__BEGIN_DECLS
-#ifdef __UCLIBC_MJN3_ONLY__
-#warning "mjn3 FIXME: gettext has a prototype but isn't defined."
-#warning "mjn3 FIXME: __OPTIMIZE__ is never defined."
-#endif
-
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
-extern char *gettext (__const char *__msgid)
+extern char *gettext (const char *__msgid)
__THROW __attribute_format_arg__ (1);
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
-extern char *dgettext (__const char *__domainname, __const char *__msgid)
+extern char *dgettext (const char *__domainname, const char *__msgid)
__THROW __attribute_format_arg__ (2);
#if 0 /* uClibc: disabled */
-extern char *__dgettext (__const char *__domainname, __const char *__msgid)
+extern char *__dgettext (const char *__domainname, const char *__msgid)
__THROW __attribute_format_arg__ (2);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
-extern char *dcgettext (__const char *__domainname,
- __const char *__msgid, int __category)
+extern char *dcgettext (const char *__domainname,
+ const char *__msgid, int __category)
__THROW __attribute_format_arg__ (2);
#if 0 /* uClibc: disabled */
-extern char *__dcgettext (__const char *__domainname,
- __const char *__msgid, int __category)
+extern char *__dcgettext (const char *__domainname,
+ const char *__msgid, int __category)
__THROW __attribute_format_arg__ (2);
#endif
/* Similar to `gettext' but select the plural form corresponding to the
number N. */
-extern char *ngettext (__const char *__msgid1, __const char *__msgid2,
+extern char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
__THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
/* Similar to `dgettext' but select the plural form corresponding to the
number N. */
-extern char *dngettext (__const char *__domainname, __const char *__msgid1,
- __const char *__msgid2, unsigned long int __n)
+extern char *dngettext (const char *__domainname, const char *__msgid1,
+ const char *__msgid2, unsigned long int __n)
__THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
/* Similar to `dcgettext' but select the plural form corresponding to the
number N. */
-extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
- __const char *__msgid2, unsigned long int __n,
+extern char *dcngettext (const char *__domainname, const char *__msgid1,
+ const char *__msgid2, unsigned long int __n,
int __category)
__THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
@@ -89,17 +85,17 @@ extern char *dcngettext (__const char *__domainname, __const char *__msgid1,
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
-extern char *textdomain (__const char *__domainname) __THROW;
+extern char *textdomain (const char *__domainname) __THROW;
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
-extern char *bindtextdomain (__const char *__domainname,
- __const char *__dirname) __THROW;
+extern char *bindtextdomain (const char *__domainname,
+ const char *__dirname) __THROW;
/* Specify the character encoding in which the messages from the
DOMAINNAME message catalog will be returned. */
-extern char *bind_textdomain_codeset (__const char *__domainname,
- __const char *__codeset) __THROW;
+extern char *bind_textdomain_codeset (const char *__domainname,
+ const char *__codeset) __THROW;
/* Optimized version of the function above. */
@@ -130,4 +126,15 @@ extern char *bind_textdomain_codeset (__const char *__domainname,
__END_DECLS
+#else
+
+#define gettext(msgid) ((const char *) (msgid))
+
+#endif /* __UCLIBC_HAS_GETTEXT_AWARENESS__ */
+
+#ifdef _LIBC
+# define _(x) gettext(x)
+# define N_(x) x
+#endif
+
#endif /* libintl.h */
diff --git a/include/limits.h b/include/limits.h
index 45cd6f253..c274dd492 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2005
+ 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types <limits.h>
@@ -122,20 +122,20 @@
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
/* `_GCC_LIMITS_H_' is what GCC's file defines. */
# include_next <limits.h>
+#endif
/* The <limits.h> files in some gcc versions don't define LLONG_MIN,
LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for
ages are available. */
-# ifdef __USE_ISOC99
-# ifndef LLONG_MIN
-# define LLONG_MIN LONG_LONG_MIN
-# endif
-# ifndef LLONG_MAX
-# define LLONG_MAX LONG_LONG_MAX
-# endif
-# ifndef ULLONG_MAX
-# define ULLONG_MAX ULONG_LONG_MAX
-# endif
+#if defined __USE_ISOC99 && defined __GNUC__
+# ifndef LLONG_MIN
+# define LLONG_MIN (-LLONG_MAX-1)
+# endif
+# ifndef LLONG_MAX
+# define LLONG_MAX __LONG_LONG_MAX__
+# endif
+# ifndef ULLONG_MAX
+# define ULLONG_MAX (LLONG_MAX * 2ULL + 1)
# endif
#endif
diff --git a/include/link.h b/include/link.h
index 6ce15df5f..711777bae 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
/* Data structure for communication from the run-time dynamic linker for
loaded ELF shared objects.
- Copyright (C) 1995-2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2001, 2004, 2005, 2006, 2010 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
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _LINK_H
#define _LINK_H 1
@@ -27,7 +26,7 @@
#include <dlfcn.h>
#endif
#include <sys/types.h>
-#if defined _LIBC && defined __UCLIBC_HAS_THREADS_NATIVE__
+#if defined _LIBC && defined __UCLIBC_HAS_TLS__
#include <tls.h>
#endif
@@ -80,9 +79,12 @@ extern struct r_debug _r_debug;
*/
extern ElfW(Dyn) _DYNAMIC[];
-#ifdef __FDPIC__
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
# include <bits/elf-fdpic.h>
#endif
+#ifdef __DSBT__
+# include <bits/elf-dsbt.h>
+#endif
/* Structure describing a loaded shared object. The `l_next' and `l_prev'
members form a chain of all the shared objects loaded at startup.
@@ -95,16 +97,20 @@ struct link_map
/* These first few members are part of the protocol with the debugger.
This is the same format used in SVR4. */
-#ifdef __FDPIC__
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
struct elf32_fdpic_loadaddr l_addr;
#else
+#ifdef __DSBT__
+ struct elf32_dsbt_loadaddr l_addr;
+#else
ElfW(Addr) l_addr; /* Base address shared object is loaded at. */
#endif
+#endif
char *l_name; /* Absolute file name object was found in. */
ElfW(Dyn) *l_ld; /* Dynamic section of the shared object. */
struct link_map *l_next, *l_prev; /* Chain of loaded objects. */
-
-#ifdef USE_TLS
+#ifdef _LIBC
+#if defined(USE_TLS) && USE_TLS
/* Thread-local storage related info. */
/* Start of the initialization image. */
@@ -126,6 +132,9 @@ struct link_map
size_t l_tls_modid;
/* Nonzero if _dl_init_static_tls should be called for this module */
unsigned int l_need_tls_init:1;
+ /* Address of TLS descriptor hash table. */
+ void *l_tlsdesc_table;
+#endif
#endif
};
@@ -175,11 +184,15 @@ enum
struct dl_phdr_info
{
-#ifdef __FDPIC__
+#if defined(__FRV_FDPIC__) || defined(__BFIN_FDPIC__)
struct elf32_fdpic_loadaddr dlpi_addr;
#else
+#ifdef __DSBT__
+ struct elf32_dsbt_loadaddr dlpi_addr;
+#else
ElfW(Addr) dlpi_addr;
#endif
+#endif
const char *dlpi_name;
const ElfW(Phdr) *dlpi_phdr;
ElfW(Half) dlpi_phnum;
diff --git a/include/locale.h b/include/locale.h
index c708d4435..3cd6f5ef3 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,95-99,2000,01,02 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995-2002,2007,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.11 Localization <locale.h>
@@ -39,6 +38,7 @@ __BEGIN_DECLS
#define LC_COLLATE __LC_COLLATE
#define LC_MONETARY __LC_MONETARY
#define LC_MESSAGES __LC_MESSAGES
+#define LC_ALL __LC_ALL
#if 0
#define LC_PAPER __LC_PAPER
#define LC_NAME __LC_NAME
@@ -47,9 +47,10 @@ __BEGIN_DECLS
#define LC_MEASUREMENT __LC_MEASUREMENT
#define LC_IDENTIFICATION __LC_IDENTIFICATION
#endif
-#define LC_ALL __LC_ALL
+__BEGIN_NAMESPACE_STD
+
/* Structure giving information about numeric and monetary notation. */
struct lconv
{
@@ -121,18 +122,17 @@ struct lconv
};
-__BEGIN_NAMESPACE_STD
-
/* Set and/or return the current locale. */
-extern char *setlocale (int __category, __const char *__locale) __THROW;
+extern char *setlocale (int __category, const char *__locale) __THROW;
/* Return the numeric/monetary information for the current locale. */
extern struct lconv *localeconv (void) __THROW;
+libc_hidden_proto(localeconv)
__END_NAMESPACE_STD
-#if defined(__USE_GNU) && defined(__UCLIBC_HAS_LOCALE__)
+#if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__
/* The concept of one static locale per category is not very well
thought out. Many applications will need to process its data using
information from several different locales. Another application is
@@ -144,19 +144,16 @@ __END_NAMESPACE_STD
Attention: all these functions are *not* standardized in any form.
This is a proof-of-concept implementation. */
-#if defined(__UCLIBC_HAS_XLOCALE__)
/* Get locale datatype definition. */
# include <xlocale.h>
-#endif
-
-typedef __locale_t locale_t;
/* Return a reference to a data structure representing a set of locale
datasets. Unlike for the CATEGORY parameter for `setlocale' the
CATEGORY_MASK parameter here uses a single bit for each category,
made by OR'ing together LC_*_MASK bits above. */
-extern __locale_t newlocale (int __category_mask, __const char *__locale,
+extern __locale_t newlocale (int __category_mask, const char *__locale,
__locale_t __base) __THROW;
+libc_hidden_proto(newlocale)
/* These are the bits that can be set in the CATEGORY_MASK argument to
`newlocale'. In the GNU implementation, LC_FOO_MASK has the value
@@ -168,9 +165,6 @@ extern __locale_t newlocale (int __category_mask, __const char *__locale,
# define LC_COLLATE_MASK (1 << __LC_COLLATE)
# define LC_MONETARY_MASK (1 << __LC_MONETARY)
# define LC_MESSAGES_MASK (1 << __LC_MESSAGES)
-#ifdef L_newlocale
-#warning mask defines for extra locale categories
-#endif /* L_newlocale - uClibc note */
#ifdef LC_PAPER
# define LC_PAPER_MASK (1 << __LC_PAPER)
# define LC_NAME_MASK (1 << __LC_NAME)
@@ -215,6 +209,7 @@ extern void freelocale (__locale_t __dataset) __THROW;
for all threads and can also be installed any time, meaning
the thread uses the global settings controlled by `setlocale'. */
extern __locale_t uselocale (__locale_t __dataset) __THROW;
+libc_hidden_proto(uselocale)
/* This value can be passed to `uselocale' and may be returned by it.
Passing this value to any other function has undefined behavior. */
diff --git a/include/malloc.h b/include/malloc.h
index 12834a547..b16a1105a 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _MALLOC_H
#define _MALLOC_H 1
@@ -124,12 +123,16 @@ extern void free __MALLOC_P ((__malloc_ptr_t __ptr));
/* Allocate SIZE bytes allocated to ALIGNMENT bytes. */
extern __malloc_ptr_t memalign __MALLOC_P ((size_t __alignment, size_t __size));
+libc_hidden_proto(memalign)
+#ifdef __UCLIBC_SUSV2_LEGACY__
/* Allocate SIZE bytes on a page boundary. */
extern __malloc_ptr_t valloc __MALLOC_P ((size_t __size)) __attribute_malloc__;
+#endif
#ifdef __MALLOC_STANDARD__
+# ifdef __USE_SVID
/* SVID2/XPG mallinfo structure */
struct mallinfo {
int arena; /* total space allocated from system */
@@ -146,15 +149,18 @@ struct mallinfo {
/* Returns a copy of the updated current mallinfo. */
extern struct mallinfo mallinfo __MALLOC_P ((void));
+libc_hidden_proto(mallinfo)
+# endif /* __USE_SVID */
+# ifdef __USE_GNU
/* Release all but __pad bytes of freed top-most memory back to the
system. Return 1 if successful, else 0. */
extern int malloc_trim(size_t pad);
+# endif /* __USE_GNU */
#include <stdio.h>
-/* Prints brief summary statistics to the specified file.
- * Writes to stderr if file is NULL. */
-extern void malloc_stats(FILE *file);
+/* Prints brief summary statistics on the stderr. */
+extern void malloc_stats(void);
/* SVID2/XPG mallopt options */
#ifndef M_MXFAST
@@ -189,7 +195,9 @@ extern int mallopt __MALLOC_P ((int __param, int __val));
* if it returns. If __uc_malloc_failed is NULL, uclibc will _exit(1).
* NB: do not use stdio in __uc_malloc_failed handler! */
extern void *__uc_malloc(size_t size);
+libc_hidden_proto(__uc_malloc)
extern void (*__uc_malloc_failed)(size_t size);
+libc_hidden_proto(__uc_malloc_failed)
#ifdef __cplusplus
} /* end of extern "C" */
diff --git a/include/math.h b/include/math.h
index 34c042dc5..25454764a 100644
--- a/include/math.h
+++ b/include/math.h
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.12 Mathematics <math.h>
@@ -46,44 +45,79 @@ __BEGIN_DECLS
/* Get general and ISO C99 specific information. */
#include <bits/mathdef.h>
+
/* The file <bits/mathcalls.h> contains the prototypes for all the
actual math functions. These macros are used for those prototypes,
so we can easily declare each function as both `name' and `__name',
and can declare the float versions `namef' and `__namef'. */
-#define __MATHCALL(function,suffix, args) \
- __MATHDECL (_Mdouble_,function,suffix, args)
-#define __MATHDECL(type, function,suffix, args) \
- __MATHDECL_1(type, function,suffix, args); \
- __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
-#define __MATHCALLX(function,suffix, args, attrib) \
- __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
-#define __MATHDECLX(type, function,suffix, args, attrib) \
- __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
- __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib)
-#define __MATHDECL_1(type, function,suffix, args) \
- extern type __MATH_PRECNAME(function,suffix) args __THROW
-
-#define _Mdouble_ double
-#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
-# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
-# define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
+#define __MATHDECL_1(type,function,suffix,args) \
+ extern type __MATH_PRECNAME(function,suffix) args __THROW
+
+#define __MATHDECL(type,function,suffix,args) \
+ __MATHDECL_1(type,function,suffix,args);
+
+#define __MATHCALL(function,suffix,args) \
+ __MATHDECL(_Mdouble_,function,suffix,args)
+
+#define __MATHDECLX(type,function,suffix,args,attrib) \
+ __MATHDECL_1(type,function,suffix,args) __attribute__ (attrib); \
+ __MATH_maybe_libm_hidden_proto(function)
+
+#define __MATHCALLX(function,suffix,args,attrib) \
+ __MATHDECLX(_Mdouble_,function,suffix,args,attrib)
+
+/* Decls which are also used internally in libm.
+ Only the main variant is used internally, no need to try to avoid relocs
+ for the {l,f} variants. */
+#define __MATHDECLI(type,function,suffix,args) \
+ __MATHDECL_1(type,function,suffix,args); \
+ __MATH_maybe_libm_hidden_proto(function)
+
+#define __MATHCALLI(function,suffix,args) \
+ __MATHDECLI(_Mdouble_,function,suffix,args)
+
+/* Private helpers for purely macro impls below.
+ Only make __foo{,f,l} visible but not (the macro-only) foo. */
+#if defined _LIBC
+# define __MATHDECL_PRIV(type,function,suffix,args,attrib) \
+ __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib); \
+ libm_hidden_proto(__MATH_PRECNAME(__##function,suffix))
+#else
+# define __MATHDECL_PRIV(type,function,suffix,args,attrib) \
+ __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib);
+#endif
+
+
+/* Include the file of declarations, declaring double versions */
+
+#if defined _LIBC
+# define __MATH_maybe_libm_hidden_proto(x) libm_hidden_proto(x)
+#else
+# define __MATH_maybe_libm_hidden_proto(x)
+#endif
+#define _Mdouble_ double
+#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
+#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
+#define _Mdouble_END_NAMESPACE __END_NAMESPACE_STD
#include <bits/mathcalls.h>
#undef _Mdouble_
#undef _Mdouble_BEGIN_NAMESPACE
#undef _Mdouble_END_NAMESPACE
-#undef __MATH_PRECNAME
+#undef __MATH_PRECNAME
+#undef __MATH_maybe_libm_hidden_proto
-#if defined __USE_MISC || defined __USE_ISOC99
+#if defined __USE_MISC || defined __USE_ISOC99
/* Include the file of declarations again, this time using `float'
instead of `double' and appending f to each function name. */
+# define __MATH_maybe_libm_hidden_proto(x)
# ifndef _Mfloat_
# define _Mfloat_ float
# endif
-# define _Mdouble_ _Mfloat_
+# define _Mdouble_ _Mfloat_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##f##r
# else
@@ -95,24 +129,25 @@ __BEGIN_DECLS
# undef _Mdouble_
# undef _Mdouble_BEGIN_NAMESPACE
# undef _Mdouble_END_NAMESPACE
+# undef _Mfloat_
# undef __MATH_PRECNAME
+# undef __MATH_maybe_libm_hidden_proto
+
-# if (__STDC__ - 0 || __GNUC__ - 0) \
+# if (defined __STDC__ || defined __GNUC__) \
&& (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
# ifdef __LDBL_COMPAT
# ifdef __USE_ISOC99
-extern float __nldbl_nexttowardf (float __x, long double __y)
- __THROW __attribute__ ((__const__));
+extern float __nldbl_nexttowardf (float __x, long double __y) __THROW
+ __attribute__ ((__const__));
# ifdef __REDIRECT_NTH
-extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
- __nldbl_nexttowardf)
- __attribute__ ((__const__));
-extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
- nextafter) __attribute__ ((__const__));
-extern long double __REDIRECT_NTH (nexttowardl,
- (long double __x, long double __y),
- nextafter) __attribute__ ((__const__));
+extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), __nldbl_nexttowardf)
+ __attribute__ ((__const__));
+extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), nextafter)
+ __attribute__ ((__const__));
+extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __y), nextafter)
+ __attribute__ ((__const__));
# endif
# endif
@@ -120,17 +155,17 @@ extern long double __REDIRECT_NTH (nexttowardl,
instead of `double' and appending l to each function name. */
# undef __MATHDECL_1
-# define __MATHDECL_2(type, function,suffix, args, alias) \
- extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix), \
- args, alias)
-# define __MATHDECL_1(type, function,suffix, args) \
- __MATHDECL_2(type, function,suffix, args, __CONCAT(function,suffix))
+# define __MATHDECL_2(type,function,suffix,args,alias) \
+ extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix),args,alias)
+# define __MATHDECL_1(type,function,suffix,args) \
+ __MATHDECL_2(type,function,suffix,args,__CONCAT(function,suffix))
# endif
+# define __MATH_maybe_libm_hidden_proto(x)
# ifndef _Mlong_double_
# define _Mlong_double_ long double
# endif
-# define _Mdouble_ _Mlong_double_
+# define _Mdouble_ _Mlong_double_
# ifdef __STDC__
# define __MATH_PRECNAME(name,r) name##l##r
# else
@@ -140,9 +175,11 @@ extern long double __REDIRECT_NTH (nexttowardl,
# define _Mdouble_END_NAMESPACE __END_NAMESPACE_C99
# include <bits/mathcalls.h>
# undef _Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
+# undef _Mdouble_BEGIN_NAMESPACE
+# undef _Mdouble_END_NAMESPACE
+# undef _Mlong_double_
# undef __MATH_PRECNAME
+# undef __MATH_maybe_libm_hidden_proto
# endif /* __STDC__ || __GNUC__ */
@@ -159,7 +196,7 @@ extern int signgam;
/* ISO C99 defines some generic macros which work on any data type. */
-#ifdef __USE_ISOC99
+#if defined(__USE_ISOC99) || defined(__USE_BSD)
/* Get the architecture specific values describing the floating-point
evaluation. The following symbols will get defined:
@@ -279,6 +316,11 @@ enum
#endif /* Use ISO C99. */
+/* BSD compat */
+#define finite(x) __finite(x)
+#define finitef(x) __finitef(x)
+#define finitel(x) __finitel(x)
+
#ifdef __USE_MISC
/* Support for various different standard error handling behaviors. */
typedef enum
@@ -338,8 +380,10 @@ extern int matherr (struct exception *__exc);
#else /* !SVID */
# ifdef __USE_XOPEN
+# ifdef __UCLIBC_SUSV4_LEGACY__
/* X/Open wants another strange constant. */
# define MAXFLOAT 3.40282347e+38F
+# endif
# endif
#endif /* SVID */
diff --git a/include/memory.h b/include/memory.h
index 743fa6a95..176a0a92c 100644
--- a/include/memory.h
+++ b/include/memory.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* SVID
diff --git a/include/mntent.h b/include/mntent.h
index a82e9539a..f9f119db5 100644
--- a/include/mntent.h
+++ b/include/mntent.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _MNTENT_H
#define _MNTENT_H 1
@@ -64,7 +63,8 @@ struct mntent
/* Prepare to begin reading and/or writing mount table entries from the
beginning of FILE. MODE is as for `fopen'. */
-extern FILE *setmntent (__const char *__file, __const char *__mode) __THROW;
+extern FILE *setmntent (const char *__file, const char *__mode) __THROW;
+libc_hidden_proto(setmntent)
/* Read one mount table entry from STREAM. Returns a pointer to storage
reused on the next call, or null for EOF or error (use feof/ferror to
@@ -77,20 +77,22 @@ extern struct mntent *getmntent_r (FILE *__restrict __stream,
struct mntent *__restrict __result,
char *__restrict __buffer,
int __bufsize) __THROW;
+libc_hidden_proto(getmntent_r)
#endif
/* Write the mount table entry described by MNT to STREAM.
Return zero on success, nonzero on failure. */
extern int addmntent (FILE *__restrict __stream,
- __const struct mntent *__restrict __mnt) __THROW;
+ const struct mntent *__restrict __mnt) __THROW;
/* Close a stream opened with `setmntent'. */
extern int endmntent (FILE *__stream) __THROW;
+libc_hidden_proto(endmntent)
/* Search MNT->mnt_opts for an option matching OPT.
Returns the address of the substring, or null if none found. */
-extern char *hasmntopt (__const struct mntent *__mnt,
- __const char *__opt) __THROW;
+extern char *hasmntopt (const struct mntent *__mnt,
+ const char *__opt) __THROW;
__END_DECLS
diff --git a/include/mqueue.h b/include/mqueue.h
index f75b50611..fbfd807b2 100644
--- a/include/mqueue.h
+++ b/include/mqueue.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _MQUEUE_H
#define _MQUEUE_H 1
diff --git a/include/net/ethernet.h b/include/net/ethernet.h
index 7ca8e8348..9698c70bb 100644
--- a/include/net/ethernet.h
+++ b/include/net/ethernet.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2001, 2008 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Based on the FreeBSD version of this file. Curiously, that file
lacks a copyright in the header. */
@@ -45,9 +44,17 @@ struct ether_header
/* Ethernet protocol ID's */
#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
+#define ETHERTYPE_SPRITE 0x0500 /* Sprite */
#define ETHERTYPE_IP 0x0800 /* IP */
#define ETHERTYPE_ARP 0x0806 /* Address resolution */
#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
+#define ETHERTYPE_AT 0x809B /* AppleTalk protocol */
+#define ETHERTYPE_AARP 0x80F3 /* AppleTalk ARP */
+#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
+#define ETHERTYPE_IPX 0x8137 /* IPX */
+#define ETHERTYPE_IPV6 0x86dd /* IP protocol version 6 */
+#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
+
#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
#define ETHER_TYPE_LEN 2 /* bytes in type field */
diff --git a/include/net/if.h b/include/net/if.h
index ebb3e9f30..67636e0fc 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_H
#define _NET_IF_H 1
@@ -191,14 +190,17 @@ struct ifconf
__BEGIN_DECLS
/* Convert an interface name to an index, and vice versa. */
-extern unsigned int if_nametoindex (__const char *__ifname) __THROW;
+extern unsigned int if_nametoindex (const char *__ifname) __THROW;
+libc_hidden_proto(if_nametoindex)
extern char *if_indextoname (unsigned int __ifindex, char *__ifname) __THROW;
/* Return a list of all interfaces and their indices. */
extern struct if_nameindex *if_nameindex (void) __THROW;
+libc_hidden_proto(if_nameindex)
/* Free the data returned from if_nameindex. */
extern void if_freenameindex (struct if_nameindex *__ptr) __THROW;
+libc_hidden_proto(if_freenameindex)
__END_DECLS
diff --git a/include/net/if_arp.h b/include/net/if_arp.h
index 46f035bef..b2997efaa 100644
--- a/include/net/if_arp.h
+++ b/include/net/if_arp.h
@@ -1,5 +1,5 @@
/* Definitions for Address Resolution Protocol.
- Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997,1999,2001,2006,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Based on the 4.4BSD and Linux version of this file. */
@@ -96,7 +95,7 @@ struct arphdr
#define ARPHRD_ADAPT 264
#define ARPHRD_ROSE 270
#define ARPHRD_X25 271 /* CCITT X.25. */
-#define ARPHDR_HWX25 272 /* Boards with X.25 in firmware. */
+#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware. */
#define ARPHRD_PPP 512
#define ARPHRD_CISCO 513 /* Cisco HDLC. */
#define ARPHRD_HDLC ARPHRD_CISCO
@@ -126,6 +125,14 @@ struct arphdr
#define ARPHRD_FCFABRIC 787 /* Fibrechanel fabric. */
#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR. */
#define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
+#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header. */
+#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header. */
+#define ARPHRD_IEEE802154 804 /* IEEE 802.15.4 header. */
+#define ARPHRD_IEEE802154_PHY 805 /* IEEE 802.15.4 PHY header. */
+
+#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known. */
+#define ARPHRD_NONE 0xFFFE /* Zero header length. */
+
/* ARP ioctl request. */
struct arpreq
diff --git a/include/net/if_packet.h b/include/net/if_packet.h
index e5184e7f1..135f2b8a4 100644
--- a/include/net/if_packet.h
+++ b/include/net/if_packet.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __IF_PACKET_H
#define __IF_PACKET_H
diff --git a/include/net/if_shaper.h b/include/net/if_shaper.h
index 7060af31e..84c9ddd24 100644
--- a/include/net/if_shaper.h
+++ b/include/net/if_shaper.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_SHAPER_H
#define _NET_IF_SHAPER_H 1
diff --git a/include/net/if_slip.h b/include/net/if_slip.h
index 66bd7f30a..381131cba 100644
--- a/include/net/if_slip.h
+++ b/include/net/if_slip.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NET_IF_SLIP_H
#define _NET_IF_SLIP_H 1
diff --git a/include/net/route.h b/include/net/route.h
index da5c810c7..d1023bee3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Based on the 4.4BSD and Linux version of this file. */
@@ -55,6 +54,7 @@ struct rtentry
#define rt_mss rt_mtu
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
struct in6_rtmsg
{
struct in6_addr rtmsg_dst;
@@ -68,6 +68,7 @@ struct in6_rtmsg
u_int32_t rtmsg_flags;
int rtmsg_ifindex;
};
+#endif
#define RTF_UP 0x0001 /* Route usable. */
@@ -129,6 +130,7 @@ struct in6_rtmsg
#define RT_CLASS_MAX 255
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define RTMSG_ACK NLMSG_ACK
#define RTMSG_OVERRUN NLMSG_OVERRUN
@@ -141,5 +143,6 @@ struct in6_rtmsg
#define RTMSG_CONTROL 0x40
#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */
+#endif
#endif /* net/route.h */
diff --git a/include/netax25/ax25.h b/include/netax25/ax25.h
index ce3c7abc9..a248dac1a 100644
--- a/include/netax25/ax25.h
+++ b/include/netax25/ax25.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETAX25_AX25_H
#define _NETAX25_AX25_H 1
diff --git a/include/netdb.h b/include/netdb.h
index df90601ac..95abe95cb 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002, 2003, 2004, 2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* All data returned by the network data base library are supplied in
host order and returned in network order (suitable for use in
@@ -27,7 +26,7 @@
#include <netinet/in.h>
#include <stdint.h>
-#ifdef __USE_MISC
+#if defined __USE_MISC && defined __UCLIBC_HAS_RPC__
/* This is necessary to make this include file properly replace the
Sun version. */
# include <rpc/netdb.h>
@@ -54,24 +53,39 @@
__BEGIN_DECLS
/* Error status for non-reentrant lookup functions.
- We use a macro to access always the thread-specific `h_errno' variable.
- We always need the extern int here in case internal libc code undefines
- the macro because it needs access to the underlying storage. */
-extern int h_errno;
-#ifdef __UCLIBC_HAS_THREADS__
-# define h_errno (*__h_errno_location ())
-#endif
+ We use a macro to access always the thread-specific `h_errno' variable. */
+#define h_errno (*__h_errno_location ())
/* Function to get address of global `h_errno' variable. */
extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
+/* Macros for accessing h_errno from inside libc. */
#ifdef _LIBC
-# define __set_h_errno(x) (h_errno = (x))
-#endif
+# ifdef __UCLIBC_HAS_THREADS__
+# if defined __UCLIBC_HAS_TLS__ \
+ && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+# undef h_errno
+# ifndef NOT_IN_libc
+# define h_errno __libc_h_errno
+# else
+# define h_errno h_errno /* For #ifndef h_errno tests. */
+# endif
+extern __thread int h_errno attribute_tls_model_ie;
+# define __set_h_errno(x) (h_errno = (x))
+# else
+static inline int __set_h_errno (int __err)
+{
+ return *__h_errno_location () = __err;
+}
+# endif /* __UCLIBC_HAS_TLS__ */
+# else
+# undef h_errno
+# define __set_h_errno(x) (h_errno = (x))
+extern int h_errno;
+# endif /* __UCLIBC_HAS_THREADS__ */
+#endif /* _LIBC */
/* Possible values left in `h_errno'. */
-#define NETDB_INTERNAL -1 /* See errno. */
-#define NETDB_SUCCESS 0 /* No problem. */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found. */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found,
or SERVERFAIL. */
@@ -79,7 +93,11 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
NOTIMP. */
#define NO_DATA 4 /* Valid name, no data record of requested
type. */
-#define NO_ADDRESS NO_DATA /* No address, look for MX record. */
+#if defined __USE_MISC || defined __USE_GNU
+# define NETDB_INTERNAL -1 /* See errno. */
+# define NETDB_SUCCESS 0 /* No problem. */
+# define NO_ADDRESS NO_DATA /* No address, look for MX record. */
+#endif
#ifdef __USE_XOPEN2K
/* Highest reserved Internet port number. */
@@ -91,13 +109,15 @@ extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
# define SCOPE_DELIMITER '%'
#endif
+#if defined __USE_MISC || defined __USE_GNU
/* Print error indicated by `h_errno' variable on standard error. STR
if non-null is printed before the error string. */
-extern void herror (__const char *__str) __THROW;
+extern void herror (const char *__str) __THROW;
+libc_hidden_proto(herror)
/* Return string associated with error ERR_NUM. */
-extern __const char *hstrerror (int __err_num) __THROW;
-
+extern const char *hstrerror (int __err_num) __THROW;
+#endif
/* Description of data base entry for a single host. */
@@ -108,7 +128,9 @@ struct hostent
int h_addrtype; /* Host address type. */
int h_length; /* Length of address. */
char **h_addr_list; /* List of addresses from name server. */
-#define h_addr h_addr_list[0] /* Address, for backward compatibility. */
+#if defined __USE_MISC || defined __USE_GNU
+# define h_addr h_addr_list[0] /* Address, for backward compatibility.*/
+#endif
};
/* Open host data base files and mark them as staying open even after
@@ -136,14 +158,16 @@ extern struct hostent *gethostent (void);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct hostent *gethostbyaddr (__const void *__addr, __socklen_t __len,
+extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
int __type);
+libc_hidden_proto(gethostbyaddr)
/* Return entry from host data base for host with NAME.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct hostent *gethostbyname (__const char *__name);
+extern struct hostent *gethostbyname (const char *__name);
+libc_hidden_proto(gethostbyname)
#ifdef __USE_MISC
/* Return entry from host data base for host with NAME. AF must be
@@ -154,7 +178,8 @@ extern struct hostent *gethostbyname (__const char *__name);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern struct hostent *gethostbyname2 (__const char *__name, int __af);
+extern struct hostent *gethostbyname2 (const char *__name, int __af);
+libc_hidden_proto(gethostbyname2)
/* Reentrant versions of the functions above. The additional
arguments specify a buffer of BUFLEN starting at BUF. The last
@@ -170,25 +195,29 @@ extern int gethostent_r (struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(gethostent_r)
-extern int gethostbyaddr_r (__const void *__restrict __addr, __socklen_t __len,
+extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
int __type,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(gethostbyaddr_r)
-extern int gethostbyname_r (__const char *__restrict __name,
+extern int gethostbyname_r (const char *__restrict __name,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(gethostbyname_r)
-extern int gethostbyname2_r (__const char *__restrict __name, int __af,
+extern int gethostbyname2_r (const char *__restrict __name, int __af,
struct hostent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct hostent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(gethostbyname2_r)
#endif /* misc */
@@ -198,12 +227,14 @@ extern int gethostbyname2_r (__const char *__restrict __name, int __af,
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void setnetent (int __stay_open);
+libc_hidden_proto(setnetent)
/* Close network data base files and clear `stay open' flag.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void endnetent (void);
+libc_hidden_proto(endnetent)
/* Get next entry from network data base file. Open data base if
necessary.
@@ -223,10 +254,8 @@ extern struct netent *getnetbyaddr (uint32_t __net, int __type);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct netent *getnetbyname (__const char *__name);
+extern struct netent *getnetbyname (const char *__name);
-#if 0
-/* FIXME */
#ifdef __USE_MISC
/* Reentrant versions of the functions above. The additional
arguments specify a buffer of BUFLEN starting at BUF. The last
@@ -242,20 +271,22 @@ extern int getnetent_r (struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(getnetent_r)
extern int getnetbyaddr_r (uint32_t __net, int __type,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
+libc_hidden_proto(getnetbyaddr_r)
-extern int getnetbyname_r (__const char *__restrict __name,
+extern int getnetbyname_r (const char *__restrict __name,
struct netent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct netent **__restrict __result,
int *__restrict __h_errnop);
-#endif /* misc */
-#endif
+libc_hidden_proto(getnetbyname_r)
+#endif /* __USE_MISC */
/* Description of data base entry for a single service. */
@@ -273,12 +304,14 @@ struct servent
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void setservent (int __stay_open);
+libc_hidden_proto(setservent)
/* Close service data base files and clear `stay open' flag.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void endservent (void);
+libc_hidden_proto(endservent)
/* Get next entry from service data base file. Open data base if
necessary.
@@ -292,15 +325,16 @@ extern struct servent *getservent (void);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct servent *getservbyname (__const char *__name,
- __const char *__proto);
+extern struct servent *getservbyname (const char *__name,
+ const char *__proto);
/* Return entry from service data base which matches port PORT and
protocol PROTO.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct servent *getservbyport (int __port, __const char *__proto);
+extern struct servent *getservbyport (int __port, const char *__proto);
+libc_hidden_proto(getservbyport)
#ifdef __USE_MISC
@@ -314,17 +348,20 @@ extern struct servent *getservbyport (int __port, __const char *__proto);
extern int getservent_r (struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+libc_hidden_proto(getservent_r)
-extern int getservbyname_r (__const char *__restrict __name,
- __const char *__restrict __proto,
+extern int getservbyname_r (const char *__restrict __name,
+ const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+libc_hidden_proto(getservbyname_r)
-extern int getservbyport_r (int __port, __const char *__restrict __proto,
+extern int getservbyport_r (int __port, const char *__restrict __proto,
struct servent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct servent **__restrict __result);
+libc_hidden_proto(getservbyport_r)
#endif /* misc */
@@ -342,12 +379,14 @@ struct protoent
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void setprotoent (int __stay_open);
+libc_hidden_proto(setprotoent)
/* Close protocol data base files and clear `stay open' flag.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern void endprotoent (void);
+libc_hidden_proto(endprotoent)
/* Get next entry from protocol data base file. Open data base if
necessary.
@@ -360,7 +399,7 @@ extern struct protoent *getprotoent (void);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct protoent *getprotobyname (__const char *__name);
+extern struct protoent *getprotobyname (const char *__name);
/* Return entry from protocol data base which number is PROTO.
@@ -380,16 +419,19 @@ extern struct protoent *getprotobynumber (int __proto);
extern int getprotoent_r (struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+libc_hidden_proto(getprotoent_r)
-extern int getprotobyname_r (__const char *__restrict __name,
+extern int getprotobyname_r (const char *__restrict __name,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+libc_hidden_proto(getprotobyname_r)
extern int getprotobynumber_r (int __proto,
struct protoent *__restrict __result_buf,
char *__restrict __buf, size_t __buflen,
struct protoent **__restrict __result);
+libc_hidden_proto(getprotobynumber_r)
#ifdef __UCLIBC_HAS_NETGROUP__
@@ -399,7 +441,7 @@ extern int getprotobynumber_r (int __proto,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int setnetgrent (__const char *__netgroup);
+extern int setnetgrent (const char *__netgroup);
/* Free all space allocated by previous `setnetgrent' call.
@@ -427,8 +469,8 @@ extern int getnetgrent (char **__restrict __hostp,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int innetgr (__const char *__netgroup, __const char *__host,
- __const char *__user, __const char *domain);
+extern int innetgr (const char *__netgroup, const char *__host,
+ const char *__user, const char *__domain);
/* Reentrant version of `getnetgrent' where result is placed in BUFFER.
@@ -443,11 +485,12 @@ extern int getnetgrent_r (char **__restrict __hostp,
#endif /* UCLIBC_HAS_NETGROUP */
#endif /* misc */
-
+#ifdef __UCLIBC__
/* ruserpass - remote password check.
This function also exists in glibc but is undocumented */
extern int ruserpass(const char *host, const char **aname, const char **apass);
-
+libc_hidden_proto(ruserpass)
+#endif
#ifdef __USE_BSD
/* Call `rshd' at port RPORT on remote machine *AHOST to execute CMD.
@@ -462,9 +505,9 @@ extern int ruserpass(const char *host, const char **aname, const char **apass);
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
- __const char *__restrict __locuser,
- __const char *__restrict __remuser,
- __const char *__restrict __cmd, int *__restrict __fd2p);
+ const char *__restrict __locuser,
+ const char *__restrict __remuser,
+ const char *__restrict __cmd, int *__restrict __fd2p);
#if 0
/* FIXME */
@@ -476,9 +519,9 @@ extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
- __const char *__restrict __locuser,
- __const char *__restrict __remuser,
- __const char *__restrict __cmd, int *__restrict __fd2p,
+ const char *__restrict __locuser,
+ const char *__restrict __remuser,
+ const char *__restrict __cmd, int *__restrict __fd2p,
sa_family_t __af);
#endif
@@ -493,9 +536,9 @@ extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int rexec (char **__restrict __ahost, int __rport,
- __const char *__restrict __name,
- __const char *__restrict __pass,
- __const char *__restrict __cmd, int *__restrict __fd2p);
+ const char *__restrict __name,
+ const char *__restrict __pass,
+ const char *__restrict __cmd, int *__restrict __fd2p);
/* This is the equivalent function where the protocol can be selected
and which therefore can be used for IPv6.
@@ -505,10 +548,11 @@ extern int rexec (char **__restrict __ahost, int __rport,
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int rexec_af (char **__restrict __ahost, int __rport,
- __const char *__restrict __name,
- __const char *__restrict __pass,
- __const char *__restrict __cmd, int *__restrict __fd2p,
+ const char *__restrict __name,
+ const char *__restrict __pass,
+ const char *__restrict __cmd, int *__restrict __fd2p,
sa_family_t __af);
+libc_hidden_proto(rexec_af)
/* Check whether user REMUSER on system RHOST is allowed to login as LOCUSER.
If SUSER is not zero the user tries to become superuser. Return 0 if
@@ -518,8 +562,8 @@ extern int rexec_af (char **__restrict __ahost, int __rport,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int ruserok (__const char *__rhost, int __suser,
- __const char *__remuser, __const char *__locuser);
+extern int ruserok (const char *__rhost, int __suser,
+ const char *__remuser, const char *__locuser);
#if 0
/* FIXME */
@@ -530,8 +574,8 @@ extern int ruserok (__const char *__rhost, int __suser,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int ruserok_af (__const char *__rhost, int __suser,
- __const char *__remuser, __const char *__locuser,
+extern int ruserok_af (const char *__rhost, int __suser,
+ const char *__remuser, const char *__locuser,
sa_family_t __af);
#endif
@@ -544,6 +588,7 @@ extern int ruserok_af (__const char *__rhost, int __suser,
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int rresvport (int *__alport);
+libc_hidden_proto(rresvport)
#if 0
/* FIXME */
@@ -582,16 +627,6 @@ struct addrinfo
# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
returned address type.. */
-# ifdef __USE_GNU
-# define AI_IDN 0x0040 /* IDN encode input (assuming it is encoded
- in the current locale's character set)
- before looking it up. */
-# define AI_CANONIDN 0x0080 /* Translate canonical name from IDN format. */
-# define AI_IDN_ALLOW_UNASSIGNED 0x0100 /* Don't reject unassigned Unicode
- code points. */
-# define AI_IDN_USE_STD3_ASCII_RULES 0x0200 /* Validate strings according to
- STD3 rules. */
-# endif
# define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
/* Error values for `getaddrinfo' function. */
@@ -599,32 +634,34 @@ struct addrinfo
# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
-# define EAI_NODATA -5 /* No address associated with NAME. */
# define EAI_FAMILY -6 /* `ai_family' not supported. */
# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
-# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
# define EAI_MEMORY -10 /* Memory allocation failure. */
# define EAI_SYSTEM -11 /* System error returned in `errno'. */
# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
# ifdef __USE_GNU
+# define EAI_NODATA -5 /* No address associated with NAME. */
+# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
# define EAI_INPROGRESS -100 /* Processing request in progress. */
# define EAI_CANCELED -101 /* Request canceled. */
# define EAI_NOTCANCELED -102 /* Request not canceled. */
# define EAI_ALLDONE -103 /* All requests done. */
# define EAI_INTR -104 /* Interrupted by a signal. */
-# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
# endif
-# define NI_MAXHOST 1025
-# define NI_MAXSERV 32
+# ifdef __USE_MISC
+# define NI_MAXHOST 1025
+# define NI_MAXSERV 32
+# endif
# define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
# define NI_NUMERICSERV 2 /* Don't convert port number to name. */
# define NI_NOFQDN 4 /* Only return nodename portion. */
# define NI_NAMEREQD 8 /* Don't return numeric addresses. */
# define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
-# ifdef __USE_GNU
+#if 0 /* uClibc: not implemented */
+/* # ifdef __USE_GNU */
# define NI_IDN 32 /* Convert name from IDN format. */
# define NI_IDN_ALLOW_UNASSIGNED 64 /* Don't reject unassigned Unicode
code points. */
@@ -637,25 +674,28 @@ struct addrinfo
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int getaddrinfo (__const char *__restrict __name,
- __const char *__restrict __service,
- __const struct addrinfo *__restrict __req,
+extern int getaddrinfo (const char *__restrict __name,
+ const char *__restrict __service,
+ const struct addrinfo *__restrict __req,
struct addrinfo **__restrict __pai);
+libc_hidden_proto(getaddrinfo)
/* Free `addrinfo' structure AI including associated storage. */
extern void freeaddrinfo (struct addrinfo *__ai) __THROW;
+libc_hidden_proto(freeaddrinfo)
/* Convert error return from getaddrinfo() to a string. */
-extern __const char *gai_strerror (int __ecode) __THROW;
+extern const char *gai_strerror (int __ecode) __THROW;
/* Translate a socket address to a location and service name.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int getnameinfo (__const struct sockaddr *__restrict __sa,
+extern int getnameinfo (const struct sockaddr *__restrict __sa,
socklen_t __salen, char *__restrict __host,
socklen_t __hostlen, char *__restrict __serv,
socklen_t __servlen, unsigned int __flags);
+libc_hidden_proto(getnameinfo)
#endif /* POSIX */
__END_DECLS
diff --git a/include/neteconet/ec.h b/include/neteconet/ec.h
index f21601ca0..63a75ccf7 100644
--- a/include/neteconet/ec.h
+++ b/include/neteconet/ec.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETECONET_EC_H
#define _NETECONET_EC_H 1
diff --git a/include/netinet/ether.h b/include/netinet/ether.h
index a16255037..546282066 100644
--- a/include/netinet/ether.h
+++ b/include/netinet/ether.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_ETHER_H
#define _NETINET_ETHER_H 1
@@ -25,31 +24,38 @@
/* Get definition of `struct ether_addr'. */
#include <netinet/if_ether.h>
+#ifdef _LIBC
#define ETHER_FILE_NAME "/etc/ethers"
+#endif
__BEGIN_DECLS
+#if defined __UCLIBC_HAS_SOCKET__ || defined __UCLIBC_HAS_IPV4__ || \
+ defined __UCLIBC_HAS_IPV6__
/* Convert 48 bit Ethernet ADDRess to ASCII. */
-extern char *ether_ntoa (__const struct ether_addr *__addr) __THROW;
-extern char *ether_ntoa_r (__const struct ether_addr *__addr, char *__buf)
+extern char *ether_ntoa (const struct ether_addr *__addr) __THROW;
+extern char *ether_ntoa_r (const struct ether_addr *__addr, char *__buf)
__THROW;
+libc_hidden_proto(ether_ntoa_r)
/* Convert ASCII string S to 48 bit Ethernet address. */
-extern struct ether_addr *ether_aton (__const char *__asc) __THROW;
-extern struct ether_addr *ether_aton_r (__const char *__asc,
+extern struct ether_addr *ether_aton (const char *__asc) __THROW;
+extern struct ether_addr *ether_aton_r (const char *__asc,
struct ether_addr *__addr) __THROW;
+libc_hidden_proto(ether_aton_r)
/* Map 48 bit Ethernet number ADDR to HOSTNAME. */
-extern int ether_ntohost (char *__hostname, __const struct ether_addr *__addr)
+extern int ether_ntohost (char *__hostname, const struct ether_addr *__addr)
__THROW;
/* Map HOSTNAME to 48 bit Ethernet address. */
-extern int ether_hostton (__const char *__hostname, struct ether_addr *__addr)
+extern int ether_hostton (const char *__hostname, struct ether_addr *__addr)
__THROW;
/* Scan LINE and set ADDR and HOSTNAME. */
-extern int ether_line (__const char *__line, struct ether_addr *__addr,
+extern int ether_line (const char *__line, struct ether_addr *__addr,
char *__hostname) __THROW;
+#endif
__END_DECLS
diff --git a/include/netinet/icmp6.h b/include/netinet/icmp6.h
index 0cb1aa6a6..776f6bdda 100644
--- a/include/netinet/icmp6.h
+++ b/include/netinet/icmp6.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1997,2000,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1997,2000,2006,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_ICMP6_H
#define _NETINET_ICMP6_H 1
@@ -161,11 +160,11 @@ struct nd_neighbor_advert /* neighbor advertisement */
#define nd_na_code nd_na_hdr.icmp6_code
#define nd_na_cksum nd_na_hdr.icmp6_cksum
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
#define ND_NA_FLAG_ROUTER 0x80000000
#define ND_NA_FLAG_SOLICITED 0x40000000
#define ND_NA_FLAG_OVERRIDE 0x20000000
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
#define ND_NA_FLAG_ROUTER 0x00000080
#define ND_NA_FLAG_SOLICITED 0x00000040
#define ND_NA_FLAG_OVERRIDE 0x00000020
@@ -299,10 +298,10 @@ struct rr_pco_use /* use prefix part */
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
-#elif BYTE_ORDER == LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
#endif
@@ -316,10 +315,10 @@ struct rr_result /* router renumbering result message */
struct in6_addr rrr_prefix;
};
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
# define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
-#elif BYTE_ORDER == LITTLE_ENDIAN
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
#endif
@@ -339,7 +338,7 @@ struct nd_opt_home_agent_info
uint8_t nd_opt_home_agent_info_type;
uint8_t nd_opt_home_agent_info_len;
uint16_t nd_opt_home_agent_info_reserved;
- int16_t nd_opt_home_agent_info_preference;
+ uint16_t nd_opt_home_agent_info_preference;
uint16_t nd_opt_home_agent_info_lifetime;
};
diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
index aadb59bea..feb43578e 100644
--- a/include/netinet/if_ether.h
+++ b/include/netinet/if_ether.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __NETINET_IF_ETHER_H
diff --git a/include/netinet/if_fddi.h b/include/netinet/if_fddi.h
index 1a0ec927d..54372d5aa 100644
--- a/include/netinet/if_fddi.h
+++ b/include/netinet/if_fddi.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IF_FDDI_H
#define _NETINET_IF_FDDI_H 1
diff --git a/include/netinet/if_tr.h b/include/netinet/if_tr.h
index 45c39115f..6c5ec9b2f 100644
--- a/include/netinet/if_tr.h
+++ b/include/netinet/if_tr.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IF_TR_H
#define _NETINET_IF_TR_H 1
diff --git a/include/netinet/igmp.h b/include/netinet/igmp.h
index 67396baaa..e40fbabe5 100644
--- a/include/netinet/igmp.h
+++ b/include/netinet/igmp.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IGMP_H
#define _NETINET_IGMP_H 1
diff --git a/include/netinet/in.h b/include/netinet/in.h
index 6bfc5e780..884d925c9 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007
+/* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IN_H
#define _NETINET_IN_H 1
@@ -53,6 +52,8 @@ enum
#define IPPROTO_IDP IPPROTO_IDP
IPPROTO_TP = 29, /* SO Transport Protocol Class 4. */
#define IPPROTO_TP IPPROTO_TP
+ IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol. */
+#define IPPROTO_DCCP IPPROTO_DCCP
IPPROTO_IPV6 = 41, /* IPv6 header. */
#define IPPROTO_IPV6 IPPROTO_IPV6
IPPROTO_ROUTING = 43, /* IPv6 routing header. */
@@ -83,6 +84,8 @@ enum
#define IPPROTO_COMP IPPROTO_COMP
IPPROTO_SCTP = 132, /* Stream Control Transmission Protocol. */
#define IPPROTO_SCTP IPPROTO_SCTP
+ IPPROTO_UDPLITE = 136, /* UDP-Lite protocol. */
+#define IPPROTO_UDPLITE IPPROTO_UDPLITE
IPPROTO_RAW = 255, /* Raw IP packets. */
#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_MAX
@@ -190,33 +193,41 @@ struct in_addr
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* IPv6 address */
struct in6_addr
{
union
{
- uint8_t u6_addr8[16];
- uint16_t u6_addr16[8];
- uint32_t u6_addr32[4];
- } in6_u;
-#define s6_addr in6_u.u6_addr8
-#define s6_addr16 in6_u.u6_addr16
-#define s6_addr32 in6_u.u6_addr32
+ uint8_t __u6_addr8[16];
+#if defined __USE_MISC || defined __USE_GNU
+ uint16_t __u6_addr16[8];
+ uint32_t __u6_addr32[4];
+#endif
+ } __in6_u;
+#define s6_addr __in6_u.__u6_addr8
+#if defined __USE_MISC || defined __USE_GNU
+# define s6_addr16 __in6_u.__u6_addr16
+# define s6_addr32 __in6_u.__u6_addr32
+#endif
};
-extern const struct in6_addr in6addr_any; /* :: */
-extern const struct in6_addr in6addr_loopback; /* ::1 */
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
-#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
+#endif
-/* Get the definition of the macro to define the common sockaddr members. */
-#include <bits/socket.h>
+#ifdef __UCLIBC_HAS_IPV6__
+extern const struct in6_addr in6addr_any; /* :: */
+extern const struct in6_addr in6addr_loopback; /* ::1 */
+libc_hidden_proto(in6addr_loopback)
+#endif
+
+#define INET_ADDRSTRLEN 16
-#if 1 /* defined __UCLIBC_HAS_IPV4__ */
+#if 1 /*def __UCLIBC_HAS_IPV4__*/
/* Structure describing an Internet socket address. */
struct sockaddr_in
{
@@ -232,6 +243,7 @@ struct sockaddr_in
};
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* Ditto, for IPv6. */
struct sockaddr_in6
{
@@ -241,8 +253,10 @@ struct sockaddr_in6
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* IPv6 scope-id */
};
+#endif
+#if defined __USE_MISC || defined __USE_GNU
/* IPv4 multicast request. */
struct ip_mreq
{
@@ -264,7 +278,10 @@ struct ip_mreq_source
/* IP address of interface. */
struct in_addr imr_sourceaddr;
};
+#endif
+
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* Likewise, for IPv6. */
struct ipv6_mreq
{
@@ -274,8 +291,10 @@ struct ipv6_mreq
/* local interface */
unsigned int ipv6mr_interface;
};
+#endif
+#if defined __USE_MISC || defined __USE_GNU
/* Multicast group request. */
struct group_req
{
@@ -342,6 +361,7 @@ struct group_filter
- sizeof (struct sockaddr_storage) \
+ ((numsrc) \
* sizeof (struct sockaddr_storage)))
+#endif
/* Get system-specific definitions. */
@@ -355,12 +375,16 @@ struct group_filter
may have different representations but the values are always the same. */
extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
+libc_hidden_proto(ntohl)
extern uint16_t ntohs (uint16_t __netshort)
__THROW __attribute__ ((__const__));
+libc_hidden_proto(ntohs)
extern uint32_t htonl (uint32_t __hostlong)
__THROW __attribute__ ((__const__));
+libc_hidden_proto(htonl)
extern uint16_t htons (uint16_t __hostshort)
__THROW __attribute__ ((__const__));
+libc_hidden_proto(htons)
#include <endian.h>
@@ -388,73 +412,85 @@ extern uint16_t htons (uint16_t __hostshort)
# endif
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define IN6_IS_ADDR_UNSPECIFIED(a) \
- (((__const uint32_t *) (a))[0] == 0 \
- && ((__const uint32_t *) (a))[1] == 0 \
- && ((__const uint32_t *) (a))[2] == 0 \
- && ((__const uint32_t *) (a))[3] == 0)
+ (((const uint32_t *) (a))[0] == 0 \
+ && ((const uint32_t *) (a))[1] == 0 \
+ && ((const uint32_t *) (a))[2] == 0 \
+ && ((const uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a) \
- (((__const uint32_t *) (a))[0] == 0 \
- && ((__const uint32_t *) (a))[1] == 0 \
- && ((__const uint32_t *) (a))[2] == 0 \
- && ((__const uint32_t *) (a))[3] == htonl (1))
+ (((const uint32_t *) (a))[0] == 0 \
+ && ((const uint32_t *) (a))[1] == 0 \
+ && ((const uint32_t *) (a))[2] == 0 \
+ && ((const uint32_t *) (a))[3] == htonl (1))
-#define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
+#define IN6_IS_ADDR_MULTICAST(a) (((const uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_LINKLOCAL(a) \
- ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfe800000))
#define IN6_IS_ADDR_SITELOCAL(a) \
- ((((__const uint32_t *) (a))[0] & htonl (0xffc00000)) \
+ ((((const uint32_t *) (a))[0] & htonl (0xffc00000)) \
== htonl (0xfec00000))
#define IN6_IS_ADDR_V4MAPPED(a) \
- ((((__const uint32_t *) (a))[0] == 0) \
- && (((__const uint32_t *) (a))[1] == 0) \
- && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
+ ((((const uint32_t *) (a))[0] == 0) \
+ && (((const uint32_t *) (a))[1] == 0) \
+ && (((const uint32_t *) (a))[2] == htonl (0xffff)))
#define IN6_IS_ADDR_V4COMPAT(a) \
- ((((__const uint32_t *) (a))[0] == 0) \
- && (((__const uint32_t *) (a))[1] == 0) \
- && (((__const uint32_t *) (a))[2] == 0) \
- && (ntohl (((__const uint32_t *) (a))[3]) > 1))
+ ((((const uint32_t *) (a))[0] == 0) \
+ && (((const uint32_t *) (a))[1] == 0) \
+ && (((const uint32_t *) (a))[2] == 0) \
+ && (ntohl (((const uint32_t *) (a))[3]) > 1))
#define IN6_ARE_ADDR_EQUAL(a,b) \
- ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \
- && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
- && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
- && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+ ((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) \
+ && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) \
+ && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) \
+ && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
+#endif
+#if defined __USE_MISC || defined __USE_GNU
/* Bind socket to a privileged IP port. */
extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
+libc_hidden_proto(bindresvport)
+# if 0 /*def __UCLIBC_HAS_IPV6__*/
/* The IPv6 version of this function. */
extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
__THROW;
+# endif
+#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
+ && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
+ && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
+ && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
+ && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
- && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
+ && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
+#endif
+
+#ifdef __USE_GNU
+# if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* IPv6 packet information. */
struct in6_pktinfo
{
@@ -470,22 +506,22 @@ struct ip6_mtuinfo
};
-#if 0 /*def __USE_GNU*/
+# if 0
/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
extern int inet6_option_space (int __nbytes)
__THROW __attribute_deprecated__;
extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
int __type) __THROW __attribute_deprecated__;
extern int inet6_option_append (struct cmsghdr *__cmsg,
- __const uint8_t *__typep, int __multx,
+ const uint8_t *__typep, int __multx,
int __plusy) __THROW __attribute_deprecated__;
extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
int __multx, int __plusy)
__THROW __attribute_deprecated__;
-extern int inet6_option_next (__const struct cmsghdr *__cmsg,
+extern int inet6_option_next (const struct cmsghdr *__cmsg,
uint8_t **__tptrp)
__THROW __attribute_deprecated__;
-extern int inet6_option_find (__const struct cmsghdr *__cmsg,
+extern int inet6_option_find (const struct cmsghdr *__cmsg,
uint8_t **__tptrp, int __type)
__THROW __attribute_deprecated__;
@@ -513,13 +549,16 @@ extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
int __segments) __THROW;
-extern int inet6_rth_add (void *__bp, __const struct in6_addr *__addr) __THROW;
-extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW;
-extern int inet6_rth_segments (__const void *__bp) __THROW;
-extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index)
+extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __THROW;
+extern int inet6_rth_reverse (const void *__in, void *__out) __THROW;
+extern int inet6_rth_segments (const void *__bp) __THROW;
+extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
__THROW;
+# endif
+# endif
+# if 0
/* Multicast source filter support. */
/* Get IPv4 source filter. */
@@ -532,23 +571,24 @@ extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
struct in_addr __group, uint32_t __fmode,
uint32_t __numsrc,
- __const struct in_addr *__slist)
+ const struct in_addr *__slist)
__THROW;
/* Get source filter. */
extern int getsourcefilter (int __s, uint32_t __interface_addr,
- __const struct sockaddr *__group,
+ const struct sockaddr *__group,
socklen_t __grouplen, uint32_t *__fmode,
uint32_t *__numsrc,
struct sockaddr_storage *__slist) __THROW;
/* Set source filter. */
extern int setsourcefilter (int __s, uint32_t __interface_addr,
- __const struct sockaddr *__group,
+ const struct sockaddr *__group,
socklen_t __grouplen, uint32_t __fmode,
uint32_t __numsrc,
- __const struct sockaddr_storage *__slist) __THROW;
+ const struct sockaddr_storage *__slist) __THROW;
+# endif
#endif /* use GNU */
__END_DECLS
diff --git a/include/netinet/in_systm.h b/include/netinet/in_systm.h
index 51a08e176..d398d0c9e 100644
--- a/include/netinet/in_systm.h
+++ b/include/netinet/in_systm.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IN_SYSTM_H
#define _NETINET_IN_SYSTM_H 1
diff --git a/include/netinet/ip.h b/include/netinet/ip.h
index fc9144052..3fe58b9ee 100644
--- a/include/netinet/ip.h
+++ b/include/netinet/ip.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2009 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __NETINET_IP_H
#define __NETINET_IP_H 1
@@ -153,7 +153,60 @@ struct ip_timestamp
#define IP_MAXPACKET 65535 /* maximum packet size */
/*
- * Definitions for IP type of service (ip_tos)
+ * Definitions for Explicit Congestion Notification (ECN)
+ *
+ * Taken from RFC-3168, Section 5.
+ */
+
+#define IPTOS_ECN_MASK 0x03
+#define IPTOS_ECN(x) ((x) & IPTOS_ECN_MASK)
+#define IPTOS_ECN_NOT_ECT 0x00
+#define IPTOS_ECN_ECT1 0x01
+#define IPTOS_ECN_ECT0 0x02
+#define IPTOS_ECN_CE 0x03
+
+/*
+ * Definitions for IP differentiated services code points (DSCP)
+ *
+ * Taken from RFC-2597, Section 6 and RFC-2598, Section 2.3.
+ */
+
+#define IPTOS_DSCP_MASK 0xfc
+#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK)
+#define IPTOS_DSCP_AF11 0x28
+#define IPTOS_DSCP_AF12 0x30
+#define IPTOS_DSCP_AF13 0x38
+#define IPTOS_DSCP_AF21 0x48
+#define IPTOS_DSCP_AF22 0x50
+#define IPTOS_DSCP_AF23 0x58
+#define IPTOS_DSCP_AF31 0x68
+#define IPTOS_DSCP_AF32 0x70
+#define IPTOS_DSCP_AF33 0x78
+#define IPTOS_DSCP_AF41 0x88
+#define IPTOS_DSCP_AF42 0x90
+#define IPTOS_DSCP_AF43 0x98
+#define IPTOS_DSCP_EF 0xb8
+
+/*
+ * In RFC 2474, Section 4.2.2.1, the Class Selector Codepoints subsume
+ * the old ToS Precedence values.
+ */
+#define IPTOS_CLASS_MASK 0xe0
+#define IPTOS_CLASS(class) ((class) & IPTOS_CLASS_MASK)
+#define IPTOS_CLASS_CS0 0x00
+#define IPTOS_CLASS_CS1 0x20
+#define IPTOS_CLASS_CS2 0x40
+#define IPTOS_CLASS_CS3 0x60
+#define IPTOS_CLASS_CS4 0x80
+#define IPTOS_CLASS_CS5 0xa0
+#define IPTOS_CLASS_CS6 0xc0
+#define IPTOS_CLASS_CS7 0xe0
+
+#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
+
+/*
+ * Definitions for IP type of service (ip_tos) [deprecated; use DSCP
+ * and CS definitions above instead.]
*/
#define IPTOS_TOS_MASK 0x1E
#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK)
@@ -164,18 +217,18 @@ struct ip_timestamp
#define IPTOS_MINCOST IPTOS_LOWCOST
/*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ * Definitions for IP precedence (also in ip_tos) [also deprecated.]
*/
-#define IPTOS_PREC_MASK 0xe0
-#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK)
-#define IPTOS_PREC_NETCONTROL 0xe0
-#define IPTOS_PREC_INTERNETCONTROL 0xc0
-#define IPTOS_PREC_CRITIC_ECP 0xa0
-#define IPTOS_PREC_FLASHOVERRIDE 0x80
-#define IPTOS_PREC_FLASH 0x60
-#define IPTOS_PREC_IMMEDIATE 0x40
-#define IPTOS_PREC_PRIORITY 0x20
-#define IPTOS_PREC_ROUTINE 0x00
+#define IPTOS_PREC_MASK IPTOS_CLASS_MASK
+#define IPTOS_PREC(tos) IPTOS_CLASS(tos)
+#define IPTOS_PREC_NETCONTROL IPTOS_CLASS_CS7
+#define IPTOS_PREC_INTERNETCONTROL IPTOS_CLASS_CS6
+#define IPTOS_PREC_CRITIC_ECP IPTOS_CLASS_CS5
+#define IPTOS_PREC_FLASHOVERRIDE IPTOS_CLASS_CS4
+#define IPTOS_PREC_FLASH IPTOS_CLASS_CS3
+#define IPTOS_PREC_IMMEDIATE IPTOS_CLASS_CS2
+#define IPTOS_PREC_PRIORITY IPTOS_CLASS_CS1
+#define IPTOS_PREC_ROUTINE IPTOS_CLASS_CS0
/*
* Definitions for options.
diff --git a/include/netinet/ip6.h b/include/netinet/ip6.h
index bef2af2f5..b4f0f3799 100644
--- a/include/netinet/ip6.h
+++ b/include/netinet/ip6.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NETINET_IP6_H
#define _NETINET_IP6_H 1
@@ -102,11 +101,11 @@ struct ip6_frag
uint32_t ip6f_ident; /* identification */
};
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
# define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
# define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
# define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
# define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
# define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
# define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
@@ -176,11 +175,11 @@ struct ip6_opt_router
};
/* Router alert values (in network byte order) */
-#if BYTE_ORDER == BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
# define IP6_ALERT_MLD 0x0000
# define IP6_ALERT_RSVP 0x0001
# define IP6_ALERT_AN 0x0002
-#else /* BYTE_ORDER == LITTLE_ENDING */
+#else /* __BYTE_ORDER == __LITTLE_ENDING */
# define IP6_ALERT_MLD 0x0000
# define IP6_ALERT_RSVP 0x0100
# define IP6_ALERT_AN 0x0200
diff --git a/include/netinet/ip_icmp.h b/include/netinet/ip_icmp.h
index 2fc8e9c1c..79788f91c 100644
--- a/include/netinet/ip_icmp.h
+++ b/include/netinet/ip_icmp.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __NETINET_IP_ICMP_H
#define __NETINET_IP_ICMP_H 1
diff --git a/include/netinet/protocols.h b/include/netinet/protocols.h
deleted file mode 100644
index 1a619c474..000000000
--- a/include/netinet/protocols.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* protocols.h */
-#ifndef _NETINET_PROTOCOLS_H
-#define _NETINET_PROTOCOLS_H
-
-#define IP_ICMP 1
-#define IP_IGMP 2
-#define IP_GGP 3
-#define IP_ST 5
-#define IP_TCP 6
-#define IP_UCL 7
-#define IP_EGP 8
-#define IP_IGP 9
-#define IP_BBN_RCC_MON 10
-#define IP_NVP_II 11
-#define IP_PUP 12
-#define IP_ARGUS 13
-#define IP_EMCON 14
-#define IP_XNET 15
-#define IP_CHAOS 16
-#define IP_UDP 17
-#define IP_MUX 18
-#define IP_DCN_MEAS 19
-#define IP_HMP 20
-#define IP_PRM 21
-#define IP_XNS_IDP 22
-#define IP_TRUNK1 23
-#define IP_TRUNK2 24
-#define IP_LEAF1 25
-#define IP_LEAF2 26
-#define IP_RDP 27
-#define IP_IRTP 28
-#define IP_ISO_TP4 29
-#define IP_NETBLT 30
-#define IP_MFE_NSP 31
-#define IP_MERIT_INP 32
-#define IP_SEP 33
-#define IP_3PC 34
-#define IP_CFTP 62
-#define SAT_EXPAK 64
-#define IP_RVD 66
-#define IP_IPPC 67
-#define IP_SAT_MON 69
-#define IP_VISA 70
-#define IP_IPCV 71
-#define IP_BR_SAT_MON 76
-#define IP_SUN_ND 77
-#define IP_WB_MON 78
-#define IP_WB_EXPAK 79
-#define IP_ISO_IP 80
-#define IP_VMTP 81
-#define IP_SECURE_VMTP 82
-#define IP_VINES 83
-#define IP_TTP 84
-#define NSFNET_IGP 85
-#define IP_DGP 86
-#define IP_TCF 87
-#define IP_IGRP 88
-#define IP_OSPFIGP 89
-#define IP_SPRITE_RPG 90
-#define IP_LARP 91
-
-#endif /* _NETINET_PROTOCOLS_H*/
diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h
index 06e8414b5..04032bb68 100644
--- a/include/netinet/tcp.h
+++ b/include/netinet/tcp.h
@@ -51,6 +51,16 @@
#define TCP_QUICKACK 12 /* Bock/reenable quick ACKs. */
#define TCP_CONGESTION 13 /* Congestion control algorithm. */
#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
+#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
+#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
+#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
+#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
+#define TCP_REPAIR 19 /* TCP sock is under repair right now */
+#define TCP_REPAIR_QUEUE 20 /* Set TCP queue to repair */
+#define TCP_QUEUE_SEQ 21 /* Set sequence number of repaired queue. */
+#define TCP_REPAIR_OPTIONS 22 /* Repair TCP connection options */
+#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
+#define TCP_TIMESTAMP 24 /* TCP time stamp */
#ifdef __USE_MISC
# include <sys/types.h>
diff --git a/include/netinet/udp.h b/include/netinet/udp.h
index 45b69f749..7d4976885 100644
--- a/include/netinet/udp.h
+++ b/include/netinet/udp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-1997,2004,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* Copyright (C) 1982, 1986 Regents of the University of California.
@@ -74,6 +73,16 @@ struct udphdr
};
#endif
+/* UDP socket options */
+#define UDP_CORK 1 /* Never send partially complete segments. */
+#define UDP_ENCAP 100 /* Set the socket to accept
+ encapsulated packets. */
+
+/* UDP encapsulation types */
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
+#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
+#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
+
#define SOL_UDP 17 /* sockopt level for UDP */
#endif /* netinet/udp.h */
diff --git a/include/netipx/ipx.h b/include/netipx/ipx.h
index 7eb42ef55..abe981fb8 100644
--- a/include/netipx/ipx.h
+++ b/include/netipx/ipx.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __NETIPX_IPX_H
#define __NETIPX_IPX_H 1
diff --git a/include/netpacket/packet.h b/include/netpacket/packet.h
index 6c634282f..350a13b10 100644
--- a/include/netpacket/packet.h
+++ b/include/netpacket/packet.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef __NETPACKET_PACKET_H
#define __NETPACKET_PACKET_H 1
diff --git a/include/nl_types.h b/include/nl_types.h
index 74e762113..cb86cf0cd 100644
--- a/include/nl_types.h
+++ b/include/nl_types.h
@@ -12,20 +12,21 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _NL_TYPES_H
#define _NL_TYPES_H 1
#include <features.h>
+#ifndef __UCLIBC_STRICT_HEADERS__
/* The default message set used by the gencat program. */
#define NL_SETD 1
/* Value for FLAG parameter of `catgets' to say we want XPG4 compliance. */
#define NL_CAT_LOCALE 1
+#endif
__BEGIN_DECLS
@@ -34,25 +35,29 @@ __BEGIN_DECLS
#warning "mjn3 FIXME: None of these prototypes have implementations."
#endif
+#ifndef __UCLIBC_STRICT_HEADERS__
/* Message catalog descriptor type. */
typedef void *nl_catd;
+#endif
/* Type used by `nl_langinfo'. */
typedef int nl_item;
+#if 0
/* Open message catalog for later use, returning descriptor.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern nl_catd catopen (__const char *__cat_name, int __flag) __nonnull ((1));
+extern nl_catd catopen (const char *__cat_name, int __flag) __nonnull ((1));
/* Return translation with NUMBER in SET of CATALOG; if not found
return STRING. */
extern char *catgets (nl_catd __catalog, int __set, int __number,
- __const char *__string) __THROW __nonnull ((1));
+ const char *__string) __THROW __nonnull ((1));
/* Close message CATALOG. */
extern int catclose (nl_catd __catalog) __THROW __nonnull ((1));
+#endif
__END_DECLS
diff --git a/include/obstack.h b/include/obstack.h
index 244e580ad..8ef0b7a45 100644
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -1,7 +1,7 @@
/* obstack.h - object stack macros
- Copyright (C) 1988,89,90,91,92,93,94,96,97,98,99 Free Software Foundation, Inc.
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ Copyright (C) 1988-1994,1996-1999,2003,2004,2005
+ 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
modify it under the terms of the GNU Lesser General Public
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Summary:
@@ -110,45 +109,36 @@ Summary:
extern "C" {
#endif
-/* We use subtraction of (char *) 0 instead of casting to int
- because on word-addressable machines a simple cast to int
- may ignore the byte-within-word field of the pointer. */
-
-#ifndef __PTR_TO_INT
-# define __PTR_TO_INT(P) ((P) - (char *) 0)
-#endif
-
-#ifndef __INT_TO_PTR
-# define __INT_TO_PTR(P) ((P) + (char *) 0)
-#endif
-
-/* We need the type of the resulting object. If __PTRDIFF_TYPE__ is
+/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
defined, as with GNU C, use that; that way we don't pollute the
- namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is
- available, include it and use ptrdiff_t. In traditional C, long is
- the best that we can do. */
+ namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
+ and use ptrdiff_t. */
#ifdef __PTRDIFF_TYPE__
# define PTR_INT_TYPE __PTRDIFF_TYPE__
#else
-# ifdef HAVE_STDDEF_H
-# include <stddef.h>
-# define PTR_INT_TYPE ptrdiff_t
-# else
-# define PTR_INT_TYPE long
-# endif
+# include <stddef.h>
+# define PTR_INT_TYPE ptrdiff_t
#endif
-#if defined _LIBC || defined HAVE_STRING_H
-# include <string.h>
-# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
-#else
-# ifdef memcpy
-# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
-# else
-# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N))
-# endif
-#endif
+/* If B is the base of an object addressed by P, return the result of
+ aligning P to the next multiple of A + 1. B and P must be of type
+ char *. A + 1 must be a power of 2. */
+
+#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
+
+/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case
+ where pointers can be converted to integers, aligned as integers,
+ and converted back again. If PTR_INT_TYPE is narrower than a
+ pointer (e.g., the AS/400), play it safe and compute the alignment
+ relative to B. Otherwise, use the faster strategy of computing the
+ alignment relative to 0. */
+
+#define __PTR_ALIGN(B, P, A) \
+ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
+ P, A)
+
+#include <string.h>
struct _obstack_chunk /* Lives at front of each chunk. */
{
@@ -164,20 +154,18 @@ struct obstack /* control current object in current chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
- PTR_INT_TYPE temp; /* Temporary for some macros. */
+ union
+ {
+ PTR_INT_TYPE tempint;
+ void *tempptr;
+ } temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
-#if defined __STDC__ && __STDC__
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
-#else
- struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
- void (*freefun) (); /* User's function to free a chunk. */
- char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
-#endif
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This
@@ -190,77 +178,23 @@ struct obstack /* control current object in current chunk */
/* Declare the external functions we use; they are in obstack.c. */
-#if defined __STDC__ && __STDC__
extern void _obstack_newchunk (struct obstack *, int);
-extern void _obstack_free (struct obstack *, void *);
+libc_hidden_proto(_obstack_newchunk)
extern int _obstack_begin (struct obstack *, int, int,
void *(*) (long), void (*) (void *));
extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long),
void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *);
-#else
-extern void _obstack_newchunk ();
-extern void _obstack_free ();
-extern int _obstack_begin ();
-extern int _obstack_begin_1 ();
-extern int _obstack_memory_used ();
-#endif
-
-#if defined __STDC__ && __STDC__
-
-/* Do the function-declarations after the structs
- but before defining the macros. */
-
-void obstack_init (struct obstack *obstack);
-
-void * obstack_alloc (struct obstack *obstack, int size);
-
-void * obstack_copy (struct obstack *obstack, const void *address, int size);
-void * obstack_copy0 (struct obstack *obstack, const void *address, int size);
void obstack_free (struct obstack *obstack, void *block);
-void obstack_blank (struct obstack *obstack, int size);
-
-void obstack_grow (struct obstack *obstack, const void *data, int size);
-void obstack_grow0 (struct obstack *obstack, const void *data, int size);
-
-void obstack_1grow (struct obstack *obstack, int data_char);
-void obstack_ptr_grow (struct obstack *obstack, const void *data);
-void obstack_int_grow (struct obstack *obstack, int data);
-
-void * obstack_finish (struct obstack *obstack);
-
-int obstack_object_size (struct obstack *obstack);
-
-int obstack_room (struct obstack *obstack);
-void obstack_make_room (struct obstack *obstack, int size);
-void obstack_1grow_fast (struct obstack *obstack, int data_char);
-void obstack_ptr_grow_fast (struct obstack *obstack, const void *data);
-void obstack_int_grow_fast (struct obstack *obstack, int data);
-void obstack_blank_fast (struct obstack *obstack, int size);
-
-void * obstack_base (struct obstack *obstack);
-void * obstack_next_free (struct obstack *obstack);
-int obstack_alignment_mask (struct obstack *obstack);
-int obstack_chunk_size (struct obstack *obstack);
-int obstack_memory_used (struct obstack *obstack);
-
-#endif /* __STDC__ */
-
-/* Non-ANSI C cannot really support alternative functions for these macros,
- so we do not declare them. */
/* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function which
should either abort gracefully or use longjump - but shouldn't
return. The default action is to print a message and abort. */
-#if defined __STDC__ && __STDC__
extern void (*obstack_alloc_failed_handler) (void);
-#else
-extern void (*obstack_alloc_failed_handler) ();
-#endif
/* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure;
@@ -269,7 +203,7 @@ extern int obstack_exit_failure;
Note that this might not be the final address of the object
because a new chunk might be needed to hold the final size. */
-#define obstack_base(h) ((h)->object_base)
+#define obstack_base(h) ((void *) (h)->object_base)
/* Size for allocating ordinary chunks. */
@@ -283,67 +217,34 @@ extern int obstack_exit_failure;
#define obstack_alignment_mask(h) ((h)->alignment_mask)
-/* To prevent prototype warnings provide complete argument list in
- standard C version. */
-#if defined __STDC__ && __STDC__
-
-# define obstack_init(h) \
+/* To prevent prototype warnings provide complete argument list. */
+#define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
+ (void *(*) (long)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
-# define obstack_begin(h, size) \
+#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
- (void *(*) (long)) obstack_chunk_alloc, \
+ (void *(*) (long)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
-# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
+#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
- (void *(*) (long)) (chunkfun), \
+ (void *(*) (long)) (chunkfun), \
(void (*) (void *)) (freefun))
-# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
+#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) (void *, long)) (chunkfun), \
(void (*) (void *, void *)) (freefun), (arg))
-# define obstack_chunkfun(h, newchunkfun) \
+#define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun))
-# define obstack_freefun(h, newfreefun) \
+#define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
-#else
-
-# define obstack_init(h) \
- _obstack_begin ((h), 0, 0, \
- (void *(*) ()) obstack_chunk_alloc, \
- (void (*) ()) obstack_chunk_free)
-
-# define obstack_begin(h, size) \
- _obstack_begin ((h), (size), 0, \
- (void *(*) ()) obstack_chunk_alloc, \
- (void (*) ()) obstack_chunk_free)
-
-# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
- _obstack_begin ((h), (size), (alignment), \
- (void *(*) ()) (chunkfun), \
- (void (*) ()) (freefun))
-
-# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
- _obstack_begin_1 ((h), (size), (alignment), \
- (void *(*) ()) (chunkfun), \
- (void (*) ()) (freefun), (arg))
-
-# define obstack_chunkfun(h, newchunkfun) \
- ((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
-
-# define obstack_freefun(h, newfreefun) \
- ((h) -> freefun = (void (*)()) (newfreefun))
-
-#endif
-
-#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = achar)
+#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h,n) ((h)->next_free += (n))
@@ -364,12 +265,12 @@ extern int obstack_exit_failure;
# define obstack_object_size(OBSTACK) \
__extension__ \
- ({ struct obstack *__o = (OBSTACK); \
+ ({ struct obstack const *__o = (OBSTACK); \
(unsigned) (__o->next_free - __o->object_base); })
# define obstack_room(OBSTACK) \
__extension__ \
- ({ struct obstack *__o = (OBSTACK); \
+ ({ struct obstack const *__o = (OBSTACK); \
(unsigned) (__o->chunk_limit - __o->next_free); })
# define obstack_make_room(OBSTACK,length) \
@@ -382,8 +283,11 @@ __extension__ \
# define obstack_empty_p(OBSTACK) \
__extension__ \
- ({ struct obstack *__o = (OBSTACK); \
- (__o->chunk->prev == 0 && __o->next_free - __o->chunk->contents == 0); })
+ ({ struct obstack const *__o = (OBSTACK); \
+ (__o->chunk->prev == 0 \
+ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \
+ __o->chunk->contents, \
+ __o->alignment_mask)); })
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
@@ -391,7 +295,7 @@ __extension__ \
int __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \
- _obstack_memcpy (__o->next_free, (where), __len); \
+ memcpy (__o->next_free, where, __len); \
__o->next_free += __len; \
(void) 0; })
@@ -401,7 +305,7 @@ __extension__ \
int __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \
- _obstack_memcpy (__o->next_free, (where), __len); \
+ memcpy (__o->next_free, where, __len); \
__o->next_free += __len; \
*(__o->next_free)++ = 0; \
(void) 0; })
@@ -411,7 +315,7 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, 1); \
- *(__o->next_free)++ = (datum); \
+ obstack_1grow_fast (__o, datum); \
(void) 0; })
/* These assume that the obstack alignment is good enough for pointers
@@ -423,22 +327,28 @@ __extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (void *) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (void *)); \
- *((void **)__o->next_free)++ = (datum); \
- (void) 0; })
+ obstack_ptr_grow_fast (__o, datum); }) \
# define obstack_int_grow(OBSTACK,datum) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
if (__o->next_free + sizeof (int) > __o->chunk_limit) \
_obstack_newchunk (__o, sizeof (int)); \
- *((int *)__o->next_free)++ = (datum); \
- (void) 0; })
+ obstack_int_grow_fast (__o, datum); })
-# define obstack_ptr_grow_fast(h,aptr) \
- (*((void **) (h)->next_free)++ = (aptr))
+# define obstack_ptr_grow_fast(OBSTACK,aptr) \
+__extension__ \
+({ struct obstack *__o1 = (OBSTACK); \
+ *(const void **) __o1->next_free = (aptr); \
+ __o1->next_free += sizeof (const void *); \
+ (void) 0; })
-# define obstack_int_grow_fast(h,aint) \
- (*((int *) (h)->next_free)++ = (aint))
+# define obstack_int_grow_fast(OBSTACK,aint) \
+__extension__ \
+({ struct obstack *__o1 = (OBSTACK); \
+ *(int *) __o1->next_free = (aint); \
+ __o1->next_free += sizeof (int); \
+ (void) 0; })
# define obstack_blank(OBSTACK,length) \
__extension__ \
@@ -446,7 +356,7 @@ __extension__ \
int __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
- __o->next_free += __len; \
+ obstack_blank_fast (__o, __len); \
(void) 0; })
# define obstack_alloc(OBSTACK,length) \
@@ -469,21 +379,20 @@ __extension__ \
/* The local variable is named __o1 to avoid a name conflict
when obstack_blank is called. */
-# define obstack_finish(OBSTACK) \
+# define obstack_finish(OBSTACK) \
__extension__ \
({ struct obstack *__o1 = (OBSTACK); \
- void *value; \
- value = (void *) __o1->object_base; \
- if (__o1->next_free == value) \
+ void *__value = (void *) __o1->object_base; \
+ if (__o1->next_free == __value) \
__o1->maybe_empty_object = 1; \
__o1->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
- & ~ (__o1->alignment_mask)); \
+ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \
+ __o1->alignment_mask); \
if (__o1->next_free - (char *)__o1->chunk \
> __o1->chunk_limit - (char *)__o1->chunk) \
__o1->next_free = __o1->chunk_limit; \
__o1->object_base = __o1->next_free; \
- value; })
+ __value; })
# define obstack_free(OBSTACK, OBJ) \
__extension__ \
@@ -502,7 +411,10 @@ __extension__ \
(unsigned) ((h)->chunk_limit - (h)->next_free)
# define obstack_empty_p(h) \
- ((h)->chunk->prev == 0 && (h)->next_free - (h)->chunk->contents == 0)
+ ((h)->chunk->prev == 0 \
+ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \
+ (h)->chunk->contents, \
+ (h)->alignment_mask))
/* Note that the call to _obstack_newchunk is enclosed in (..., 0)
so that we can avoid having void expressions
@@ -511,51 +423,51 @@ __extension__ \
but some compilers won't accept it. */
# define obstack_make_room(h,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0))
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0))
# define obstack_grow(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
- _obstack_memcpy ((h)->next_free, (where), (h)->temp), \
- (h)->next_free += (h)->temp)
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint)
# define obstack_grow0(h,where,length) \
-( (h)->temp = (length), \
- (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \
- ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \
- _obstack_memcpy ((h)->next_free, (where), (h)->temp), \
- (h)->next_free += (h)->temp, \
+( (h)->temp.tempint = (length), \
+ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \
+ memcpy ((h)->next_free, where, (h)->temp.tempint), \
+ (h)->next_free += (h)->temp.tempint, \
*((h)->next_free)++ = 0)
# define obstack_1grow(h,datum) \
( (((h)->next_free + 1 > (h)->chunk_limit) \
? (_obstack_newchunk ((h), 1), 0) : 0), \
- (*((h)->next_free)++ = (datum)))
+ obstack_1grow_fast (h, datum))
# define obstack_ptr_grow(h,datum) \
( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \
- (*((const char **) (((h)->next_free+=sizeof(char *))-sizeof(char *))) = (datum)))
+ obstack_ptr_grow_fast (h, datum))
# define obstack_int_grow(h,datum) \
( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \
? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \
- (*((int *) (((h)->next_free+=sizeof(int))-sizeof(int))) = (datum)))
+ obstack_int_grow_fast (h, datum))
# define obstack_ptr_grow_fast(h,aptr) \
- (*((const char **) (h)->next_free)++ = (aptr))
+ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr))
# define obstack_int_grow_fast(h,aint) \
- (*((int *) (h)->next_free)++ = (aint))
+ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint))
# define obstack_blank(h,length) \
-( (h)->temp = (length), \
- (((h)->chunk_limit - (h)->next_free < (h)->temp) \
- ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \
- ((h)->next_free += (h)->temp))
+( (h)->temp.tempint = (length), \
+ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \
+ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \
+ obstack_blank_fast (h, (h)->temp.tempint))
# define obstack_alloc(h,length) \
(obstack_blank ((h), (length)), obstack_finish ((h)))
@@ -566,35 +478,27 @@ __extension__ \
# define obstack_copy0(h,where,length) \
(obstack_grow0 ((h), (where), (length)), obstack_finish ((h)))
-# define obstack_finish(h) \
+# define obstack_finish(h) \
( ((h)->next_free == (h)->object_base \
? (((h)->maybe_empty_object = 1), 0) \
: 0), \
- (h)->temp = __PTR_TO_INT ((h)->object_base), \
+ (h)->temp.tempptr = (h)->object_base, \
(h)->next_free \
- = __INT_TO_PTR ((__PTR_TO_INT ((h)->next_free)+(h)->alignment_mask) \
- & ~ ((h)->alignment_mask)), \
+ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \
+ (h)->alignment_mask), \
(((h)->next_free - (char *) (h)->chunk \
> (h)->chunk_limit - (char *) (h)->chunk) \
? ((h)->next_free = (h)->chunk_limit) : 0), \
(h)->object_base = (h)->next_free, \
- __INT_TO_PTR ((h)->temp))
+ (h)->temp.tempptr)
-# if defined __STDC__ && __STDC__
-# define obstack_free(h,obj) \
-( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
- (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
- ? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
-# else
-# define obstack_free(h,obj) \
-( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
- (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
+# define obstack_free(h,obj) \
+( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
+ ((((h)->temp.tempint > 0 \
+ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
? (int) ((h)->next_free = (h)->object_base \
- = (h)->temp + (char *) (h)->chunk) \
- : (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
-# endif
+ = (h)->temp.tempint + (char *) (h)->chunk) \
+ : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
#endif /* not __GNUC__ or not __STDC__ */
diff --git a/include/paths.h b/include/paths.h
index ae892c4cf..0b4035d22 100644
--- a/include/paths.h
+++ b/include/paths.h
@@ -44,6 +44,7 @@
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DRUM "/dev/drum"
+#define _PATH_GSHADOW "/etc/gshadow"
#define _PATH_KLOG "/proc/kmsg"
#define _PATH_KMEM "/dev/kmem"
#define _PATH_LASTLOG "/var/log/lastlog"
@@ -64,7 +65,6 @@
#define _PATH_VI "/usr/bin/vi"
#define _PATH_WTMP "/var/log/wtmp"
-/* uClibc */
#ifdef _LIBC
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_GROUP "/etc/group"
diff --git a/include/printf.h b/include/printf.h
index 72dffaab4..c6467a0ef 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* March 11, 2001 Manuel Novoa III
*
@@ -41,7 +40,7 @@ __BEGIN_DECLS
* need to support bitfields since that's what glibc made visible to users.
* So, we take
* advantage of how gcc lays out bitfields to create an appropriate
- * mapping. Inside uclibc (UCLIBC_INTERNAL is defined) we access the
+ * mapping. Inside uclibc (i.e. if _LIBC is defined) we access the
* bitfields using bitmasks in a single flag variable.
*
* WARNING -- This may very well fail if built with -fpack-struct!!!
@@ -61,7 +60,7 @@ struct printf_info {
int spec;
#endif
-#ifndef UCLIBC_INTERNAL
+#ifndef _LIBC
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int space:1; /* Space flag. */
@@ -95,7 +94,7 @@ struct printf_info {
#error unsupported byte order!
#endif
-#else /* UCLIBC_INTERNAL */
+#else /* _LIBC */
uint32_t _flags; /* non-gnu */
#define __PRINT_INFO_FLAG_space (1<<0)
@@ -121,7 +120,7 @@ struct printf_info {
#define PRINT_INFO_SET_extra(INFO_PTR,VAL) \
((INFO_PTR)->_flags |= (((INFO_PTR)->_flags & ~1) | ((VAL) & 1)))
-#endif /* UCLIBC_INTERNAL */
+#endif /* _LIBC */
#ifdef __UCLIBC_HAS_WCHAR__
wchar_t pad; /* Padding character. */
@@ -143,14 +142,14 @@ struct printf_info {
#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__
typedef int (*printf_function) (FILE *__stream,
- __const struct printf_info *__info,
- __const void *__const *__args);
+ const struct printf_info *__info,
+ const void *const *__args);
/* Type of a printf specifier-arginfo function.
INFO gives information about the format specification.
N, ARGTYPES, and return value are as for parse_printf_format. */
-typedef int printf_arginfo_function (__const struct printf_info *__info,
+typedef int printf_arginfo_function (const struct printf_info *__info,
size_t __n, int *__argtypes);
@@ -174,7 +173,7 @@ extern int register_printf_function (int __spec, printf_function __func,
array it is passed with the types of the arguments it wants, and return
the number of arguments it wants. */
-extern size_t parse_printf_format (__const char *__restrict __fmt, size_t __n,
+extern size_t parse_printf_format (const char *__restrict __fmt, size_t __n,
int *__restrict __argtypes) __THROW;
@@ -222,11 +221,11 @@ enum { /* C type: */
the format specifier is a uppercase character powers of 1000 are
used. Otherwise powers of 1024. */
extern int printf_size (FILE *__restrict __fp,
- __const struct printf_info *__info,
- __const void *__const *__restrict __args) __THROW;
+ const struct printf_info *__info,
+ const void *const *__restrict __args) __THROW;
/* This is the appropriate argument information function for `printf_size'. */
-extern int printf_size_info (__const struct printf_info *__restrict
+extern int printf_size_info (const struct printf_info *__restrict
__info, size_t __n, int *__restrict __argtypes)
__THROW;
diff --git a/include/protocols/timed.h b/include/protocols/timed.h
index 4345bed47..f50061cc1 100644
--- a/include/protocols/timed.h
+++ b/include/protocols/timed.h
@@ -32,14 +32,17 @@
#ifndef _PROTOCOLS_TIMED_H
#define _PROTOCOLS_TIMED_H 1
+#include <features.h>
+#ifdef __UCLIBC_HAS_RPC__
#include <rpc/types.h>
+#endif
/*
* Time Synchronization Protocol
*/
#define TSPVERSION 1
-#define ANYADDR NULL
+#define ANYADDR NULL
struct tsp {
u_char tsp_type;
diff --git a/include/pty.h b/include/pty.h
index 2d4b5e270..f23a260ae 100644
--- a/include/pty.h
+++ b/include/pty.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _PTY_H
#define _PTY_H 1
@@ -33,6 +32,7 @@ __BEGIN_DECLS
ends in AMASTER and ASLAVE. */
extern int openpty (int *__amaster, int *__aslave, char *__name,
struct termios *__termp, struct winsize *__winp) __THROW;
+libutil_hidden_proto(openpty)
/* Create child process and establish the slave pseudo terminal as the
child's controlling terminal. */
diff --git a/include/pwd.h b/include/pwd.h
index e87413304..72475a61d 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 9.2.2 User Database Access <pwd.h>
@@ -100,7 +99,7 @@ extern struct passwd *fgetpwent (FILE *__stream);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int putpwent (__const struct passwd *__restrict __p,
+extern int putpwent (const struct passwd *__restrict __p,
FILE *__restrict __f);
#endif
@@ -114,7 +113,8 @@ extern struct passwd *getpwuid (__uid_t __uid);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern struct passwd *getpwnam (__const char *__name);
+extern struct passwd *getpwnam (const char *__name);
+libc_hidden_proto(getpwnam)
#if defined __USE_POSIX || defined __USE_MISC
@@ -140,17 +140,20 @@ extern struct passwd *getpwnam (__const char *__name);
extern int getpwent_r (struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
+libc_hidden_proto(getpwent_r)
# endif
extern int getpwuid_r (__uid_t __uid,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
+libc_hidden_proto(getpwuid_r)
-extern int getpwnam_r (__const char *__restrict __name,
+extern int getpwnam_r (const char *__restrict __name,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
+libc_hidden_proto(getpwnam_r)
# ifdef __USE_SVID
@@ -165,6 +168,7 @@ extern int fgetpwent_r (FILE *__restrict __stream,
struct passwd *__restrict __resultbuf,
char *__restrict __buffer, size_t __buflen,
struct passwd **__restrict __result);
+libc_hidden_proto(fgetpwent_r)
# endif
#endif /* POSIX or reentrant */
diff --git a/include/regex.h b/include/regex.h
index 5bd3088e5..94d893073 100644
--- a/include/regex.h
+++ b/include/regex.h
@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005
+ Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,28 +15,15 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _REGEX_H
#define _REGEX_H 1
#include <sys/types.h>
-/* Allow the use in C++ code. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-# include <stddef.h>
-#endif
+__BEGIN_DECLS
/* The following two types have to be signed and unsigned integer type
wide enough to hold a value of a pointer. For most ANSI compilers
@@ -52,20 +39,21 @@ typedef unsigned long int active_reg_t;
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t;
+#ifdef __USE_GNU
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
-#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
/* If this bit is not set, then + and ? are operators, and \+ and \? are
literals.
If set, then \+ and \? are operators and + and ? are literals. */
-#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
+# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
/* If this bit is set, then character classes are supported. They are:
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
+# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
/* If this bit is set, then ^ and $ are always anchors (outside bracket
expressions, of course).
@@ -79,7 +67,7 @@ typedef unsigned long int reg_syntax_t;
POSIX draft 11.2 says that * etc. in leading positions is undefined.
We already implemented a previous draft which made those constructs
invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
+# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
/* If this bit is set, then special characters are always special
regardless of where they are in the pattern.
@@ -87,71 +75,71 @@ typedef unsigned long int reg_syntax_t;
some contexts; otherwise they are ordinary. Specifically,
* + ? and intervals are only special when not after the beginning,
open-group, or alternation operator. */
-#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
+# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
+# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
/* If this bit is set, then . matches newline.
If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
+# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
/* If this bit is set, then . doesn't match NUL.
If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
+# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
/* If this bit is set, nonmatching lists [^...] do not match newline.
If not set, they do. */
-#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
+# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
/* If this bit is set, either \{...\} or {...} defines an
interval, depending on RE_NO_BK_BRACES.
If not set, \{, \}, {, and } are literals. */
-#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
+# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
/* If this bit is set, +, ? and | aren't recognized as operators.
If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
+# define RE_LIMITED_OPS (RE_INTERVALS << 1)
/* If this bit is set, newline is an alternation operator.
If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
+# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
are literals.
If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
+# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
/* If this bit is set, (...) defines a group, and \( and \) are literals.
If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
+# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
/* If this bit is set, then \<digit> matches <digit>.
If not set, then \<digit> is a back-reference. */
-#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
+# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
/* If this bit is set, then | is an alternation operator, and \| is literal.
If not set, then \| is an alternation operator, and | is literal. */
-#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
+# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
/* If this bit is set, then an ending range point collating higher
than the starting range point, as in [z-a], is invalid.
If not set, then when ending range point collates higher than the
starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
+# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
/* If this bit is set, then an unmatched ) is ordinary.
If not set, then an unmatched ) is invalid. */
-#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
+# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
/* If this bit is set, succeed as soon as we match the whole pattern,
without further backtracking. */
-#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
+# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
/* If this bit is set, do not process the GNU regex operators.
If not set, then the GNU regex operators are recognized. */
-#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
+# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
/* If this bit is set, turn on internal regex debugging.
If not set, and debugging was on, turn it off.
@@ -159,29 +147,30 @@ typedef unsigned long int reg_syntax_t;
We define this bit always, so that all that's needed to turn on
debugging is to recompile regex.c; the calling code can always have
this bit set, and it won't affect anything in the normal case. */
-#define RE_DEBUG (RE_NO_GNU_OPS << 1)
+# define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* If this bit is set, a syntactically invalid interval is treated as
a string of ordinary characters. For example, the ERE 'a{1' is
treated as 'a\{1'. */
-#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
/* If this bit is set, then ignore case when matching.
If not set, then case is significant. */
-#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
for ^, because it is difficult to scan the regex backwards to find
whether ^ should be special. */
-#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
+# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
/* If this bit is set, then \{ cannot be first in an bre or
immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
+# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
-#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+#endif
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
@@ -189,6 +178,7 @@ typedef unsigned long int reg_syntax_t;
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
+#ifdef __USE_GNU
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
@@ -263,11 +253,12 @@ extern reg_syntax_t re_syntax_options;
/* Maximum number of duplicates an interval can allow. Some systems
(erroneously) define this in other header files, but we want our
value, so remove any previous define. */
-#ifdef RE_DUP_MAX
-# undef RE_DUP_MAX
-#endif
+# ifdef RE_DUP_MAX
+# undef RE_DUP_MAX
+# endif
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
-#define RE_DUP_MAX (0x7fff)
+# define RE_DUP_MAX (0x7fff)
+#endif
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
@@ -311,7 +302,7 @@ extern reg_syntax_t re_syntax_options;
`re_error_msg' table in regex.c. */
typedef enum
{
-#ifdef _XOPEN_SOURCE
+#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
REG_ENOSYS = -1, /* This will never happen for this implementation. */
#endif
@@ -346,7 +337,16 @@ typedef enum
private to the regex routines. */
#ifndef RE_TRANSLATE_TYPE
-# define RE_TRANSLATE_TYPE unsigned char *
+# define __RE_TRANSLATE_TYPE unsigned char *
+# ifdef __USE_GNU
+# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
+# endif
+#endif
+
+#ifdef __USE_GNU
+# define __REPB_PREFIX(name) name
+#else
+# define __REPB_PREFIX(name) __##name
#endif
struct re_pattern_buffer
@@ -354,27 +354,27 @@ struct re_pattern_buffer
/* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are sometimes used as
array indexes. */
- unsigned char *buffer;
+ unsigned char *__REPB_PREFIX(buffer);
/* Number of bytes to which `buffer' points. */
- unsigned long int allocated;
+ unsigned long int __REPB_PREFIX(allocated);
/* Number of bytes actually used in `buffer'. */
- unsigned long int used;
+ unsigned long int __REPB_PREFIX(used);
/* Syntax setting with which the pattern was compiled. */
- reg_syntax_t syntax;
+ reg_syntax_t __REPB_PREFIX(syntax);
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
fastmap, if there is one, to skip over impossible starting points
for matches. */
- char *fastmap;
+ char *__REPB_PREFIX(fastmap);
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation is
applied to a pattern when it is compiled and to a string when it
is matched. */
- RE_TRANSLATE_TYPE translate;
+ __RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
@@ -383,34 +383,36 @@ struct re_pattern_buffer
Well, in truth it's used only in `re_search_2', to see whether or
not we should use the fastmap, so we don't set this absolutely
perfectly; see `re_compile_fastmap' (the `duplicate' case). */
- unsigned can_be_null : 1;
+ unsigned __REPB_PREFIX(can_be_null) : 1;
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
for `max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
+#ifdef __USE_GNU
+# define REGS_UNALLOCATED 0
+# define REGS_REALLOCATE 1
+# define REGS_FIXED 2
+#endif
+ unsigned __REPB_PREFIX(regs_allocated) : 2;
/* Set to zero when `regex_compile' compiles a pattern; set to one
by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
+ unsigned __REPB_PREFIX(fastmap_accurate) : 1;
/* If set, `re_match_2' does not return information about
subexpressions. */
- unsigned no_sub : 1;
+ unsigned __REPB_PREFIX(no_sub) : 1;
/* If set, a beginning-of-line anchor doesn't match at the beginning
of the string. */
- unsigned not_bol : 1;
+ unsigned __REPB_PREFIX(not_bol) : 1;
/* Similarly for an end-of-line anchor. */
- unsigned not_eol : 1;
+ unsigned __REPB_PREFIX(not_eol) : 1;
/* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
+ unsigned __REPB_PREFIX(newline_anchor) : 1;
};
typedef struct re_pattern_buffer regex_t;
@@ -419,6 +421,7 @@ typedef struct re_pattern_buffer regex_t;
typedef int regoff_t;
+#ifdef __USE_GNU
/* This is the structure we store register match data in. See
regex.texinfo for a full description of what registers match. */
struct re_registers
@@ -432,8 +435,9 @@ struct re_registers
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
`re_match_2' returns information about at least this many registers
the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-# define RE_NREGS 30
+# ifndef RE_NREGS
+# define RE_NREGS 30
+# endif
#endif
@@ -448,7 +452,7 @@ typedef struct
/* Declarations for routines. */
-
+#ifdef __USE_GNU
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the `re_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
@@ -464,6 +468,7 @@ extern const char *re_compile_pattern (const char *__pattern, size_t __length,
accelerate searches. Return 0 if successful and -2 if was an
internal error. */
extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
+libc_hidden_proto(re_compile_fastmap)
/* Search in the string STRING (with length LENGTH) for the pattern
@@ -474,6 +479,7 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
extern int re_search (struct re_pattern_buffer *__buffer, const char *__string,
int __length, int __start, int __range,
struct re_registers *__regs);
+libc_hidden_proto(re_search)
/* Like `re_search', but search in the concatenation of STRING1 and
@@ -482,6 +488,7 @@ extern int re_search_2 (struct re_pattern_buffer *__buffer,
const char *__string1, int __length1,
const char *__string2, int __length2, int __start,
int __range, struct re_registers *__regs, int __stop);
+libc_hidden_proto(re_search_2)
/* Like `re_search', but return how many characters in STRING the regexp
@@ -513,8 +520,9 @@ extern void re_set_registers (struct re_pattern_buffer *__buffer,
struct re_registers *__regs,
unsigned int __num_regs,
regoff_t *__starts, regoff_t *__ends);
+#endif /* Use GNU */
-#if defined _REGEX_RE_COMP || defined _LIBC
+#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
@@ -535,7 +543,8 @@ extern int re_exec (const char *);
#endif
/* gcc 3.1 and up support the [restrict] syntax. */
#ifndef __restrict_arr
-# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) \
+ && !defined __GNUG__
# define __restrict_arr __restrict
# else
# define __restrict_arr
@@ -551,15 +560,15 @@ extern int regexec (const regex_t *__restrict __preg,
const char *__restrict __string, size_t __nmatch,
regmatch_t __pmatch[__restrict_arr],
int __eflags);
+libc_hidden_proto(regexec)
extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
char *__restrict __errbuf, size_t __errbuf_size);
extern void regfree (regex_t *__preg);
+libc_hidden_proto(regfree)
-#ifdef __cplusplus
-}
-#endif /* C++ */
+__END_DECLS
#endif /* regex.h */
diff --git a/include/regexp.h b/include/regexp.h
index b7b50b710..17879aed1 100644
--- a/include/regexp.h
+++ b/include/regexp.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2004, 2008
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -13,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _REGEXP_H
#define _REGEXP_H 1
@@ -81,6 +81,7 @@
__BEGIN_DECLS
+#if 0
/* Interface variables. They contain the results of the successful
calls to `setp' and `advance'. */
extern char *loc1;
@@ -89,6 +90,7 @@ extern char *loc2;
/* The use of this variable in the `advance' function is not
supported. */
extern char *locs;
+#endif
#ifndef __DO_NOT_DEFINE_COMPILE
@@ -100,7 +102,7 @@ extern char *locs;
on the macros. */
char *
compile (char *__restrict instring, char *__restrict expbuf,
- __const char *__restrict endbuf, int eof)
+ const char *__restrict endbuf, int eof)
{
char *__input_buffer = NULL;
size_t __input_size = 0;
@@ -129,8 +131,9 @@ compile (char *__restrict instring, char *__restrict expbuf,
__expr_ptr = (regex_t *) expbuf;
/* The remaining space in the buffer can be used for the compiled
pattern. */
- __expr_ptr->buffer = expbuf + sizeof (regex_t);
- __expr_ptr->allocated = endbuf - (char *) __expr_ptr->buffer;
+ __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
+ __expr_ptr->__REPB_PREFIX (allocated)
+ = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
while ((__ch = (GETC ())) != eof)
{
@@ -162,7 +165,10 @@ compile (char *__restrict instring, char *__restrict expbuf,
}
__input_buffer[__current_size++] = __ch;
}
- __input_buffer[__current_size++] = '\0';
+ if (__current_size)
+ __input_buffer[__current_size++] = '\0';
+ else
+ __input_buffer = "";
/* Now compile the pattern. */
__error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
@@ -198,23 +204,26 @@ compile (char *__restrict instring, char *__restrict expbuf,
}
/* Everything is ok. */
- RETURN ((char *) (__expr_ptr->buffer + __expr_ptr->used));
+ RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
+ + __expr_ptr->__REPB_PREFIX (used)));
}
#endif
+#if 0
/* Find the next match in STRING. The compiled regular expression is
found in the buffer starting at EXPBUF. `loc1' will return the
first character matched and `loc2' points to the next unmatched
character. */
-extern int step (__const char *__restrict __string,
- __const char *__restrict __expbuf) __THROW;
+extern int step (const char *__restrict __string,
+ const char *__restrict __expbuf) __THROW;
/* Match the beginning of STRING with the compiled regular expression
in EXPBUF. If the match is successful `loc2' will contain the
position of the first unmatched character. */
-extern int advance (__const char *__restrict __string,
- __const char *__restrict __expbuf) __THROW;
+extern int advance (const char *__restrict __string,
+ const char *__restrict __expbuf) __THROW;
+#endif
__END_DECLS
diff --git a/include/resolv.h b/include/resolv.h
index 3434f5d8c..9349be11f 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -98,56 +98,85 @@ typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns,
# define RES_MAXNDOTS 15 /* should reflect bit field size */
# define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
# define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
-# define RES_DFLRETRY 2 /* Default #/tries. */
+# define RES_DFLRETRY 3 /* Default #/tries. */
+/* (glibc uses RES_DFLRETRY of 2 but also does _res.retry = 4 sometimes (!) */
# define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
+/* _res (an instance of this structure) uses 0.5kb in bss
+ * in "ordinary" libc's (glibc, xBSD). We want to be less wasteful.
+ * We (1) shuffle and shrink some integer fields,
+ * and (2) can switch off stuff we don't support.
+ * Everything inside __UCLIBC_HAS_COMPAT_RES_STATE__
+ * is not actually used by uclibc and can be configured off.
+ * However, this will prevent some programs from building.
+ * Really obscure stuff with no observed users in the wild is under
+ * __UCLIBC_HAS_EXTRA_COMPAT_RES_STATE__.
+ * I guess it's safe to set that to N.
+ */
struct __res_state {
- int retrans; /* retransmition time interval */
- int retry; /* number of times to retransmit */
- u_long options; /* option flags - see below. */
- int nscount; /* number of name servers */
- struct sockaddr_in
- nsaddr_list[MAXNS]; /* address of name server */
-# define nsaddr nsaddr_list[0] /* for backward compatibility */
- u_short id; /* current message id */
- char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
+ /*int retrans, retry; - moved, was here */
+ u_int32_t options; /* (was: ulong) option flags - see below. */
+ struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */
+#define nsaddr nsaddr_list[0] /* for backward compatibility */
+ char *dnsrch[MAXDNSRCH + 1]; /* components of domain to search */
+ /*char defdname[256]; - moved, was here */
+ u_int8_t nscount; /* (was: int) number of name servers */
+ u_int8_t ndots; /* (was: unsigned:4) threshold for initial abs. query */
+ u_int8_t retrans; /* (was: int) retransmission time interval */
+ u_int8_t retry; /* (was: int) number of times to retransmit */
+#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__
+ /* googling for "_res.defdname" says it's still sometimes used.
+ * Pity. It's huge, I want to move it to EXTRA_COMPAT... */
char defdname[256]; /* default domain (deprecated) */
- u_long pfcode; /* RES_PRF_ flags - see below. */
- unsigned ndots:4; /* threshold for initial abs. query */
- unsigned nsort:4; /* number of elements in sort_list[] */
- char unused[3];
+ u_int8_t nsort; /* (was: unsigned:4) number of elements in sort_list[] */
+ u_int16_t pfcode; /* (was: ulong) RES_PRF_ flags. Used by dig. */
+ unsigned short id; /* current message id */
+ int res_h_errno; /* last one set for this context */
struct {
struct in_addr addr;
u_int32_t mask;
} sort_list[MAXRESOLVSORT];
- res_send_qhook qhook; /* query hook */
- res_send_rhook rhook; /* response hook */
- int res_h_errno; /* last one set for this context */
- int _vcsock; /* PRIVATE: for res_send VC i/o */
- u_int _flags; /* PRIVATE: see below */
+#endif
+
+ /* I assume that the intention is to store all
+ * DNS servers' addresses here, and duplicate in nsaddr_list[]
+ * those which have IPv4 address. In the case of IPv4 address
+ * _u._ext.nsaddrs[x] will point to some nsaddr_list[y],
+ * otherwise it will point into malloc'ed sockaddr_in6.
+ * nscount is the number of IPv4 addresses and _u._ext.nscount
+ * is the number of addresses of all kinds.
+ *
+ * If this differs from established usage and you need
+ * to change this, please describe how it is supposed to work.
+ */
union {
- char pad[52]; /* On an i386 this means 512b total. */
struct {
- u_int16_t nscount;
-#if 0
- u_int16_t nsmap[MAXNS];
-#else
- u_int16_t nstimes[MAXNS]; /* ms. */
+#ifdef __UCLIBC_HAS_IPV6__
+ struct sockaddr_in6 *nsaddrs[MAXNS];
#endif
+ u_int8_t nscount; /* (was: u_int16_t) */
+#ifdef __UCLIBC_HAS_COMPAT_RES_STATE__
+ /* rather obscure, and differs in BSD and glibc */
+ u_int16_t nstimes[MAXNS];
int nssocks[MAXNS];
u_int16_t nscount6;
u_int16_t nsinit;
- struct sockaddr_in6 *nsaddrs[MAXNS];
-#if 0
-#ifdef _LIBC
- unsigned long long int initstamp
- __attribute__((packed));
-#else
- unsigned int _initstamp[2];
-#endif
+ /* glibc also has: */
+ /*u_int16_t nsmap[MAXNS];*/
+ /*unsigned long long initstamp;*/
#endif
} _ext;
} _u;
+
+#ifdef __UCLIBC_HAS_EXTRA_COMPAT_RES_STATE__
+ /* Truly obscure stuff.
+ * Googling for "_res.XXX" for these members
+ * turned up basically empty */
+ res_send_qhook qhook; /* query hook */
+ res_send_rhook rhook; /* response hook */
+ int _vcsock; /* PRIVATE: for res_send VC i/o */
+ unsigned _flags; /* PRIVATE: see below */
+#endif
};
typedef struct __res_state *res_state;
@@ -196,6 +225,7 @@ struct res_sym {
/*
* Resolver options (keep these in synch with res_debug.c, please)
+ * (which of these do we really implement??)
*/
#define RES_INIT 0x00000001 /* address initialized */
#define RES_DEBUG 0x00000002 /* print debug messages */
@@ -247,53 +277,69 @@ struct res_sym {
/* 0x00008000 */
/* Things involving an internal (static) resolver context. */
-#if 0
__BEGIN_DECLS
extern struct __res_state *__res_state(void) __attribute__ ((__const__));
__END_DECLS
#define _res (*__res_state())
-#else
-extern struct __res_state _res;
-#endif
+#if 0
#define fp_nquery __fp_nquery
#define fp_query __fp_query
#define hostalias __hostalias
#define p_query __p_query
+#endif
#define res_close __res_close
#define res_init __res_init
+#if 0
#define res_isourserver __res_isourserver
+#endif
#define res_mkquery __res_mkquery
#define res_query __res_query
#define res_querydomain __res_querydomain
#define res_search __res_search
+#if 0
#define res_send __res_send
+#endif
__BEGIN_DECLS
+#if 0
void fp_nquery (const u_char *, int, FILE *) __THROW;
void fp_query (const u_char *, FILE *) __THROW;
const char * hostalias (const char *) __THROW;
void p_query (const u_char *) __THROW;
+#endif
#ifdef __UCLIBC_HAS_BSD_RES_CLOSE__
void res_close (void) __THROW;
#endif
int res_init (void) __THROW;
+libc_hidden_proto(res_init)
+#if 0
int res_isourserver (const struct sockaddr_in *) __THROW;
+#endif
int res_mkquery (int, const char *, int, int, const u_char *,
int, const u_char *, u_char *, int) __THROW;
int res_query (const char *, int, int, u_char *, int) __THROW;
+libc_hidden_proto(res_query)
int res_querydomain (const char *, const char *, int, int,
u_char *, int) __THROW;
+libc_hidden_proto(res_querydomain)
int res_search (const char *, int, int, u_char *, int) __THROW;
+#if 0
int res_send (const u_char *, int, u_char *, int) __THROW;
+#endif
__END_DECLS
+#if 0
#define b64_ntop __b64_ntop
#define b64_pton __b64_pton
-#define dn_comp __dn_comp
#define dn_count_labels __dn_count_labels
+#endif
+#define dn_comp __dn_comp
#define dn_expand __dn_expand
#define dn_skipname __dn_skipname
+#define res_ninit __res_ninit
+#define res_nclose __res_nclose
+#if 0
#define fp_resstat __fp_resstat
#define loc_aton __loc_aton
#define loc_ntoa __loc_ntoa
@@ -315,8 +361,6 @@ __END_DECLS
#define res_hostalias __res_hostalias
#define res_mailok __res_mailok
#define res_nameinquery __res_nameinquery
-#define res_nclose __res_nclose
-#define res_ninit __res_ninit
#define res_nmkquery __res_nmkquery
#define res_npquery __res_npquery
#define res_nquery __res_nquery
@@ -330,7 +374,9 @@ __END_DECLS
#define sym_ntop __sym_ntop
#define sym_ntos __sym_ntos
#define sym_ston __sym_ston
+#endif
__BEGIN_DECLS
+#if 0
int res_hnok (const char *) __THROW;
int res_ownok (const char *) __THROW;
int res_mailok (const char *) __THROW;
@@ -342,7 +388,6 @@ int b64_ntop (u_char const *, size_t, char *, size_t) __THROW;
int b64_pton (char const *, u_char *, size_t) __THROW;
int loc_aton (const char *ascii, u_char *binary) __THROW;
const char * loc_ntoa (const u_char *binary, char *ascii) __THROW;
-int dn_skipname (const u_char *, const u_char *) __THROW;
void putlong (u_int32_t, u_char *) __THROW;
void putshort (u_int16_t, u_char *) __THROW;
const char * p_class (int) __THROW;
@@ -358,10 +403,18 @@ const u_char * p_fqname (const u_char *, const u_char *, FILE *) __THROW;
const char * p_option (u_long option) __THROW;
char * p_secstodate (u_long) __THROW;
int dn_count_labels (const char *) __THROW;
+#endif
+int dn_skipname (const u_char *, const u_char *) __THROW;
+libc_hidden_proto(dn_skipname)
int dn_comp (const char *, u_char *, int, u_char **, u_char **)
__THROW;
+libc_hidden_proto(dn_comp)
int dn_expand (const u_char *, const u_char *, const u_char *,
char *, int) __THROW;
+libc_hidden_proto(dn_expand)
+int res_ninit (res_state) __THROW;
+void res_nclose (res_state) __THROW;
+#if 0
u_int res_randomid (void) __THROW;
int res_nameinquery (const char *, int, int,
const u_char *, const u_char *) __THROW;
@@ -369,7 +422,6 @@ int res_queriesmatch (const u_char *, const u_char *,
const u_char *, const u_char *) __THROW;
const char * p_section (int section, int opcode) __THROW;
/* Things involving a resolver context. */
-int res_ninit (res_state) __THROW;
int res_nisourserver (const res_state,
const struct sockaddr_in *) __THROW;
void fp_resstat (const res_state, FILE *) __THROW;
@@ -388,8 +440,27 @@ int res_nmkquery (res_state, int, const char *, int, int,
int) __THROW;
int res_nsend (res_state, const u_char *, int, u_char *, int)
__THROW;
-void res_nclose (res_state) __THROW;
-__END_DECLS
#endif
+__END_DECLS
+
+# if _LIBC
+# ifdef __UCLIBC_HAS_THREADS__
+# if defined __UCLIBC_HAS_TLS__ \
+ && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+# undef _res
+# ifndef NOT_IN_libc
+# define __resp __libc_resp
+# endif
+# define _res (*__resp)
+extern __thread struct __res_state *__resp attribute_tls_model_ie;
+# endif
+# else
+# undef _res
+# define _res (*__resp)
+extern struct __res_state *__resp;
+# endif /* __UCLIBC_HAS_THREADS__ */
+# endif /* _LIBC */
+
+#endif /* _RESOLV_H_ */
#endif /* !_RESOLV_H_ */
diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index 17eb59f70..70066fe52 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -41,17 +41,6 @@
#ifndef _RPC_AUTH_H
#define _RPC_AUTH_H 1
-#ifdef _LIBC
-/* Some adjustments to make the libc source from glibc
- * compile more easily with uClibc... */
-#ifndef __FORCE_GLIBC
-#define __FORCE_GLIBC
-#endif
-#ifndef _GNU_SOUCE
-#define _GNU_SOUCE
-#endif
-#define _(X) X
-#endif
#include <features.h>
#include <rpc/xdr.h>
@@ -107,13 +96,17 @@ struct AUTH {
struct opaque_auth ah_cred;
struct opaque_auth ah_verf;
union des_block ah_key;
+ /* not sure whether non-const-ness is a part of the spec... if it is,
+ * enclose "const" in #ifdef _LIBC / #endif
+ * to make it effective only for libc compile */
+ const
struct auth_ops {
void (*ah_nextverf) (AUTH *);
int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */
int (*ah_validate) (AUTH *, struct opaque_auth *);
/* validate verifier */
int (*ah_refresh) (AUTH *); /* refresh credentials */
- void (*ah_destroy) (AUTH *); /* destroy this structure */
+ void (*ah_destroy) (AUTH *); /* destroy this structure */
} *ah_ops;
caddr_t ah_private;
};
@@ -171,13 +164,18 @@ extern struct opaque_auth _null_auth;
*/
extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,
int __len, __gid_t *__aup_gids);
+libc_hidden_proto(authunix_create)
extern AUTH *authunix_create_default (void);
+libc_hidden_proto(authunix_create_default)
extern AUTH *authnone_create (void) __THROW;
+libc_hidden_proto(authnone_create)
+#if 0
extern AUTH *authdes_create (const char *__servername, u_int __window,
struct sockaddr *__syncaddr, des_block *__ckey)
__THROW;
extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
struct sockaddr *, des_block *) __THROW;
+#endif
#define AUTH_NONE 0 /* no authentication */
@@ -189,16 +187,17 @@ extern AUTH *authdes_pk_create (const char *, netobj *, u_int,
#define AUTH_DH AUTH_DES /* Diffie-Hellman (this is DES) */
#define AUTH_KERB 4 /* kerberos style */
+#if 0
/*
* Netname manipulating functions
*
*/
extern int getnetname (char *) __THROW;
-extern int host2netname (char *, __const char *, __const char *) __THROW;
-extern int user2netname (char *, __const uid_t, __const char *) __THROW;
-extern int netname2user (__const char *, uid_t *, gid_t *, int *, gid_t *)
+extern int host2netname (char *, const char *, const char *) __THROW;
+extern int user2netname (char *, const uid_t, const char *) __THROW;
+extern int netname2user (const char *, uid_t *, gid_t *, int *, gid_t *)
__THROW;
-extern int netname2host (__const char *, char *, __const int) __THROW;
+extern int netname2host (const char *, char *, const int) __THROW;
/*
*
@@ -213,11 +212,13 @@ extern int key_gendes (des_block *);
extern int key_setsecret (char *);
extern int key_secretkey_is_set (void);
extern int key_get_conv (char *, des_block *);
+#endif
/*
* XDR an opaque authentication struct.
*/
extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *) __THROW;
+libc_hidden_proto(xdr_opaque_auth)
__END_DECLS
diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h
index 12ada8404..bcd96e424 100644
--- a/include/rpc/auth_des.h
+++ b/include/rpc/auth_des.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _RPC_AUTH_DES_H
#define _RPC_AUTH_DES_H 1
@@ -24,6 +23,7 @@
__BEGIN_DECLS
+#if 0
/* There are two kinds of "names": fullnames and nicknames */
enum authdes_namekind
{
@@ -47,6 +47,7 @@ struct authdes_cred
struct authdes_fullname adc_fullname;
uint32_t adc_nickname;
};
+#endif
/* A timeval replacement for !32bit platforms */
struct rpc_timeval
@@ -55,6 +56,7 @@ struct rpc_timeval
uint32_t tv_usec; /* Microseconds. */
};
+#if 0
/* A des authentication verifier */
struct authdes_verf
{
@@ -86,22 +88,23 @@ struct authdes_verf
#define adv_nickname adv_int_u
/* Map a des credential into a unix cred. */
-extern int authdes_getucred (__const struct authdes_cred * __adc,
+extern int authdes_getucred (const struct authdes_cred * __adc,
uid_t * __uid, gid_t * __gid,
short *__grouplen, gid_t * __groups) __THROW;
/* Get the public key for NAME and place it in KEY. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY should
have HEXKEYBYTES + 1 bytes long to fit all characters from the key. */
-extern int getpublickey (__const char *__name, char *__key) __THROW;
+extern int getpublickey (const char *__name, char *__key) __THROW;
/* Get the secret key for NAME and place it in KEY. PASSWD is used to
decrypt the encrypted key stored in the database. NAME can only be
up to MAXNETNAMELEN bytes long and the destination buffer KEY
should have HEXKEYBYTES + 1 bytes long to fit all characters from
the key. */
-extern int getsecretkey (__const char *__name, char *__key,
- __const char *__passwd) __THROW;
+extern int getsecretkey (const char *__name, char *__key,
+ const char *__passwd) __THROW;
+#endif
extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
struct rpc_timeval *__timeout) __THROW;
diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h
index 424661d9c..713fcb437 100644
--- a/include/rpc/auth_unix.h
+++ b/include/rpc/auth_unix.h
@@ -74,6 +74,7 @@ struct authunix_parms
extern bool_t xdr_authunix_parms (XDR *__xdrs, struct authunix_parms *__p)
__THROW;
+libc_hidden_proto(xdr_authunix_parms)
/*
* If a response verifier has flavor AUTH_SHORT,
diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h
index cf271c5c1..32da6b4e5 100644
--- a/include/rpc/clnt.h
+++ b/include/rpc/clnt.h
@@ -132,6 +132,10 @@ struct rpc_err {
typedef struct CLIENT CLIENT;
struct CLIENT {
AUTH *cl_auth; /* authenticator */
+ /* not sure whether non-const-ness is a part of the spec... if it is,
+ * enclose "const" in #ifdef _LIBC / #endif
+ * to make it effective only for libc compile */
+ const
struct clnt_ops {
enum clnt_stat (*cl_call) (CLIENT *, u_long, xdrproc_t, caddr_t, xdrproc_t,
caddr_t, struct timeval);
@@ -277,7 +281,7 @@ struct CLIENT {
* u_long prog;
* u_long vers;
*/
-extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
+extern CLIENT *clntraw_create (const u_long __prog, const u_long __vers)
__THROW;
@@ -291,8 +295,8 @@ extern CLIENT *clntraw_create (__const u_long __prog, __const u_long __vers)
* u_ong vers; -- version number
* char *prot; -- protocol
*/
-extern CLIENT *clnt_create (__const char *__host, __const u_long __prog,
- __const u_long __vers, __const char *__prot)
+extern CLIENT *clnt_create (const char *__host, const u_long __prog,
+ const u_long __vers, const char *__prot)
__THROW;
@@ -310,6 +314,7 @@ extern CLIENT *clnt_create (__const char *__host, __const u_long __prog,
extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog,
u_long __version, int *__sockp, u_int __sendsz,
u_int __recvsz) __THROW;
+libc_hidden_proto(clnttcp_create)
/*
* UDP based rpc.
@@ -335,12 +340,12 @@ extern CLIENT *clnttcp_create (struct sockaddr_in *__raddr, u_long __prog,
extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, u_long __program,
u_long __version, struct timeval __wait_resend,
int *__sockp) __THROW;
+libc_hidden_proto(clntudp_create)
extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
u_long __program, u_long __version,
struct timeval __wait_resend, int *__sockp,
u_int __sendsz, u_int __recvsz) __THROW;
-
-
+libc_hidden_proto(clntudp_bufcreate)
/*
@@ -357,19 +362,22 @@ extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr,
extern CLIENT *clntunix_create (struct sockaddr_un *__raddr, u_long __program,
u_long __version, int *__sockp,
u_int __sendsz, u_int __recvsz) __THROW;
+libc_hidden_proto(clntunix_create)
-extern int callrpc (__const char *__host, __const u_long __prognum,
- __const u_long __versnum, __const u_long __procnum,
- __const xdrproc_t __inproc, __const char *__in,
- __const xdrproc_t __outproc, char *__out) __THROW;
+extern int callrpc (const char *__host, const u_long __prognum,
+ const u_long __versnum, const u_long __procnum,
+ const xdrproc_t __inproc, const char *__in,
+ const xdrproc_t __outproc, char *__out) __THROW;
extern int _rpc_dtablesize (void) __THROW;
+libc_hidden_proto(_rpc_dtablesize)
/*
* Print why creation failed
*/
-extern void clnt_pcreateerror (__const char *__msg); /* stderr */
-extern char *clnt_spcreateerror(__const char *__msg) __THROW; /* string */
+extern void clnt_pcreateerror (const char *__msg); /* stderr */
+extern char *clnt_spcreateerror(const char *__msg) __THROW; /* string */
+libc_hidden_proto(clnt_spcreateerror)
/*
* Like clnt_perror(), but is more verbose in its output
@@ -379,10 +387,13 @@ extern void clnt_perrno (enum clnt_stat __num); /* stderr */
/*
* Print an English error message, given the client error code
*/
-extern void clnt_perror (CLIENT *__clnt, __const char *__msg);
+extern void clnt_perror (CLIENT *__clnt, const char *__msg);
/* stderr */
-extern char *clnt_sperror (CLIENT *__clnt, __const char *__msg) __THROW;
+libc_hidden_proto(clnt_perror)
+extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW;
/* string */
+libc_hidden_proto(clnt_sperror)
+
/*
* If a creation fails, the following allows the user to figure out why.
@@ -400,11 +411,12 @@ extern struct rpc_createerr rpc_createerr;
* Copy error message to buffer.
*/
extern char *clnt_sperrno (enum clnt_stat __num) __THROW; /* string */
+libc_hidden_proto(clnt_sperrno)
/*
* get the port number on the host for the rpc program,version and proto
*/
-extern int getrpcport (__const char * __host, u_long __prognum,
+extern int getrpcport (const char * __host, u_long __prognum,
u_long __versnum, u_int proto) __THROW;
/*
diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h
index 86717373c..764b8cf1a 100644
--- a/include/rpc/netdb.h
+++ b/include/rpc/netdb.h
@@ -51,13 +51,18 @@ struct rpcent
};
extern void setrpcent (int __stayopen) __THROW;
+libc_hidden_proto(setrpcent)
extern void endrpcent (void) __THROW;
-extern struct rpcent *getrpcbyname (__const char *__name) __THROW;
+libc_hidden_proto(endrpcent)
+extern struct rpcent *getrpcbyname (const char *__name) __THROW;
+libc_hidden_proto(getrpcbyname)
extern struct rpcent *getrpcbynumber (int __number) __THROW;
+libc_hidden_proto(getrpcbynumber)
extern struct rpcent *getrpcent (void) __THROW;
+libc_hidden_proto(getrpcent)
#if defined __USE_MISC && defined __UCLIBC_HAS_REENTRANT_RPC__
-extern int getrpcbyname_r (__const char *__name, struct rpcent *__result_buf,
+extern int getrpcbyname_r (const char *__name, struct rpcent *__result_buf,
char *__buffer, size_t __buflen,
struct rpcent **__result) __THROW;
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 1b1c45291..936516af7 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -69,29 +69,32 @@ typedef bool_t (*resultproc_t) (caddr_t resp, struct sockaddr_in *raddr);
* address if the responder to the broadcast.
*/
-extern bool_t pmap_set (__const u_long __program, __const u_long __vers,
+extern bool_t pmap_set (const u_long __program, const u_long __vers,
int __protocol, u_short __port) __THROW;
-extern bool_t pmap_unset (__const u_long __program, __const u_long __vers)
+libc_hidden_proto(pmap_set)
+extern bool_t pmap_unset (const u_long __program, const u_long __vers)
__THROW;
+libc_hidden_proto(pmap_unset)
extern struct pmaplist *pmap_getmaps (struct sockaddr_in *__address) __THROW;
extern enum clnt_stat pmap_rmtcall (struct sockaddr_in *__addr,
- __const u_long __prog,
- __const u_long __vers,
- __const u_long __proc,
+ const u_long __prog,
+ const u_long __vers,
+ const u_long __proc,
xdrproc_t __xdrargs,
caddr_t __argsp, xdrproc_t __xdrres,
caddr_t __resp, struct timeval __tout,
u_long *__port_ptr) __THROW;
-extern enum clnt_stat clnt_broadcast (__const u_long __prog,
- __const u_long __vers,
- __const u_long __proc, xdrproc_t __xargs,
+extern enum clnt_stat clnt_broadcast (const u_long __prog,
+ const u_long __vers,
+ const u_long __proc, xdrproc_t __xargs,
caddr_t __argsp, xdrproc_t __xresults,
caddr_t __resultsp,
resultproc_t __eachresult) __THROW;
extern u_short pmap_getport (struct sockaddr_in *__address,
- __const u_long __program,
- __const u_long __version, u_int __protocol)
+ const u_long __program,
+ const u_long __version, u_int __protocol)
__THROW;
+libc_hidden_proto(pmap_getport)
__END_DECLS
diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h
index cd64e36de..30b26709f 100644
--- a/include/rpc/pmap_prot.h
+++ b/include/rpc/pmap_prot.h
@@ -95,6 +95,7 @@ struct pmap {
};
extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs) __THROW;
+libc_hidden_proto(xdr_pmap)
struct pmaplist {
struct pmap pml_map;
@@ -102,6 +103,7 @@ struct pmaplist {
};
extern bool_t xdr_pmaplist (XDR *__xdrs, struct pmaplist **__rp) __THROW;
+libc_hidden_proto(xdr_pmaplist)
__END_DECLS
diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h
index 7a38b5f5f..59b4f6587 100644
--- a/include/rpc/pmap_rmt.h
+++ b/include/rpc/pmap_rmt.h
@@ -53,6 +53,8 @@ struct rmtcallargs {
extern bool_t xdr_rmtcall_args (XDR *__xdrs, struct rmtcallargs *__crp)
__THROW;
+libc_hidden_proto(xdr_rmtcall_args)
+
struct rmtcallres {
u_long *port_ptr;
@@ -62,6 +64,7 @@ struct rmtcallres {
};
extern bool_t xdr_rmtcallres (XDR *__xdrs, struct rmtcallres *__crp) __THROW;
+libc_hidden_proto(xdr_rmtcallres)
__END_DECLS
diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h
index 8194ffee3..df0542890 100644
--- a/include/rpc/rpc.h
+++ b/include/rpc/rpc.h
@@ -38,19 +38,6 @@
#ifndef _RPC_RPC_H
#define _RPC_RPC_H 1
-#ifdef _LIBC
-/* Some adjustments to make the libc source from glibc
- * compile more easily with uClibc... */
-#ifndef __FORCE_GLIBC
-#define __FORCE_GLIBC
-#endif
-#ifndef _GNU_SOUCE
-#define _GNU_SOUCE
-#endif
-#define _(X) X
-#include <features.h>
-#endif
-
#include <rpc/types.h> /* some typedefs */
#include <netinet/in.h>
@@ -84,10 +71,12 @@ __BEGIN_DECLS
/* Global variables, protected for multi-threaded applications. */
extern fd_set *__rpc_thread_svc_fdset (void) __attribute__ ((__const__));
+libc_hidden_proto(__rpc_thread_svc_fdset)
#define svc_fdset (*__rpc_thread_svc_fdset ())
extern struct rpc_createerr *__rpc_thread_createerr (void)
__attribute__ ((__const__));
+libc_hidden_proto(__rpc_thread_createerr)
#define get_rpc_createerr() (*__rpc_thread_createerr ())
/* The people who "engineered" RPC should bee punished for naming the
data structure and the variable the same. We cannot always define the
@@ -100,14 +89,13 @@ extern struct rpc_createerr *__rpc_thread_createerr (void)
extern struct pollfd **__rpc_thread_svc_pollfd (void)
__attribute__ ((__const__));
+libc_hidden_proto(__rpc_thread_svc_pollfd)
#define svc_pollfd (*__rpc_thread_svc_pollfd ())
extern int *__rpc_thread_svc_max_pollfd (void) __attribute__ ((__const__));
+libc_hidden_proto(__rpc_thread_svc_max_pollfd)
#define svc_max_pollfd (*__rpc_thread_svc_max_pollfd ())
-extern bool_t xdr_accepted_reply (XDR *xdrs, struct accepted_reply *ar);
-extern bool_t xdr_rejected_reply (XDR *xdrs, struct rejected_reply *rr);
-
__END_DECLS
#endif /* rpc/rpc.h */
diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h
index 636d60ea9..1137dadd2 100644
--- a/include/rpc/rpc_msg.h
+++ b/include/rpc/rpc_msg.h
@@ -171,6 +171,7 @@ struct rpc_msg {
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
+libc_hidden_proto(xdr_callmsg)
/*
* XDR routine to pre-serialize the static part of a rpc message.
@@ -179,6 +180,7 @@ extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
* struct rpc_msg *cmsg;
*/
extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
+libc_hidden_proto(xdr_callhdr)
/*
* XDR routine to handle a rpc reply.
@@ -187,6 +189,7 @@ extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg) __THROW;
* struct rpc_msg *rmsg;
*/
extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW;
+libc_hidden_proto(xdr_replymsg)
/*
* Fills in the error part of a reply message.
@@ -196,6 +199,27 @@ extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg) __THROW;
*/
extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error)
__THROW;
+libc_hidden_proto(_seterr_reply)
+
+#ifdef __UCLIBC__
+/*
+ * XDR routine to handle an accepted rpc reply.
+ * xdr_accepted_reply(xdrs, rej)
+ * XDR *xdrs;
+ * struct accepted_reply *rej;
+ */
+extern bool_t xdr_accepted_reply(XDR *__xdrs, struct accepted_reply *__ar);
+libc_hidden_proto(xdr_accepted_reply)
+
+/*
+ * XDR routine to handle a rejected rpc reply.
+ * xdr_rejected_reply(xdrs, rej)
+ * XDR *xdrs;
+ * struct rejected_reply *rej;
+ */
+extern bool_t xdr_rejected_reply(XDR *__xdrs, struct rejected_reply *__rr);
+libc_hidden_proto(xdr_rejected_reply)
+#endif
__END_DECLS
diff --git a/include/rpc/svc.h b/include/rpc/svc.h
index 3ffca50bd..689832548 100644
--- a/include/rpc/svc.h
+++ b/include/rpc/svc.h
@@ -173,6 +173,7 @@ typedef void (*__dispatch_fn_t) (struct svc_req*, SVCXPRT*);
extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
rpcvers_t __vers, __dispatch_fn_t __dispatch,
rpcprot_t __protocol) __THROW;
+libc_hidden_proto(svc_register)
/*
* Service un-registration
@@ -182,6 +183,7 @@ extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
* rpcvers_t vers;
*/
extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW;
+libc_hidden_proto(svc_unregister)
/*
* Transport registration.
@@ -190,6 +192,7 @@ extern void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW;
* SVCXPRT *xprt;
*/
extern void xprt_register (SVCXPRT *__xprt) __THROW;
+libc_hidden_proto(xprt_register)
/*
* Transport un-register
@@ -198,7 +201,7 @@ extern void xprt_register (SVCXPRT *__xprt) __THROW;
* SVCXPRT *xprt;
*/
extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
-
+libc_hidden_proto(xprt_unregister)
/*
* When the service routine is called, it must first check to see if it
@@ -228,8 +231,10 @@ extern void xprt_unregister (SVCXPRT *__xprt) __THROW;
extern bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results,
caddr_t __xdr_location) __THROW;
+libc_hidden_proto(svc_sendreply)
extern void svcerr_decode (SVCXPRT *__xprt) __THROW;
+libc_hidden_proto(svcerr_decode)
extern void svcerr_weakauth (SVCXPRT *__xprt) __THROW;
@@ -237,10 +242,13 @@ extern void svcerr_noproc (SVCXPRT *__xprt) __THROW;
extern void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
rpcvers_t __high_vers) __THROW;
+libc_hidden_proto(svcerr_progvers)
extern void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW;
+libc_hidden_proto(svcerr_auth)
extern void svcerr_noprog (SVCXPRT *__xprt) __THROW;
+libc_hidden_proto(svcerr_noprog)
extern void svcerr_systemerr (SVCXPRT *__xprt) __THROW;
@@ -270,9 +278,13 @@ extern fd_set svc_fdset;
* also see clnt.h for protocol numbers.
*/
extern void svc_getreq (int __rdfds) __THROW;
+libc_hidden_proto(svc_getreq)
extern void svc_getreq_common (const int __fd) __THROW;
+libc_hidden_proto(svc_getreq_common)
extern void svc_getreqset (fd_set *__readfds) __THROW;
+libc_hidden_proto(svc_getreqset)
extern void svc_getreq_poll (struct pollfd *, const int) __THROW;
+libc_hidden_proto(svc_getreq_poll)
extern void svc_exit (void) __THROW;
extern void svc_run (void) __THROW;
@@ -294,8 +306,10 @@ extern SVCXPRT *svcraw_create (void) __THROW;
* Udp based rpc.
*/
extern SVCXPRT *svcudp_create (int __sock) __THROW;
+libc_hidden_proto(svcudp_create)
extern SVCXPRT *svcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz)
__THROW;
+libc_hidden_proto(svcudp_bufcreate)
/*
* Tcp based rpc.
diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h
index 1c1a7156a..834e3c923 100644
--- a/include/rpc/svc_auth.h
+++ b/include/rpc/svc_auth.h
@@ -48,6 +48,7 @@ __BEGIN_DECLS
*/
extern enum auth_stat _authenticate (struct svc_req *__rqst,
struct rpc_msg *__msg) __THROW;
+libc_hidden_proto(_authenticate)
__END_DECLS
diff --git a/include/rpc/types.h b/include/rpc/types.h
index 469576e52..8eff8e718 100644
--- a/include/rpc/types.h
+++ b/include/rpc/types.h
@@ -33,19 +33,6 @@
#ifndef _RPC_TYPES_H
#define _RPC_TYPES_H 1
-#ifdef _LIBC
-/* Some adjustments to make the libc source from glibc
- * compile more easily with uClibc... */
-#ifndef __FORCE_GLIBC
-#define __FORCE_GLIBC
-#endif
-#ifndef _GNU_SOUCE
-#define _GNU_SOUCE
-#endif
-#define _(X) X
-#endif
-#include <features.h>
-
typedef int bool_t;
typedef int enum_t;
/* This needs to be changed to uint32_t in the future */
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index 25dd214ee..a424153b6 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -36,14 +36,6 @@
#ifndef _RPC_XDR_H
#define _RPC_XDR_H 1
-#ifdef _LIBC
-/* Some adjustments to make the libc source from glibc
- * compile more easily with uClibc... */
-# ifndef __FORCE_GLIBC
-# define __FORCE_GLIBC
-# endif
-# define _(X) X
-#endif
#include <features.h>
#include <sys/types.h>
#include <rpc/types.h>
@@ -120,17 +112,21 @@ typedef struct XDR XDR;
struct XDR
{
enum xdr_op x_op; /* operation; fast additional param */
+ /* not sure whether non-const-ness is a part of the spec... if it is,
+ * enclose "const" in #ifdef _LIBC / #endif
+ * to make it effective only for libc compile */
+ const
struct xdr_ops
{
bool_t (*x_getlong) (XDR *__xdrs, long *__lp);
/* get a long from underlying stream */
- bool_t (*x_putlong) (XDR *__xdrs, __const long *__lp);
+ bool_t (*x_putlong) (XDR *__xdrs, const long *__lp);
/* put a long to " */
bool_t (*x_getbytes) (XDR *__xdrs, caddr_t __addr, u_int __len);
/* get some bytes from " */
- bool_t (*x_putbytes) (XDR *__xdrs, __const char *__addr, u_int __len);
+ bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, u_int __len);
/* put some bytes to " */
- u_int (*x_getpostn) (__const XDR *__xdrs);
+ u_int (*x_getpostn) (const XDR *__xdrs);
/* returns bytes off from beginning */
bool_t (*x_setpostn) (XDR *__xdrs, u_int __pos);
/* lets you reposition the stream */
@@ -140,7 +136,7 @@ struct XDR
/* free privates of this xdr_stream */
bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip);
/* get a int from underlying stream */
- bool_t (*x_putint32) (XDR *__xdrs, __const int32_t *__ip);
+ bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip);
/* put a int to " */
}
*x_ops;
@@ -293,14 +289,23 @@ struct xdr_discrim
* also, the XDR structure is always updated by some of these calls.
*/
extern bool_t xdr_void (void) __THROW;
+libc_hidden_proto(xdr_void)
extern bool_t xdr_short (XDR *__xdrs, short *__sp) __THROW;
+libc_hidden_proto(xdr_short)
extern bool_t xdr_u_short (XDR *__xdrs, u_short *__usp) __THROW;
+libc_hidden_proto(xdr_u_short)
extern bool_t xdr_int (XDR *__xdrs, int *__ip) __THROW;
+libc_hidden_proto(xdr_int)
extern bool_t xdr_u_int (XDR *__xdrs, u_int *__up) __THROW;
+libc_hidden_proto(xdr_u_int)
extern bool_t xdr_long (XDR *__xdrs, long *__lp) __THROW;
+libc_hidden_proto(xdr_long)
extern bool_t xdr_u_long (XDR *__xdrs, u_long *__ulp) __THROW;
+libc_hidden_proto(xdr_u_long)
extern bool_t xdr_hyper (XDR *__xdrs, quad_t *__llp) __THROW;
+libc_hidden_proto(xdr_hyper)
extern bool_t xdr_u_hyper (XDR *__xdrs, u_quad_t *__ullp) __THROW;
+libc_hidden_proto(xdr_u_hyper)
extern bool_t xdr_longlong_t (XDR *__xdrs, quad_t *__llp) __THROW;
extern bool_t xdr_u_longlong_t (XDR *__xdrs, u_quad_t *__ullp) __THROW;
extern bool_t xdr_int8_t (XDR *__xdrs, int8_t *__ip) __THROW;
@@ -311,18 +316,27 @@ extern bool_t xdr_int32_t (XDR *__xdrs, int32_t *__ip) __THROW;
extern bool_t xdr_uint32_t (XDR *__xdrs, uint32_t *__up) __THROW;
extern bool_t xdr_int64_t (XDR *__xdrs, int64_t *__ip) __THROW;
extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up) __THROW;
+extern bool_t xdr_quad_t (XDR *__xdrs, quad_t *__ip) __THROW;
+extern bool_t xdr_u_quad_t (XDR *__xdrs, u_quad_t *__up) __THROW;
extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp) __THROW;
+libc_hidden_proto(xdr_bool)
extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep) __THROW;
+libc_hidden_proto(xdr_enum)
extern bool_t xdr_array (XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
u_int __maxsize, u_int __elsize, xdrproc_t __elproc)
__THROW;
+libc_hidden_proto(xdr_array)
extern bool_t xdr_bytes (XDR *__xdrs, char **__cpp, u_int *__sizep,
u_int __maxsize) __THROW;
+libc_hidden_proto(xdr_bytes)
extern bool_t xdr_opaque (XDR *__xdrs, caddr_t __cp, u_int __cnt) __THROW;
+libc_hidden_proto(xdr_opaque)
extern bool_t xdr_string (XDR *__xdrs, char **__cpp, u_int __maxsize) __THROW;
+libc_hidden_proto(xdr_string)
extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
- __const struct xdr_discrim *__choices,
+ const struct xdr_discrim *__choices,
xdrproc_t dfault) __THROW;
+libc_hidden_proto(xdr_union)
extern bool_t xdr_char (XDR *__xdrs, char *__cp) __THROW;
extern bool_t xdr_u_char (XDR *__xdrs, u_char *__cp) __THROW;
extern bool_t xdr_vector (XDR *__xdrs, char *__basep, u_int __nelem,
@@ -331,6 +345,7 @@ extern bool_t xdr_float (XDR *__xdrs, float *__fp) __THROW;
extern bool_t xdr_double (XDR *__xdrs, double *__dp) __THROW;
extern bool_t xdr_reference (XDR *__xdrs, caddr_t *__xpp, u_int __size,
xdrproc_t __proc) __THROW;
+libc_hidden_proto(xdr_reference)
extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp,
u_int __obj_size, xdrproc_t __xdr_obj) __THROW;
extern bool_t xdr_wrapstring (XDR *__xdrs, char **__cpp) __THROW;
@@ -355,8 +370,9 @@ extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np) __THROW;
*/
/* XDR using memory buffers */
-extern void xdrmem_create (XDR *__xdrs, __const caddr_t __addr,
+extern void xdrmem_create (XDR *__xdrs, const caddr_t __addr,
u_int __size, enum xdr_op __xop) __THROW;
+libc_hidden_proto(xdrmem_create)
/* XDR using stdio library */
extern void xdrstdio_create (XDR *__xdrs, FILE *__file, enum xdr_op __xop)
@@ -367,15 +383,19 @@ extern void xdrrec_create (XDR *__xdrs, u_int __sendsize,
u_int __recvsize, caddr_t __tcp_handle,
int (*__readit) (char *, char *, int),
int (*__writeit) (char *, char *, int)) __THROW;
+libc_hidden_proto(xdrrec_create)
/* make end of xdr record */
extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow) __THROW;
+libc_hidden_proto(xdrrec_endofrecord)
/* move to beginning of next record */
extern bool_t xdrrec_skiprecord (XDR *__xdrs) __THROW;
+libc_hidden_proto(xdrrec_skiprecord)
/* true if no more input */
extern bool_t xdrrec_eof (XDR *__xdrs) __THROW;
+libc_hidden_proto(xdrrec_eof)
/* free memory buffers for xdr */
extern void xdr_free (xdrproc_t __proc, char *__objp) __THROW;
diff --git a/include/sched.h b/include/sched.h
index 7cfdbf1f9..f262a0be5 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
- Copyright (C) 1996,1997,1999,2001-2003,2004 Free Software Foundation, Inc.
+ Copyright (C) 1996,1997,1999,2001-2004,2007 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SCHED_H
#define _SCHED_H 1
@@ -25,6 +24,9 @@
/* Get type definitions. */
#include <bits/types.h>
+#define __need_size_t
+#include <stddef.h>
+
#define __need_timespec
#include <time.h>
@@ -37,7 +39,7 @@
__BEGIN_DECLS
/* Set scheduling parameters for a process. */
-extern int sched_setparam (__pid_t __pid, __const struct sched_param *__param)
+extern int sched_setparam (__pid_t __pid, const struct sched_param *__param)
__THROW;
/* Retrieve scheduling parameters for a particular process. */
@@ -45,7 +47,7 @@ extern int sched_getparam (__pid_t __pid, struct sched_param *__param) __THROW;
/* Set scheduling algorithm and/or parameters for a process. */
extern int sched_setscheduler (__pid_t __pid, int __policy,
- __const struct sched_param *__param) __THROW;
+ const struct sched_param *__param) __THROW;
/* Retrieve scheduling algorithm for a particular purpose. */
extern int sched_getscheduler (__pid_t __pid) __THROW;
@@ -63,22 +65,61 @@ extern int sched_get_priority_min (int __algorithm) __THROW;
extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
-#ifdef __USE_GNU
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
/* Access macros for `cpu_set'. */
-#define CPU_SETSIZE __CPU_SETSIZE
-#define CPU_SET(cpu, cpusetp) __CPU_SET (cpu, cpusetp)
-#define CPU_CLR(cpu, cpusetp) __CPU_CLR (cpu, cpusetp)
-#define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp)
-#define CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp)
+# define CPU_SETSIZE __CPU_SETSIZE
+# define CPU_SET(cpu, cpusetp) __CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
+# define CPU_CLR(cpu, cpusetp) __CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
+# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET_S (cpu, sizeof (cpu_set_t), \
+ cpusetp)
+# define CPU_ZERO(cpusetp) __CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)
+# define CPU_COUNT(cpusetp) __CPU_COUNT_S (sizeof (cpu_set_t), cpusetp)
+
+# define CPU_SET_S(cpu, setsize, cpusetp) __CPU_SET_S (cpu, setsize, cpusetp)
+# define CPU_CLR_S(cpu, setsize, cpusetp) __CPU_CLR_S (cpu, setsize, cpusetp)
+# define CPU_ISSET_S(cpu, setsize, cpusetp) __CPU_ISSET_S (cpu, setsize, \
+ cpusetp)
+# define CPU_ZERO_S(setsize, cpusetp) __CPU_ZERO_S (setsize, cpusetp)
+# define CPU_COUNT_S(setsize, cpusetp) __CPU_COUNT_S (setsize, cpusetp)
+
+# define CPU_EQUAL(cpusetp1, cpusetp2) \
+ __CPU_EQUAL_S (sizeof (cpu_set_t), cpusetp1, cpusetp2)
+# define CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
+ __CPU_EQUAL_S (setsize, cpusetp1, cpusetp2)
+
+# define CPU_AND(destset, srcset1, srcset2) \
+ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
+# define CPU_OR(destset, srcset1, srcset2) \
+ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
+# define CPU_XOR(destset, srcset1, srcset2) \
+ __CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
+# define CPU_AND_S(setsize, destset, srcset1, srcset2) \
+ __CPU_OP_S (setsize, destset, srcset1, srcset2, &)
+# define CPU_OR_S(setsize, destset, srcset1, srcset2) \
+ __CPU_OP_S (setsize, destset, srcset1, srcset2, |)
+# define CPU_XOR_S(setsize, destset, srcset1, srcset2) \
+ __CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
+
+# define CPU_ALLOC_SIZE(count) __CPU_ALLOC_SIZE (count)
+# define CPU_ALLOC(count) __CPU_ALLOC (count)
+# define CPU_FREE(cpuset) __CPU_FREE (cpuset)
/* Set the CPU affinity for a task */
extern int sched_setaffinity (__pid_t __pid, size_t __cpusetsize,
- __const cpu_set_t *__cpuset) __THROW;
+ const cpu_set_t *__cpuset) __THROW;
/* Get the CPU affinity for a task */
extern int sched_getaffinity (__pid_t __pid, size_t __cpusetsize,
cpu_set_t *__cpuset) __THROW;
+
+# ifdef _LIBC
+extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
+ int __flags, void *__arg, ...);
+extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+ size_t __child_stack_size, int __flags, void *__arg, ...);
+# endif
+
#endif
__END_DECLS
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 49ab75806..20ca8de86 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* This header file contains public constants and structures used by
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index ba8c84faf..14b45b34d 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SCSI_IOCTL_H
#define _SCSI_IOCTL_H
diff --git a/include/scsi/sg.h b/include/scsi/sg.h
index b0dc0ad7d..2aa593729 100644
--- a/include/scsi/sg.h
+++ b/include/scsi/sg.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
History:
diff --git a/include/search.h b/include/search.h
index 2ffba697b..f93c788b4 100644
--- a/include/search.h
+++ b/include/search.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SEARCH_H
#define _SEARCH_H 1
@@ -52,7 +51,7 @@ extern void remque (void *__elem) __THROW;
/* For use with hsearch(3). */
#ifndef __COMPAR_FN_T
# define __COMPAR_FN_T
-typedef int (*__compar_fn_t) (__const void *, __const void *);
+typedef int (*__compar_fn_t) (const void *, const void *);
# ifdef __USE_GNU
typedef __compar_fn_t comparison_fn_t;
@@ -106,8 +105,11 @@ struct hsearch_data
same time. */
extern int hsearch_r (ENTRY __item, ACTION __action, ENTRY **__retval,
struct hsearch_data *__htab) __THROW;
+libc_hidden_proto(hsearch_r)
extern int hcreate_r (size_t __nel, struct hsearch_data *__htab) __THROW;
+libc_hidden_proto(hcreate_r)
extern void hdestroy_r (struct hsearch_data *__htab) __THROW;
+libc_hidden_proto(hdestroy_r)
#endif
@@ -127,28 +129,30 @@ VISIT;
/* Search for an entry matching the given KEY in the tree pointed to
by *ROOTP and insert a new element if not found. */
-extern void *tsearch (__const void *__key, void **__rootp,
+extern void *tsearch (const void *__key, void **__rootp,
__compar_fn_t __compar);
+libc_hidden_proto(tsearch)
/* Search for an entry matching the given KEY in the tree pointed to
by *ROOTP. If no matching entry is available return NULL. */
-extern void *tfind (__const void *__key, void *__const *__rootp,
+extern void *tfind (const void *__key, void *const *__rootp,
__compar_fn_t __compar);
+libc_hidden_proto(tfind)
/* Remove the element matching KEY from the tree pointed to by *ROOTP. */
-extern void *tdelete (__const void *__restrict __key,
+extern void *tdelete (const void *__restrict __key,
void **__restrict __rootp,
__compar_fn_t __compar);
#ifndef __ACTION_FN_T
# define __ACTION_FN_T
-typedef void (*__action_fn_t) (__const void *__nodep, VISIT __value,
+typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
int __level);
#endif
/* Walk through the whole tree and call the ACTION callback for every node
or leaf. */
-extern void twalk (__const void *__root, __action_fn_t __action);
+extern void twalk (const void *__root, __action_fn_t __action);
#ifdef __USE_GNU
/* Callback type for function to free a tree node. If the keys are atomic
@@ -157,17 +161,19 @@ typedef void (*__free_fn_t) (void *__nodep);
/* Destroy the whole tree, call FREEFCT for each node or leaf. */
extern void tdestroy (void *__root, __free_fn_t __freefct);
+libc_hidden_proto(tdestroy)
#endif
/* Perform linear search for KEY by comparing by COMPAR in an array
[BASE,BASE+NMEMB*SIZE). */
-extern void *lfind (__const void *__key, __const void *__base,
+extern void *lfind (const void *__key, const void *__base,
size_t *__nmemb, size_t __size, __compar_fn_t __compar);
+libc_hidden_proto(lfind)
/* Perform linear search for KEY by comparing by COMPAR function in
array [BASE,BASE+NMEMB*SIZE) and insert entry if not found. */
-extern void *lsearch (__const void *__key, void *__base,
+extern void *lsearch (const void *__key, void *__base,
size_t *__nmemb, size_t __size, __compar_fn_t __compar);
__END_DECLS
diff --git a/include/setjmp.h b/include/setjmp.h
index 99e3dc8cd..71c1d35cb 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999,2001,2002,2007,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.13 Nonlocal jumps <setjmp.h>
@@ -30,8 +29,9 @@ __BEGIN_DECLS
#include <bits/setjmp.h> /* Get `__jmp_buf'. */
#include <bits/sigset.h> /* Get `__sigset_t'. */
+
/* Calling environment, plus possibly a saved signal mask. */
-typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
+struct __jmp_buf_tag
{
/* NOTE: The machine-dependent definitions of `__sigsetjmp'
assume that a `jmp_buf' begins with a `__jmp_buf' and that
@@ -40,23 +40,30 @@ typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
__jmp_buf __jmpbuf; /* Calling environment. */
int __mask_was_saved; /* Saved the signal mask? */
__sigset_t __saved_mask; /* Saved signal mask. */
- } jmp_buf[1];
+ };
+
+__BEGIN_NAMESPACE_STD
+
+typedef struct __jmp_buf_tag jmp_buf[1];
/* Store the calling environment in ENV, also saving the signal mask.
Return 0. */
-extern int setjmp (jmp_buf __env) __THROW;
+extern int setjmp (jmp_buf __env) __THROWNL;
-/* Store the calling environment in ENV, not saving the signal mask.
- Return 0. */
-extern int _setjmp (jmp_buf __env) __THROW;
+__END_NAMESPACE_STD
/* Store the calling environment in ENV, also saving the
signal mask if SAVEMASK is nonzero. Return 0.
This is the internal name for `sigsetjmp'. */
-extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW;
+extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
+ __THROWNL;
#ifndef __FAVOR_BSD
+/* Store the calling environment in ENV, not saving the signal mask.
+ Return 0. */
+extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
+
/* Do not save the signal mask. This is equivalent to the `_setjmp'
BSD function. */
# define setjmp(env) _setjmp (env)
@@ -68,16 +75,21 @@ extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW;
#endif /* Favor BSD. */
+__BEGIN_NAMESPACE_STD
+
/* Jump to the environment saved in ENV, making the
`setjmp' call there return VAL, or 1 if VAL is 0. */
-extern void longjmp (jmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
+ __THROWNL __attribute__ ((__noreturn__));
+
+__END_NAMESPACE_STD
+
#if defined __USE_BSD || defined __USE_XOPEN
/* Same. Usually `_longjmp' is used with `_setjmp', which does not save
the signal mask. But it is how ENV was saved that determines whether
`longjmp' restores the mask; `_longjmp' is just an alias. */
-extern void _longjmp (jmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
+ __THROWNL __attribute__ ((__noreturn__));
#endif
@@ -85,7 +97,7 @@ extern void _longjmp (jmp_buf __env, int __val)
/* Use the same type for `jmp_buf' and `sigjmp_buf'.
The `__mask_was_saved' flag determines whether
or not `longjmp' will restore the signal mask. */
-typedef jmp_buf sigjmp_buf;
+typedef struct __jmp_buf_tag sigjmp_buf[1];
/* Store the calling environment in ENV, also saving the
signal mask if SAVEMASK is nonzero. Return 0. */
@@ -96,9 +108,21 @@ typedef jmp_buf sigjmp_buf;
Restore the signal mask if that sigsetjmp call saved it.
This is just an alias `longjmp'. */
extern void siglongjmp (sigjmp_buf __env, int __val)
- __THROW __attribute__ ((__noreturn__));
+ __THROWNL __attribute__ ((__noreturn__));
#endif /* Use POSIX. */
__END_DECLS
+#ifdef _LIBC
+extern void __longjmp(__jmp_buf __env, int __val) __THROWNL attribute_noreturn;
+libc_hidden_proto(__longjmp)
+extern __typeof(longjmp) __libc_longjmp __THROWNL attribute_noreturn;
+extern __typeof(siglongjmp) __libc_siglongjmp __THROWNL attribute_noreturn;
+extern void _longjmp_unwind(jmp_buf __env, int __val);
+libc_hidden_proto(_longjmp_unwind)
+extern int __sigjmp_save(sigjmp_buf __env, int __savemask) attribute_hidden;
+/* We use the normal longjmp for unwinding */
+# define __libc_unwind_longjmp(buf, val) __libc_longjmp(buf, val)
+#endif
+
#endif /* setjmp.h */
diff --git a/include/sgtty.h b/include/sgtty.h
index 5b2bc4184..d37b58548 100644
--- a/include/sgtty.h
+++ b/include/sgtty.h
@@ -12,28 +12,33 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SGTTY_H
#define _SGTTY_H 1
+#warning useless header on uClibc
+
#include <features.h>
#include <sys/ioctl.h>
+#ifndef __UCLIBC_STRICT_HEADERS__
/* On some systems this type is not defined by <bits/ioctl-types.h>;
in that case, the functions are just stubs that return ENOSYS. */
struct sgttyb;
+#endif
__BEGIN_DECLS
+#if 0
/* Fill in *PARAMS with terminal parameters associated with FD. */
extern int gtty (int __fd, struct sgttyb *__params) __THROW;
/* Set the terminal parameters associated with FD to *PARAMS. */
-extern int stty (int __fd, __const struct sgttyb *__params) __THROW;
+extern int stty (int __fd, const struct sgttyb *__params) __THROW;
+#endif
__END_DECLS
diff --git a/include/shadow.h b/include/shadow.h
index 778df52b9..97725102f 100644
--- a/include/shadow.h
+++ b/include/shadow.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Declaration of types and functions for shadow password suite. */
@@ -84,7 +83,7 @@ extern struct spwd *getspent (void);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern struct spwd *getspnam (__const char *__name);
+extern struct spwd *getspnam (const char *__name);
/* Read shadow entry from STRING.
@@ -92,7 +91,7 @@ extern struct spwd *getspnam (__const char *__name);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern struct spwd *sgetspent (__const char *__string);
+extern struct spwd *sgetspent (const char *__string);
/* Read next shadow entry from STREAM.
@@ -108,7 +107,7 @@ extern struct spwd *fgetspent (FILE *__stream);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int putspent (__const struct spwd *__p, FILE *__stream);
+extern int putspent (const struct spwd *__p, FILE *__stream);
#ifdef __USE_MISC
@@ -120,18 +119,22 @@ extern int putspent (__const struct spwd *__p, FILE *__stream);
therefore not marked with __THROW. */
extern int getspent_r (struct spwd *__result_buf, char *__buffer,
size_t __buflen, struct spwd **__result);
+libc_hidden_proto(getspent_r)
-extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
+extern int getspnam_r (const char *__name, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
+libc_hidden_proto(getspnam_r)
-extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
+extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
+libc_hidden_proto(sgetspent_r)
extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
char *__buffer, size_t __buflen,
struct spwd **__result);
+libc_hidden_proto(fgetspent_r)
#endif /* misc */
diff --git a/include/signal.h b/include/signal.h
index 610acdc70..38baaccfb 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003, 2004, 2007, 2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.14 Signal handling <signal.h>
@@ -57,32 +56,69 @@ typedef __sigset_t sigset_t;
#include <bits/types.h>
#include <bits/signum.h>
+/* Fake signal functions. */
+#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
+#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
+#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
+#ifdef __USE_UNIX98
+# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
+#endif
+/* Biggest signal number + 1 (including real-time signals). */
+#ifndef _NSIG /* if arch has not defined it in bits/signum.h... */
+# define _NSIG 65
+#endif
+#ifdef __USE_MISC
+# define NSIG _NSIG
+#endif
+/* Real-time signal range */
+#define SIGRTMIN (__libc_current_sigrtmin())
+#define SIGRTMAX (__libc_current_sigrtmax())
+/* These are the hard limits of the kernel. These values should not be
+ used directly at user level. */
+#ifndef __SIGRTMIN /* if arch has not defined it in bits/signum.h... */
+# define __SIGRTMIN 32
+#endif
+#define __SIGRTMAX (_NSIG - 1)
+
+
#if defined __USE_XOPEN || defined __USE_XOPEN2K
# ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
+# endif
#endif
#ifdef __USE_XOPEN
-# endif
# ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
# endif
#endif /* Unix98 */
+#if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__
+/* We need `struct timespec' later on. */
+# define __need_timespec
+# include <time.h>
+#endif
+
+#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
+/* Get the `siginfo_t' type plus the needed symbols. */
+# include <bits/siginfo.h>
+#endif
+
/* Type of a signal handler. */
typedef void (*__sighandler_t) (int);
+
#if defined __UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL__
/* The X/Open definition of `signal' specifies the SVID semantic. Use
the additional function `sysv_signal' when X/Open compatibility is
requested. */
extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
__THROW;
-#ifdef __USE_GNU
+# ifdef __USE_GNU
extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
__THROW;
-#endif
+# endif
#endif /* __UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL__ */
/* Set the handler for the signal SIG to HANDLER, returning the old
@@ -92,6 +128,7 @@ __BEGIN_NAMESPACE_STD
#if defined __USE_BSD || !defined __UCLIBC_HAS_OBSOLETE_SYSV_SIGNAL__
extern __sighandler_t signal (int __sig, __sighandler_t __handler)
__THROW;
+libc_hidden_proto(signal)
#else
/* Make sure the used `signal' implementation is the SVID version. */
# ifdef __REDIRECT_NTH
@@ -104,7 +141,7 @@ extern __sighandler_t __REDIRECT_NTH (signal,
#endif
__END_NAMESPACE_STD
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
/* The X/Open definition of `signal' conflicts with the BSD version.
So they defined another function `bsd_signal'. */
extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
@@ -116,33 +153,41 @@ extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
If PID is < -1, send SIG to all processes in process group - PID. */
#ifdef __USE_POSIX
extern int kill (__pid_t __pid, int __sig) __THROW;
-#endif /* Use POSIX. */
+libc_hidden_proto(kill)
+#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Send SIG to all processes in process group PGRP.
If PGRP is zero, send SIG to all processes in
the current process's process group. */
extern int killpg (__pid_t __pgrp, int __sig) __THROW;
-#endif /* Use BSD || X/Open Unix. */
+#endif
__BEGIN_NAMESPACE_STD
/* Raise signal SIG, i.e., send SIG to yourself. */
extern int raise (int __sig) __THROW;
+libc_hidden_proto(raise)
__END_NAMESPACE_STD
-#ifdef __USE_SVID
+#if 0 /*def __USE_SVID*/
/* SVID names for the same things. */
extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
__THROW;
extern int gsignal (int __sig) __THROW;
#endif /* Use SVID. */
-#ifdef __USE_MISC
+/* glibc guards the next two wrong with __USE_XOPEN2K */
+#if defined __USE_MISC || defined __USE_XOPEN2K8
/* Print a message describing the meaning of the given signal number. */
-extern void psignal (int __sig, __const char *__s);
-#endif /* Use misc. */
+extern void psignal (int __sig, const char *__s);
+#endif /* Use misc or POSIX 2008. */
+#if 0 /*def __USE_XOPEN2K8*/
+/* Print a message describing the meaning of the given signal information. */
+extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
+#endif /* POSIX 2008. */
+#ifdef __UCLIBC_SUSV4_LEGACY__
/* The `sigpause' function has two different interfaces. The original
BSD definition defines the argument as a mask of the signal, while
the more modern interface in X/Open defines it as the signal
@@ -151,22 +196,25 @@ extern void psignal (int __sig, __const char *__s);
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int __sigpause (int __sig_or_mask, int __is_sig);
+/*extern int __sigpause (int __sig_or_mask, int __is_sig);*/
#ifdef __FAVOR_BSD
/* Set the mask of blocked signals to MASK,
wait for a signal to arrive, and then restore the mask. */
-extern int sigpause (int __mask) __THROW __attribute_deprecated__;
-# define sigpause(mask) __sigpause ((mask), 0)
+/*extern int sigpause (int __mask) __THROW __attribute_deprecated__;
+# define sigpause(mask) __sigpause ((mask), 0)*/
+/* uClibc note: BSD sigpause is available as __bsd_sigpause.
+ * It is intentionally not prototyped */
#else
# ifdef __USE_XOPEN
/* Remove a signal from the signal mask and suspend the process. */
-# define sigpause(sig) __sigpause ((sig), 1)
+extern int sigpause(int __sig);
+/*# define sigpause(sig) __sigpause ((sig), 1)*/
# endif
#endif
+#endif /* __UCLIBC_SUSV4_LEGACY__ */
-
-#ifdef __USE_BSD
+#if 0 /*def __USE_BSD*/
/* None of the following functions should be used anymore. They are here
only for compatibility. A single word (`int') is not guaranteed to be
enough to hold a complete signal mask and therefore these functions
@@ -186,10 +234,6 @@ extern int siggetmask (void) __THROW __attribute_deprecated__;
#endif /* Use BSD. */
-#ifdef __USE_MISC
-# define NSIG _NSIG
-#endif
-
#ifdef __USE_GNU
typedef __sighandler_t sighandler_t;
#endif
@@ -201,15 +245,6 @@ typedef __sighandler_t sig_t;
#ifdef __USE_POSIX
-# ifdef __USE_POSIX199309
-/* We need `struct timespec' later on. */
-# define __need_timespec
-# include <time.h>
-
-/* Get the `siginfo_t' type plus the needed symbols. */
-# include <bits/siginfo.h>
-# endif
-
/* Clear all signals from SET. */
extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
@@ -218,25 +253,27 @@ extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
/* Add SIGNO to SET. */
extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
+libc_hidden_proto(sigaddset)
/* Remove SIGNO from SET. */
extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
+libc_hidden_proto(sigdelset)
/* Return 1 if SIGNO is in SET, 0 if not. */
-extern int sigismember (__const sigset_t *__set, int __signo)
+extern int sigismember (const sigset_t *__set, int __signo)
__THROW __nonnull ((1));
# ifdef __USE_GNU
/* Return non-empty value is SET is not empty. */
-extern int sigisemptyset (__const sigset_t *__set) __THROW __nonnull ((1));
+extern int sigisemptyset (const sigset_t *__set) __THROW __nonnull ((1));
/* Build new signal set by combining the two inputs set using logical AND. */
-extern int sigandset (sigset_t *__set, __const sigset_t *__left,
- __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
+extern int sigandset (sigset_t *__set, const sigset_t *__left,
+ const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
/* Build new signal set by combining the two inputs set using logical OR. */
-extern int sigorset (sigset_t *__set, __const sigset_t *__left,
- __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
+extern int sigorset (sigset_t *__set, const sigset_t *__left,
+ const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
# endif /* GNU */
/* Get the system-specific definitions of `struct sigaction'
@@ -244,19 +281,58 @@ extern int sigorset (sigset_t *__set, __const sigset_t *__left,
# include <bits/sigaction.h>
/* Get and/or change the set of blocked signals. */
-extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
+extern int sigprocmask (int __how, const sigset_t *__restrict __set,
sigset_t *__restrict __oset) __THROW;
+libc_hidden_proto(sigprocmask)
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int sigsuspend (__const sigset_t *__set) __nonnull ((1));
+extern int sigsuspend (const sigset_t *__set) __nonnull ((1));
+#ifdef _LIBC
+extern __typeof(sigsuspend) __sigsuspend_nocancel attribute_hidden;
+libc_hidden_proto(sigsuspend)
+#endif
/* Get and/or set the action for signal SIG. */
-extern int sigaction (int __sig, __const struct sigaction *__restrict __act,
+extern int sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact) __THROW;
+#ifdef _LIBC
+# if 0 /* this is in headers */
+/* In uclibc, userspace struct sigaction is identical to
+ * "new" struct kernel_sigaction (one from the Linux 2.1.68 kernel).
+ * See sigaction.h
+ */
+struct old_kernel_sigaction;
+extern int __syscall_sigaction(int, const struct old_kernel_sigaction *,
+ struct old_kernel_sigaction *) attribute_hidden;
+# else /* this is how the function is built */
+extern __typeof(sigaction) __syscall_sigaction attribute_hidden;
+# endif
+# define __need_size_t
+# include <stddef.h>
+/* candidate for attribute_hidden, if NPTL would behave */
+extern int __syscall_rt_sigaction(int, const struct sigaction *,
+ struct sigaction *, size_t)
+# ifndef __UCLIBC_HAS_THREADS_NATIVE__
+ attribute_hidden
+# endif
+ ;
+extern __typeof(sigaction) __libc_sigaction;
+libc_hidden_proto(sigaction)
+
+# ifdef __mips__
+# define _KERNEL_NSIG_WORDS (_NSIG / _MIPS_SZLONG)
+typedef struct {
+ unsigned long sig[_KERNEL_NSIG_WORDS];
+} kernel_sigset_t;
+# define __SYSCALL_SIGSET_T_SIZE (sizeof(kernel_sigset_t))
+# else
+# define __SYSCALL_SIGSET_T_SIZE (_NSIG / 8)
+# endif
+#endif
/* Put in SET all signals that are blocked and waiting to be delivered. */
extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
@@ -266,7 +342,7 @@ extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
+extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
__nonnull ((1, 2));
# if defined __USE_POSIX199309 && defined __UCLIBC_HAS_REALTIME__
@@ -274,22 +350,29 @@ extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int sigwaitinfo (__const sigset_t *__restrict __set,
+extern int sigwaitinfo (const sigset_t *__restrict __set,
siginfo_t *__restrict __info) __nonnull ((1));
+#ifdef _LIBC
+extern __typeof(sigwaitinfo) __sigwaitinfo attribute_hidden;
+#endif
/* Select any of pending signals from SET and place information in INFO.
Wait the time specified by TIMEOUT if no signal is pending.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int sigtimedwait (__const sigset_t *__restrict __set,
+extern int sigtimedwait (const sigset_t *__restrict __set,
siginfo_t *__restrict __info,
- __const struct timespec *__restrict __timeout)
+ const struct timespec *__restrict __timeout)
__nonnull ((1));
+#ifdef _LIBC
+extern __typeof(sigtimedwait) __sigtimedwait_nocancel attribute_hidden;
+libc_hidden_proto(sigtimedwait)
+#endif
/* Send signal SIG to the process PID. Associate data in VAL with the
signal. */
-extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
+extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
__THROW;
# endif /* Use POSIX 199306. */
@@ -297,13 +380,14 @@ extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
#ifdef __USE_BSD
-#ifdef __UCLIBC_HAS_SYS_SIGLIST__
+# ifdef __UCLIBC_HAS_SYS_SIGLIST__
/* Names of the signals. This variable exists only for compatibility.
Use `strsignal' instead (see <string.h>). */
-#define _sys_siglist sys_siglist
-extern __const char *__const sys_siglist[_NSIG];
-#endif /* __UCLIBC_HAS_SYS_SIGLIST__ */
+# define _sys_siglist sys_siglist
+extern const char *const sys_siglist[_NSIG];
+# endif
+#ifndef __UCLIBC_STRICT_HEADERS__
/* Structure passed to `sigvec'. */
struct sigvec
{
@@ -318,48 +402,60 @@ struct sigvec
# define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */
# define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */
# define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */
+#endif
+#if 0
/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
of VEC. The signals in `sv_mask' will be blocked while the handler runs.
If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL,
it is filled in with the old information for SIG. */
-extern int sigvec (int __sig, __const struct sigvec *__vec,
+extern int sigvec (int __sig, const struct sigvec *__vec,
struct sigvec *__ovec) __THROW;
+#endif
/* Get machine-dependent `struct sigcontext' and signal subcodes. */
# include <bits/sigcontext.h>
+#if 0
/* Restore the state saved in SCP. */
extern int sigreturn (struct sigcontext *__scp) __THROW;
+#endif
#endif /* use BSD. */
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# define __need_size_t
+# include <stddef.h>
+# ifdef __UCLIBC_SUSV4_LEGACY__
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
(causing them to fail with EINTR); if INTERRUPT is zero, make system
calls be restarted after signal SIG. */
extern int siginterrupt (int __sig, int __interrupt) __THROW;
+# endif
# include <bits/sigstack.h>
# ifdef __USE_XOPEN
/* This will define `ucontext_t' and `mcontext_t'. */
-# include <ucontext.h>
+/* SuSv4 obsoleted include/ucontext.h */
+# include <sys/ucontext.h>
# endif
+# if 0
/* Run signals handlers on the stack specified by SS (if not NULL).
If OSS is not NULL, it is filled in with the old signal stack status.
This interface is obsolete and on many platform not implemented. */
extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
__THROW __attribute_deprecated__;
+# endif
/* Alternate signal handler stack interface.
This interface should always be preferred over `sigstack'. */
-extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
+extern int sigaltstack (const struct sigaltstack *__restrict __ss,
struct sigaltstack *__restrict __oss) __THROW;
#endif /* use BSD or X/Open Unix. */
@@ -385,7 +481,7 @@ extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
be defined here. */
# include <bits/pthreadtypes.h>
# include <bits/sigthread.h>
-#endif /* use Unix98 */
+#endif
/* The following functions are used internally in the C library and in
other code which need deep insights. */
@@ -395,6 +491,10 @@ extern int __libc_current_sigrtmin (void) __THROW;
/* Return number of available real-time signal with lowest priority. */
extern int __libc_current_sigrtmax (void) __THROW;
+#ifdef _LIBC
+extern sigset_t _sigintr attribute_hidden;
+# include <string.h>
+#endif
#endif /* signal.h */
__END_DECLS
diff --git a/include/spawn.h b/include/spawn.h
new file mode 100644
index 000000000..3de375b41
--- /dev/null
+++ b/include/spawn.h
@@ -0,0 +1,295 @@
+/* Definitions for POSIX spawn interface.
+ Copyright (C) 2000,2003,2004,2009,2011,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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SPAWN_H
+#define _SPAWN_H 1
+
+#include <features.h>
+#include <sched.h>
+#define __need_sigset_t
+#include <signal.h>
+#include <sys/types.h>
+
+/* For the tiny inlines (errno/free/memset). */
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+/* Data structure to contain attributes for thread creation. */
+typedef struct
+{
+ short int __flags;
+ pid_t __pgrp;
+ sigset_t __sd;
+ sigset_t __ss;
+ struct sched_param __sp;
+ int __policy;
+ int __pad[16];
+} posix_spawnattr_t;
+
+
+/* Data structure to contain information about the actions to be
+ performed in the new process with respect to file descriptors. */
+typedef struct
+{
+ int __allocated;
+ int __used;
+ struct __spawn_action *__actions;
+ int __pad[16];
+} posix_spawn_file_actions_t;
+
+
+/* Flags to be set in the `posix_spawnattr_t'. */
+#define POSIX_SPAWN_RESETIDS 0x01
+#define POSIX_SPAWN_SETPGROUP 0x02
+#define POSIX_SPAWN_SETSIGDEF 0x04
+#define POSIX_SPAWN_SETSIGMASK 0x08
+#define POSIX_SPAWN_SETSCHEDPARAM 0x10
+#define POSIX_SPAWN_SETSCHEDULER 0x20
+#ifdef __USE_GNU
+# define POSIX_SPAWN_USEVFORK 0x40
+#endif
+
+__BEGIN_DECLS
+
+/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
+ Before running the process perform the actions described in FILE-ACTIONS.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern int posix_spawn (pid_t *__restrict __pid,
+ const char *__restrict __path,
+ const posix_spawn_file_actions_t *__restrict
+ __file_actions,
+ const posix_spawnattr_t *__restrict __attrp,
+ char *const __argv[__restrict_arr],
+ char *const __envp[__restrict_arr]);
+
+/* Similar to `posix_spawn' but search for FILE in the PATH.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern int posix_spawnp (pid_t *__pid, const char *__file,
+ const posix_spawn_file_actions_t *__file_actions,
+ const posix_spawnattr_t *__attrp,
+ char *const __argv[], char *const __envp[]);
+
+
+/* Initialize data structure with attributes for `spawn' to default values. */
+static inline
+int posix_spawnattr_init (posix_spawnattr_t *__attr)
+{
+ memset (__attr, 0, sizeof (*__attr));
+ return 0;
+}
+
+/* Free resources associated with ATTR. */
+static inline
+int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
+{
+ return 0;
+}
+
+/* Store signal mask for signals with default handling from ATTR in
+ SIGDEFAULT. */
+static inline
+int posix_spawnattr_getsigdefault (const posix_spawnattr_t *
+ __restrict __attr,
+ sigset_t *__restrict __sigdefault)
+{
+ memcpy (__sigdefault, &__attr->__sd, sizeof (sigset_t));
+ return 0;
+}
+
+/* Set signal mask for signals with default handling in ATTR to SIGDEFAULT. */
+static inline
+int posix_spawnattr_setsigdefault (posix_spawnattr_t *__restrict __attr,
+ const sigset_t *__restrict
+ __sigdefault)
+{
+ memcpy (&__attr->__sd, __sigdefault, sizeof (sigset_t));
+ return 0;
+}
+
+/* Store signal mask for the new process from ATTR in SIGMASK. */
+static inline
+int posix_spawnattr_getsigmask (const posix_spawnattr_t *__restrict
+ __attr,
+ sigset_t *__restrict __sigmask)
+{
+ memcpy (__sigmask, &__attr->__ss, sizeof (sigset_t));
+ return 0;
+}
+
+/* Set signal mask for the new process in ATTR to SIGMASK. */
+static inline
+int posix_spawnattr_setsigmask (posix_spawnattr_t *__restrict __attr,
+ const sigset_t *__restrict __sigmask)
+{
+ memcpy (&__attr->__ss, __sigmask, sizeof (sigset_t));
+ return 0;
+}
+
+/* Get flag word from the attribute structure. */
+static inline
+int posix_spawnattr_getflags (const posix_spawnattr_t *__restrict
+ __attr,
+ short int *__restrict __flags)
+{
+ *__flags = __attr->__flags;
+ return 0;
+}
+
+/* Store flags in the attribute structure. */
+static inline
+int posix_spawnattr_setflags (posix_spawnattr_t *_attr,
+ short int __flags)
+{
+#ifdef POSIX_SPAWN_USEVFORK
+# define __POSIX_SPAWN_USEVFORK POSIX_SPAWN_USEVFORK
+#else
+# define __POSIX_SPAWN_USEVFORK 0
+#endif
+#define __POSIX_SPAWN_MASK (POSIX_SPAWN_RESETIDS \
+ | POSIX_SPAWN_SETPGROUP \
+ | POSIX_SPAWN_SETSIGDEF \
+ | POSIX_SPAWN_SETSIGMASK \
+ | POSIX_SPAWN_SETSCHEDPARAM \
+ | POSIX_SPAWN_SETSCHEDULER \
+ | __POSIX_SPAWN_USEVFORK)
+
+ /* Check no invalid bits are set. */
+ if (__flags & ~__POSIX_SPAWN_MASK)
+ return EINVAL;
+
+ _attr->__flags = __flags;
+ return 0;
+#undef __POSIX_SPAWN_USEVFORK
+#undef __POSIX_SPAWN_MASK
+}
+
+/* Get process group ID from the attribute structure. */
+static inline
+int posix_spawnattr_getpgroup (const posix_spawnattr_t *__restrict
+ __attr, pid_t *__restrict __pgroup)
+{
+ *__pgroup = __attr->__pgrp;
+ return 0;
+}
+
+/* Store process group ID in the attribute structure. */
+static inline
+int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
+ pid_t __pgroup)
+{
+ __attr->__pgrp = __pgroup;
+ return 0;
+}
+
+/* Get scheduling policy from the attribute structure. */
+static inline
+int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *
+ __restrict __attr,
+ int *__restrict __schedpolicy)
+{
+ *__schedpolicy = __attr->__policy;
+ return 0;
+}
+
+/* Store scheduling policy in the attribute structure. */
+static inline
+int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
+ int __schedpolicy)
+{
+ switch (__schedpolicy) {
+ case SCHED_OTHER:
+ case SCHED_FIFO:
+ case SCHED_RR:
+ break;
+ default:
+ return EINVAL;
+ }
+
+ __attr->__policy = __schedpolicy;
+ return 0;
+}
+
+/* Get scheduling parameters from the attribute structure. */
+static inline
+int posix_spawnattr_getschedparam (const posix_spawnattr_t *
+ __restrict __attr,
+ struct sched_param *__restrict
+ __schedparam)
+{
+ memcpy (__schedparam, &__attr->__sp, sizeof (__attr->__sp));
+ return 0;
+}
+
+/* Store scheduling parameters in the attribute structure. */
+static inline
+int posix_spawnattr_setschedparam (posix_spawnattr_t *__restrict __attr,
+ const struct sched_param *
+ __restrict __schedparam)
+{
+ __attr->__sp = *__schedparam;
+ return 0;
+}
+
+/* Initialize data structure for file attribute for `spawn' call. */
+static inline
+int posix_spawn_file_actions_init (posix_spawn_file_actions_t *
+ __file_actions)
+{
+ memset (__file_actions, 0, sizeof (*__file_actions));
+ return 0;
+}
+
+/* Free resources associated with FILE-ACTIONS. */
+static inline
+int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *
+ __file_actions)
+{
+ free (__file_actions->__actions);
+ return 0;
+}
+
+/* Add an action to FILE-ACTIONS which tells the implementation to call
+ `open' for the given file during the `spawn' call. */
+extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *
+ __restrict __file_actions,
+ int __fd,
+ const char *__restrict __path,
+ int __oflag, mode_t __mode)
+ __THROW;
+
+/* Add an action to FILE-ACTIONS which tells the implementation to call
+ `close' for the given file descriptor during the `spawn' call. */
+extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *
+ __file_actions, int __fd)
+ __THROW;
+
+/* Add an action to FILE-ACTIONS which tells the implementation to call
+ `dup2' for the given file descriptors during the `spawn' call. */
+extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *
+ __file_actions,
+ int __fd, int __newfd) __THROW;
+
+__END_DECLS
+
+#endif /* spawn.h */
diff --git a/include/stdint.h b/include/stdint.h
index 6d1ecbec4..9ca84453c 100644
--- a/include/stdint.h
+++ b/include/stdint.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,2006 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99: 7.18 Integer types <stdint.h>
@@ -238,7 +237,7 @@ typedef unsigned long long int uintmax_t;
# define UINTPTR_MAX (4294967295U)
# endif
-#if !defined(__H8300H__) && !defined(__H8300S__)
+
/* Minimum for largest signed integral type. */
# define INTMAX_MIN (-__INT64_C(9223372036854775807)-1)
/* Maximum for largest signed integral type. */
@@ -246,15 +245,6 @@ typedef unsigned long long int uintmax_t;
/* Maximum for largest unsigned integral type. */
# define UINTMAX_MAX (__UINT64_C(18446744073709551615))
-#else
-/* Minimum for largest signed integral type. */
-# define INTMAX_MIN (-LONG_LONG_MAX-1)
-/* Maximum for largest signed integral type. */
-# define INTMAX_MAX (LONG_LONG_MAX)
-
-/* Maximum for largest unsigned integral type. */
-# define UINTMAX_MAX (LONG_LONG_MAX<<1+1)
-#endif
/* Limits of other integer types. */
@@ -309,8 +299,8 @@ typedef unsigned long long int uintmax_t;
# endif
/* Unsigned. */
-# define UINT8_C(c) c ## U
-# define UINT16_C(c) c ## U
+# define UINT8_C(c) c
+# define UINT16_C(c) c
# define UINT32_C(c) c ## U
# if __WORDSIZE == 64
# define UINT64_C(c) c ## UL
diff --git a/include/stdio.h b/include/stdio.h
index c854ec333..9aae5abf4 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.19 Input/output <stdio.h>
@@ -88,7 +87,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 +113,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 +121,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'.
@@ -142,16 +141,23 @@ extern FILE *stderr; /* Standard error output stream. */
__BEGIN_NAMESPACE_STD
/* Remove file FILENAME. */
-extern int remove (__const char *__filename) __THROW;
+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;
+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;
+libc_hidden_proto(renameat)
+#endif
__BEGIN_NAMESPACE_STD
/* Create a temporary file and open it read/write.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
#ifndef __USE_FILE_OFFSET64
extern FILE *tmpfile (void) __wur;
@@ -167,18 +173,20 @@ extern FILE *__REDIRECT (tmpfile, (void), tmpfile64) __wur;
extern FILE *tmpfile64 (void) __wur;
#endif
+#ifdef __UCLIBC_SUSV4_LEGACY__
/* Generate a temporary filename. */
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 __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.
@@ -186,7 +194,7 @@ extern char *tmpnam_r (char *__s) __THROW __wur;
If not and if DIR is not NULL, that value is checked. If that fails,
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)
+extern char *tempnam (const char *__dir, const char *__pfx)
__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
@@ -231,22 +242,23 @@ __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) __wur;
+extern FILE *fopen (const char *__restrict __filename,
+ 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,
+extern FILE *freopen (const char *__restrict __filename,
+ const char *__restrict __modes,
FILE *__restrict __stream) __wur;
#else
# ifdef __REDIRECT
-extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
- __const char *__restrict __modes), fopen64)
+extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
+ const char *__restrict __modes), fopen64)
__wur;
-extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
- __const char *__restrict __modes,
+extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
+ const char *__restrict __modes,
FILE *__restrict __stream), freopen64)
__wur;
# else
@@ -256,35 +268,40 @@ extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
#endif
__END_NAMESPACE_STD
#ifdef __USE_LARGEFILE64
-extern FILE *fopen64 (__const char *__restrict __filename,
- __const char *__restrict __modes) __wur;
-extern FILE *freopen64 (__const char *__restrict __filename,
- __const char *__restrict __modes,
+extern FILE *fopen64 (const char *__restrict __filename,
+ const char *__restrict __modes) __wur;
+libc_hidden_proto(fopen64)
+extern FILE *freopen64 (const char *__restrict __filename,
+ const char *__restrict __modes,
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 __wur;
+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,
+ const char *__restrict __modes,
_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)
+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 __wur;
+extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
+libc_hidden_proto(open_memstream)
#endif
#endif
@@ -298,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
@@ -317,70 +335,81 @@ __BEGIN_NAMESPACE_STD
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fprintf (FILE *__restrict __stream,
- __const char *__restrict __format, ...);
+ 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, ...);
+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, ...) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+libc_hidden_proto(sprintf)
/* Write formatted output to S from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
+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
marked with __THROW. */
-extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
+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;
+extern int vsprintf (char *__restrict __s, const char *__restrict __format,
+ __gnuc_va_list __arg) __THROWNL
+ __attribute__ ((__format__ (__printf__, 2, 0)));
__END_NAMESPACE_STD
#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
__BEGIN_NAMESPACE_C99
/* Maximum chars of output to write in MAXLEN. */
extern int snprintf (char *__restrict __s, size_t __maxlen,
- __const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+ const char *__restrict __format, ...)
+ __THROWNL __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)));
+ const char *__restrict __format, __gnuc_va_list __arg)
+ __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
+libc_hidden_proto(vsnprintf)
__END_NAMESPACE_C99
#endif
#ifdef __USE_GNU
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
-extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
+extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
__gnuc_va_list __arg)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+ __THROWNL __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))) __wur;
+ const char *__restrict __fmt, ...)
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
#endif
extern int asprintf (char **__restrict __ptr,
- __const char *__restrict __fmt, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+ const char *__restrict __fmt, ...)
+ __THROWNL __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
- 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. */
-extern int vdprintf (int __fd, __const char *__restrict __fmt,
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern int vdprintf (int __fd, const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
+libc_hidden_proto(vdprintf)
+extern int dprintf (int __fd, const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
#endif
@@ -391,15 +420,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, ...) __wur;
+ 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, ...) __wur;
+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;
+extern int sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...)
+ __THROW __attribute__ ((__format__ (__scanf__, 2, 3)));
+libc_hidden_proto(sscanf)
__END_NAMESPACE_STD
#ifdef __USE_ISOC99
@@ -408,21 +442,23 @@ __BEGIN_NAMESPACE_C99
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
+extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
__gnuc_va_list __arg)
__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)
+extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
__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)
+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. */
@@ -433,6 +469,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.
@@ -452,10 +489,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
@@ -466,6 +502,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. */
@@ -478,6 +515,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.
@@ -508,9 +546,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. */
@@ -531,13 +566,23 @@ __BEGIN_NAMESPACE_STD
marked with __THROW. */
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
__wur;
+libc_hidden_proto(fgets)
+#if !defined __USE_ISOC11 \
+ || (defined __cplusplus && __cplusplus <= 201103L)
/* 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.
+ The function has been officially removed in ISO C11. This opportunity
+ is used to also remove it from the GNU feature list. It is now only
+ available when explicitly using an old ISO C, Unix, or POSIX standard.
+ GCC defines _GNU_SOURCE when building C++ code and the function is still
+ in C++11, so it is also available for C++.
+
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern char *gets (char *__s) __wur;
+extern char *gets (char *__s) __wur __attribute_deprecated__;
+#endif
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -549,10 +594,11 @@ __END_NAMESPACE_STD
therefore not marked with __THROW. */
extern char *fgets_unlocked (char *__restrict __s, int __n,
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
@@ -571,6 +617,7 @@ extern __ssize_t __getdelim (char **__restrict __lineptr,
extern __ssize_t getdelim (char **__restrict __lineptr,
size_t *__restrict __n, int __delimiter,
FILE *__restrict __stream) __wur;
+libc_hidden_proto(getdelim)
/* Like `getdelim', but reads up to a newline.
@@ -581,42 +628,47 @@ extern __ssize_t getdelim (char **__restrict __lineptr,
extern __ssize_t getline (char **__restrict __lineptr,
size_t *__restrict __n,
FILE *__restrict __stream) __wur;
+libc_hidden_proto(getline)
#endif
__BEGIN_NAMESPACE_STD
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
+extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
+libc_hidden_proto(fputs)
/* Write a string, followed by a newline, to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int puts (__const char *__s);
+extern int puts (const char *__s);
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int ungetc (int __c, FILE *__stream);
+libc_hidden_proto(ungetc)
/* Read chunks of generic data from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern size_t fread (void *__restrict __ptr, size_t __size,
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
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
+extern size_t fwrite (const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) __wur;
+libc_hidden_proto(fwrite)
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -626,8 +678,9 @@ __END_NAMESPACE_STD
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int fputs_unlocked (__const char *__restrict __s,
+extern int fputs_unlocked (const char *__restrict __s,
FILE *__restrict __stream);
+libc_hidden_proto(fputs_unlocked)
#endif
#ifdef __USE_MISC
@@ -639,8 +692,10 @@ extern int fputs_unlocked (__const char *__restrict __s,
therefore not marked with __THROW. */
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) __wur;
-extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
+libc_hidden_proto(fread_unlocked)
+extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) __wur;
+libc_hidden_proto(fwrite_unlocked)
#endif
@@ -650,16 +705,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) __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,
@@ -703,13 +761,13 @@ extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
+extern int fsetpos (FILE *__stream, const fpos_t *__pos);
#else
# ifdef __REDIRECT
extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
fpos_t *__restrict __pos), fgetpos64);
extern int __REDIRECT (fsetpos,
- (FILE *__stream, __const fpos_t *__pos), fsetpos64);
+ (FILE *__stream, const fpos_t *__pos), fsetpos64);
# else
# define fgetpos fgetpos64
# define fsetpos fsetpos64
@@ -719,9 +777,11 @@ __END_NAMESPACE_STD
#ifdef __USE_LARGEFILE64
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
+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);
+extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
#endif
__BEGIN_NAMESPACE_STD
@@ -746,7 +806,8 @@ __BEGIN_NAMESPACE_STD
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern void perror (__const char *__s);
+extern void perror (const char *__s);
+libc_hidden_proto(perror)
__END_NAMESPACE_STD
#ifdef __UCLIBC_HAS_SYS_ERRLIST__
@@ -754,7 +815,7 @@ __END_NAMESPACE_STD
function provides all the needed functionality. */
#ifdef __USE_BSD
extern int sys_nerr;
-extern __const char *__const sys_errlist[];
+extern const char *const sys_errlist[];
#endif
#endif /* __UCLIBC_HAS_SYS_ERRLIST__ */
@@ -762,11 +823,13 @@ extern __const char *__const sys_errlist[];
#ifdef __USE_POSIX
/* Return the system file descriptor for STREAM. */
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 __wur;
+libc_hidden_proto(fileno_unlocked)
#endif
@@ -776,7 +839,7 @@ extern int fileno_unlocked (FILE *__stream) __THROW __wur;
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern FILE *popen (__const char *__command, __const char *__modes) __wur;
+extern FILE *popen (const char *__command, const char *__modes) __wur;
/* Close a stream opened by popen and return the status of its child.
@@ -798,18 +861,19 @@ extern char *cuserid (char *__s);
#endif /* Use X/Open, but not issue 6. */
-#if 0 /* def __USE_GNU uClibc note: not supported */
+#if defined __USE_GNU && defined __UCLIBC_HAS_OBSTACK__
struct obstack; /* See <obstack.h>. */
/* Write formatted output to an obstack. */
extern int obstack_printf (struct obstack *__restrict __obstack,
- __const char *__restrict __format, ...)
- __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+ const char *__restrict __format, ...)
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
extern int obstack_vprintf (struct obstack *__restrict __obstack,
- __const char *__restrict __format,
+ const char *__restrict __format,
__gnuc_va_list __args)
- __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
-#endif /* Use GNU. */
+ __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
+libc_hidden_proto(obstack_vprintf)
+#endif /* USE_GNU && UCLIBC_HAS_OBSTACK. */
#if defined __USE_POSIX || defined __USE_MISC
@@ -831,27 +895,31 @@ 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)
#endif
-#ifndef __STDIO_GETC_MACRO
-#define __stdin stdin
-#endif
#define getchar() __GETC(__stdin)
-
-#ifndef __STDIO_PUTC_MACRO
-#define __stdout stdout
-#endif
#define putchar(_ch) __PUTC((_ch), __stdout)
#if defined __USE_POSIX || defined __USE_MISC
@@ -870,6 +938,8 @@ extern void funlockfile (FILE *__stream) __THROW;
#define ferror_unlocked(_fp) __FERROR_UNLOCKED(_fp)
#endif
+#endif
+
__END_DECLS
#endif /* <stdio.h> included. */
diff --git a/include/stdio_ext.h b/include/stdio_ext.h
index 23d12e092..c9443499d 100644
--- a/include/stdio_ext.h
+++ b/include/stdio_ext.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This header contains the same definitions as the header of the same name
on Sun's Solaris OS. */
@@ -81,6 +80,7 @@ extern void _flushlbf (void);
/* Set locking status of stream FP to TYPE. */
extern int __fsetlocking (FILE *__fp, int __type) __THROW;
+libc_hidden_proto(__fsetlocking)
__END_DECLS
diff --git a/include/stdlib.h b/include/stdlib.h
index b87dfd921..ba8849ed0 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2007, 2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.20 General utilities <stdlib.h>
@@ -39,7 +38,7 @@ __BEGIN_DECLS
#ifndef __need_malloc_and_calloc
#define _STDLIB_H 1
-#if defined __USE_XOPEN && !defined _SYS_WAIT_H
+#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
/* XPG requires a few symbols from <sys/wait.h> being defined. */
# include <bits/waitflags.h>
# include <bits/waitstatus.h>
@@ -50,15 +49,15 @@ __BEGIN_DECLS
as well as POSIX.1 use of `int' for the status word. */
# 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
# define __WAIT_INT(status) (*(int *) &(status))
# endif
/* 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
the actual function definitions. */
@@ -84,14 +83,14 @@ typedef union
# endif /* Use BSD. */
/* Define the macros <sys/wait.h> also would define this way. */
-# 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))
-# if 0 /* def __WIFCONTINUED */
-# define WIFCONTINUED(status) __WIFCONTINUED(__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
+# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
# endif
#endif /* X/Open and <sys/wait.h> not included. */
@@ -141,31 +140,36 @@ __END_NAMESPACE_C99
#if 0
#define MB_CUR_MAX (__ctype_get_mb_cur_max ())
extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
-#endif
+#else
#ifdef __UCLIBC_HAS_WCHAR__
-#define MB_CUR_MAX (_stdlib_mb_cur_max ())
+# define MB_CUR_MAX (_stdlib_mb_cur_max ())
extern size_t _stdlib_mb_cur_max (void) __THROW __wur;
+libc_hidden_proto(_stdlib_mb_cur_max)
+#else
+# define MB_CUR_MAX 1
+#endif
#endif
__BEGIN_NAMESPACE_STD
#ifdef __UCLIBC_HAS_FLOATS__
/* Convert a string to a floating-point number. */
-extern double atof (__const char *__nptr)
+extern double atof (const char *__nptr)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
#endif /* __UCLIBC_HAS_FLOATS__ */
/* Convert a string to an integer. */
-extern int atoi (__const char *__nptr)
+extern int atoi (const char *__nptr)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
+libc_hidden_proto(atoi)
/* Convert a string to a long integer. */
-extern long int atol (__const char *__nptr)
+extern long int atol (const char *__nptr)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
__END_NAMESPACE_STD
#if defined __USE_ISOC99 || defined __USE_MISC
__BEGIN_NAMESPACE_C99
/* Convert a string to a long long integer. */
-__extension__ extern long long int atoll (__const char *__nptr)
+__extension__ extern long long int atoll (const char *__nptr)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
__END_NAMESPACE_C99
#endif
@@ -173,18 +177,19 @@ __END_NAMESPACE_C99
#ifdef __UCLIBC_HAS_FLOATS__
__BEGIN_NAMESPACE_STD
/* Convert a string to a floating-point number. */
-extern double strtod (__const char *__restrict __nptr,
+extern double strtod (const char *__restrict __nptr,
char **__restrict __endptr)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(strtod)
__END_NAMESPACE_STD
#ifdef __USE_ISOC99
__BEGIN_NAMESPACE_C99
/* Likewise for `float' and `long double' sizes of floating-point numbers. */
-extern float strtof (__const char *__restrict __nptr,
+extern float strtof (const char *__restrict __nptr,
char **__restrict __endptr) __THROW __nonnull ((1)) __wur;
-extern long double strtold (__const char *__restrict __nptr,
+extern long double strtold (const char *__restrict __nptr,
char **__restrict __endptr)
__THROW __nonnull ((1)) __wur;
__END_NAMESPACE_C99
@@ -193,24 +198,28 @@ __END_NAMESPACE_C99
__BEGIN_NAMESPACE_STD
/* Convert a string to a long integer. */
-extern long int strtol (__const char *__restrict __nptr,
+extern long int strtol (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(strtol)
/* Convert a string to an unsigned long integer. */
-extern unsigned long int strtoul (__const char *__restrict __nptr,
+extern unsigned long int strtoul (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(strtoul)
__END_NAMESPACE_STD
#ifdef __USE_BSD
+#include <sys/types.h> /* for u_quad_t */
+
/* Convert a string to a quadword integer. */
__extension__
-extern long long int strtoq (__const char *__restrict __nptr,
+extern quad_t strtoq (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
/* Convert a string to an unsigned quadword integer. */
__extension__
-extern unsigned long long int strtouq (__const char *__restrict __nptr,
+extern u_quad_t strtouq (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
#endif /* GCC and use BSD. */
@@ -219,30 +228,30 @@ extern unsigned long long int strtouq (__const char *__restrict __nptr,
__BEGIN_NAMESPACE_C99
/* Convert a string to a quadword integer. */
__extension__
-extern long long int strtoll (__const char *__restrict __nptr,
+extern long long int strtoll (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(strtoll)
/* Convert a string to an unsigned quadword integer. */
__extension__
-extern unsigned long long int strtoull (__const char *__restrict __nptr,
+extern unsigned long long int strtoull (const char *__restrict __nptr,
char **__restrict __endptr, int __base)
__THROW __nonnull ((1)) __wur;
__END_NAMESPACE_C99
#endif /* ISO C99 or GCC and use MISC. */
-#ifdef __UCLIBC_HAS_XLOCALE__
-#ifdef __USE_GNU
+#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
/* The concept of one static locale per category is not very well
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
- 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.
- 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
(almost) opaque type for the user level programs. */
@@ -250,44 +259,44 @@ __END_NAMESPACE_C99
/* Special versions of the functions above which take the locale to
use as an additional parameter. */
-extern long int strtol_l (__const char *__restrict __nptr,
+extern long int strtol_l (const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) __THROW __nonnull ((1, 4)) __wur;
+libc_hidden_proto(strtol_l)
-extern unsigned long int strtoul_l (__const char *__restrict __nptr,
+extern unsigned long int strtoul_l (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
__THROW __nonnull ((1, 4)) __wur;
+libc_hidden_proto(strtoul_l)
__extension__
-extern long long int strtoll_l (__const char *__restrict __nptr,
+extern long long int strtoll_l (const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc)
__THROW __nonnull ((1, 4)) __wur;
__extension__
-extern unsigned long long int strtoull_l (__const char *__restrict __nptr,
+extern unsigned long long int strtoull_l (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
__THROW __nonnull ((1, 4)) __wur;
#ifdef __UCLIBC_HAS_FLOATS__
-extern double strtod_l (__const char *__restrict __nptr,
+extern double strtod_l (const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc)
__THROW __nonnull ((1, 3)) __wur;
-extern float strtof_l (__const char *__restrict __nptr,
+extern float strtof_l (const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc)
__THROW __nonnull ((1, 3)) __wur;
-extern long double strtold_l (__const char *__restrict __nptr,
+extern long double strtold_l (const char *__restrict __nptr,
char **__restrict __endptr,
__locale_t __loc)
__THROW __nonnull ((1, 3)) __wur;
#endif /* __UCLIBC_HAS_FLOATS__ */
-
#endif /* GNU */
-#endif /* __UCLIBC_HAS_XLOCALE__ */
#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED
@@ -297,7 +306,7 @@ extern long double strtold_l (__const char *__restrict __nptr,
extern char *l64a (long int __n) __THROW __wur;
/* Read a number from a string S in base 64 as above. */
-extern long int a64l (__const char *__s)
+extern long int a64l (const char *__s)
__THROW __attribute_pure__ __nonnull ((1)) __wur;
#endif /* Use SVID || extended X/Open. */
@@ -311,6 +320,7 @@ extern long int a64l (__const char *__s)
We provide both interfaces to the same random number generator. */
/* Return a random long integer between 0 and RAND_MAX inclusive. */
extern long int random (void) __THROW;
+libc_hidden_proto(random)
/* Seed the random number generator with the given number. */
extern void srandom (unsigned int __seed) __THROW;
@@ -337,26 +347,37 @@ struct random_data
int32_t *fptr; /* Front pointer. */
int32_t *rptr; /* Rear pointer. */
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 */
+ int8_t rand_type; /* Type of random number generator. */
+ int8_t rand_deg; /* Degree of random number generator. */
+ int8_t rand_sep; /* Distance between front and rear. */
+#endif
int32_t *end_ptr; /* Pointer behind state table. */
};
extern int random_r (struct random_data *__restrict __buf,
int32_t *__restrict __result) __THROW __nonnull ((1, 2));
+libc_hidden_proto(random_r)
extern int srandom_r (unsigned int __seed, struct random_data *__buf)
__THROW __nonnull ((2));
+libc_hidden_proto(srandom_r)
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
size_t __statelen,
struct random_data *__restrict __buf)
__THROW __nonnull ((2, 4));
+libc_hidden_proto(initstate_r)
extern int setstate_r (char *__restrict __statebuf,
struct random_data *__restrict __buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(setstate_r)
# endif /* Use misc. */
#endif /* Use SVID || extended X/Open || BSD. */
@@ -419,16 +440,19 @@ extern int drand48_r (struct drand48_data *__restrict __buffer,
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
double *__restrict __result) __THROW __nonnull ((1, 2));
+libc_hidden_proto(erand48_r)
#endif /* __UCLIBC_HAS_FLOATS__ */
/* Return non-negative, long integer in [0,2^31). */
extern int lrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(lrand48_r)
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(nrand48_r)
/* Return signed, long integers in [-2^31,2^31). */
extern int mrand48_r (struct drand48_data *__restrict __buffer,
@@ -438,13 +462,16 @@ extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(jrand48_r)
/* Seed random number generator. */
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
__THROW __nonnull ((2));
+libc_hidden_proto(srand48_r)
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) __THROW __nonnull ((1, 2));
+libc_hidden_proto(seed48_r)
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer)
@@ -459,9 +486,11 @@ extern int lcong48_r (unsigned short int __param[7],
__BEGIN_NAMESPACE_STD
/* Allocate SIZE bytes of memory. */
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
+/* We want the malloc symbol overridable at runtime, do not hide it! */
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0. */
extern void *calloc (size_t __nmemb, size_t __size)
__THROW __attribute_malloc__ __wur;
+/* We want the calloc symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
#endif
@@ -469,13 +498,18 @@ __END_NAMESPACE_STD
__BEGIN_NAMESPACE_STD
/* Re-allocate the previously allocated block
in PTR, making the new block SIZE bytes long. */
+/* __attribute_malloc__ is not used, because if realloc returns
+ the same pointer that was passed to it, aliasing needs to be allowed
+ between objects pointed by the old and new pointers. */
extern void *realloc (void *__ptr, size_t __size)
- __THROW __attribute_malloc__ __attribute_warn_unused_result__;
+ __THROW __wur;
+/* We want the realloc symbol overridable at runtime, do not hide it! */
/* Free a block allocated by `malloc', `realloc' or `calloc'. */
extern void free (void *__ptr) __THROW;
+/* We want the free symbol overridable at runtime, do not hide it! */
__END_NAMESPACE_STD
-#ifdef __USE_MISC
+#if 0 /*def __USE_MISC*/
/* Free a block. An alias for `free'. (Sun Unices). */
extern void cfree (void *__ptr) __THROW;
#endif /* Use misc. */
@@ -498,6 +532,7 @@ extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump. */
extern void abort (void) __THROW __attribute__ ((__noreturn__));
+libc_hidden_proto(abort)
/* Register a function to be called when `exit' is called. */
@@ -513,9 +548,10 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
__BEGIN_NAMESPACE_STD
/* 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. */
extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
+libc_hidden_proto(exit)
__END_NAMESPACE_STD
#ifdef __USE_ISOC99
@@ -529,13 +565,16 @@ __END_NAMESPACE_C99
__BEGIN_NAMESPACE_STD
/* Return the value of envariable NAME, or NULL if it doesn't exist. */
-extern char *getenv (__const char *__name) __THROW __nonnull ((1)) __wur;
+extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
+libc_hidden_proto(getenv)
__END_NAMESPACE_STD
+#if 0
/* This function is similar to the above but returns NULL if the
programs is running with SUID or SGID enabled. */
-extern char *__secure_getenv (__const char *__name)
+extern char *__secure_getenv (const char *__name)
__THROW __nonnull ((1)) __wur;
+#endif
#if defined __USE_SVID || defined __USE_XOPEN
/* The SVID says this is in <stdio.h>, but this seems a better place. */
@@ -547,11 +586,13 @@ extern int putenv (char *__string) __THROW __nonnull ((1));
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set NAME to VALUE in the environment.
If REPLACE is nonzero, overwrite an existing value. */
-extern int setenv (__const char *__name, __const char *__value, int __replace)
+extern int setenv (const char *__name, const char *__value, int __replace)
__THROW __nonnull ((2));
+libc_hidden_proto(setenv)
/* Remove the variable NAME from the environment. */
-extern int unsetenv (__const char *__name) __THROW;
+extern int unsetenv (const char *__name) __THROW;
+libc_hidden_proto(unsetenv)
#endif
/* The following is used by uClibc in atexit.c and sysconf.c */
@@ -572,11 +613,13 @@ extern int clearenv (void) __THROW;
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+# if defined __UCLIBC_SUSV3_LEGACY__
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the file name unique.
Returns TEMPLATE, or a null pointer if it cannot get a unique file name. */
extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
+# endif
/* Generate a unique temporary file name from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
@@ -584,7 +627,7 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
Returns a file descriptor open on the file for reading and writing,
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. */
# ifndef __USE_FILE_OFFSET64
extern int mkstemp (char *__template) __nonnull ((1)) __wur;
@@ -601,7 +644,36 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
# endif
#endif
-#ifdef __USE_BSD
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+# if defined __UCLIBC_SUSV3_LEGACY__
+extern char *mktemps (char *__template, int __suffixlen) __THROW __nonnull ((1)) __wur;
+# endif
+
+/* The mkstemps() function is like mkstemp(), except that the string in
+ template contains a suffix of suffixlen characters. Thus, template is
+ of the form prefixXXXXXXsuffix, and the string XXXXXX is modified as
+ for mkstemp().
+ Returns a file descriptor open on the file for reading and writing,
+ or -1 if it cannot create a uniquely-named file.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen), mkstemps64)
+ __nonnull ((1)) __wur;
+# else
+# define mkstemps mkstemps64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkstemps64 (char *__template, int __suffixlen) __nonnull ((1)) __wur;
+# endif
+#endif
+
+#if defined __USE_BSD || defined __USE_XOPEN2K8
/* Create a unique temporary directory from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the directory name unique.
@@ -610,51 +682,95 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
#endif
+#ifdef __USE_GNU
+/* Generate a unique temporary file name from TEMPLATE similar to
+ mkstemp. But allow the caller to pass additional flags which are
+ used in the open call to create the file..
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
+ __nonnull ((1)) __wur;
+# else
+# define mkostemp mkostemp64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
+# endif
+#endif
+
+#ifdef __USE_GNU
+/* Generate a unique temporary file name from TEMPLATE similar to
+ mkostemp. But allow the caller to pass additional file name suffix.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkostemps (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen, int __flags), mkostemps64)
+ __nonnull ((1)) __wur;
+# else
+# define mkostemps mkostemps64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkostemps64 (char *__template, int __suffixlen, int __flags) __nonnull ((1)) __wur;
+# endif
+#endif
+
__BEGIN_NAMESPACE_STD
/* Execute the given line as a shell command.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int system (__const char *__command) __wur;
+extern int system (const char *__command) __wur;
__END_NAMESPACE_STD
-#if 0 /* def __USE_GNU */
+#ifdef __USE_GNU
/* Return a malloc'd string containing the canonical absolute name of the
- named file. The last file name component need not exist, and may be a
- symlink to a nonexistent file. */
-extern char *canonicalize_file_name (__const char *__name)
+ existing named file. */
+extern char *canonicalize_file_name (const char *__name)
__THROW __nonnull ((1)) __wur;
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-/* Return the canonical absolute name of file NAME. The last file name
- component need not exist, and may be a symlink to a nonexistent file.
- 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. */
-/* we choose to handle __resolved==NULL as crash :) */
-extern char *realpath (__const char *__restrict __name,
- char *__restrict __resolved) __THROW __wur __nonnull((2));
+/* 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,
+ char *__restrict __resolved) __THROW __wur;
+libc_hidden_proto(realpath)
#endif
/* Shorthand for type of comparison functions. */
#ifndef __COMPAR_FN_T
# define __COMPAR_FN_T
-typedef int (*__compar_fn_t) (__const void *, __const void *);
+typedef int (*__compar_fn_t) (const void *, const void *);
# ifdef __USE_GNU
typedef __compar_fn_t comparison_fn_t;
# endif
#endif
+#ifdef __USE_GNU
+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
+#endif
__BEGIN_NAMESPACE_STD
/* Do a binary search for KEY in BASE, which consists of NMEMB elements
of SIZE bytes each, using COMPAR to perform the comparisons. */
-extern void *bsearch (__const void *__key, __const void *__base,
+extern void *bsearch (const void *__key, const void *__base,
size_t __nmemb, size_t __size, __compar_fn_t __compar)
__nonnull ((1, 2, 5)) __wur;
@@ -662,7 +778,13 @@ extern void *bsearch (__const void *__key, __const void *__base,
using COMPAR to perform the comparisons. */
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) __nonnull ((1, 4));
-
+libc_hidden_proto(qsort)
+#ifdef __USE_GNU
+extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
+ __compar_d_fn_t __compar, void *__arg)
+ __nonnull ((1, 4));
+libc_hidden_proto(qsort_r)
+#endif
/* Return the absolute value of X. */
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
@@ -694,12 +816,11 @@ __END_NAMESPACE_C99
#endif
-#if defined __USE_SVID || defined __USE_XOPEN_EXTENDED || defined __USE_BSD
+#if ( defined __USE_SVID || defined __USE_XOPEN_EXTENDED ) && defined __UCLIBC_HAS_FLOATS__
/* Convert floating point numbers to strings. The returned values are
valid only until another call to the same function. */
# ifdef __UCLIBC_SUSV3_LEGACY__
-
#if 0
/* Convert VALUE to a string with NDIGIT digits and return a pointer to
this. Set *DECPT with the position of the decimal character and *SIGN
@@ -721,6 +842,7 @@ extern char *gcvt (double __value, int __ndigit, char *__buf)
__THROW __nonnull ((3)) __wur;
# endif /* __UCLIBC_SUSV3_LEGACY__ */
+
# if 0 /*def __USE_MISC*/
/* Long double versions of above functions. */
extern char *qecvt (long double __value, int __ndigit,
@@ -753,15 +875,16 @@ extern int qfcvt_r (long double __value, int __ndigit,
# endif /* misc */
#endif /* use MISC || use X/Open Unix */
+
#ifdef __UCLIBC_HAS_WCHAR__
__BEGIN_NAMESPACE_STD
/* Return the length of the multibyte character
in S, which is no longer than N. */
-extern int mblen (__const char *__s, size_t __n) __THROW __wur;
+extern int mblen (const char *__s, size_t __n) __THROW __wur;
/* Return the length of the given multibyte character,
putting its `wchar_t' representation in *PWC. */
extern int mbtowc (wchar_t *__restrict __pwc,
- __const char *__restrict __s, size_t __n) __THROW __wur;
+ const char *__restrict __s, size_t __n) __THROW __wur;
/* Put the multibyte character represented
by WCHAR in S, returning its length. */
extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur;
@@ -769,10 +892,10 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW __wur;
/* Convert a multibyte string to a wide char string. */
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
- __const char *__restrict __s, size_t __n) __THROW;
+ const char *__restrict __s, size_t __n) __THROW;
/* Convert a wide char string to multibyte string. */
extern size_t wcstombs (char *__restrict __s,
- __const wchar_t *__restrict __pwcs, size_t __n)
+ const wchar_t *__restrict __pwcs, size_t __n)
__THROW;
__END_NAMESPACE_STD
#endif /* __UCLIBC_HAS_WCHAR__ */
@@ -783,7 +906,7 @@ __END_NAMESPACE_STD
or negative response expression as specified by the LC_MESSAGES category
in the program's current locale. Returns 1 if affirmative, 0 if
negative, and -1 if not matching. */
-extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur;
+extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur;
#endif
@@ -795,7 +918,7 @@ extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur;
suboption. On exit *OPTIONP is set to the beginning of the next
token or at the terminating NUL character. */
extern int getsubopt (char **__restrict __optionp,
- char *__const *__restrict __tokens,
+ char *const *__restrict __tokens,
char **__restrict __valuep)
__THROW __nonnull ((1, 2, 3)) __wur;
#endif
@@ -804,7 +927,7 @@ extern int getsubopt (char **__restrict __optionp,
#ifdef __USE_XOPEN
# if defined __UCLIBC_HAS_CRYPT__
/* Setup DES tables according KEY. */
-extern void setkey (__const char *__key) __THROW __nonnull ((1));
+extern void setkey (const char *__key) __THROW __nonnull ((1));
# endif /* __UCLIBC_HAS_CRYPT__ */
#endif
@@ -814,12 +937,12 @@ extern void setkey (__const char *__key) __THROW __nonnull ((1));
#ifdef __USE_XOPEN2K
/* Return a master pseudo-terminal handle. */
extern int posix_openpt (int __oflag) __wur;
-libc_hidden_proto(posix_openpt)
#endif
#ifdef __USE_XOPEN
/* The next four functions all take a master pseudo-tty fd and
perform an operation on the associated slave: */
+
#ifdef __UCLIBC_HAS_PTY__
/* Chown the slave to the calling user. */
extern int grantpt (int __fd) __THROW;
@@ -842,6 +965,7 @@ extern char *ptsname (int __fd) __THROW __wur;
Return 0 on success, otherwise an error number. */
extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
__THROW __nonnull ((2));
+libc_hidden_proto(ptsname_r)
# endif
# if defined __UCLIBC_HAS_GETPT__
/* Open a master pseudo terminal and return its file descriptor. */
@@ -858,12 +982,19 @@ extern int getloadavg (double __loadavg[], int __nelem)
#endif
#ifdef __UCLIBC_HAS_ARC4RANDOM__
-#include <stdint.h>
-extern uint32_t arc4random(void);
+# include <sys/types.h>
+extern u_int32_t arc4random(void);
extern void arc4random_stir(void);
extern void arc4random_addrandom(unsigned char *, int);
#endif
+#ifdef _LIBC
+extern int __drand48_iterate (unsigned short int xsubi[3], struct drand48_data *buffer) attribute_hidden;
+
+/* Global state for non-reentrant functions. */
+extern struct drand48_data __libc_drand48_data attribute_hidden;
+#endif
+
#endif /* don't just need malloc and calloc */
#undef __need_malloc_and_calloc
diff --git a/include/string.h b/include/string.h
index bbca20af3..8315203a4 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1993, 1995-2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1995-2004,2007,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.21 String handling <string.h>
@@ -36,12 +35,12 @@ __BEGIN_DECLS
__BEGIN_NAMESPACE_STD
/* Copy N bytes of SRC to DEST. */
extern void *memcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n)
+ const void *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
libc_hidden_proto(memcpy)
/* Copy N bytes of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
-extern void *memmove (void *__dest, __const void *__src, size_t __n)
+extern void *memmove (void *__dest, const void *__src, size_t __n)
__THROW __nonnull ((1, 2));
libc_hidden_proto(memmove)
__END_NAMESPACE_STD
@@ -50,7 +49,7 @@ __END_NAMESPACE_STD
Return the position in DEST one byte past where C was copied,
or NULL if C was not found in the first N bytes of SRC. */
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN
-extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
+extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
int __c, size_t __n)
__THROW __nonnull ((1, 2));
libc_hidden_proto(memccpy)
@@ -63,12 +62,12 @@ extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
libc_hidden_proto(memset)
/* Compare N bytes of S1 and S2. */
-extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
+extern int memcmp (const void *__s1, const void *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(memcmp)
/* Search N bytes of S for C. */
-extern void *memchr (__const void *__s, int __c, size_t __n)
+extern void *memchr (const void *__s, int __c, size_t __n)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(memchr)
__END_NAMESPACE_STD
@@ -76,12 +75,12 @@ __END_NAMESPACE_STD
#ifdef __USE_GNU
/* Search in S for C. This is similar to `memchr' but there is no
length limit. */
-extern void *rawmemchr (__const void *__s, int __c)
+extern void *rawmemchr (const void *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(rawmemchr)
/* Search N bytes of S for the final occurrence of C. */
-extern void *memrchr (__const void *__s, int __c, size_t __n)
+extern void *memrchr (const void *__s, int __c, size_t __n)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(memrchr)
#endif
@@ -89,63 +88,62 @@ libc_hidden_proto(memrchr)
__BEGIN_NAMESPACE_STD
/* Copy SRC to DEST. */
-extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
+extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
libc_hidden_proto(strcpy)
/* Copy no more than N characters of SRC to DEST. */
extern char *strncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n)
+ const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
libc_hidden_proto(strncpy)
/* Append SRC onto DEST. */
-extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
+extern char *strcat (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
libc_hidden_proto(strcat)
/* Append no more than N characters from SRC onto DEST. */
-extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
+extern char *strncat (char *__restrict __dest, const char *__restrict __src,
size_t __n) __THROW __nonnull ((1, 2));
libc_hidden_proto(strncat)
/* Compare S1 and S2. */
-extern int strcmp (__const char *__s1, __const char *__s2)
+extern int strcmp (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcmp)
/* Compare N characters of S1 and S2. */
-extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
+extern int strncmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strncmp)
/* Compare the collated forms of S1 and S2. */
-extern int strcoll (__const char *__s1, __const char *__s2)
+extern int strcoll (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcoll)
/* Put a transformation of SRC into no more than N bytes of DEST. */
extern size_t strxfrm (char *__restrict __dest,
- __const char *__restrict __src, size_t __n)
+ const char *__restrict __src, size_t __n)
__THROW __nonnull ((2));
-libc_hidden_proto(strxfrm)
__END_NAMESPACE_STD
-#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
+#if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__
/* The following functions are equivalent to the both above but they
take the locale they use for the collation as an extra argument.
This is not standardsized but something like will come. */
# include <xlocale.h>
/* Compare the collated forms of S1 and S2 using rules from L. */
-extern int strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
+extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
libc_hidden_proto(strcoll_l)
/* Put a transformation of SRC into no more than N bytes of DEST. */
-extern size_t strxfrm_l (char *__dest, __const char *__src, size_t __n,
+extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
__locale_t __l) __THROW __nonnull ((2, 4));
libc_hidden_proto(strxfrm_l)
#endif
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Duplicate S, returning an identical malloc'd string. */
-extern char *strdup (__const char *__s)
+extern char *strdup (const char *__s)
__THROW __attribute_malloc__ __nonnull ((1));
libc_hidden_proto(strdup)
#endif
@@ -153,8 +151,8 @@ libc_hidden_proto(strdup)
/* Return a malloc'd copy of at most N bytes of STRING. The
resultant string is terminated even if no null terminator
appears before STRING[N]. */
-#if defined __USE_GNU
-extern char *strndup (__const char *__string, size_t __n)
+#if defined __USE_XOPEN2K8
+extern char *strndup (const char *__string, size_t __n)
__THROW __attribute_malloc__ __nonnull ((1));
libc_hidden_proto(strndup)
#endif
@@ -164,7 +162,7 @@ libc_hidden_proto(strndup)
# define strdupa(s) \
(__extension__ \
({ \
- __const char *__old = (s); \
+ const char *__old = (s); \
size_t __len = strlen (__old) + 1; \
char *__new = (char *) __builtin_alloca (__len); \
(char *) memcpy (__new, __old, __len); \
@@ -174,7 +172,7 @@ libc_hidden_proto(strndup)
# define strndupa(s, n) \
(__extension__ \
({ \
- __const char *__old = (s); \
+ const char *__old = (s); \
size_t __len = strnlen (__old, (n)); \
char *__new = (char *) __builtin_alloca (__len + 1); \
__new[__len] = '\0'; \
@@ -184,11 +182,11 @@ libc_hidden_proto(strndup)
__BEGIN_NAMESPACE_STD
/* Find the first occurrence of C in S. */
-extern char *strchr (__const char *__s, int __c)
+extern char *strchr (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(strchr)
/* Find the last occurrence of C in S. */
-extern char *strrchr (__const char *__s, int __c)
+extern char *strrchr (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(strrchr)
__END_NAMESPACE_STD
@@ -196,7 +194,7 @@ __END_NAMESPACE_STD
#ifdef __USE_GNU
/* This function is similar to `strchr'. But it returns a pointer to
the closing NUL byte in case C is not found in S. */
-extern char *strchrnul (__const char *__s, int __c)
+extern char *strchrnul (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(strchrnul)
#endif
@@ -204,26 +202,26 @@ libc_hidden_proto(strchrnul)
__BEGIN_NAMESPACE_STD
/* Return the length of the initial segment of S which
consists entirely of characters not in REJECT. */
-extern size_t strcspn (__const char *__s, __const char *__reject)
+extern size_t strcspn (const char *__s, const char *__reject)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcspn)
/* Return the length of the initial segment of S which
consists entirely of characters in ACCEPT. */
-extern size_t strspn (__const char *__s, __const char *__accept)
+extern size_t strspn (const char *__s, const char *__accept)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strspn)
/* Find the first occurrence in S of any character in ACCEPT. */
-extern char *strpbrk (__const char *__s, __const char *__accept)
+extern char *strpbrk (const char *__s, const char *__accept)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strpbrk)
/* Find the first occurrence of NEEDLE in HAYSTACK. */
-extern char *strstr (__const char *__haystack, __const char *__needle)
+extern char *strstr (const char *__haystack, const char *__needle)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strstr)
/* Divide S into tokens separated by characters in DELIM. */
-extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
+extern char *strtok (char *__restrict __s, const char *__restrict __delim)
__THROW __nonnull ((2));
libc_hidden_proto(strtok)
__END_NAMESPACE_STD
@@ -232,12 +230,12 @@ __END_NAMESPACE_STD
passed between calls are stored in SAVE_PTR. */
#if 0 /* uClibc: disabled */
extern char *__strtok_r (char *__restrict __s,
- __const char *__restrict __delim,
+ const char *__restrict __delim,
char **__restrict __save_ptr)
__THROW __nonnull ((2, 3));
#endif
#if defined __USE_POSIX || defined __USE_MISC
-extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
+extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
char **__restrict __save_ptr)
__THROW __nonnull ((2, 3));
libc_hidden_proto(strtok_r)
@@ -245,7 +243,7 @@ libc_hidden_proto(strtok_r)
#ifdef __USE_GNU
/* Similar to `strstr' but this function ignores the case of both strings. */
-extern char *strcasestr (__const char *__haystack, __const char *__needle)
+extern char *strcasestr (const char *__haystack, const char *__needle)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcasestr)
#endif
@@ -254,20 +252,21 @@ libc_hidden_proto(strcasestr)
/* Find the first occurrence of NEEDLE in HAYSTACK.
NEEDLE is NEEDLELEN bytes long;
HAYSTACK is HAYSTACKLEN bytes long. */
-extern void *memmem (__const void *__haystack, size_t __haystacklen,
- __const void *__needle, size_t __needlelen)
+extern void *memmem (const void *__haystack, size_t __haystacklen,
+ const void *__needle, size_t __needlelen)
__THROW __attribute_pure__ __nonnull ((1, 3));
-libc_hidden_proto(memmem)
/* Copy N bytes of SRC to DEST, return pointer to bytes after the
last written byte. */
-#if 0 /* uClibc: disabled */
+#if __GNUC_PREREQ (3, 4)
+# define __mempcpy(dest, src, n) __builtin_mempcpy(dest, src, n)
+#else /* uClibc: disabled */
extern void *__mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n)
+ const void *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
#endif
extern void *mempcpy (void *__restrict __dest,
- __const void *__restrict __src, size_t __n)
+ const void *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
libc_hidden_proto(mempcpy)
#endif
@@ -275,15 +274,15 @@ libc_hidden_proto(mempcpy)
__BEGIN_NAMESPACE_STD
/* Return the length of S. */
-extern size_t strlen (__const char *__s)
+extern size_t strlen (const char *__s)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(strlen)
__END_NAMESPACE_STD
-#ifdef __USE_GNU
+#ifdef __USE_XOPEN2K8
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
-extern size_t strnlen (__const char *__string, size_t __maxlen)
+extern size_t strnlen (const char *__string, size_t __maxlen)
__THROW __attribute_pure__ __nonnull ((1));
libc_hidden_proto(strnlen)
#endif
@@ -307,6 +306,7 @@ __END_NAMESPACE_STD
ERRNUM. */
extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen)
__THROW __nonnull ((2));
+libc_hidden_proto(__xpg_strerror_r)
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (strerror_r,
(int __errnum, char *__buf, size_t __buflen),
@@ -319,6 +319,7 @@ extern int __REDIRECT_NTH (strerror_r,
used. */
extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen)
__THROW __nonnull ((2));
+libc_hidden_proto(__glibc_strerror_r)
# ifdef __REDIRECT_NTH
extern char * __REDIRECT_NTH (strerror_r,
(int __errnum, char *__buf, size_t __buflen),
@@ -329,6 +330,12 @@ extern char * __REDIRECT_NTH (strerror_r,
# endif
#endif
+#if 0 /*defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__*/
+/* Translate error number to string according to the locale L. */
+extern char *strerror_l (int __errnum, __locale_t __l) __THROW;
+#endif
+
+
/* We define this function always since `bzero' is sometimes needed when
the namespace rules does not allow this. */
#if 0 /* uClibc: disabled */
@@ -338,35 +345,57 @@ extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
#ifdef __USE_BSD
# ifdef __UCLIBC_SUSV3_LEGACY__
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
-extern void bcopy (__const void *__src, void *__dest, size_t __n)
+extern void bcopy (const void *__src, void *__dest, size_t __n)
__THROW __nonnull ((1, 2));
/* Set N bytes of S to 0. */
extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2 (same as memcmp). */
-extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+extern int bcmp (const void *__s1, const void *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence of C in S (same as strchr). */
-extern char *index (__const char *__s, int __c)
+extern char *index (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
/* Find the last occurrence of C in S (same as strrchr). */
-extern char *rindex (__const char *__s, int __c)
+extern char *rindex (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
-# else
-# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
+# elif defined(__UCLIBC_SUSV3_LEGACY_MACROS__) && !defined(_STRINGS_H)
/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
* They are replaced as proposed by SuSv3. Don't sync this part
* with glibc and keep it in sync with strings.h. */
-# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
-# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
-# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
-# define index(s,c) strchr((s), (c))
-# define rindex(s,c) strrchr((s), (c))
-# endif
+/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
+static __inline__ void bcopy (__const void *__src, void *__dest, size_t __n)
+{
+ memmove(__dest, __src, __n);
+}
+
+/* Set N bytes of S to 0. */
+static __inline__ void bzero (void *__s, size_t __n)
+{
+ memset(__s, 0, __n);
+}
+
+/* Compare N bytes of S1 and S2 (same as memcmp). */
+static __inline__ int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+{
+ return memcmp(__s1, __s2, __n);
+}
+
+/* Find the first occurrence of C in S (same as strchr). */
+static __inline__ char *index (__const char *__s, int __c)
+{
+ return strchr(__s, __c);
+}
+
+/* Find the last occurrence of C in S (same as strrchr). */
+static __inline__ char *rindex (__const char *__s, int __c)
+{
+ return strrchr(__s, __c);
+}
# endif
/* Return the position of the first bit set in I, or 0 if none are set.
@@ -376,7 +405,7 @@ libc_hidden_proto(ffs)
/* The following two functions are non-standard but necessary for non-32 bit
platforms. */
-#if 0 /*def __USE_GNU*/
+#ifdef __USE_GNU
extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
# ifdef __GNUC__
__extension__ extern int ffsll (long long int __ll)
@@ -385,25 +414,25 @@ __extension__ extern int ffsll (long long int __ll)
# endif
/* Compare S1 and S2, ignoring case. */
-extern int strcasecmp (__const char *__s1, __const char *__s2)
+extern int strcasecmp (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcasecmp)
/* Compare no more than N chars of S1 and S2, ignoring case. */
-extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strncasecmp)
#endif /* Use BSD. */
-#if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
+#if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__
/* Again versions of a few functions which use the given locale instead
of the global one. */
-extern int strcasecmp_l (__const char *__s1, __const char *__s2,
+extern int strcasecmp_l (const char *__s1, const char *__s2,
__locale_t __loc)
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
libc_hidden_proto(strcasecmp_l)
-extern int strncasecmp_l (__const char *__s1, __const char *__s2,
+extern int strncasecmp_l (const char *__s1, const char *__s2,
size_t __n, __locale_t __loc)
__THROW __attribute_pure__ __nonnull ((1, 2, 4));
libc_hidden_proto(strncasecmp_l)
@@ -413,61 +442,59 @@ libc_hidden_proto(strncasecmp_l)
/* Return the next DELIM-delimited token from *STRINGP,
terminating it with a '\0', and update *STRINGP to point past it. */
extern char *strsep (char **__restrict __stringp,
- __const char *__restrict __delim)
+ const char *__restrict __delim)
__THROW __nonnull ((1, 2));
libc_hidden_proto(strsep)
#endif
-#ifdef __USE_GNU
-/* Compare S1 and S2 as strings holding name & indices/version numbers. */
-#if 0
-extern int strverscmp (__const char *__s1, __const char *__s2)
- __THROW __attribute_pure__ __nonnull ((1, 2));
-libc_hidden_proto(strverscmp)
-#endif
-
+#ifdef __USE_XOPEN2K8
/* Return a string describing the meaning of the signal number in SIG. */
extern char *strsignal (int __sig) __THROW;
libc_hidden_proto(strsignal)
/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
-#if 0 /* uClibc: disabled */
-extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
+# if 0 /* uClibc: disabled */
+extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
-#endif
-extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
+# endif
+extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
__THROW __nonnull ((1, 2));
libc_hidden_proto(stpcpy)
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
-#if 0 /* uClibc: disabled */
+# if 0 /* uClibc: disabled */
extern char *__stpncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n)
+ const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
-#endif
+# endif
extern char *stpncpy (char *__restrict __dest,
- __const char *__restrict __src, size_t __n)
+ const char *__restrict __src, size_t __n)
__THROW __nonnull ((1, 2));
-libc_hidden_proto(stpncpy)
+#endif
+
+#ifdef __USE_GNU
+/* Compare S1 and S2 as strings holding name & indices/version numbers. */
+extern int strverscmp (const char *__s1, const char *__s2)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
+libc_hidden_proto(strverscmp)
-#if 0 /* uClibc does not support strfry or memfrob. */
+# if 0 /* uClibc does not support strfry or memfrob. */
/* Sautee STRING briskly. */
extern char *strfry (char *__string) __THROW __nonnull ((1));
/* Frobnicate N bytes of S. */
extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1));
-#endif
+# endif
# ifndef basename
/* Return the file name within directory of FILENAME. We don't
declare the function if the `basename' macro is available (defined
in <libgen.h>) which makes the XPG version of this function
available. */
-extern char *basename (__const char *__filename) __THROW __nonnull ((1));
-libc_hidden_proto(basename)
+extern char *basename (const char *__filename) __THROW __nonnull ((1));
# endif
-#endif
+#endif /* __USE_GNU */
#ifdef __USE_BSD
@@ -482,4 +509,11 @@ libc_hidden_proto(strlcpy)
__END_DECLS
-#endif /* string.h */
+
+#if defined(_LIBC) && defined(__UCLIBC_HAS_STRING_ARCH_OPT__)
+# if defined __i386__
+# include <../libc/string/i386/string.h>
+# endif
+#endif
+
+#endif /* string.h */
diff --git a/include/strings.h b/include/strings.h
index 550f4ab9c..baf2a6389 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,96,97,99,2000,2001,2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _STRINGS_H
#define _STRINGS_H 1
@@ -35,22 +34,22 @@ __BEGIN_DECLS
# ifdef __UCLIBC_SUSV3_LEGACY__
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
-extern void bcopy (__const void *__src, void *__dest, size_t __n)
+extern void bcopy (const void *__src, void *__dest, size_t __n)
__THROW __nonnull ((1, 2));
/* Set N bytes of S to 0. */
extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2 (same as memcmp). */
-extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
+extern int bcmp (const void *__s1, const void *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence of C in S (same as strchr). */
-extern char *index (__const char *__s, int __c)
+extern char *index (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
/* Find the last occurrence of C in S (same as strrchr). */
-extern char *rindex (__const char *__s, int __c)
+extern char *rindex (const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
# else
# ifdef __UCLIBC_SUSV3_LEGACY_MACROS__
@@ -69,10 +68,11 @@ extern char *rindex (__const char *__s, int __c)
/* Return the position of the first bit set in I, or 0 if none are set.
The least-significant bit is position 1, the most-significant 32. */
extern int ffs (int __i) __THROW __attribute__ ((__const__));
+libc_hidden_proto(ffs)
/* The following two functions are non-standard but necessary for non-32 bit
platforms. */
-#if 0 /*def __USE_GNU*/
+# ifdef __USE_GNU
extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
# ifdef __GNUC__
__extension__ extern int ffsll (long long int __ll)
@@ -81,17 +81,39 @@ __extension__ extern int ffsll (long long int __ll)
# endif
/* Compare S1 and S2, ignoring case. */
-extern int strcasecmp (__const char *__s1, __const char *__s2)
+extern int strcasecmp (const char *__s1, const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
+libc_hidden_proto(strcasecmp)
/* Compare no more than N chars of S1 and S2, ignoring case. */
-extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
+extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
-
+libc_hidden_proto(strncasecmp)
+
+#if defined __USE_XOPEN2K8 && defined __UCLIBC_HAS_XLOCALE__
+/* The following functions are equivalent to the both above but they
+ take the locale they use for the collation as an extra argument.
+ This is not standardsized but something like will come. */
+# include <xlocale.h>
+
+/* Again versions of a few functions which use the given locale instead
+ of the global one. */
+extern int strcasecmp_l (const char *__s1, const char *__s2,
+ __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2, 3));
+libc_hidden_proto(strcasecmp_l)
+
+extern int strncasecmp_l (const char *__s1, const char *__s2,
+ size_t __n, __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2, 4));
+libc_hidden_proto(strncasecmp_l)
+#endif
__END_DECLS
-#ifdef UCLIBC_INTERNAL
+#ifdef _LIBC
+/* comment is wrong and will face this, when HAS_GNU option will be added
+ * header is SuSv standard */
#error "<strings.h> should not be included from libc."
#endif
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 588c1ebb2..f725ce98c 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H 1
@@ -38,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
@@ -61,12 +73,9 @@
# define __inline /* No inline functions. */
# define __THROW
+# define __THROWNL
# define __NTH(fct) fct
-# define __const const
-# define __signed signed
-# define __volatile volatile
-
#endif /* GCC. */
/* These two macros are not used in glibc anymore. They are kept here
@@ -120,14 +129,6 @@
#endif
-/* Support for bounded pointers. */
-#ifndef __BOUNDED_POINTERS__
-# define __bounded /* nothing */
-# define __unbounded /* nothing */
-# define __ptrvalue /* nothing */
-#endif
-
-
/* Fortify support. */
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
#define __bos0(ptr) __builtin_object_size (ptr, 0)
@@ -178,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
@@ -226,6 +231,12 @@
# define __attribute_pure__ /* Ignore */
#endif
+#if __GNUC_PREREQ (2,96)
+# define __attribute_const__ __attribute__((__const__))
+#else
+# define __attribute_const__ /* unimplemented */
+#endif
+
/* At some point during the gcc 3.1 development the `used' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
diff --git a/include/sys/dir.h b/include/sys/dir.h
index 2611d6cd9..5352f9029 100644
--- a/include/sys/dir.h
+++ b/include/sys/dir.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_DIR_H
#define _SYS_DIR_H 1
diff --git a/include/sys/file.h b/include/sys/file.h
index 93b36350a..42dfa44b5 100644
--- a/include/sys/file.h
+++ b/include/sys/file.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_FILE_H
#define _SYS_FILE_H 1
@@ -39,7 +38,7 @@ __BEGIN_DECLS
/* Operations for the `flock' call. */
#define LOCK_SH 1 /* Shared lock. */
-#define LOCK_EX 2 /* Exclusive lock. */
+#define LOCK_EX 2 /* Exclusive lock. */
#define LOCK_UN 8 /* Unlock. */
/* Can be OR'd in to one of the above. */
diff --git a/include/sys/fsuid.h b/include/sys/fsuid.h
index 4ecb19918..2fd512e74 100644
--- a/include/sys/fsuid.h
+++ b/include/sys/fsuid.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_FSUID_H
#define _SYS_FSUID_H 1
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
index 6d8a0f40b..3ff134c8d 100644
--- a/include/sys/ioctl.h
+++ b/include/sys/ioctl.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H 1
@@ -40,6 +39,7 @@ __BEGIN_DECLS
One argument may follow; its presence and type depend on REQUEST.
Return value depends on REQUEST. Usually -1 indicates error. */
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
+libc_hidden_proto(ioctl)
__END_DECLS
diff --git a/include/sys/ipc.h b/include/sys/ipc.h
index 42806db2b..02aab5255 100644
--- a/include/sys/ipc.h
+++ b/include/sys/ipc.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_IPC_H
#define _SYS_IPC_H 1
@@ -51,7 +50,7 @@ typedef __key_t key_t;
__BEGIN_DECLS
/* Generates key for System V style IPC. */
-extern key_t ftok (__const char *__pathname, int __proj_id) __THROW;
+extern key_t ftok (const char *__pathname, int __proj_id) __THROW;
__END_DECLS
diff --git a/include/sys/kd.h b/include/sys/kd.h
index d459c079e..44ab953bc 100644
--- a/include/sys/kd.h
+++ b/include/sys/kd.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_KD_H
#define _SYS_KD_H 1
diff --git a/include/sys/kdaemon.h b/include/sys/kdaemon.h
index 61491f93d..921e07274 100644
--- a/include/sys/kdaemon.h
+++ b/include/sys/kdaemon.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Interfaces to control the various kernel daemons. */
diff --git a/include/sys/klog.h b/include/sys/klog.h
index 35f5fe40e..f5fef94b0 100644
--- a/include/sys/klog.h
+++ b/include/sys/klog.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_KLOG_H
diff --git a/include/sys/mman.h b/include/sys/mman.h
index 10471e683..71d553af4 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -1,5 +1,5 @@
/* Definitions for BSD-style memory management.
- Copyright (C) 1994-2000, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1994-2000, 2003, 2004, 2005 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_MMAN_H
#define _SYS_MMAN_H 1
@@ -57,9 +56,10 @@ __BEGIN_DECLS
#ifndef __USE_FILE_OFFSET64
extern void *mmap (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset) __THROW;
+libc_hidden_proto(mmap)
#else
-# ifdef __REDIRECT
-extern void * __REDIRECT (mmap,
+# ifdef __REDIRECT_NTH
+extern void * __REDIRECT_NTH (mmap,
(void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off64_t __offset),
mmap64);
@@ -75,6 +75,7 @@ extern void *mmap64 (void *__addr, size_t __len, int __prot,
/* Deallocate any mapping for the region starting at ADDR and extending LEN
bytes. Returns 0 if successful, -1 for errors (and sets errno). */
extern int munmap (void *__addr, size_t __len) __THROW;
+libc_hidden_proto(munmap)
/* Change the memory protection of the region starting at ADDR and
extending LEN bytes to PROT. Returns 0 if successful, -1 for errors
@@ -98,7 +99,7 @@ static __inline__ int msync (void *__addr, size_t __len, int __flags) { return 0
#endif
-#if defined __USE_BSD && defined __UCLIBC_LINUX_SPECIFIC__
+#if defined __USE_BSD && (defined __UCLIBC_LINUX_SPECIFIC__ || defined __UCLIBC_HAS_THREADS_NATIVE__)
/* Advise the system about particular usage patterns the program follows
for the region starting at ADDR and extending LEN bytes. */
extern int madvise (void *__addr, size_t __len, int __advice) __THROW;
@@ -113,10 +114,10 @@ extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW;
/* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to
be memory resident. */
-extern int mlock (__const void *__addr, size_t __len) __THROW;
+extern int mlock (const void *__addr, size_t __len) __THROW;
/* Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). */
-extern int munlock (__const void *__addr, size_t __len) __THROW;
+extern int munlock (const void *__addr, size_t __len) __THROW;
/* Cause all currently mapped pages of the process to be memory resident
until unlocked by a call to the `munlockall', until the process exits,
@@ -131,8 +132,8 @@ extern int munlockall (void) __THROW;
/* On no-mmu systems, memory cannot be swapped out, so
* these functions will always succeed. */
-static __inline__ int mlock (__const void *__addr, size_t __len) { return 0; }
-static __inline__ int munlock (__const void *__addr, size_t __len) { return 0; }
+static __inline__ int mlock (const void *__addr, size_t __len) { return 0; }
+static __inline__ int munlock (const void *__addr, size_t __len) { return 0; }
static __inline__ int mlockall (int __flags) { return 0; }
static __inline__ int munlockall (void) { return 0; }
#endif
@@ -156,19 +157,22 @@ extern int mincore (void *__start, size_t __len, unsigned char *__vec)
resides after a successful call. */
extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
int __flags, ...) __THROW;
+libc_hidden_proto(mremap)
+#ifdef __UCLIBC_LINUX_SPECIFIC__
/* Remap arbitrary pages of a shared backing store within an existing
VMA. */
extern int remap_file_pages (void *__start, size_t __size, int __prot,
size_t __pgoff, int __flags) __THROW;
#endif
+#endif
/* Open shared memory segment. */
-extern int shm_open (__const char *__name, int __oflag, mode_t __mode);
+extern int shm_open (const char *__name, int __oflag, mode_t __mode);
/* Remove shared memory segment. */
-extern int shm_unlink (__const char *__name);
+extern int shm_unlink (const char *__name);
__END_DECLS
diff --git a/include/sys/mount.h b/include/sys/mount.h
index b30554987..c0e7b84f8 100644
--- a/include/sys/mount.h
+++ b/include/sys/mount.h
@@ -1,5 +1,5 @@
/* Header file for mounting/unmount Linux filesystems.
- Copyright (C) 1996,1997,1998,1999,2000,2004 Free Software Foundation, Inc.
+ Copyright (C) 1996-2000, 2004, 2010, 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This is taken from /usr/include/linux/fs.h. */
@@ -47,23 +46,46 @@ enum
#define MS_REMOUNT MS_REMOUNT
MS_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
#define MS_MANDLOCK MS_MANDLOCK
- S_WRITE = 128, /* Write on file/directory/symlink. */
-#define S_WRITE S_WRITE
- S_APPEND = 256, /* Append-only file. */
-#define S_APPEND S_APPEND
- S_IMMUTABLE = 512, /* Immutable file. */
-#define S_IMMUTABLE S_IMMUTABLE
+ MS_DIRSYNC = 128, /* Directory modifications are synchronous. */
+#define MS_DIRSYNC MS_DIRSYNC
MS_NOATIME = 1024, /* Do not update access times. */
#define MS_NOATIME MS_NOATIME
MS_NODIRATIME = 2048, /* Do not update directory access times. */
#define MS_NODIRATIME MS_NODIRATIME
MS_BIND = 4096, /* Bind directory at different place. */
#define MS_BIND MS_BIND
+ MS_MOVE = 8192,
+#define MS_MOVE MS_MOVE
+ MS_REC = 16384,
+#define MS_REC MS_REC
+ MS_SILENT = 32768,
+#define MS_SILENT MS_SILENT
+ MS_POSIXACL = 1 << 16, /* VFS does not apply the umask. */
+#define MS_POSIXACL MS_POSIXACL
+ MS_UNBINDABLE = 1 << 17, /* Change to unbindable. */
+#define MS_UNBINDABLE MS_UNBINDABLE
+ MS_PRIVATE = 1 << 18, /* Change to private. */
+#define MS_PRIVATE MS_PRIVATE
+ MS_SLAVE = 1 << 19, /* Change to slave. */
+#define MS_SLAVE MS_SLAVE
+ MS_SHARED = 1 << 20, /* Change to shared. */
+#define MS_SHARED MS_SHARED
+ MS_RELATIME = 1 << 21, /* Update atime relative to mtime/ctime. */
+#define MS_RELATIME MS_RELATIME
+ MS_KERNMOUNT = 1 << 22, /* This is a kern_mount call. */
+#define MS_KERNMOUNT MS_KERNMOUNT
+ MS_I_VERSION = 1 << 23, /* Update inode I_version field. */
+#define MS_I_VERSION MS_I_VERSION
+ MS_STRICTATIME = 1 << 24, /* Always perform atime updates. */
+#define MS_STRICTATIME MS_STRICTATIME
+ MS_ACTIVE = 1 << 30,
+#define MS_ACTIVE MS_ACTIVE
+ MS_NOUSER = 1 << 31
+#define MS_NOUSER MS_NOUSER
};
/* Flags that can be altered by MS_REMOUNT */
-#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \
- |MS_NODIRATIME)
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
/* Magic mount flag number. Has to be or-ed to the flag values. */
@@ -96,23 +118,32 @@ enum
/* Possible value for FLAGS parameter of `umount2'. */
enum
{
- MNT_FORCE = 1 /* Force unmounting. */
+ MNT_FORCE = 1, /* Force unmounting. */
#define MNT_FORCE MNT_FORCE
+ MNT_DETACH = 2, /* Just detach from the tree. */
+#define MNT_DETACH MNT_DETACH
+ MNT_EXPIRE = 4, /* Mark for expiry. */
+#define MNT_EXPIRE MNT_EXPIRE
+ UMOUNT_NOFOLLOW = 8 /* Don't follow symlink on umount. */
+#define UMOUNT_NOFOLLOW UMOUNT_NOFOLLOW
};
__BEGIN_DECLS
/* Mount a filesystem. */
-extern int mount (__const char *__special_file, __const char *__dir,
- __const char *__fstype, unsigned long int __rwflag,
- __const void *__data) __THROW;
+extern int mount (const char *__special_file, const char *__dir,
+ const char *__fstype, unsigned long int __rwflag,
+ const void *__data) __THROW;
/* Unmount a filesystem. */
-extern int umount (__const char *__special_file) __THROW;
+extern int umount (const char *__special_file) __THROW;
+#ifdef __UCLIBC_LINUX_SPECIFIC__
/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */
-extern int umount2 (__const char *__special_file, int __flags) __THROW;
+extern int umount2 (const char *__special_file, int __flags) __THROW;
+libc_hidden_proto(umount2)
+#endif
__END_DECLS
diff --git a/include/sys/msg.h b/include/sys/msg.h
index 1fd64b2ac..b27e972ae 100644
--- a/include/sys/msg.h
+++ b/include/sys/msg.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1999,2000,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,1999,2000,2003,2006,2007
+ 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
@@ -12,15 +13,17 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_MSG_H
#define _SYS_MSG_H
#include <features.h>
+#define __need_size_t
+#include <stddef.h>
+
/* Get common definition of System V style IPC. */
#include <sys/ipc.h>
@@ -66,14 +69,14 @@ extern int msgget (key_t __key, int __msgflg) __THROW;
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int msgrcv (int __msqid, void *__msgp, size_t __msgsz,
- long int __msgtyp, int __msgflg);
+extern ssize_t msgrcv (int __msqid, void *__msgp, size_t __msgsz,
+ long int __msgtyp, int __msgflg);
/* Send message to message queue.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int msgsnd (int __msqid, __const void *__msgp, size_t __msgsz,
+extern int msgsnd (int __msqid, const void *__msgp, size_t __msgsz,
int __msgflg);
__END_DECLS
diff --git a/include/sys/mtio.h b/include/sys/mtio.h
index 51fa550cd..60f3e51e7 100644
--- a/include/sys/mtio.h
+++ b/include/sys/mtio.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Written by H. Bergman <hennus@cybercomm.nl>. */
diff --git a/include/sys/param.h b/include/sys/param.h
index 0b0424eb9..d329706c9 100644
--- a/include/sys/param.h
+++ b/include/sys/param.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,2000,2001,2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1997,2000,2001,2003,2008 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
@@ -12,17 +12,26 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_PARAM_H
#define _SYS_PARAM_H 1
+#ifndef ARG_MAX
+# define __undef_ARG_MAX
+#endif
+
#include <limits.h>
#include <linux/limits.h>
#include <linux/param.h>
+/* The kernel headers defines ARG_MAX. The value is wrong, though. */
+#ifndef __undef_ARG_MAX
+# undef ARG_MAX
+# undef __undef_ARG_MAX
+#endif
+
/* BSD names for some <limits.h> values. */
#define NBBY CHAR_BIT
@@ -31,12 +40,12 @@
#endif
#define MAXSYMLINKS 20
#define CANBSIZ MAX_CANON
-#define NCARGS ARG_MAX
#define MAXPATHLEN PATH_MAX
-/* The following is not really correct but it is a value we used for a
+/* The following are not really correct but it is a value we used for a
long time and which seems to be usable. People should not use NOFILE
- anyway. */
+ and NCARGS anyway. */
#define NOFILE 256
+#define NCARGS 131072
#include <sys/types.h>
diff --git a/include/sys/personality.h b/include/sys/personality.h
index 154b1131a..ee1de6403 100644
--- a/include/sys/personality.h
+++ b/include/sys/personality.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* Taken verbatim from Linux 2.4 (include/linux/personality.h). */
diff --git a/include/sys/poll.h b/include/sys/poll.h
index a298dac15..029a9badd 100644
--- a/include/sys/poll.h
+++ b/include/sys/poll.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_POLL_H
#define _SYS_POLL_H 1
@@ -30,8 +29,6 @@
/* Get the timespec definition. */
# define __need_timespec
# include <time.h>
-/* get NULL definition. */
-# include <stddef.h>
#endif
@@ -58,6 +55,7 @@ __BEGIN_DECLS
This function is a cancellation point and therefore not marked with
__THROW. */
extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
+libc_hidden_proto(poll)
#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
/* Like poll, but before waiting the threads signal mask is replaced
@@ -67,8 +65,8 @@ extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
This function is a cancellation point and therefore not marked with
__THROW. */
extern int ppoll (struct pollfd *__fds, nfds_t __nfds,
- __const struct timespec *__timeout,
- __const __sigset_t *__ss);
+ const struct timespec *__timeout,
+ const __sigset_t *__ss);
#endif
__END_DECLS
diff --git a/include/sys/queue.h b/include/sys/queue.h
index d62afcc84..daf4553d3 100644
--- a/include/sys/queue.h
+++ b/include/sys/queue.h
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -27,38 +27,24 @@
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
- * $FreeBSD: src/sys/sys/queue.h,v 1.68 2006/10/24 11:20:29 ru Exp $
*/
-#ifndef _SYS_QUEUE_H_
+#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
-#include <sys/cdefs.h>
-
/*
- * This file defines four types of data structures: singly-linked lists,
- * singly-linked tail queues, lists and tail queues.
- *
- * A singly-linked list is headed by a single forward pointer. The elements
- * are singly linked for minimum space and pointer manipulation overhead at
- * the expense of O(n) removal for arbitrary elements. New elements can be
- * added to the list after an existing element or at the head of the list.
- * Elements being removed from the head of the list should use the explicit
- * macro for this purpose for optimum efficiency. A singly-linked list may
- * only be traversed in the forward direction. Singly-linked lists are ideal
- * for applications with large datasets and few or no removals or for
- * implementing a LIFO queue.
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
*
- * A singly-linked tail queue is headed by a pair of pointers, one to the
- * head of the list and the other to the tail of the list. The elements are
- * singly linked for minimum space and pointer manipulation overhead at the
- * expense of O(n) removal for arbitrary elements. New elements can be added
- * to the list after an existing element, at the head of the list, or at the
- * end of the list. Elements being removed from the head of the tail queue
- * should use the explicit macro for this purpose for optimum efficiency.
- * A singly-linked tail queue may only be traversed in the forward direction.
- * Singly-linked tail queues are ideal for applications with large datasets
- * and few or no removals or for implementing a FIFO queue.
+ * A singly-linked list is headed by a single forward pointer. The
+ * elements are singly linked for minimum space and pointer manipulation
+ * overhead at the expense of O(n) removal for arbitrary elements. New
+ * elements can be added to the list after an existing element or at the
+ * head of the list. Elements being removed from the head of the list
+ * should use the explicit macro for this purpose for optimum
+ * efficiency. A singly-linked list may only be traversed in the forward
+ * direction. Singly-linked lists are ideal for applications with large
+ * datasets and few or no removals or for implementing a LIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
@@ -67,6 +53,13 @@
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
@@ -74,67 +67,85 @@
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
- * For details on the use of these macros, see the queue(3) manual page.
- *
- *
- * SLIST LIST STAILQ TAILQ
- * _HEAD + + + +
- * _HEAD_INITIALIZER + + + +
- * _ENTRY + + + +
- * _INIT + + + +
- * _EMPTY + + + +
- * _FIRST + + + +
- * _NEXT + + + +
- * _PREV - - - +
- * _LAST - - + +
- * _FOREACH + + + +
- * _FOREACH_SAFE + + + +
- * _FOREACH_REVERSE - - - +
- * _FOREACH_REVERSE_SAFE - - - +
- * _INSERT_HEAD + + + +
- * _INSERT_BEFORE - + - +
- * _INSERT_AFTER + + + +
- * _INSERT_TAIL - - + +
- * _CONCAT - - + +
- * _REMOVE_HEAD + - + -
- * _REMOVE + + + +
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
*
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List functions.
+ */
+#define LIST_INIT(head) do { \
+ (head)->lh_first = NULL; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
+ (listelm)->field.le_next->field.le_prev = \
+ &(elm)->field.le_next; \
+ (listelm)->field.le_next = (elm); \
+ (elm)->field.le_prev = &(listelm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ (elm)->field.le_next = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &(elm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.le_next = (head)->lh_first) != NULL) \
+ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+ (head)->lh_first = (elm); \
+ (elm)->field.le_prev = &(head)->lh_first; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_REMOVE(elm, field) do { \
+ if ((elm)->field.le_next != NULL) \
+ (elm)->field.le_next->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = (elm)->field.le_next; \
+} while (/*CONSTCOND*/0)
+
+#define LIST_FOREACH(var, head, field) \
+ for ((var) = ((head)->lh_first); \
+ (var); \
+ (var) = ((var)->field.le_next))
+
+/*
+ * List access methods.
*/
-#ifdef QUEUE_MACRO_DEBUG
-/* Store the last 2 places the queue element or head was altered */
-struct qm_trace {
- char * lastfile;
- int lastline;
- char * prevfile;
- int prevline;
-};
-
-#define TRACEBUF struct qm_trace trace;
-#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
-
-#define QMD_TRACE_HEAD(head) do { \
- (head)->trace.prevline = (head)->trace.lastline; \
- (head)->trace.prevfile = (head)->trace.lastfile; \
- (head)->trace.lastline = __LINE__; \
- (head)->trace.lastfile = __FILE__; \
-} while (0)
-
-#define QMD_TRACE_ELEM(elem) do { \
- (elem)->trace.prevline = (elem)->trace.lastline; \
- (elem)->trace.prevfile = (elem)->trace.lastfile; \
- (elem)->trace.lastline = __LINE__; \
- (elem)->trace.lastfile = __FILE__; \
-} while (0)
-
-#else
-#define QMD_TRACE_ELEM(elem)
-#define QMD_TRACE_HEAD(head)
-#define TRACEBUF
-#define TRASHIT(x)
-#endif /* QUEUE_MACRO_DEBUG */
+#define LIST_EMPTY(head) ((head)->lh_first == NULL)
+#define LIST_FIRST(head) ((head)->lh_first)
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
/*
- * Singly-linked List declarations.
+ * Singly-linked List definitions.
*/
#define SLIST_HEAD(name, type) \
struct name { \
@@ -152,66 +163,55 @@ struct { \
/*
* Singly-linked List functions.
*/
-#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
-
-#define SLIST_FIRST(head) ((head)->slh_first)
-
-#define SLIST_FOREACH(var, head, field) \
- for ((var) = SLIST_FIRST((head)); \
- (var); \
- (var) = SLIST_NEXT((var), field))
-
-#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = SLIST_FIRST((head)); \
- (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
- for ((varp) = &SLIST_FIRST((head)); \
- ((var) = *(varp)) != NULL; \
- (varp) = &SLIST_NEXT((var), field))
-
#define SLIST_INIT(head) do { \
- SLIST_FIRST((head)) = NULL; \
-} while (0)
+ (head)->slh_first = NULL; \
+} while (/*CONSTCOND*/0)
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
- SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
- SLIST_NEXT((slistelm), field) = (elm); \
-} while (0)
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (/*CONSTCOND*/0)
#define SLIST_INSERT_HEAD(head, elm, field) do { \
- SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
- SLIST_FIRST((head)) = (elm); \
-} while (0)
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (/*CONSTCOND*/0)
-#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (/*CONSTCOND*/0)
#define SLIST_REMOVE(head, elm, type, field) do { \
- if (SLIST_FIRST((head)) == (elm)) { \
+ if ((head)->slh_first == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
- struct type *curelm = SLIST_FIRST((head)); \
- while (SLIST_NEXT(curelm, field) != (elm)) \
- curelm = SLIST_NEXT(curelm, field); \
- SLIST_NEXT(curelm, field) = \
- SLIST_NEXT(SLIST_NEXT(curelm, field), field); \
+ struct type *curelm = (head)->slh_first; \
+ while(curelm->field.sle_next != (elm)) \
+ curelm = curelm->field.sle_next; \
+ curelm->field.sle_next = \
+ curelm->field.sle_next->field.sle_next; \
} \
- TRASHIT((elm)->field.sle_next); \
-} while (0)
+} while (/*CONSTCOND*/0)
+
+#define SLIST_FOREACH(var, head, field) \
+ for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
+
+/*
+ * Singly-linked List access methods.
+ */
+#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
+#define SLIST_FIRST(head) ((head)->slh_first)
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
-#define SLIST_REMOVE_HEAD(head, field) do { \
- SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
-} while (0)
/*
* Singly-linked Tail queue declarations.
*/
-#define STAILQ_HEAD(name, type) \
+#define STAILQ_HEAD(name, type) \
struct name { \
- struct type *stqh_first;/* first element */ \
- struct type **stqh_last;/* addr of last next element */ \
+ struct type *stqh_first; /* first element */ \
+ struct type **stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
@@ -225,394 +225,350 @@ struct { \
/*
* Singly-linked Tail queue functions.
*/
-#define STAILQ_CONCAT(head1, head2) do { \
- if (!STAILQ_EMPTY((head2))) { \
- *(head1)->stqh_last = (head2)->stqh_first; \
- (head1)->stqh_last = (head2)->stqh_last; \
- STAILQ_INIT((head2)); \
- } \
-} while (0)
-
-#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
-
-#define STAILQ_FIRST(head) ((head)->stqh_first)
-
-#define STAILQ_FOREACH(var, head, field) \
- for((var) = STAILQ_FIRST((head)); \
- (var); \
- (var) = STAILQ_NEXT((var), field))
-
-
-#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = STAILQ_FIRST((head)); \
- (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
#define STAILQ_INIT(head) do { \
- STAILQ_FIRST((head)) = NULL; \
- (head)->stqh_last = &STAILQ_FIRST((head)); \
-} while (0)
-
-#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
- if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
- STAILQ_NEXT((tqelm), field) = (elm); \
-} while (0)
+ (head)->stqh_first = NULL; \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
- if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
- STAILQ_FIRST((head)) = (elm); \
-} while (0)
+ if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (head)->stqh_first = (elm); \
+} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
- STAILQ_NEXT((elm), field) = NULL; \
+ (elm)->field.stqe_next = NULL; \
*(head)->stqh_last = (elm); \
- (head)->stqh_last = &STAILQ_NEXT((elm), field); \
-} while (0)
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+} while (/*CONSTCOND*/0)
-#define STAILQ_LAST(head, type, field) \
- (STAILQ_EMPTY((head)) ? \
- NULL : \
- ((struct type *)(void *) \
- ((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
+ (head)->stqh_last = &(elm)->field.stqe_next; \
+ (listelm)->field.stqe_next = (elm); \
+} while (/*CONSTCOND*/0)
-#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
+#define STAILQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(head)->stqh_first; \
+} while (/*CONSTCOND*/0)
#define STAILQ_REMOVE(head, elm, type, field) do { \
- if (STAILQ_FIRST((head)) == (elm)) { \
+ if ((head)->stqh_first == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->stqh_first; \
+ while (curelm->field.stqe_next != (elm)) \
+ curelm = curelm->field.stqe_next; \
+ if ((curelm->field.stqe_next = \
+ curelm->field.stqe_next->field.stqe_next) == NULL) \
+ (head)->stqh_last = &(curelm)->field.stqe_next; \
} \
- else { \
- struct type *curelm = STAILQ_FIRST((head)); \
- while (STAILQ_NEXT(curelm, field) != (elm)) \
- curelm = STAILQ_NEXT(curelm, field); \
- if ((STAILQ_NEXT(curelm, field) = \
- STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
- (head)->stqh_last = &STAILQ_NEXT((curelm), field);\
+} while (/*CONSTCOND*/0)
+
+#define STAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->stqh_first); \
+ (var); \
+ (var) = ((var)->field.stqe_next))
+
+#define STAILQ_CONCAT(head1, head2) do { \
+ if (!STAILQ_EMPTY((head2))) { \
+ *(head1)->stqh_last = (head2)->stqh_first; \
+ (head1)->stqh_last = (head2)->stqh_last; \
+ STAILQ_INIT((head2)); \
} \
- TRASHIT((elm)->field.stqe_next); \
-} while (0)
+} while (/*CONSTCOND*/0)
+
+/*
+ * Singly-linked Tail queue access methods.
+ */
+#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
+#define STAILQ_FIRST(head) ((head)->stqh_first)
+#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
-#define STAILQ_REMOVE_HEAD(head, field) do { \
- if ((STAILQ_FIRST((head)) = \
- STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
- (head)->stqh_last = &STAILQ_FIRST((head)); \
-} while (0)
/*
- * List declarations.
+ * Simple queue definitions.
*/
-#define LIST_HEAD(name, type) \
+#define SIMPLEQ_HEAD(name, type) \
struct name { \
- struct type *lh_first; /* first element */ \
+ struct type *sqh_first; /* first element */ \
+ struct type **sqh_last; /* addr of last next element */ \
}
-#define LIST_HEAD_INITIALIZER(head) \
- { NULL }
+#define SIMPLEQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).sqh_first }
-#define LIST_ENTRY(type) \
+#define SIMPLEQ_ENTRY(type) \
struct { \
- struct type *le_next; /* next element */ \
- struct type **le_prev; /* address of previous next element */ \
+ struct type *sqe_next; /* next element */ \
}
/*
- * List functions.
+ * Simple queue functions.
*/
+#define SIMPLEQ_INIT(head) do { \
+ (head)->sqh_first = NULL; \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (head)->sqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.sqe_next = NULL; \
+ *(head)->sqh_last = (elm); \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (listelm)->field.sqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
+ if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
+ if ((head)->sqh_first == (elm)) { \
+ SIMPLEQ_REMOVE_HEAD((head), field); \
+ } else { \
+ struct type *curelm = (head)->sqh_first; \
+ while (curelm->field.sqe_next != (elm)) \
+ curelm = curelm->field.sqe_next; \
+ if ((curelm->field.sqe_next = \
+ curelm->field.sqe_next->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(curelm)->field.sqe_next; \
+ } \
+} while (/*CONSTCOND*/0)
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define QMD_LIST_CHECK_HEAD(head, field) do { \
- if (LIST_FIRST((head)) != NULL && \
- LIST_FIRST((head))->field.le_prev != \
- &LIST_FIRST((head))) \
- panic("Bad list head %p first->prev != head", (head)); \
-} while (0)
-
-#define QMD_LIST_CHECK_NEXT(elm, field) do { \
- if (LIST_NEXT((elm), field) != NULL && \
- LIST_NEXT((elm), field)->field.le_prev != \
- &((elm)->field.le_next)) \
- panic("Bad link elm %p next->prev != elm", (elm)); \
-} while (0)
-
-#define QMD_LIST_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.le_prev != (elm)) \
- panic("Bad link elm %p prev->next != elm", (elm)); \
-} while (0)
-#else
-#define QMD_LIST_CHECK_HEAD(head, field)
-#define QMD_LIST_CHECK_NEXT(elm, field)
-#define QMD_LIST_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define LIST_EMPTY(head) ((head)->lh_first == NULL)
-
-#define LIST_FIRST(head) ((head)->lh_first)
-
-#define LIST_FOREACH(var, head, field) \
- for ((var) = LIST_FIRST((head)); \
- (var); \
- (var) = LIST_NEXT((var), field))
-
-#define LIST_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = LIST_FIRST((head)); \
- (var) && ((tvar) = LIST_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define LIST_INIT(head) do { \
- LIST_FIRST((head)) = NULL; \
-} while (0)
-
-#define LIST_INSERT_AFTER(listelm, elm, field) do { \
- QMD_LIST_CHECK_NEXT(listelm, field); \
- if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
- LIST_NEXT((listelm), field)->field.le_prev = \
- &LIST_NEXT((elm), field); \
- LIST_NEXT((listelm), field) = (elm); \
- (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
-} while (0)
-
-#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
- QMD_LIST_CHECK_PREV(listelm, field); \
- (elm)->field.le_prev = (listelm)->field.le_prev; \
- LIST_NEXT((elm), field) = (listelm); \
- *(listelm)->field.le_prev = (elm); \
- (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
-} while (0)
-
-#define LIST_INSERT_HEAD(head, elm, field) do { \
- QMD_LIST_CHECK_HEAD((head), field); \
- if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
- LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
- LIST_FIRST((head)) = (elm); \
- (elm)->field.le_prev = &LIST_FIRST((head)); \
-} while (0)
+#define SIMPLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->sqh_first); \
+ (var); \
+ (var) = ((var)->field.sqe_next))
-#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+/*
+ * Simple queue access methods.
+ */
+#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL)
+#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
+#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
-#define LIST_REMOVE(elm, field) do { \
- QMD_LIST_CHECK_NEXT(elm, field); \
- QMD_LIST_CHECK_PREV(elm, field); \
- if (LIST_NEXT((elm), field) != NULL) \
- LIST_NEXT((elm), field)->field.le_prev = \
- (elm)->field.le_prev; \
- *(elm)->field.le_prev = LIST_NEXT((elm), field); \
- TRASHIT((elm)->field.le_next); \
- TRASHIT((elm)->field.le_prev); \
-} while (0)
/*
- * Tail queue declarations.
+ * Tail queue definitions.
*/
-#define TAILQ_HEAD(name, type) \
+#define _TAILQ_HEAD(name, type, qual) \
struct name { \
- struct type *tqh_first; /* first element */ \
- struct type **tqh_last; /* addr of last next element */ \
- TRACEBUF \
+ qual type *tqh_first; /* first element */ \
+ qual type *qual *tqh_last; /* addr of last next element */ \
}
+#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
#define TAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).tqh_first }
-#define TAILQ_ENTRY(type) \
+#define _TAILQ_ENTRY(type, qual) \
struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
- TRACEBUF \
+ qual type *tqe_next; /* next element */ \
+ qual type *qual *tqe_prev; /* address of previous next element */\
}
+#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
/*
* Tail queue functions.
*/
-#if (defined(_KERNEL) && defined(INVARIANTS))
-#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
- if (!TAILQ_EMPTY(head) && \
- TAILQ_FIRST((head))->field.tqe_prev != \
- &TAILQ_FIRST((head))) \
- panic("Bad tailq head %p first->prev != head", (head)); \
-} while (0)
-
-#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
- if (*(head)->tqh_last != NULL) \
- panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
-} while (0)
-
-#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
- if (TAILQ_NEXT((elm), field) != NULL && \
- TAILQ_NEXT((elm), field)->field.tqe_prev != \
- &((elm)->field.tqe_next)) \
- panic("Bad link elm %p next->prev != elm", (elm)); \
-} while (0)
-
-#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
- if (*(elm)->field.tqe_prev != (elm)) \
- panic("Bad link elm %p prev->next != elm", (elm)); \
-} while (0)
-#else
-#define QMD_TAILQ_CHECK_HEAD(head, field)
-#define QMD_TAILQ_CHECK_TAIL(head, headname)
-#define QMD_TAILQ_CHECK_NEXT(elm, field)
-#define QMD_TAILQ_CHECK_PREV(elm, field)
-#endif /* (_KERNEL && INVARIANTS) */
-
-#define TAILQ_CONCAT(head1, head2, field) do { \
- if (!TAILQ_EMPTY(head2)) { \
- *(head1)->tqh_last = (head2)->tqh_first; \
- (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
- (head1)->tqh_last = (head2)->tqh_last; \
- TAILQ_INIT((head2)); \
- QMD_TRACE_HEAD(head1); \
- QMD_TRACE_HEAD(head2); \
- } \
-} while (0)
-
-#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
-
-#define TAILQ_FIRST(head) ((head)->tqh_first)
-
-#define TAILQ_FOREACH(var, head, field) \
- for ((var) = TAILQ_FIRST((head)); \
- (var); \
- (var) = TAILQ_NEXT((var), field))
-
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = TAILQ_FIRST((head)); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
- (var) = (tvar))
-
-#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
- for ((var) = TAILQ_LAST((head), headname); \
- (var); \
- (var) = TAILQ_PREV((var), headname, field))
-
-#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
- for ((var) = TAILQ_LAST((head), headname); \
- (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
- (var) = (tvar))
-
#define TAILQ_INIT(head) do { \
- TAILQ_FIRST((head)) = NULL; \
- (head)->tqh_last = &TAILQ_FIRST((head)); \
- QMD_TRACE_HEAD(head); \
-} while (0)
-
-#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
- QMD_TAILQ_CHECK_NEXT(listelm, field); \
- if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
- TAILQ_NEXT((elm), field)->field.tqe_prev = \
- &TAILQ_NEXT((elm), field); \
- else { \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_HEAD(head); \
- } \
- TAILQ_NEXT((listelm), field) = (elm); \
- (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
- QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&listelm->field); \
-} while (0)
-
-#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
- QMD_TAILQ_CHECK_PREV(listelm, field); \
- (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
- TAILQ_NEXT((elm), field) = (listelm); \
- *(listelm)->field.tqe_prev = (elm); \
- (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_ELEM(&(elm)->field); \
- QMD_TRACE_ELEM(&listelm->field); \
-} while (0)
+ (head)->tqh_first = NULL; \
+ (head)->tqh_last = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
- QMD_TAILQ_CHECK_HEAD(head, field); \
- if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
- TAILQ_FIRST((head))->field.tqe_prev = \
- &TAILQ_NEXT((elm), field); \
+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
+ (head)->tqh_first->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
else \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- TAILQ_FIRST((head)) = (elm); \
- (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
- QMD_TRACE_HEAD(head); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (head)->tqh_first = (elm); \
+ (elm)->field.tqe_prev = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
- QMD_TAILQ_CHECK_TAIL(head, field); \
- TAILQ_NEXT((elm), field) = NULL; \
+ (elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
- (head)->tqh_last = &TAILQ_NEXT((elm), field); \
- QMD_TRACE_HEAD(head); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
-#define TAILQ_LAST(head, headname) \
- (*(((struct headname *)((head)->tqh_last))->tqh_last))
-
-#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+ (elm)->field.tqe_next->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (listelm)->field.tqe_next = (elm); \
+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
-#define TAILQ_PREV(elm, headname, field) \
- (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ (elm)->field.tqe_next = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
#define TAILQ_REMOVE(head, elm, field) do { \
- QMD_TAILQ_CHECK_NEXT(elm, field); \
- QMD_TAILQ_CHECK_PREV(elm, field); \
- if ((TAILQ_NEXT((elm), field)) != NULL) \
- TAILQ_NEXT((elm), field)->field.tqe_prev = \
+ if (((elm)->field.tqe_next) != NULL) \
+ (elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
- else { \
+ else \
(head)->tqh_last = (elm)->field.tqe_prev; \
- QMD_TRACE_HEAD(head); \
- } \
- *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
- TRASHIT((elm)->field.tqe_next); \
- TRASHIT((elm)->field.tqe_prev); \
- QMD_TRACE_ELEM(&(elm)->field); \
-} while (0)
+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
+} while (/*CONSTCOND*/0)
+#define TAILQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->tqh_first); \
+ (var); \
+ (var) = ((var)->field.tqe_next))
-#ifdef _KERNEL
+#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
+ for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
+ (var); \
+ (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
+
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
/*
- * XXX insque() and remque() are an old way of handling certain queues.
- * They bogusly assumes that all queue heads look alike.
+ * Tail queue access methods.
*/
+#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
-struct quehead {
- struct quehead *qh_link;
- struct quehead *qh_rlink;
-};
-
-#ifdef __CC_SUPPORTS___INLINE
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-static __inline void
-insque(void *a, void *b)
-{
- struct quehead *element = (struct quehead *)a,
- *head = (struct quehead *)b;
- element->qh_link = head->qh_link;
- element->qh_rlink = head;
- head->qh_link = element;
- element->qh_link->qh_rlink = element;
+/*
+ * Circular queue definitions.
+ */
+#define CIRCLEQ_HEAD(name, type) \
+struct name { \
+ struct type *cqh_first; /* first element */ \
+ struct type *cqh_last; /* last element */ \
}
-static __inline void
-remque(void *a)
-{
- struct quehead *element = (struct quehead *)a;
+#define CIRCLEQ_HEAD_INITIALIZER(head) \
+ { (void *)&head, (void *)&head }
- element->qh_link->qh_rlink = element->qh_rlink;
- element->qh_rlink->qh_link = element->qh_link;
- element->qh_rlink = 0;
+#define CIRCLEQ_ENTRY(type) \
+struct { \
+ struct type *cqe_next; /* next element */ \
+ struct type *cqe_prev; /* previous element */ \
}
-#else /* !__CC_SUPPORTS___INLINE */
+/*
+ * Circular queue functions.
+ */
+#define CIRCLEQ_INIT(head) do { \
+ (head)->cqh_first = (void *)(head); \
+ (head)->cqh_last = (void *)(head); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \
+ (elm)->field.cqe_prev = (listelm); \
+ if ((listelm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \
+ (listelm)->field.cqe_next = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm); \
+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
+ if ((listelm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \
+ (listelm)->field.cqe_prev = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.cqe_next = (head)->cqh_first; \
+ (elm)->field.cqe_prev = (void *)(head); \
+ if ((head)->cqh_last == (void *)(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (head)->cqh_first->field.cqe_prev = (elm); \
+ (head)->cqh_first = (elm); \
+} while (/*CONSTCOND*/0)
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.cqe_next = (void *)(head); \
+ (elm)->field.cqe_prev = (head)->cqh_last; \
+ if ((head)->cqh_first == (void *)(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (head)->cqh_last->field.cqe_next = (elm); \
+ (head)->cqh_last = (elm); \
+} while (/*CONSTCOND*/0)
-void insque(void *a, void *b);
-void remque(void *a);
+#define CIRCLEQ_REMOVE(head, elm, field) do { \
+ if ((elm)->field.cqe_next == (void *)(head)) \
+ (head)->cqh_last = (elm)->field.cqe_prev; \
+ else \
+ (elm)->field.cqe_next->field.cqe_prev = \
+ (elm)->field.cqe_prev; \
+ if ((elm)->field.cqe_prev == (void *)(head)) \
+ (head)->cqh_first = (elm)->field.cqe_next; \
+ else \
+ (elm)->field.cqe_prev->field.cqe_next = \
+ (elm)->field.cqe_next; \
+} while (/*CONSTCOND*/0)
-#endif /* __CC_SUPPORTS___INLINE */
+#define CIRCLEQ_FOREACH(var, head, field) \
+ for ((var) = ((head)->cqh_first); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_next))
-#endif /* _KERNEL */
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
+ for ((var) = ((head)->cqh_last); \
+ (var) != (const void *)(head); \
+ (var) = ((var)->field.cqe_prev))
-#endif /* !_SYS_QUEUE_H_ */
+/*
+ * Circular queue access methods.
+ */
+#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
+#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
+#define CIRCLEQ_LAST(head) ((head)->cqh_last)
+#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
+#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
+
+#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
+ (((elm)->field.cqe_next == (void *)(head)) \
+ ? ((head)->cqh_first) \
+ : (elm->field.cqe_next))
+#define CIRCLEQ_LOOP_PREV(head, elm, field) \
+ (((elm)->field.cqe_prev == (void *)(head)) \
+ ? ((head)->cqh_last) \
+ : (elm->field.cqe_prev))
+
+#endif /* sys/queue.h */
diff --git a/include/sys/quota.h b/include/sys/quota.h
index a6afdbe44..088e6139e 100644
--- a/include/sys/quota.h
+++ b/include/sys/quota.h
@@ -30,8 +30,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * Version: $Id: quota.h,v 1.1 2002/01/03 04:00:09 andersen Exp $
*/
#ifndef _SYS_QUOTA_H
@@ -40,6 +38,19 @@
#include <features.h>
#include <sys/types.h>
+#ifdef __UCLIBC__
+# undef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 1
+#endif
+
+/*
+ * Select between different incompatible quota versions.
+ * Default to the version used by Linux kernel version 2.4.22
+ * or later. */
+#ifndef _LINUX_QUOTA_VERSION
+# define _LINUX_QUOTA_VERSION 2
+#endif
+
/*
* Convert diskblocks to blocks and the other way around.
* currently only to fool the BSD source. :-)
@@ -94,21 +105,33 @@
#define SUBCMDSHIFT 8
#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
-#define Q_QUOTAON 0x0100 /* enable quotas */
-#define Q_QUOTAOFF 0x0200 /* disable quotas */
-#define Q_GETQUOTA 0x0300 /* get limits and usage */
-#define Q_SETQUOTA 0x0400 /* set limits and usage */
-#define Q_SETUSE 0x0500 /* set usage */
-#define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
-#define Q_SETQLIM 0x0700 /* set limits */
-#define Q_GETSTATS 0x0800 /* get collected stats */
-#define Q_RSQUASH 0x1000 /* set root_squash option */
+#if _LINUX_QUOTA_VERSION < 2
+# define Q_QUOTAON 0x0100 /* enable quotas */
+# define Q_QUOTAOFF 0x0200 /* disable quotas */
+# define Q_GETQUOTA 0x0300 /* get limits and usage */
+# define Q_SETQUOTA 0x0400 /* set limits and usage */
+# define Q_SETUSE 0x0500 /* set usage */
+# define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */
+# define Q_SETQLIM 0x0700 /* set limits */
+# define Q_GETSTATS 0x0800 /* get collected stats */
+# define Q_RSQUASH 0x1000 /* set root_squash option */
+#else
+# define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
+# define Q_QUOTAON 0x800002 /* turn quotas on */
+# define Q_QUOTAOFF 0x800003 /* turn quotas off */
+# define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
+# define Q_GETINFO 0x800005 /* get information about quota files */
+# define Q_SETINFO 0x800006 /* set information about quota files */
+# define Q_GETQUOTA 0x800007 /* get user quota structure */
+# define Q_SETQUOTA 0x800008 /* set user quota structure */
+#endif
/*
* The following structure defines the format of the disk quota file
* (as it appears on disk) - the file is an array of these structures
* indexed by user or group number.
*/
+#if _LINUX_QUOTA_VERSION < 2
struct dqblk
{
u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
@@ -120,13 +143,45 @@ struct dqblk
time_t dqb_btime; /* time limit for excessive disk use */
time_t dqb_itime; /* time limit for excessive files */
};
+#else
+
+/* Flags that indicate which fields in dqblk structure are valid. */
+#define QIF_BLIMITS 1
+#define QIF_SPACE 2
+#define QIF_ILIMITS 4
+#define QIF_INODES 8
+#define QIF_BTIME 16
+#define QIF_ITIME 32
+#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
+#define QIF_USAGE (QIF_SPACE | QIF_INODES)
+#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
+#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
+
+struct dqblk
+ {
+ u_int64_t dqb_bhardlimit; /* absolute limit on disk quota blocks alloc */
+ u_int64_t dqb_bsoftlimit; /* preferred limit on disk quota blocks */
+ u_int64_t dqb_curspace; /* current quota block count */
+ u_int64_t dqb_ihardlimit; /* maximum # allocated inodes */
+ u_int64_t dqb_isoftlimit; /* preferred inode limit */
+ u_int64_t dqb_curinodes; /* current # allocated inodes */
+ u_int64_t dqb_btime; /* time limit for excessive disk use */
+ u_int64_t dqb_itime; /* time limit for excessive files */
+ u_int32_t dqb_valid; /* bitmask of QIF_* constants */
+ };
+#endif
/*
* Shorthand notation.
*/
#define dq_bhardlimit dq_dqb.dqb_bhardlimit
#define dq_bsoftlimit dq_dqb.dqb_bsoftlimit
-#define dq_curblocks dq_dqb.dqb_curblocks
+#if _LINUX_QUOTA_VERSION < 2
+# define dq_curblocks dq_dqb.dqb_curblocks
+#else
+# define dq_curspace dq_dqb.dqb_curspace
+# define dq_valid dq_dqb.dqb_valid
+#endif
#define dq_ihardlimit dq_dqb.dqb_ihardlimit
#define dq_isoftlimit dq_dqb.dqb_isoftlimit
#define dq_curinodes dq_dqb.dqb_curinodes
@@ -135,6 +190,7 @@ struct dqblk
#define dqoff(UID) ((loff_t)((UID) * sizeof (struct dqblk)))
+#if _LINUX_QUOTA_VERSION < 2
struct dqstats
{
u_int32_t lookups;
@@ -147,6 +203,22 @@ struct dqstats
u_int32_t free_dquots;
u_int32_t syncs;
};
+#else
+
+/* Flags that indicate which fields in dqinfo structure are valid. */
+# define IIF_BGRACE 1
+# define IIF_IGRACE 2
+# define IIF_FLAGS 4
+# define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
+
+struct dqinfo
+ {
+ u_int64_t dqi_bgrace;
+ u_int64_t dqi_igrace;
+ u_int32_t dqi_flags;
+ u_int32_t dqi_valid;
+ };
+#endif
__BEGIN_DECLS
diff --git a/include/sys/reboot.h b/include/sys/reboot.h
index 2a719c7a3..bc685aebb 100644
--- a/include/sys/reboot.h
+++ b/include/sys/reboot.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This file should define RB_* macros to be used as flag
bits in the argument to the `reboot' system call. */
diff --git a/include/sys/resource.h b/include/sys/resource.h
index 391274137..17167ed99 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_RESOURCE_H
#define _SYS_RESOURCE_H 1
@@ -50,6 +49,7 @@ typedef int __priority_which_t;
#ifndef __USE_FILE_OFFSET64
extern int getrlimit (__rlimit_resource_t __resource,
struct rlimit *__rlimits) __THROW;
+libc_hidden_proto(getrlimit)
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (getrlimit, (__rlimit_resource_t __resource,
@@ -68,11 +68,12 @@ extern int getrlimit64 (__rlimit_resource_t __resource,
Return 0 if successful, -1 if not (and sets errno). */
#ifndef __USE_FILE_OFFSET64
extern int setrlimit (__rlimit_resource_t __resource,
- __const struct rlimit *__rlimits) __THROW;
+ const struct rlimit *__rlimits) __THROW;
+libc_hidden_proto(setrlimit)
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource,
- __const struct rlimit *__rlimits),
+ const struct rlimit *__rlimits),
setrlimit64);
# else
# define setrlimit setrlimit64
@@ -80,7 +81,7 @@ extern int __REDIRECT_NTH (setrlimit, (__rlimit_resource_t __resource,
#endif
#ifdef __USE_LARGEFILE64
extern int setrlimit64 (__rlimit_resource_t __resource,
- __const struct rlimit64 *__rlimits) __THROW;
+ const struct rlimit64 *__rlimits) __THROW;
#endif
/* Return resource usage information on process indicated by WHO
@@ -92,11 +93,13 @@ extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW;
(as specified by WHO) is used. A lower priority number means higher
priority. Priorities range from PRIO_MIN to PRIO_MAX (above). */
extern int getpriority (__priority_which_t __which, id_t __who) __THROW;
+libc_hidden_proto(getpriority)
/* Set the priority of all processes specified by WHICH and WHO (see above)
to PRIO. Returns 0 on success, -1 on errors. */
extern int setpriority (__priority_which_t __which, id_t __who, int __prio)
__THROW;
+libc_hidden_proto(setpriority)
__END_DECLS
diff --git a/include/sys/select.h b/include/sys/select.h
index 2a408433e..0c2192dbb 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
@@ -110,6 +109,10 @@ extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout);
+#ifdef _LIBC
+extern __typeof(select) __select_nocancel attribute_hidden;
+libc_hidden_proto(select)
+#endif
#ifdef __USE_XOPEN2K
/* Same as above only that the TIMEOUT value is given with higher
diff --git a/include/sys/sem.h b/include/sys/sem.h
index 24a57fc32..84168d834 100644
--- a/include/sys/sem.h
+++ b/include/sys/sem.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SEM_H
#define _SYS_SEM_H 1
@@ -61,7 +60,7 @@ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW;
#ifdef __USE_GNU
/* Operate on semaphore with timeout. */
extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops,
- __const struct timespec *__timeout) __THROW;
+ const struct timespec *__timeout) __THROW;
#endif
__END_DECLS
diff --git a/include/sys/sendfile.h b/include/sys/sendfile.h
index 4c1367b6b..dae074c05 100644
--- a/include/sys/sendfile.h
+++ b/include/sys/sendfile.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SENDFILE_H
#define _SYS_SENDFILE_H 1
@@ -45,6 +44,7 @@ extern ssize_t __REDIRECT_NTH (sendfile,
#ifdef __USE_LARGEFILE64
extern ssize_t sendfile64 (int __out_fd, int __in_fd, __off64_t *__offset,
size_t __count) __THROW;
+libc_hidden_proto(sendfile64)
#endif
__END_DECLS
diff --git a/include/sys/shm.h b/include/sys/shm.h
index 8ec30b486..8f04adeb4 100644
--- a/include/sys/shm.h
+++ b/include/sys/shm.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999, 2000, 2002 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SHM_H
#define _SYS_SHM_H 1
@@ -41,6 +40,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
+
__BEGIN_DECLS
/* The following System V style IPC functions implement a shared memory
@@ -53,11 +53,11 @@ extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW;
extern int shmget (key_t __key, size_t __size, int __shmflg) __THROW;
/* Attach shared memory segment. */
-extern void *shmat (int __shmid, __const void *__shmaddr, int __shmflg)
+extern void *shmat (int __shmid, const void *__shmaddr, int __shmflg)
__THROW;
/* Detach shared memory segment. */
-extern int shmdt (__const void *__shmaddr) __THROW;
+extern int shmdt (const void *__shmaddr) __THROW;
__END_DECLS
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 4ae1ea980..8642312aa 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -1,5 +1,6 @@
/* Declarations of socket constants, types, and functions.
- Copyright (C) 1991,92,1994-2001,2003 Free Software Foundation, Inc.
+ Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008
+ 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
@@ -13,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SOCKET_H
#define _SYS_SOCKET_H 1
@@ -27,6 +27,10 @@ __BEGIN_DECLS
#include <sys/uio.h>
#define __need_size_t
#include <stddef.h>
+#ifdef __USE_GNU
+/* Get the __sigset_t definition. */
+# include <bits/sigset.h>
+#endif
/* This operating system-specific header file defines the SOCK_*, PF_*,
@@ -64,7 +68,7 @@ enum
old-style declaration, too. */
#if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU
# define __SOCKADDR_ARG struct sockaddr *__restrict
-# define __CONST_SOCKADDR_ARG __const struct sockaddr *
+# define __CONST_SOCKADDR_ARG const struct sockaddr *
#else
/* Add more `struct sockaddr_AF' types here as necessary.
These are all the ones I found on NetBSD and Linux. */
@@ -87,7 +91,7 @@ enum
typedef union { __SOCKADDR_ALLTYPES
} __SOCKADDR_ARG __attribute__ ((__transparent_union__));
# undef __SOCKADDR_ONETYPE
-# define __SOCKADDR_ONETYPE(type) __const struct type *__restrict __##type##__;
+# define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__;
typedef union { __SOCKADDR_ALLTYPES
} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
# undef __SOCKADDR_ONETYPE
@@ -98,6 +102,7 @@ typedef union { __SOCKADDR_ALLTYPES
protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
Returns a file descriptor for the new socket, or -1 for errors. */
extern int socket (int __domain, int __type, int __protocol) __THROW;
+libc_hidden_proto(socket)
/* Create two new sockets, of type TYPE in domain DOMAIN and using
protocol PROTOCOL, which are connected to each other, and put file
@@ -109,10 +114,12 @@ extern int socketpair (int __domain, int __type, int __protocol,
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
__THROW;
+libc_hidden_proto(bind)
/* Put the local address of FD into *ADDR and its length in *LEN. */
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
socklen_t *__restrict __len) __THROW;
+libc_hidden_proto(getsockname)
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
For connectionless socket types, just set the default address to send to
@@ -122,6 +129,7 @@ extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
This function is a cancellation point and therefore not marked with
__THROW. */
extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
+libc_hidden_proto(connect)
/* Put the address of the peer connected to socket FD into *ADDR
(which is *LEN bytes long), and its actual length into *LEN. */
@@ -133,7 +141,8 @@ extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
+extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
+libc_hidden_proto(send)
/* Read N bytes into BUF from socket FD.
Returns the number read or -1 for errors.
@@ -141,15 +150,20 @@ extern ssize_t send (int __fd, __const void *__buf, size_t __n, int __flags);
This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
+libc_hidden_proto(recv)
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
ADDR_LEN bytes long). Returns the number sent, or -1 for errors.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
+extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
int __flags, __CONST_SOCKADDR_ARG __addr,
socklen_t __addr_len);
+#ifdef _LIBC
+extern __typeof(sendto) __sendto_nocancel attribute_hidden;
+libc_hidden_proto(sendto)
+#endif
/* Read N bytes into BUF through socket FD.
If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
@@ -161,6 +175,10 @@ extern ssize_t sendto (int __fd, __const void *__buf, size_t __n,
extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
int __flags, __SOCKADDR_ARG __addr,
socklen_t *__restrict __addr_len);
+#ifdef _LIBC
+extern __typeof(recvfrom) __recvfrom_nocancel attribute_hidden;
+libc_hidden_proto(recvfrom)
+#endif
/* Send a message described MESSAGE on socket FD.
@@ -168,8 +186,9 @@ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
+extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
int __flags);
+libc_hidden_proto(sendmsg)
/* Receive a message as described by MESSAGE from socket FD.
Returns the number of bytes read or -1 for errors.
@@ -177,6 +196,7 @@ extern ssize_t sendmsg (int __fd, __const struct msghdr *__message,
This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
+libc_hidden_proto(recvmsg)
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
@@ -190,13 +210,15 @@ extern int getsockopt (int __fd, int __level, int __optname,
to *OPTVAL (which is OPTLEN bytes long).
Returns 0 on success, -1 for errors. */
extern int setsockopt (int __fd, int __level, int __optname,
- __const void *__optval, socklen_t __optlen) __THROW;
+ const void *__optval, socklen_t __optlen) __THROW;
+libc_hidden_proto(setsockopt)
/* Prepare to accept connections on socket FD.
N connection requests will be queued before further requests are refused.
Returns 0 on success, -1 for errors. */
extern int listen (int __fd, int __n) __THROW;
+libc_hidden_proto(listen)
/* Await a connection on socket FD.
When a connection arrives, open a new socket to communicate with it,
@@ -208,6 +230,16 @@ extern int listen (int __fd, int __n) __THROW;
__THROW. */
extern int accept (int __fd, __SOCKADDR_ARG __addr,
socklen_t *__restrict __addr_len);
+libc_hidden_proto(accept)
+
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+/* Similar to 'accept' but takes an additional parameter to specify flags.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len, int __flags);
+#endif
/* Shut down all or part of the connection open on socket FD.
HOW determines what to shut down:
@@ -218,7 +250,7 @@ extern int accept (int __fd, __SOCKADDR_ARG __addr,
extern int shutdown (int __fd, int __how) __THROW;
-#ifdef __USE_XOPEN2K
+#if 0 /*def __USE_XOPEN2K*/
/* Determine wheter socket is at a out-of-band mark. */
extern int sockatmark (int __fd) __THROW;
#endif
@@ -233,4 +265,8 @@ extern int isfdtype (int __fd, int __fdtype) __THROW;
__END_DECLS
+#ifdef _LIBC
+extern int __socketcall(int, unsigned long *) attribute_hidden;
+#endif
+
#endif /* sys/socket.h */
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 508239050..495a68cb1 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,1992,1995-2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995-2004, 2005, 2006, 2007, 2009
+ 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 5.6 File Characteristics <sys/stat.h>
@@ -27,11 +27,12 @@
#include <bits/types.h> /* For __mode_t and __dev_t. */
-#if defined __USE_XOPEN || defined __USE_MISC
+#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_MISC \
+ || defined __USE_ATFILE
# if defined __USE_XOPEN || defined __USE_XOPEN2K
# define __need_time_t
# endif
-# ifdef __USE_MISC
+# if defined __USE_MISC || defined __USE_ATFILE
# define __need_timespec
# endif
# include <time.h> /* For time_t resp. timespec. */
@@ -204,15 +205,17 @@ __BEGIN_DECLS
#ifndef __USE_FILE_OFFSET64
/* Get file attributes for FILE and put them in BUF. */
-extern int stat (__const char *__restrict __file,
+extern int stat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
+libc_hidden_proto(stat)
/* Get file attributes for the file, device, pipe, or socket
that file descriptor FD is open on and put them in BUF. */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
+libc_hidden_proto(fstat)
#else
# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (stat, (__const char *__restrict __file,
+extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf), stat64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
@@ -223,9 +226,11 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int stat64 (__const char *__restrict __file,
+extern int stat64 (const char *__restrict __file,
struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+libc_hidden_proto(stat64)
+libc_hidden_proto(fstat64)
#endif
#ifdef __USE_ATFILE
@@ -233,12 +238,13 @@ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
Relative path names are interpreted relative to FD unless FD is
AT_FDCWD. */
# ifndef __USE_FILE_OFFSET64
-extern int fstatat (int __fd, __const char *__restrict __file,
+extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
+libc_hidden_proto(fstatat)
# else
# ifdef __REDIRECT_NTH
-extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file,
+extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
int __flag),
fstatat64) __nonnull ((2, 3));
@@ -247,21 +253,25 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, __const char *__restrict __file,
# endif
# endif
-extern int fstatat64 (int __fd, __const char *__restrict __file,
+# ifdef __USE_LARGEFILE64
+extern int fstatat64 (int __fd, const char *__restrict __file,
struct stat64 *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
+libc_hidden_proto(fstatat64)
+# endif
#endif
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __USE_FILE_OFFSET64
/* Get file attributes about FILE and put them in BUF.
If FILE is a symbolic link, do not follow it. */
-extern int lstat (__const char *__restrict __file,
+extern int lstat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
+libc_hidden_proto(lstat)
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
- (__const char *__restrict __file,
+ (const char *__restrict __file,
struct stat *__restrict __buf), lstat64)
__nonnull ((1, 2));
# else
@@ -269,22 +279,24 @@ extern int __REDIRECT_NTH (lstat,
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int lstat64 (__const char *__restrict __file,
+extern int lstat64 (const char *__restrict __file,
struct stat64 *__restrict __buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(lstat64)
# endif
#endif
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects its target instead. */
-extern int chmod (__const char *__file, __mode_t __mode)
+extern int chmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
+libc_hidden_proto(chmod)
#if 0 /*def __USE_BSD*/
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects the link itself
rather than its target. */
-extern int lchmod (__const char *__file, __mode_t __mode)
+extern int lchmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
#endif
@@ -296,8 +308,10 @@ extern int fchmod (int __fd, __mode_t __mode) __THROW;
#ifdef __USE_ATFILE
/* Set file access permissions of FILE relative to
the directory FD is open on. */
-extern int fchmodat (int __fd, __const char *__file, __mode_t mode, int __flag)
+extern int fchmodat (int __fd, const char *__file, __mode_t __mode,
+ int __flag)
__THROW __nonnull ((2)) __wur;
+libc_hidden_proto(fchmodat)
#endif /* Use ATFILE. */
@@ -313,46 +327,65 @@ extern __mode_t getumask (void) __THROW;
#endif
/* Create a new directory named PATH, with permission bits MODE. */
-extern int mkdir (__const char *__path, __mode_t __mode)
+extern int mkdir (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
+libc_hidden_proto(mkdir)
#ifdef __USE_ATFILE
/* Like mkdir, create a new directory with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
-extern int mkdirat (int __fd, __const char *__path, __mode_t __mode)
+extern int mkdirat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
+libc_hidden_proto(mkdirat)
#endif
/* Create a device file named PATH, with permission and special bits MODE
and device number DEV (which can be constructed from major and minor
device numbers with the `makedev' macro above). */
#if defined __USE_MISC || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
+extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev)
__THROW __nonnull ((1));
-#endif
+libc_hidden_proto(mknod)
-#ifdef __USE_ATFILE
+# ifdef __USE_ATFILE
/* Like mknod, create a new device file with permission bits MODE and
device number DEV. But interpret relative PATH names relative to
the directory associated with FD. */
-extern int mknodat (int __fd, __const char *__path, __mode_t __mode,
+extern int mknodat (int __fd, const char *__path, __mode_t __mode,
__dev_t __dev) __THROW __nonnull ((2));
+libc_hidden_proto(mknodat)
+# endif
#endif
/* Create a new FIFO named PATH, with permission bits MODE. */
-extern int mkfifo (__const char *__path, __mode_t __mode)
+extern int mkfifo (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
#ifdef __USE_ATFILE
/* Like mkfifo, create a new FIFO with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
-extern int mkfifoat (int __fd, __const char *__path, __mode_t __mode)
+extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
#endif
+
+#ifdef __USE_ATFILE
+/* Set file access and modification times relative to directory file
+ descriptor. */
+extern int utimensat (int __fd, const char *__path,
+ const struct timespec __times[2],
+ int __flags)
+ __THROW __nonnull ((2));
+libc_hidden_proto(utimensat)
+#endif
+#ifdef __USE_XOPEN2K8
+/* Set file access and modification times of the file associated with FD. */
+extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
+#endif
+
/* on uClibc we have unversioned struct stat and mknod.
* bits/stat.h is filled with wrong info, so we undo it here. */
#undef _STAT_VER
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
index f4177d4c9..ab74b0bbd 100644
--- a/include/sys/statfs.h
+++ b/include/sys/statfs.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_STATFS_H
#define _SYS_STATFS_H 1
@@ -29,23 +28,24 @@ __BEGIN_DECLS
/* Return information about the filesystem on which FILE resides. */
#ifndef __USE_FILE_OFFSET64
-extern int statfs (__const char *__file, struct statfs *__buf)
+extern int statfs (const char *__file, struct statfs *__buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(statfs)
#else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (statfs,
- (__const char *__file, struct statfs *__buf),
+ (const char *__file, struct statfs *__buf),
statfs64) __nonnull ((1, 2));
# else
# define statfs statfs64
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int statfs64 (__const char *__file, struct statfs64 *__buf)
+extern int statfs64 (const char *__file, struct statfs64 *__buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(statfs64)
#endif
-#if defined __UCLIBC_LINUX_SPECIFIC__
/* Return information about the filesystem containing the file FILDES
refers to. */
#ifndef __USE_FILE_OFFSET64
@@ -62,8 +62,8 @@ extern int __REDIRECT_NTH (fstatfs, (int __fildes, struct statfs *__buf),
#ifdef __USE_LARGEFILE64
extern int fstatfs64 (int __fildes, struct statfs64 *__buf)
__THROW __nonnull ((2));
+libc_hidden_proto(fstatfs64)
#endif
-#endif /* __UCLIBC_LINUX_SPECIFIC__ */
__END_DECLS
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index 685dd2619..e5e0c2362 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_STATVFS_H
#define _SYS_STATVFS_H 1
@@ -49,13 +48,14 @@ __BEGIN_DECLS
/* Return information about the filesystem on which FILE resides. */
#ifndef __USE_FILE_OFFSET64
-extern int statvfs (__const char *__restrict __file,
+extern int statvfs (const char *__restrict __file,
struct statvfs *__restrict __buf)
__THROW __nonnull ((1, 2));
+libc_hidden_proto(statvfs)
#else
-# ifdef __REDIRECT
-extern int __REDIRECT (statvfs,
- (__const char *__restrict __file,
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (statvfs,
+ (const char *__restrict __file,
struct statvfs *__restrict __buf), statvfs64)
__nonnull ((1, 2));
# else
@@ -63,7 +63,7 @@ extern int __REDIRECT (statvfs,
# endif
#endif
#ifdef __USE_LARGEFILE64
-extern int statvfs64 (__const char *__restrict __file,
+extern int statvfs64 (const char *__restrict __file,
struct statvfs64 *__restrict __buf)
__THROW __nonnull ((1, 2));
#endif
@@ -73,9 +73,10 @@ extern int statvfs64 (__const char *__restrict __file,
#ifndef __USE_FILE_OFFSET64
extern int fstatvfs (int __fildes, struct statvfs *__buf)
__THROW __nonnull ((2));
+libc_hidden_proto(fstatvfs)
#else
-# ifdef __REDIRECT
-extern int __REDIRECT (fstatvfs, (int __fildes, struct statvfs *__buf),
+# ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (fstatvfs, (int __fildes, struct statvfs *__buf),
fstatvfs64) __nonnull ((2));
# else
# define fstatvfs fstatvfs64
diff --git a/include/sys/swap.h b/include/sys/swap.h
index b6e7bef5d..29faba616 100644
--- a/include/sys/swap.h
+++ b/include/sys/swap.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SWAP_H
@@ -33,10 +32,10 @@ __BEGIN_DECLS
/* Make the block special device PATH available to the system for swapping.
This call is restricted to the super-user. */
-extern int swapon (__const char *__path, int __flags) __THROW;
+extern int swapon (const char *__path, int __flags) __THROW;
/* Stop using block special device PATH for swapping. */
-extern int swapoff (__const char *__path) __THROW;
+extern int swapoff (const char *__path) __THROW;
__END_DECLS
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index 4c8ede843..ec8a75cf1 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -12,26 +12,26 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYSCALL_H
#define _SYSCALL_H 1
+/* User application code should use syscall(). */
+
+#include <features.h>
+#include <bits/sysnum.h>
+#ifdef _LIBC
/* The _syscall#() macros are for uClibc internal use only.
- * User application code should use syscall() instead.
*
* The kernel provided _syscall[0-6] macros from asm/unistd.h are not suitable
* for use in uClibc as they lack PIC support etc, so for uClibc we use our own
* local _syscall# macros to be certain all such variations are handled
* properly.
*/
-
-#include <features.h>
-#include <bits/sysnum.h>
-#if defined _LIBC && (defined IS_IN_libc || defined NOT_IN_libc)
# include <bits/syscalls.h>
+# include <bits/syscalls-common.h>
#endif
#endif
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
index 110efaa76..2c2d68819 100644
--- a/include/sys/sysctl.h
+++ b/include/sys/sysctl.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SYSCTL_H
#define _SYS_SYSCTL_H 1
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
index 9fd4fa829..00e363371 100644
--- a/include/sys/sysinfo.h
+++ b/include/sys/sysinfo.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SYSINFO_H
#define _SYS_SYSINFO_H 1
@@ -24,6 +23,8 @@
#ifndef _LINUX_KERNEL_H
/* Include our own copy of struct sysinfo to avoid binary compatability
* problems with Linux 2.4, which changed things. Grumble, grumble. */
+#define _LINUX_SYSINFO_H
+
#define SI_LOAD_SHIFT 16
struct sysinfo {
long uptime; /* Seconds since boot */
@@ -48,19 +49,20 @@ __BEGIN_DECLS
/* Returns information on overall system statistics. */
extern int sysinfo (struct sysinfo *__info) __THROW;
-
/* Return number of configured processors. */
-extern int get_nprocs_conf (void) __THROW;
+#define get_nprocs_conf() (sysconf(_SC_NPROCESSORS_CONF))
/* Return number of available processors. */
-extern int get_nprocs (void) __THROW;
+#define get_nprocs() (sysconf(_SC_NPROCESSORS_ONLN))
+#if 0
/* Return number of physical pages of memory in the system. */
extern long int get_phys_pages (void) __THROW;
/* Return number of available physical pages of memory in the system. */
extern long int get_avphys_pages (void) __THROW;
+#endif
__END_DECLS
diff --git a/include/sys/syslog.h b/include/sys/syslog.h
index 3f5e6b297..8808d217c 100644
--- a/include/sys/syslog.h
+++ b/include/sys/syslog.h
@@ -184,7 +184,7 @@ extern void closelog (void);
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern void openlog (__const char *__ident, int __option, int __facility);
+extern void openlog (const char *__ident, int __option, int __facility);
/* Set the log mask level. */
extern int setlogmask (int __mask) __THROW;
@@ -193,8 +193,9 @@ extern int setlogmask (int __mask) __THROW;
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern void syslog (int __pri, __const char *__fmt, ...)
+extern void syslog (int __pri, const char *__fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
+libc_hidden_proto(syslog)
#ifdef __USE_BSD
/* Generate a log message using FMT and using arguments pointed to by AP.
@@ -203,7 +204,7 @@ extern void syslog (int __pri, __const char *__fmt, ...)
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
+extern void vsyslog (int __pri, const char *__fmt, __gnuc_va_list __ap)
__attribute__ ((__format__ (__printf__, 2, 0)));
#endif
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index c5efca4f9..3addb7500 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -13,44 +13,47 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H 1
#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)
@@ -58,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/time.h b/include/sys/time.h
index 66fb9e021..3b7a106be 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991-1994,1996-2002,2003,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1994,1996-2003,2005,2006,2009
+ 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_TIME_H
#define _SYS_TIME_H 1
@@ -71,19 +71,21 @@ typedef void *__restrict __timezone_ptr_t;
Use the functions and variables declared in <time.h> instead. */
extern int gettimeofday (struct timeval *__restrict __tv,
__timezone_ptr_t __tz) __THROW __nonnull ((1));
+libc_hidden_proto(gettimeofday)
#ifdef __USE_BSD
/* Set the current time of day and timezone information.
This call is restricted to the super-user. */
-extern int settimeofday (__const struct timeval *__tv,
- __const struct timezone *__tz)
+extern int settimeofday (const struct timeval *__tv,
+ const struct timezone *__tz)
__THROW __nonnull ((1));
+libc_hidden_proto(settimeofday)
/* Adjust the current time of day by the amount in DELTA.
If OLDDELTA is not NULL, it is filled in with the amount
of time adjustment remaining to be done from the last `adjtime' call.
This call is restricted to the super-user. */
-extern int adjtime (__const struct timeval *__delta,
+extern int adjtime (const struct timeval *__delta,
struct timeval *__olddelta) __THROW;
#endif
@@ -130,30 +132,34 @@ extern int getitimer (__itimer_which_t __which,
set *OLD to the old value of timer WHICH.
Returns 0 on success, -1 on errors. */
extern int setitimer (__itimer_which_t __which,
- __const struct itimerval *__restrict __new,
+ const struct itimerval *__restrict __new,
struct itimerval *__restrict __old) __THROW;
+libc_hidden_proto(setitimer)
/* Change the access time of FILE to TVP[0] and the modification time of
FILE to TVP[1]. If TVP is a null pointer, use the current time instead.
Returns 0 on success, -1 on errors. */
-extern int utimes (__const char *__file, __const struct timeval __tvp[2])
+extern int utimes (const char *__file, const struct timeval __tvp[2])
__THROW __nonnull ((1));
+libc_hidden_proto(utimes)
-#if 0 /*def __USE_BSD*/
+#ifdef __USE_BSD
/* Same as `utimes', but does not follow symbolic links. */
-extern int lutimes (__const char *__file, __const struct timeval __tvp[2])
+extern int lutimes (const char *__file, const struct timeval __tvp[2])
__THROW __nonnull ((1));
+#if 0
/* Same as `utimes', but takes an open file descriptor instead of a name. */
-extern int futimes (int __fd, __const struct timeval __tvp[2]) __THROW;
+extern int futimes (int __fd, const struct timeval __tvp[2]) __THROW;
+#endif
#endif
-#if 0 /*def __USE_GNU*/
+#ifdef __USE_GNU
/* Change the access time of FILE relative to FD to TVP[0] and the
modification time of FILE to TVP[1]. If TVP is a null pointer, use
the current time instead. Returns 0 on success, -1 on errors. */
-extern int futimesat (int __fd, __const char *__file,
- __const struct timeval __tvp[2]) __THROW;
+extern int futimesat (int __fd, const char *__file,
+ const struct timeval __tvp[2]) __THROW;
#endif
diff --git a/include/sys/timeb.h b/include/sys/timeb.h
index dbdbf45a8..d34e4c10e 100644
--- a/include/sys/timeb.h
+++ b/include/sys/timeb.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_TIMEB_H
#define _SYS_TIMEB_H 1
diff --git a/include/sys/times.h b/include/sys/times.h
index 6022f2f84..3936762bd 100644
--- a/include/sys/times.h
+++ b/include/sys/times.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 4.5.2 Process Times <sys/times.h>
@@ -47,6 +46,7 @@ struct tms
Return the elapsed real time, or (clock_t) -1 for errors.
All times are in CLK_TCKths of a second. */
extern clock_t times (struct tms *__buffer) __THROW;
+libc_hidden_proto(times)
__END_DECLS
diff --git a/include/sys/timex.h b/include/sys/timex.h
index d2020a6d2..4cb81d208 100644
--- a/include/sys/timex.h
+++ b/include/sys/timex.h
@@ -12,15 +12,15 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_TIMEX_H
#define _SYS_TIMEX_H 1
#include <features.h>
#include <sys/time.h>
+#include <time.h>
/* These definitions from linux/timex.h as of 2.2.0. */
@@ -67,8 +67,12 @@ struct timex
#define ADJ_ESTERROR 0x0008 /* estimated time error */
#define ADJ_STATUS 0x0010 /* clock status */
#define ADJ_TIMECONST 0x0020 /* pll time constant */
-#define ADJ_TICK 0x4000 /* tick value */
-#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
+#define ADJ_TAI 0x0080 /* set TAI offset */
+#define ADJ_MICRO 0x1000 /* select microsecond resolution */
+#define ADJ_NANO 0x2000 /* select nanosecond resolution */
+#define ADJ_TICK 0x4000 /* tick value */
+#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
+#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
/* xntp 3.4 compatibility names */
#define MOD_OFFSET ADJ_OFFSET
@@ -118,12 +122,15 @@ __BEGIN_DECLS
extern int __adjtimex (struct timex *__ntx) __THROW;
extern int adjtimex (struct timex *__ntx) __THROW;
+libc_hidden_proto(adjtimex)
#if defined __UCLIBC_NTP_LEGACY__
extern int ntp_gettime (struct ntptimeval *__ntv) __THROW;
extern int ntp_adjtime (struct timex *__tntx) __THROW;
#endif
-
+#if defined __UCLIBC_HAS_REALTIME__
+extern int clock_adjtime (clockid_t __clock_id, struct timex *__ntx) __THROW;
+#endif
__END_DECLS
#endif /* sys/timex.h */
diff --git a/include/sys/ttydefaults.h b/include/sys/ttydefaults.h
index 9be168b83..bb605a458 100644
--- a/include/sys/ttydefaults.h
+++ b/include/sys/ttydefaults.h
@@ -75,9 +75,9 @@
#define CSTART CTRL('q')
#define CSTOP CTRL('s')
#define CLNEXT CTRL('v')
-#define CDISCARD CTRL('o')
-#define CWERASE CTRL('w')
-#define CREPRINT CTRL('r')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
#define CEOT CEOF
/* compat */
#define CBRK CEOL
diff --git a/include/sys/types.h b/include/sys/types.h
index 8c0b5dce3..2b45d0300 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -1,5 +1,5 @@
/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002
- Free Software Foundation, Inc.
+ 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
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
@@ -165,7 +164,7 @@ typedef short int int16_t;
typedef int int32_t;
# if __WORDSIZE == 64
typedef long int int64_t;
-# elif defined __GNUC__ || defined __ICC
+# elif defined __GNUC__ || defined __ICC || defined __TenDRA__
__extension__ typedef long long int int64_t;
# endif
# endif
@@ -176,7 +175,7 @@ typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
# if __WORDSIZE == 64
typedef unsigned long int u_int64_t;
-# elif defined __GNUC__ || defined __ICC
+# elif defined __GNUC__ || defined __ICC || defined __TenDRA__
__extension__ typedef unsigned long long int u_int64_t;
# endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 1b203f71c..efc681e7b 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_UIO_H
#define _SYS_UIO_H 1
@@ -37,7 +36,7 @@ __BEGIN_DECLS
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count);
+extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count);
/* Write data pointed by the buffers described by IOVEC, which
is a vector of COUNT `struct iovec's, to file descriptor FD.
@@ -47,7 +46,7 @@ extern ssize_t readv (int __fd, __const struct iovec *__iovec, int __count);
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count);
+extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count);
__END_DECLS
diff --git a/include/sys/un.h b/include/sys/un.h
index 1fa10e4fe..e49d552bd 100644
--- a/include/sys/un.h
+++ b/include/sys/un.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_UN_H
#define _SYS_UN_H 1
diff --git a/include/sys/ustat.h b/include/sys/ustat.h
index 7a9cdac0d..11f51b20a 100644
--- a/include/sys/ustat.h
+++ b/include/sys/ustat.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* This interface is obsolete. Use <sys/statfs.h> instead.
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
index ca195cb4d..04ff55be7 100644
--- a/include/sys/utsname.h
+++ b/include/sys/utsname.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 96, 97, 99 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,96,97,99,2002 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 4.4 System Identification <sys/utsname.h>
@@ -29,26 +28,38 @@ __BEGIN_DECLS
#include <bits/utsname.h>
+#ifndef _UTSNAME_SYSNAME_LENGTH
+# define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
+#endif
#ifndef _UTSNAME_NODENAME_LENGTH
# define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
#endif
+#ifndef _UTSNAME_RELEASE_LENGTH
+# define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
+#endif
+#ifndef _UTSNAME_VERSION_LENGTH
+# define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
+#endif
+#ifndef _UTSNAME_MACHINE_LENGTH
+# define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
+#endif
/* Structure describing the system and machine. */
struct utsname
{
/* Name of the implementation of the operating system. */
- char sysname[_UTSNAME_LENGTH];
+ char sysname[_UTSNAME_SYSNAME_LENGTH];
/* Name of this node on the network. */
char nodename[_UTSNAME_NODENAME_LENGTH];
/* Current release level of this implementation. */
- char release[_UTSNAME_LENGTH];
+ char release[_UTSNAME_RELEASE_LENGTH];
/* Current version level of this release. */
- char version[_UTSNAME_LENGTH];
+ char version[_UTSNAME_VERSION_LENGTH];
/* Name of the hardware type the system is running on. */
- char machine[_UTSNAME_LENGTH];
+ char machine[_UTSNAME_MACHINE_LENGTH];
#if _UTSNAME_DOMAIN_LENGTH - 0
/* Name of the domain of this node on the network. */
@@ -61,12 +72,14 @@ struct utsname
};
#ifdef __USE_SVID
+/* Note that SVID assumes all members have the same size. */
# define SYS_NMLN _UTSNAME_LENGTH
#endif
/* Put information about the system in NAME. */
extern int uname (struct utsname *__name) __THROW;
+libc_hidden_proto(uname)
__END_DECLS
diff --git a/include/sys/wait.h b/include/sys/wait.h
index 81a54fc3d..f7a420b93 100644
--- a/include/sys/wait.h
+++ b/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.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h>
@@ -29,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>
@@ -47,11 +45,11 @@ __BEGIN_DECLS
(__extension__ (((union { __typeof(status) __in; int __i; }) \
{ .__in = (status) }).__i))
# else
-# define __WAIT_INT(status) (*(__const int *) &(status))
+# define __WAIT_INT(status) (*(const int *) &(status))
# endif
/* 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
the actual function definitions. */
@@ -79,26 +77,26 @@ typedef union
/* This will define all the `__W*' macros. */
# 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))
-# if 0 /*def __WIFCONTINUED*/
-# define WIFCONTINUED(status) __WIFCONTINUED(__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
+# define WIFCONTINUED(status) __WIFCONTINUED (__WAIT_INT (status))
# endif
#endif /* <stdlib.h> not included. */
#ifdef __USE_BSD
# 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
/* 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. */
@@ -137,10 +135,20 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc);
This function is a cancellation point and therefore not marked with
__THROW. */
extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options);
+#ifdef _LIBC
+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.
@@ -157,29 +165,26 @@ extern int waitid (idtype_t __idtype, __id_t __id, siginfo_t *__infop,
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-/* This being here makes the prototypes valid whether or not
- we have already included <sys/resource.h> to define `struct rusage'. */
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
-/* 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. */
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
+extern __pid_t __wait4_nocancel(__pid_t, __WAIT_STATUS, int, struct rusage *) attribute_hidden;
+#endif
+
__END_DECLS
diff --git a/include/sys/xattr.h b/include/sys/xattr.h
index 2737f90bd..f39642dcc 100644
--- a/include/sys/xattr.h
+++ b/include/sys/xattr.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _SYS_XATTR_H
#define _SYS_XATTR_H 1
@@ -37,48 +36,48 @@ enum
/* Set the attribute NAME of the file pointed to by PATH to VALUE (which
is SIZE bytes long). Return 0 on success, -1 for errors. */
-extern int setxattr (__const char *__path, __const char *__name,
- __const void *__value, size_t __size, int __flags)
+extern int setxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
__THROW;
/* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
SIZE bytes long), not following symlinks for the last pathname component.
Return 0 on success, -1 for errors. */
-extern int lsetxattr (__const char *__path, __const char *__name,
- __const void *__value, size_t __size, int __flags)
+extern int lsetxattr (const char *__path, const char *__name,
+ const void *__value, size_t __size, int __flags)
__THROW;
/* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
bytes long). Return 0 on success, -1 for errors. */
-extern int fsetxattr (int __fd, __const char *__name, __const void *__value,
+extern int fsetxattr (int __fd, const char *__name, const void *__value,
size_t __size, int __flags) __THROW;
/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
SIZE bytes long). Return 0 on success, -1 for errors. */
-extern ssize_t getxattr (__const char *__path, __const char *__name,
+extern ssize_t getxattr (const char *__path, const char *__name,
void *__value, size_t __size) __THROW;
/* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
SIZE bytes long), not following symlinks for the last pathname component.
Return 0 on success, -1 for errors. */
-extern ssize_t lgetxattr (__const char *__path, __const char *__name,
+extern ssize_t lgetxattr (const char *__path, const char *__name,
void *__value, size_t __size) __THROW;
/* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
bytes long). Return 0 on success, -1 for errors. */
-extern ssize_t fgetxattr (int __fd, __const char *__name, void *__value,
+extern ssize_t fgetxattr (int __fd, const char *__name, void *__value,
size_t __size) __THROW;
/* List attributes of the file pointed to by PATH into the user-supplied
buffer LIST (which is SIZE bytes big). Return 0 on success, -1 for
errors. */
-extern ssize_t listxattr (__const char *__path, char *__list, size_t __size)
+extern ssize_t listxattr (const char *__path, char *__list, size_t __size)
__THROW;
/* List attributes of the file pointed to by PATH into the user-supplied
buffer LIST (which is SIZE bytes big), not following symlinks for the
last pathname component. Return 0 on success, -1 for errors. */
-extern ssize_t llistxattr (__const char *__path, char *__list, size_t __size)
+extern ssize_t llistxattr (const char *__path, char *__list, size_t __size)
__THROW;
/* List attributes of the file descriptor FD into the user-supplied buffer
@@ -88,16 +87,16 @@ extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
/* Remove the attribute NAME from the file pointed to by PATH. Return 0
on success, -1 for errors. */
-extern int removexattr (__const char *__path, __const char *__name) __THROW;
+extern int removexattr (const char *__path, const char *__name) __THROW;
/* Remove the attribute NAME from the file pointed to by PATH, not
following symlinks for the last pathname component. Return 0 on
success, -1 for errors. */
-extern int lremovexattr (__const char *__path, __const char *__name) __THROW;
+extern int lremovexattr (const char *__path, const char *__name) __THROW;
/* Remove the attribute NAME from the file descriptor FD. Return 0 on
success, -1 for errors. */
-extern int fremovexattr (int __fd, __const char *__name) __THROW;
+extern int fremovexattr (int __fd, const char *__name) __THROW;
__END_DECLS
diff --git a/include/tar.h b/include/tar.h
index ddfef755d..9732d67cb 100644
--- a/include/tar.h
+++ b/include/tar.h
@@ -14,9 +14,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _TAR_H
#define _TAR_H 1
diff --git a/include/termios.h b/include/termios.h
index 9698b1fbd..7f11fd28c 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
@@ -46,16 +45,18 @@ __BEGIN_DECLS
#endif
/* Return the output baud rate stored in *TERMIOS_P. */
-extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW;
+extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW;
/* Return the input baud rate stored in *TERMIOS_P. */
-extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW;
+extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW;
/* Set the output baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
+libc_hidden_proto(cfsetospeed)
/* Set the input baud rate stored in *TERMIOS_P to SPEED. */
extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
+libc_hidden_proto(cfsetispeed)
#ifdef __USE_BSD
/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
@@ -65,11 +66,13 @@ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
/* Put the state of FD into *TERMIOS_P. */
extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
+libc_hidden_proto(tcgetattr)
/* Set the state of FD to *TERMIOS_P.
Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
extern int tcsetattr (int __fd, int __optional_actions,
- __const struct termios *__termios_p) __THROW;
+ const struct termios *__termios_p) __THROW;
+libc_hidden_proto(tcsetattr)
#ifdef __USE_BSD
diff --git a/include/tgmath.h b/include/tgmath.h
index 5fb683fef..1dc3595ee 100644
--- a/include/tgmath.h
+++ b/include/tgmath.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007
+ 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
@@ -12,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.22 Type-generic math <tgmath.h>
@@ -47,174 +47,199 @@
/* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
Allows for _Bool. Expands to an integer constant expression. */
-# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
+# if __GNUC_PREREQ (3, 1)
+# define __floating_type(type) \
+ (__builtin_classify_type ((type) 0) == 8 \
+ || (__builtin_classify_type ((type) 0) == 9 \
+ && __builtin_classify_type (__real__ ((type) 0)) == 8))
+# else
+# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
+# endif
/* The tgmath real type for T, where E is 0 if T is an integer type and
1 for a floating type. */
# define __tgmath_real_type_sub(T, E) \
- __typeof__(*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \
- : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
+ __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \
+ : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
/* The tgmath real type of EXPR. */
# define __tgmath_real_type(expr) \
- __tgmath_real_type_sub(__typeof__(expr), __floating_type(__typeof__(expr)))
+ __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0), \
+ __floating_type (__typeof__ (expr)))
/* We have two kinds of generic macros: to support functions which are
only defined on real valued parameters and those which are defined
for complex functions as well. */
# define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
- (__extension__ ({ __tgmath_real_type (Val) __tgmres; \
- if (sizeof (Val) == sizeof (double) \
- || __builtin_classify_type (Val) != 8) \
- __tgmres = Fct (Val); \
- else if (sizeof (Val) == sizeof (float)) \
- __tgmres = Fct##f (Val); \
- else \
- __tgmres = __tgml(Fct) (Val); \
- __tgmres; }))
+ (__extension__ ((sizeof (Val) == sizeof (double) \
+ || __builtin_classify_type (Val) != 8) \
+ ? (__tgmath_real_type (Val)) Fct (Val) \
+ : (sizeof (Val) == sizeof (float)) \
+ ? (__tgmath_real_type (Val)) Fct##f (Val) \
+ : (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
+
+# define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \
+ (__extension__ ((sizeof (Val) == sizeof (double) \
+ || __builtin_classify_type (Val) != 8) \
+ ? (RetType) Fct (Val) \
+ : (sizeof (Val) == sizeof (float)) \
+ ? (RetType) Fct##f (Val) \
+ : (RetType) __tgml(Fct) (Val)))
# define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
- (__extension__ ({ __tgmath_real_type (Val1) __tgmres; \
- if (sizeof (Val1) == sizeof (double) \
- || __builtin_classify_type (Val1) != 8) \
- __tgmres = Fct (Val1, Val2); \
- else if (sizeof (Val1) == sizeof (float)) \
- __tgmres = Fct##f (Val1, Val2); \
- else \
- __tgmres = __tgml(Fct) (Val1, Val2); \
- __tgmres; }))
+ (__extension__ ((sizeof (Val1) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8) \
+ ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (float)) \
+ ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \
+ : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
# define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
- if ((sizeof (Val1) > sizeof (double) \
- || sizeof (Val2) > sizeof (double)) \
- && __builtin_classify_type ((Val1) + (Val2)) == 8) \
- __tgmres = __tgml(Fct) (Val1, Val2); \
- else if (sizeof (Val1) == sizeof (double) \
- || sizeof (Val2) == sizeof (double) \
- || __builtin_classify_type (Val1) != 8 \
- || __builtin_classify_type (Val2) != 8) \
- __tgmres = Fct (Val1, Val2); \
- else \
- __tgmres = Fct##f (Val1, Val2); \
- __tgmres; }))
+ (__extension__ (((sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double)) \
+ && __builtin_classify_type ((Val1) + (Val2)) == 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ __tgml(Fct) (Val1, Val2) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8 \
+ || __builtin_classify_type (Val2) != 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct (Val1, Val2) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct##f (Val1, Val2)))
# define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
- if ((sizeof (Val1) > sizeof (double) \
- || sizeof (Val2) > sizeof (double)) \
- && __builtin_classify_type ((Val1) + (Val2)) == 8) \
- __tgmres = __tgml(Fct) (Val1, Val2, Val3); \
- else if (sizeof (Val1) == sizeof (double) \
- || sizeof (Val2) == sizeof (double) \
- || __builtin_classify_type (Val1) != 8 \
- || __builtin_classify_type (Val2) != 8) \
- __tgmres = Fct (Val1, Val2, Val3); \
- else \
- __tgmres = Fct##f (Val1, Val2, Val3); \
- __tgmres; }))
+ (__extension__ (((sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double)) \
+ && __builtin_classify_type ((Val1) + (Val2)) == 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ __tgml(Fct) (Val1, Val2, Val3) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8 \
+ || __builtin_classify_type (Val2) != 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct (Val1, Val2, Val3) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct##f (Val1, Val2, Val3)))
# define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2) + (Val3)) __tgmres;\
- if ((sizeof (Val1) > sizeof (double) \
- || sizeof (Val2) > sizeof (double) \
- || sizeof (Val3) > sizeof (double)) \
- && __builtin_classify_type ((Val1) + (Val2) \
- + (Val3)) == 8) \
- __tgmres = __tgml(Fct) (Val1, Val2, Val3); \
- else if (sizeof (Val1) == sizeof (double) \
- || sizeof (Val2) == sizeof (double) \
- || sizeof (Val3) == sizeof (double) \
- || __builtin_classify_type (Val1) != 8 \
- || __builtin_classify_type (Val2) != 8 \
- || __builtin_classify_type (Val3) != 8) \
- __tgmres = Fct (Val1, Val2, Val3); \
- else \
- __tgmres = Fct##f (Val1, Val2, Val3); \
- __tgmres; }))
+ (__extension__ (((sizeof (Val1) > sizeof (double) \
+ || sizeof (Val2) > sizeof (double) \
+ || sizeof (Val3) > sizeof (double)) \
+ && __builtin_classify_type ((Val1) + (Val2) + (Val3)) \
+ == 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0 \
+ + (__tgmath_real_type (Val3)) 0)) \
+ __tgml(Fct) (Val1, Val2, Val3) \
+ : (sizeof (Val1) == sizeof (double) \
+ || sizeof (Val2) == sizeof (double) \
+ || sizeof (Val3) == sizeof (double) \
+ || __builtin_classify_type (Val1) != 8 \
+ || __builtin_classify_type (Val2) != 8 \
+ || __builtin_classify_type (Val3) != 8) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0 \
+ + (__tgmath_real_type (Val3)) 0)) \
+ Fct (Val1, Val2, Val3) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0 \
+ + (__tgmath_real_type (Val3)) 0)) \
+ Fct##f (Val1, Val2, Val3)))
/* XXX This definition has to be changed as soon as the compiler understands
the imaginary keyword. */
# define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
- (__extension__ ({ __tgmath_real_type (Val) __tgmres; \
- if (sizeof (__real__ (Val)) > sizeof (double) \
- && __builtin_classify_type (__real__ (Val)) == 8) \
- { \
- if (sizeof (__real__ (Val)) == sizeof (Val)) \
- __tgmres = __tgml(Fct) (Val); \
- else \
- __tgmres = __tgml(Cfct) (Val); \
- } \
- else if (sizeof (__real__ (Val)) == sizeof (double) \
- || __builtin_classify_type (__real__ (Val)) \
- != 8) \
- { \
- if (sizeof (__real__ (Val)) == sizeof (Val)) \
- __tgmres = Fct (Val); \
- else \
- __tgmres = Cfct (Val); \
- } \
- else \
- { \
- if (sizeof (__real__ (Val)) == sizeof (Val)) \
- __tgmres = Fct##f (Val); \
- else \
- __tgmres = Cfct##f (Val); \
- } \
- __tgmres; }))
+ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
+ || __builtin_classify_type (__real__ (Val)) != 8) \
+ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__tgmath_real_type (Val)) Fct (Val) \
+ : (__tgmath_real_type (Val)) Cfct (Val)) \
+ : (sizeof (__real__ (Val)) == sizeof (float)) \
+ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__tgmath_real_type (Val)) Fct##f (Val) \
+ : (__tgmath_real_type (Val)) Cfct##f (Val)) \
+ : ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__tgmath_real_type (Val)) __tgml(Fct) (Val) \
+ : (__tgmath_real_type (Val)) __tgml(Cfct) (Val))))
+
+# define __TGMATH_UNARY_IMAG(Val, Cfct) \
+ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
+ || __builtin_classify_type (__real__ (Val)) != 8) \
+ ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
+ + _Complex_I)) Cfct (Val) \
+ : (sizeof (__real__ (Val)) == sizeof (float)) \
+ ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
+ + _Complex_I)) Cfct##f (Val) \
+ : (__typeof__ ((__tgmath_real_type (Val)) 0 \
+ + _Complex_I)) __tgml(Cfct) (Val)))
/* XXX This definition has to be changed as soon as the compiler understands
the imaginary keyword. */
-# define __TGMATH_UNARY_IMAG_ONLY(Val, Fct) \
- (__extension__ ({ __tgmath_real_type (Val) __tgmres; \
- if (sizeof (Val) == sizeof (__complex__ double) \
- || __builtin_classify_type (__real__ (Val)) != 8) \
- __tgmres = Fct (Val); \
- else if (sizeof (Val) == sizeof (__complex__ float)) \
- __tgmres = Fct##f (Val); \
- else \
- __tgmres = __tgml(Fct) (Val); \
- __tgmres; }))
+# define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
+ (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
+ || __builtin_classify_type (__real__ (Val)) != 8) \
+ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ Fct (Val) \
+ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ Cfct (Val)) \
+ : (sizeof (__real__ (Val)) == sizeof (float)) \
+ ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ Fct##f (Val) \
+ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ Cfct##f (Val)) \
+ : ((sizeof (__real__ (Val)) == sizeof (Val)) \
+ ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ __tgml(Fct) (Val) \
+ : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
+ __tgml(Cfct) (Val))))
/* XXX This definition has to be changed as soon as the compiler understands
the imaginary keyword. */
# define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
- (__extension__ ({ __tgmath_real_type ((Val1) + (Val2)) __tgmres; \
- if ((sizeof (__real__ (Val1)) > sizeof (double) \
- || sizeof (__real__ (Val2)) > sizeof (double)) \
- && __builtin_classify_type (__real__ (Val1) \
- + __real__ (Val2)) \
- == 8) \
- { \
- if (sizeof (__real__ (Val1)) == sizeof (Val1) \
- && sizeof (__real__ (Val2)) == sizeof (Val2)) \
- __tgmres = __tgml(Fct) (Val1, Val2); \
- else \
- __tgmres = __tgml(Cfct) (Val1, Val2); \
- } \
- else if (sizeof (__real__ (Val1)) == sizeof (double) \
- || sizeof (__real__ (Val2)) == sizeof(double) \
- || (__builtin_classify_type (__real__ (Val1)) \
- != 8) \
- || (__builtin_classify_type (__real__ (Val2)) \
- != 8)) \
- { \
- if (sizeof (__real__ (Val1)) == sizeof (Val1) \
- && sizeof (__real__ (Val2)) == sizeof (Val2)) \
- __tgmres = Fct (Val1, Val2); \
- else \
- __tgmres = Cfct (Val1, Val2); \
- } \
- else \
- { \
- if (sizeof (__real__ (Val1)) == sizeof (Val1) \
- && sizeof (__real__ (Val2)) == sizeof (Val2)) \
- __tgmres = Fct##f (Val1, Val2); \
- else \
- __tgmres = Cfct##f (Val1, Val2); \
- } \
- __tgmres; }))
+ (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double) \
+ || sizeof (__real__ (Val2)) > sizeof (double)) \
+ && __builtin_classify_type (__real__ (Val1) \
+ + __real__ (Val2)) == 8) \
+ ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2)) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ __tgml(Fct) (Val1, Val2) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ __tgml(Cfct) (Val1, Val2)) \
+ : (sizeof (__real__ (Val1)) == sizeof (double) \
+ || sizeof (__real__ (Val2)) == sizeof (double) \
+ || __builtin_classify_type (__real__ (Val1)) != 8 \
+ || __builtin_classify_type (__real__ (Val2)) != 8) \
+ ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2)) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct (Val1, Val2) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Cfct (Val1, Val2)) \
+ : ((sizeof (__real__ (Val1)) == sizeof (Val1) \
+ && sizeof (__real__ (Val2)) == sizeof (Val2)) \
+ ? (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Fct##f (Val1, Val2) \
+ : (__typeof ((__tgmath_real_type (Val1)) 0 \
+ + (__tgmath_real_type (Val2)) 0)) \
+ Cfct##f (Val1, Val2))))
#else
# error "Unsupported compiler; you cannot use <tgmath.h>"
#endif
@@ -317,7 +342,7 @@
#define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
/* Absolute value of X. */
-#define fabs(Val) __TGMATH_UNARY_REAL_IMAG (Val, fabs, cabs)
+#define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
/* Largest integer not greater than X. */
#define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
@@ -345,13 +370,13 @@
/* Round X to nearest integral value according to current rounding
direction. */
-#define lrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, lrint)
-#define llrint(Val) __TGMATH_UNARY_REAL_ONLY (Val, llrint)
+#define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint)
+#define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint)
/* Round X to nearest integral value, rounding halfway cases away from
zero. */
-#define lround(Val) __TGMATH_UNARY_REAL_ONLY (Val, lround)
-#define llround(Val) __TGMATH_UNARY_REAL_ONLY (Val, llround)
+#define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround)
+#define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround)
/* Return X with its signed changed to Y's. */
@@ -376,6 +401,7 @@
/* Return the remainder of integer divison X / Y with infinite precision. */
#define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
+#ifdef __UCLIBC_SUSV3_LEGACY__
/* Return X times (2 to the Nth power). */
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
# define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
@@ -387,9 +413,10 @@
/* Return X times (2 to the Nth power). */
#define scalbln(Val1, Val2) \
__TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
+#endif /* __UCLIBC_SUSV3_LEGACY__ */
/* Return the binary exponent of X, which must be nonzero. */
-#define ilogb(Val) __TGMATH_UNARY_REAL_ONLY (Val, ilogb)
+#define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb)
/* Return positive difference between X and Y. */
@@ -410,21 +437,21 @@
/* Absolute value, conjugates, and projection. */
/* Argument value of Z. */
-#define carg(Val) __TGMATH_UNARY_IMAG_ONLY (Val, carg)
+#define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg)
/* Complex conjugate of Z. */
-#define conj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, conj)
+#define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
/* Projection of Z onto the Riemann sphere. */
-#define cproj(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cproj)
+#define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
/* Decomposing complex values. */
/* Imaginary part of Z. */
-#define cimag(Val) __TGMATH_UNARY_IMAG_ONLY (Val, cimag)
+#define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
/* Real part of Z. */
-#define creal(Val) __TGMATH_UNARY_IMAG_ONLY (Val, creal)
+#define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
#endif /* tgmath.h */
diff --git a/include/time.h b/include/time.h
index f6863ed84..a1dfdea18 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991-1999,2000,2001,2002,2003,2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1991-2003,2006,2009 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
@@ -13,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.23 Date and time <time.h>
@@ -146,10 +144,10 @@ struct tm
#ifdef __UCLIBC_HAS_TM_EXTENSIONS__
#ifdef __USE_BSD
long int tm_gmtoff; /* Seconds east of UTC. */
- __const char *tm_zone; /* Timezone abbreviation. */
+ const char *tm_zone; /* Timezone abbreviation. */
#else
long int __tm_gmtoff; /* Seconds east of UTC. */
- __const char *__tm_zone; /* Timezone abbreviation. */
+ const char *__tm_zone; /* Timezone abbreviation. */
#endif
#endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */
};
@@ -187,6 +185,7 @@ extern clock_t clock (void) __THROW;
/* Return the current time and put it in *TIMER if TIMER is not NULL. */
extern time_t time (time_t *__timer) __THROW;
+libc_hidden_proto(time)
#ifdef __UCLIBC_HAS_FLOATS__
/* Return the difference between TIME1 and TIME0. */
@@ -194,6 +193,10 @@ extern double difftime (time_t __time1, time_t __time0)
__THROW __attribute__ ((__const__));
#endif /* __UCLIBC_HAS_FLOATS__ */
+#ifdef _LIBC
+# define CLOCK_IDFIELD_SIZE 3
+#endif
+
/* Return the `time_t' representation of TP and normalize TP. */
extern time_t mktime (struct tm *__tp) __THROW;
@@ -202,32 +205,36 @@ extern time_t mktime (struct tm *__tp) __THROW;
Write no more than MAXSIZE characters and return the number
of characters written, or 0 if it would exceed MAXSIZE. */
extern size_t strftime (char *__restrict __s, size_t __maxsize,
- __const char *__restrict __format,
- __const struct tm *__restrict __tp) __THROW;
+ const char *__restrict __format,
+ const struct tm *__restrict __tp) __THROW;
__END_NAMESPACE_STD
# ifdef __USE_XOPEN
/* Parse S according to FORMAT and store binary time information in TP.
The return value is a pointer to the first unparsed character in S. */
-extern char *strptime (__const char *__restrict __s,
- __const char *__restrict __fmt, struct tm *__tp)
+extern char *strptime (const char *__restrict __s,
+ const char *__restrict __fmt, struct tm *__tp)
__THROW;
# endif
#ifdef __UCLIBC_HAS_XLOCALE__
-# ifdef __USE_GNU
+# ifdef __USE_XOPEN2K8
/* Similar to the two functions above but take the information from
the provided locale and not the global locale. */
# include <xlocale.h>
extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
- __const char *__restrict __format,
- __const struct tm *__restrict __tp,
+ const char *__restrict __format,
+ const struct tm *__restrict __tp,
__locale_t __loc) __THROW;
+libc_hidden_proto(strftime_l)
+# endif
-extern char *strptime_l (__const char *__restrict __s,
- __const char *__restrict __fmt, struct tm *__tp,
+# ifdef __USE_GNU
+extern char *strptime_l (const char *__restrict __s,
+ const char *__restrict __fmt, struct tm *__tp,
__locale_t __loc) __THROW;
+libc_hidden_proto(strptime_l)
# endif
#endif
@@ -235,32 +242,36 @@ extern char *strptime_l (__const char *__restrict __s,
__BEGIN_NAMESPACE_STD
/* Return the `struct tm' representation of *TIMER
in Universal Coordinated Time (aka Greenwich Mean Time). */
-extern struct tm *gmtime (__const time_t *__timer) __THROW;
+extern struct tm *gmtime (const time_t *__timer) __THROW;
/* Return the `struct tm' representation
of *TIMER in the local timezone. */
-extern struct tm *localtime (__const time_t *__timer) __THROW;
+extern struct tm *localtime (const time_t *__timer) __THROW;
+libc_hidden_proto(localtime)
__END_NAMESPACE_STD
# if defined __USE_POSIX || defined __USE_MISC
/* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */
-extern struct tm *gmtime_r (__const time_t *__restrict __timer,
+extern struct tm *gmtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
/* Return the `struct tm' representation of *TIMER in local time,
using *TP to store the result. */
-extern struct tm *localtime_r (__const time_t *__restrict __timer,
+extern struct tm *localtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
+libc_hidden_proto(localtime_r)
# endif /* POSIX or misc */
__BEGIN_NAMESPACE_STD
/* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
that is the representation of TP in this format. */
-extern char *asctime (__const struct tm *__tp) __THROW;
+extern char *asctime (const struct tm *__tp) __THROW;
+libc_hidden_proto(asctime)
/* Equivalent to `asctime (localtime (timer))'. */
-extern char *ctime (__const time_t *__timer) __THROW;
+extern char *ctime (const time_t *__timer) __THROW;
+libc_hidden_proto(ctime)
__END_NAMESPACE_STD
# if defined __USE_POSIX || defined __USE_MISC
@@ -268,11 +279,12 @@ __END_NAMESPACE_STD
/* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
that is the representation of TP in this format. */
-extern char *asctime_r (__const struct tm *__restrict __tp,
+extern char *asctime_r (const struct tm *__restrict __tp,
char *__restrict __buf) __THROW;
+libc_hidden_proto(asctime_r)
/* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */
-extern char *ctime_r (__const time_t *__restrict __timer,
+extern char *ctime_r (const time_t *__restrict __timer,
char *__restrict __buf) __THROW;
# endif /* POSIX or misc */
@@ -293,6 +305,7 @@ extern char *tzname[2];
/* Set time conversion information from the TZ environment variable.
If TZ is not defined, a locale-dependent default is used. */
extern void tzset (void) __THROW;
+libc_hidden_proto(tzset)
# endif
# if defined __USE_SVID || defined __USE_XOPEN
@@ -303,7 +316,8 @@ extern long int timezone;
# ifdef __USE_SVID
/* Set the system time to *WHEN.
This call is restricted to the superuser. */
-extern int stime (__const time_t *__when) __THROW;
+extern int stime (const time_t *__when) __THROW;
+libc_hidden_proto(stime)
# endif
@@ -334,8 +348,9 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__));
This function is a cancellation point and therefore not marked with
__THROW. */
-extern int nanosleep (__const struct timespec *__requested_time,
+extern int nanosleep (const struct timespec *__requested_time,
struct timespec *__remaining);
+libc_hidden_proto(nanosleep)
/* Get resolution of clock CLOCK_ID. */
@@ -346,24 +361,24 @@ libc_hidden_proto(clock_getres)
extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
/* Set clock CLOCK_ID to value TP. */
-extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
+extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
__THROW;
-#endif /* __UCLIBC_HAS_REALTIME__ */
-#ifdef __UCLIBC_MJN3_ONLY__
-#warning "mjn3 FIXME: a bunch of unimplemented function prototypes."
+# endif /* __UCLIBC_HAS_REALTIME__ */
+
# if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
+# ifdef __UCLIBC_HAS_THREADS_NATIVE__
/* High-resolution sleep with the specified clock.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int clock_nanosleep (clockid_t __clock_id, int __flags,
- __const struct timespec *__req,
+ const struct timespec *__req,
struct timespec *__rem);
/* Return clock ID for CPU-time clock. */
extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
+# endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
# endif
-#endif /* __UCLIBC_MJN3_ONLY__ */
# if defined __UCLIBC_HAS_REALTIME__
/* Create new per-process timer using CLOCK_ID. */
@@ -376,7 +391,7 @@ extern int timer_delete (timer_t __timerid) __THROW;
/* Set timer TIMERID to VALUE, returning old value in OVLAUE. */
extern int timer_settime (timer_t __timerid, int __flags,
- __const struct itimerspec *__restrict __value,
+ const struct itimerspec *__restrict __value,
struct itimerspec *__restrict __ovalue) __THROW;
/* Get current value of timer TIMERID and store it in VLAUE. */
@@ -412,7 +427,7 @@ extern int getdate_err;
This function is a possible cancellation points and therefore not
marked with __THROW. */
-extern struct tm *getdate (__const char *__string);
+extern struct tm *getdate (const char *__string);
# endif
# ifdef __USE_GNU
@@ -426,20 +441,13 @@ extern struct tm *getdate (__const char *__string);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int getdate_r (__const char *__restrict __string,
+extern int getdate_r (const char *__restrict __string,
struct tm *__restrict __resbufp);
# endif
#endif /* __UCLIBC_MJN3_ONLY__ */
__END_DECLS
-
-#ifdef UCLIBC_INTERNAL
-/* Experiment. Grep for 'libc_hidden_proto(time)' if need to revert */
-libc_hidden_proto(time)
-#endif
-
-
#endif /* <time.h> included. */
#endif /* <time.h> not already included. */
diff --git a/include/tls.h b/include/tls.h
new file mode 100644
index 000000000..f88af405b
--- /dev/null
+++ b/include/tls.h
@@ -0,0 +1,19 @@
+/* This file defines USE___THREAD to 1 or 0 to cut down on the #if mess. */
+
+#ifndef _include_tls_h
+#define _include_tls_h 1
+
+#include_next <tls.h>
+
+#if defined USE_TLS && USE_TLS && HAVE___THREAD \
+ && (!defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt)
+
+# define USE___THREAD 1
+
+#else
+
+# define USE___THREAD 0
+
+#endif
+
+#endif
diff --git a/include/ttyent.h b/include/ttyent.h
index 0b221bccf..63df44921 100644
--- a/include/ttyent.h
+++ b/include/ttyent.h
@@ -48,7 +48,7 @@ struct ttyent {
#define TTY_ON 0x01 /* enable logins (start ty_getty program) */
#define TTY_SECURE 0x02 /* allow uid of 0 to login */
int ty_status; /* status flags */
- char *ty_window; /* command to start up window manager */
+ char *ty_window; /* command to start up window manager */
char *ty_comment; /* comment field */
};
@@ -56,9 +56,12 @@ struct ttyent {
__BEGIN_DECLS
extern struct ttyent *getttyent (void) __THROW;
-extern struct ttyent *getttynam (__const char *__tty) __THROW;
+libc_hidden_proto(getttyent)
+extern struct ttyent *getttynam (const char *__tty) __THROW;
extern int setttyent (void) __THROW;
+libc_hidden_proto(setttyent)
extern int endttyent (void) __THROW;
+libc_hidden_proto(endttyent)
__END_DECLS
diff --git a/include/ucontext.h b/include/ucontext.h
index 5bd46454e..4ce114ef1 100644
--- a/include/ucontext.h
+++ b/include/ucontext.h
@@ -12,21 +12,46 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* The System V ABI user-level context switching support functions
+ are marked obsolescent by SuSv3. */
#ifndef _UCONTEXT_H
#define _UCONTEXT_H 1
#include <features.h>
+#ifdef __UCLIBC_HAS_CONTEXT_FUNCS__
+
/* Get machine dependent definition of data structures. */
#include <sys/ucontext.h>
-/* The System V ABI user-level context switching support functions
- * are marked obsolescent by SuSv3, and are not implemented by
- * uClibc. This header is therefore empty. */
+__BEGIN_DECLS
+
+/* Get user context and store it in variable pointed to by UCP. */
+extern int getcontext (ucontext_t *__ucp) __THROWNL;
+
+/* Set user context from information of variable pointed to by UCP. */
+extern int setcontext (const ucontext_t *__ucp) __THROWNL;
+
+/* Save current context in context variable pointed to by OUCP and set
+ context from variable pointed to by UCP. */
+extern int swapcontext (ucontext_t *__restrict __oucp,
+ const ucontext_t *__restrict __ucp) __THROWNL;
+
+/* Manipulate user context UCP to continue with calling functions FUNC
+ and the ARGC-1 parameters following ARGC when the context is used
+ the next time in `setcontext' or `swapcontext'.
+
+ We cannot say anything about the parameters FUNC takes; `void'
+ is as good as any other choice. */
+extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
+ int __argc, ...) __THROW;
+
+__END_DECLS
+#endif
#endif /* ucontext.h */
diff --git a/include/ulimit.h b/include/ulimit.h
index 93b5f3796..15134ed92 100644
--- a/include/ulimit.h
+++ b/include/ulimit.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _ULIMIT_H
#define _ULIMIT_H 1
diff --git a/include/unistd.h b/include/unistd.h
index 164f28909..8e4daf687 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2006, 2007, 2008, 2009 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
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 2.10 Symbolic Constants <unistd.h>
@@ -30,33 +29,67 @@ __BEGIN_DECLS
/* These may be used to determine what facilities are present at compile time.
Their values can be obtained at run time from `sysconf'. */
+#ifdef __USE_XOPEN2K8
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008. */
+# define _POSIX_VERSION 200809L
+#elif defined __USE_XOPEN2K
/* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */
-#define _POSIX_VERSION 200112L
+# define _POSIX_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995. */
+# define _POSIX_VERSION 199506L
+#elif defined __USE_POSIX199309
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993. */
+# define _POSIX_VERSION 199309L
+#else
+/* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990. */
+# define _POSIX_VERSION 199009L
+#endif
/* These are not #ifdef __USE_POSIX2 because they are
in the theoretically application-owned namespace. */
+#ifdef __USE_XOPEN2K8
+# define __POSIX2_THIS_VERSION 200809L
+/* The utilities on GNU systems also correspond to this version. */
+#elif defined __USE_XOPEN2K
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 200112L
+#elif defined __USE_POSIX199506
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199506L
+#else
+/* The utilities on GNU systems also correspond to this version. */
+# define __POSIX2_THIS_VERSION 199209L
+#endif
+
/* The utilities on GNU systems also correspond to this version. */
-#define _POSIX2_VERSION 200112L
+#define _POSIX2_VERSION __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Bindings Option. */
-#define _POSIX2_C_BIND 200112L
+#define _POSIX2_C_BIND __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
C Language Development Utilities Option. */
-#define _POSIX2_C_DEV 200112L
+#define _POSIX2_C_DEV __POSIX2_THIS_VERSION
/* If defined, the implementation supports the
Software Development Utilities Option. */
-#define _POSIX2_SW_DEV 200112L
+#define _POSIX2_SW_DEV __POSIX2_THIS_VERSION
+#if 0 /* uClibc does not provide the utility */
/* If defined, the implementation supports the
creation of locales with the localedef utility. */
-#define _POSIX2_LOCALEDEF 200112L
+#define _POSIX2_LOCALEDEF __POSIX2_THIS_VERSION
+#endif
/* X/Open version number to which the library conforms. It is selectable. */
-#ifdef __USE_UNIX98
+#ifdef __USE_XOPEN2K8
+# define _XOPEN_VERSION 700
+#elif defined __USE_XOPEN2K
+# define _XOPEN_VERSION 600
+#elif defined __USE_UNIX98
# define _XOPEN_VERSION 500
#else
# define _XOPEN_VERSION 4
@@ -169,9 +202,11 @@ __BEGIN_DECLS
*/
#include <bits/posix_opt.h>
+/* keep it after posix_opt.h, it overwrites based on uClibc's config options */
+#include <bits/uClibc_posix_opt.h>
/* Get the environment definitions from Unix98. */
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
# include <bits/environments.h>
#endif
@@ -231,7 +266,7 @@ typedef __pid_t pid_t;
# endif
#endif /* X/Open */
-#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __intptr_t_defined
typedef __intptr_t intptr_t;
# define __intptr_t_defined
@@ -253,16 +288,16 @@ typedef __socklen_t socklen_t;
#define F_OK 0 /* Test for existence. */
/* Test for access to NAME using the real UID and real GID. */
-extern int access (__const char *__name, int __type) __THROW __nonnull ((1));
+extern int access (const char *__name, int __type) __THROW __nonnull ((1));
-#if 0 /*def __USE_GNU*/
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
/* Test for access to NAME using the effective UID and GID
(as normal file operations use). */
-extern int euidaccess (__const char *__name, int __type)
+extern int euidaccess (const char *__name, int __type)
__THROW __nonnull ((1));
/* An alias for `euidaccess', used by some other systems. */
-extern int eaccess (__const char *__name, int __type)
+extern int eaccess (const char *__name, int __type)
__THROW __nonnull ((1));
#endif
@@ -270,8 +305,9 @@ extern int eaccess (__const char *__name, int __type)
/* Test for access to FILE relative to the directory FD is open on.
If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess',
otherwise use real IDs like `access'. */
-extern int faccessat (int __fd, __const char *__file, int __type, int __flag)
+extern int faccessat (int __fd, const char *__file, int __type, int __flag)
__THROW __nonnull ((2)) __wur;
+libc_hidden_proto(faccessat)
#endif /* Use GNU. */
@@ -297,6 +333,10 @@ extern int faccessat (int __fd, __const char *__file, int __type, int __flag)
Return the new file position. */
#ifndef __USE_FILE_OFFSET64
extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
+# ifdef _LIBC
+extern __typeof(lseek) __lseek_nocancel attribute_hidden;
+libc_hidden_proto(lseek)
+# endif
#else
# ifdef __REDIRECT_NTH
extern __off64_t __REDIRECT_NTH (lseek,
@@ -309,6 +349,10 @@ extern __off64_t __REDIRECT_NTH (lseek,
#ifdef __USE_LARGEFILE64
extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
__THROW;
+# ifdef _LIBC
+extern __typeof(lseek64) __lseek64_nocancel attribute_hidden;
+libc_hidden_proto(lseek64)
+# endif
#endif
/* Close the file descriptor FD.
@@ -316,6 +360,11 @@ extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
This function is a cancellation point and therefore not marked with
__THROW. */
extern int close (int __fd);
+#ifdef _LIBC
+extern __typeof(close) __close_nocancel attribute_hidden;
+extern void __close_nocancel_no_status(int) attribute_hidden;
+libc_hidden_proto(close)
+#endif
/* Read NBYTES into BUF from FD. Return the
number read, -1 for errors or 0 for EOF.
@@ -323,14 +372,22 @@ extern int close (int __fd);
This function is a cancellation point and therefore not marked with
__THROW. */
extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;
+#ifdef _LIBC
+extern __typeof(read) __read_nocancel attribute_hidden;
+libc_hidden_proto(read)
+#endif
/* Write N bytes of BUF to FD. Return the number written, or -1.
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t write (int __fd, __const void *__buf, size_t __n) __wur;
+extern ssize_t write (int __fd, const void *__buf, size_t __n) __wur;
+#ifdef _LIBC
+extern __typeof(write) __write_nocancel attribute_hidden;
+libc_hidden_proto(write)
+#endif
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
# ifndef __USE_FILE_OFFSET64
/* Read NBYTES into BUF from FD at the given position OFFSET without
changing the file pointer. Return the number read, -1 for errors
@@ -346,14 +403,14 @@ extern ssize_t pread (int __fd, void *__buf, size_t __nbytes,
This function is a cancellation point and therefore not marked with
__THROW. */
-extern ssize_t pwrite (int __fd, __const void *__buf, size_t __n,
+extern ssize_t pwrite (int __fd, const void *__buf, size_t __n,
__off_t __offset) __wur;
# else
# ifdef __REDIRECT
extern ssize_t __REDIRECT (pread, (int __fd, void *__buf, size_t __nbytes,
__off64_t __offset),
pread64) __wur;
-extern ssize_t __REDIRECT (pwrite, (int __fd, __const void *__buf,
+extern ssize_t __REDIRECT (pwrite, (int __fd, const void *__buf,
size_t __nbytes, __off64_t __offset),
pwrite64) __wur;
# else
@@ -370,7 +427,7 @@ extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
__off64_t __offset) __wur;
/* Write N bytes of BUF to FD at the given position OFFSET without
changing the file pointer. Return the number written, or -1. */
-extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
+extern ssize_t pwrite64 (int __fd, const void *__buf, size_t __n,
__off64_t __offset) __wur;
# endif
#endif
@@ -380,6 +437,14 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n,
bytes written on PIPEDES[1] can be read from PIPEDES[0].
Returns 0 if successful, -1 if not. */
extern int pipe (int __pipedes[2]) __THROW __wur;
+libc_hidden_proto(pipe)
+
+#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
+/* Same as pipe but apply flags passed in FLAGS to the new file
+ descriptors. */
+extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur;
+libc_hidden_proto(pipe2)
+#endif
/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM.
If SECONDS is zero, any currently scheduled alarm will be cancelled.
@@ -389,6 +454,7 @@ extern int pipe (int __pipedes[2]) __THROW __wur;
to 0 and check its value after calling `alarm', and this might tell you.
The signal may come late due to processor scheduling. */
extern unsigned int alarm (unsigned int __seconds) __THROW;
+libc_hidden_proto(alarm)
/* Make the process sleep for SECONDS seconds, or until a signal arrives
and is not ignored. The function returns the number of seconds less
@@ -401,8 +467,11 @@ extern unsigned int alarm (unsigned int __seconds) __THROW;
This function is a cancellation point and therefore not marked with
__THROW. */
extern unsigned int sleep (unsigned int __seconds);
+libc_hidden_proto(sleep)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if (defined __USE_BSD \
+ || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
+ ) && defined __UCLIBC_SUSV3_LEGACY__
/* Set an alarm to go off (generating a SIGALRM signal) in VALUE
microseconds. If INTERVAL is nonzero, when the alarm goes off, the
timer is reset to go off every INTERVAL microseconds thereafter.
@@ -428,17 +497,18 @@ extern int pause (void);
/* Change the owner and group of FILE. */
-extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
+extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(chown)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the owner and group of the file that FD is open on. */
extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
/* Change owner and group of FILE, if it is a symbolic
link the ownership of the symbolic link is changed. */
-extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
+extern int lchown (const char *__file, __uid_t __owner, __gid_t __group)
__THROW __nonnull ((1)) __wur;
#endif /* Use BSD || X/Open Unix. */
@@ -446,17 +516,20 @@ extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
#ifdef __USE_ATFILE
/* Change the owner and group of FILE relative to the directory FD is open
on. */
-extern int fchownat (int __fd, __const char *__file, __uid_t __owner,
+extern int fchownat (int __fd, const char *__file, __uid_t __owner,
__gid_t __group, int __flag)
__THROW __nonnull ((2)) __wur;
+libc_hidden_proto(fchownat)
#endif /* Use GNU. */
/* Change the process's working directory to PATH. */
-extern int chdir (__const char *__path) __THROW __nonnull ((1)) __wur;
+extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur;
+libc_hidden_proto(chdir)
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Change the process's working directory to the one FD is open on. */
extern int fchdir (int __fd) __THROW __wur;
+libc_hidden_proto(fchdir)
#endif
/* Get the pathname of the current working directory,
@@ -467,6 +540,7 @@ extern int fchdir (int __fd) __THROW __wur;
bytes long, unless SIZE == 0, in which case it is as
big as necessary. */
extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
+libc_hidden_proto(getcwd)
#ifdef __USE_GNU
/* Return a malloc'd string containing the current directory name.
@@ -475,7 +549,7 @@ extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
extern char *get_current_dir_name (void) __THROW;
#endif
-#if 0 /*defined __USE_BSD || defined __USE_XOPEN_EXTENDED*/
+#if 0 /*defined __USE_BSD || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)*/
/* Put the absolute pathname of the current working directory in BUF.
If successful, return BUF. If not, put an error message in
BUF and return NULL. BUF should be at least PATH_MAX bytes long. */
@@ -489,6 +563,14 @@ extern int dup (int __fd) __THROW __wur;
/* Duplicate FD to FD2, closing FD2 and making it open on the same file. */
extern int dup2 (int __fd, int __fd2) __THROW;
+libc_hidden_proto(dup2)
+
+#ifdef __USE_GNU
+/* Duplicate FD to FD2, closing FD2 and making it open on the same
+ file while setting flags according to FLAGS. */
+extern int dup3 (int __fd, int __fd2, int __flags) __THROW;
+libc_hidden_proto(dup3)
+#endif
/* NULL-terminated array of "NAME=VALUE" environment variables. */
extern char **__environ;
@@ -499,41 +581,56 @@ extern char **environ;
/* Replace the current process, executing PATH with arguments ARGV and
environment ENVP. ARGV and ENVP are terminated by NULL pointers. */
-extern int execve (__const char *__path, char *__const __argv[],
- char *__const __envp[]) __THROW __nonnull ((1));
+extern int execve (const char *__path, char *const __argv[],
+ char *const __envp[]) __THROW __nonnull ((1, 2));
+libc_hidden_proto(execve)
-#if 0 /*def __USE_GNU*/
+#if 0 /*def __USE_XOPEN2K8*/
/* Execute the file FD refers to, overlaying the running program image.
ARGV and ENVP are passed to the new program, as for `execve'. */
-extern int fexecve (int __fd, char *__const __argv[], char *__const __envp[])
- __THROW;
+extern int fexecve (int __fd, char *const __argv[], char *const __envp[])
+ __THROW __nonnull ((2));
#endif
/* Execute PATH with arguments ARGV and environment from `environ'. */
-extern int execv (__const char *__path, char *__const __argv[])
- __THROW __nonnull ((1));
+extern int execv (const char *__path, char *const __argv[])
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execv)
/* Execute PATH with all arguments after PATH until a NULL pointer,
and the argument after that for environment. */
-extern int execle (__const char *__path, __const char *__arg, ...)
- __THROW __nonnull ((1));
+extern int execle (const char *__path, const char *__arg, ...)
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execle)
/* Execute PATH with all arguments after PATH until
a NULL pointer and environment from `environ'. */
-extern int execl (__const char *__path, __const char *__arg, ...)
- __THROW __nonnull ((1));
+extern int execl (const char *__path, const char *__arg, ...)
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execl)
/* Execute FILE, searching in the `PATH' environment variable if it contains
no slashes, with arguments ARGV and environment from `environ'. */
-extern int execvp (__const char *__file, char *__const __argv[])
- __THROW __nonnull ((1));
+extern int execvp (const char *__file, char *const __argv[])
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execvp)
/* Execute FILE, searching in the `PATH' environment variable if
it contains no slashes, with all arguments after FILE until a
NULL pointer and environment from `environ'. */
-extern int execlp (__const char *__file, __const char *__arg, ...)
- __THROW __nonnull ((1));
+extern int execlp (const char *__file, const char *__arg, ...)
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execlp)
+
+#ifdef __USE_GNU
+/* Execute FILE, searching in the `PATH' environment variable if it contains
+ no slashes, with arguments ARGV and environment from a pointer */
+extern int execvpe (const char *__file, char *const __argv[],
+ char *const __envp[])
+ __THROW __nonnull ((1, 2));
+libc_hidden_proto(execvpe)
+#endif
#if defined __USE_MISC || defined __USE_XOPEN
@@ -544,6 +641,7 @@ extern int nice (int __inc) __THROW __wur;
/* Terminate program execution with the low-order 8 bits of STATUS. */
extern void _exit (int __status) __attribute__ ((__noreturn__));
+libc_hidden_proto(_exit)
/* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf';
@@ -552,7 +650,7 @@ extern void _exit (int __status) __attribute__ ((__noreturn__));
#include <bits/confname.h>
/* Get file-specific configuration information about PATH. */
-extern long int pathconf (__const char *__path, int __name)
+extern long int pathconf (const char *__path, int __name)
__THROW __nonnull ((1));
/* Get file-specific configuration about descriptor FD. */
@@ -560,6 +658,7 @@ extern long int fpathconf (int __fd, int __name) __THROW;
/* Get the value of the system variable NAME. */
extern long int sysconf (int __name) __THROW;
+libc_hidden_proto(sysconf)
#ifdef __USE_POSIX2
/* Get the value of the string-valued system variable NAME. */
@@ -569,6 +668,7 @@ extern size_t confstr (int __name, char *__buf, size_t __len) __THROW;
/* Get the process ID of the calling process. */
extern __pid_t getpid (void) __THROW;
+libc_hidden_proto(getpid)
/* Get the process ID of the calling process's parent. */
extern __pid_t getppid (void) __THROW;
@@ -587,7 +687,7 @@ extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
/* Get the process group ID of process PID. */
extern __pid_t __getpgid (__pid_t __pid) __THROW;
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
extern __pid_t getpgid (__pid_t __pid) __THROW;
#endif
@@ -596,6 +696,7 @@ extern __pid_t getpgid (__pid_t __pid) __THROW;
If PID is zero, the current process's process group ID is set.
If PGID is zero, the process ID of the process is used. */
extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
+libc_hidden_proto(setpgid)
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Both System V and BSD have `setpgrp' functions, but with different
@@ -630,28 +731,35 @@ extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
The process group IDs of the session and the calling process
are set to the process ID of the calling process, which is returned. */
extern __pid_t setsid (void) __THROW;
+libc_hidden_proto(setsid)
-#ifdef __USE_XOPEN_EXTENDED
+#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
/* Return the session ID of the given process. */
extern __pid_t getsid (__pid_t __pid) __THROW;
+libc_hidden_proto(getsid)
#endif
/* Get the real user ID of the calling process. */
extern __uid_t getuid (void) __THROW;
+libc_hidden_proto(getuid)
/* Get the effective user ID of the calling process. */
extern __uid_t geteuid (void) __THROW;
+libc_hidden_proto(geteuid)
/* Get the real group ID of the calling process. */
extern __gid_t getgid (void) __THROW;
+libc_hidden_proto(getgid)
/* Get the effective group ID of the calling process. */
extern __gid_t getegid (void) __THROW;
+libc_hidden_proto(getegid)
/* If SIZE is zero, return the number of supplementary groups
the calling process is in. Otherwise, fill in the group IDs
of its supplementary groups in LIST and return the number written. */
extern int getgroups (int __size, __gid_t __list[]) __THROW __wur;
+libc_hidden_proto(getgroups)
#if 0 /*def __USE_GNU*/
/* Return nonzero iff the calling process is in group GID. */
@@ -662,34 +770,37 @@ extern int group_member (__gid_t __gid) __THROW;
If the calling process is the super-user, set the real
and effective user IDs, and the saved set-user-ID to UID;
if not, the effective user ID is set to UID. */
-extern int setuid (__uid_t __uid) __THROW;
+extern int setuid (__uid_t __uid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real user ID of the calling process to RUID,
and the effective user ID of the calling process to EUID. */
-extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur;
+libc_hidden_proto(setreuid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective user ID of the calling process to UID. */
-extern int seteuid (__uid_t __uid) __THROW;
-#endif /* Use BSD. */
+extern int seteuid (__uid_t __uid) __THROW __wur;
+libc_hidden_proto(seteuid)
+#endif
/* Set the group ID of the calling process to GID.
If the calling process is the super-user, set the real
and effective group IDs, and the saved set-group-ID to GID;
if not, the effective group ID is set to GID. */
-extern int setgid (__gid_t __gid) __THROW;
+extern int setgid (__gid_t __gid) __THROW __wur;
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Set the real group ID of the calling process to RGID,
and the effective group ID of the calling process to EGID. */
-extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
+extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur;
+libc_hidden_proto(setregid)
#endif
#if defined __USE_BSD || defined __USE_XOPEN2K
/* Set the effective group ID of the calling process to GID. */
-extern int setegid (__gid_t __gid) __THROW;
+extern int setegid (__gid_t __gid) __THROW __wur;
#endif /* Use BSD. */
#ifdef __USE_GNU
@@ -707,13 +818,15 @@ extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
- __THROW;
+ __THROW __wur;
+libc_hidden_proto(setresuid)
#endif
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
- __THROW;
+ __THROW __wur;
+libc_hidden_proto(setresgid)
#endif
@@ -721,7 +834,13 @@ extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
/* Clone the calling process, creating an exact copy.
Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
-extern __pid_t fork (void) __THROW;
+extern __pid_t fork (void) __THROWNL;
+# ifdef _LIBC
+# ifdef __UCLIBC_HAS_THREADS__
+extern __typeof(fork) __libc_fork;
+# endif
+libc_hidden_proto(fork)
+# endif
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
@@ -730,8 +849,13 @@ extern __pid_t fork (void) __THROW;
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
and the process ID of the new process to the old process. */
extern __pid_t vfork (void) __THROW;
+libc_hidden_proto(vfork)
#endif /* Use BSD. */
+#if 0 /* psm: seems unused , exit-thread.S is not compiled */
+/* Special exit function which only terminates the current thread. */
+extern void __exit_thread (int val) __attribute__ ((__noreturn__));
+#endif
/* Return the pathname of the terminal FD is open on, or NULL on errors.
The returned storage is good only until the next call to this function. */
@@ -741,10 +865,12 @@ extern char *ttyname (int __fd) __THROW;
open on in BUF. Return 0 on success, otherwise an error number. */
extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
__THROW __nonnull ((2)) __wur;
+libc_hidden_proto(ttyname_r)
/* Return 1 if FD is a valid descriptor associated
with a terminal, zero if not. */
extern int isatty (int __fd) __THROW;
+libc_hidden_proto(isatty)
#if 0 /*defined __USE_BSD \
|| (defined __USE_XOPEN_EXTENDED && !defined __USE_UNIX98)*/
@@ -755,56 +881,64 @@ extern int ttyslot (void) __THROW;
/* Make a link to FROM named TO. */
-extern int link (__const char *__from, __const char *__to)
+extern int link (const char *__from, const char *__to)
__THROW __nonnull ((1, 2)) __wur;
#ifdef __USE_ATFILE
/* Like link but relative paths in TO and FROM are interpreted relative
to FROMFD and TOFD respectively. */
-extern int linkat (int __fromfd, __const char *__from, int __tofd,
- __const char *__to, int __flags)
+extern int linkat (int __fromfd, const char *__from, int __tofd,
+ const char *__to, int __flags)
__THROW __nonnull ((2, 4)) __wur;
+libc_hidden_proto(linkat)
#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
/* Make a symbolic link to FROM named TO. */
-extern int symlink (__const char *__from, __const char *__to)
+extern int symlink (const char *__from, const char *__to)
__THROW __nonnull ((1, 2)) __wur;
/* Read the contents of the symbolic link PATH into no more than
LEN bytes of BUF. The contents are not null-terminated.
Returns the number of characters read, or -1 for errors. */
-extern ssize_t readlink (__const char *__restrict __path,
+extern ssize_t readlink (const char *__restrict __path,
char *__restrict __buf, size_t __len)
__THROW __nonnull ((1, 2)) __wur;
-#endif /* Use BSD. */
+libc_hidden_proto(readlink)
+#endif /* Use POSIX.1-2001. */
#ifdef __USE_ATFILE
/* Like symlink but a relative path in TO is interpreted relative to TOFD. */
-extern int symlinkat (__const char *__from, int __tofd,
- __const char *__to) __THROW __nonnull ((1, 3)) __wur;
+extern int symlinkat (const char *__from, int __tofd,
+ const char *__to) __THROW __nonnull ((1, 3)) __wur;
+libc_hidden_proto(symlinkat)
/* Like readlink but a relative PATH is interpreted relative to FD. */
-extern ssize_t readlinkat (int __fd, __const char *__restrict __path,
+extern ssize_t readlinkat (int __fd, const char *__restrict __path,
char *__restrict __buf, size_t __len)
__THROW __nonnull ((2, 3)) __wur;
+libc_hidden_proto(readlinkat)
#endif
/* Remove the link NAME. */
-extern int unlink (__const char *__name) __THROW __nonnull ((1));
+extern int unlink (const char *__name) __THROW __nonnull ((1));
+libc_hidden_proto(unlink)
#ifdef __USE_ATFILE
/* Remove the link NAME relative to FD. */
-extern int unlinkat (int __fd, __const char *__name, int __flag)
+extern int unlinkat (int __fd, const char *__name, int __flag)
__THROW __nonnull ((2));
+libc_hidden_proto(unlinkat)
#endif
/* Remove the directory PATH. */
-extern int rmdir (__const char *__path) __THROW __nonnull ((1));
+extern int rmdir (const char *__path) __THROW __nonnull ((1));
+libc_hidden_proto(rmdir)
/* Return the foreground process group ID of FD. */
extern __pid_t tcgetpgrp (int __fd) __THROW;
+libc_hidden_proto(tcgetpgrp)
/* Set the foreground process group ID of FD set PGRP_ID. */
extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
@@ -812,22 +946,23 @@ extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
/* Return the login name of the user.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern char *getlogin (void);
+libc_hidden_proto(getlogin)
#if defined __USE_REENTRANT || defined __USE_POSIX199506
/* Return at most NAME_LEN characters of the login name of the user in NAME.
If it cannot be determined or some other error occurred, return the error
code. Otherwise return 0.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int getlogin_r (char *__name, size_t __name_len) __nonnull ((1));
#endif
#if 0 /*def __USE_BSD*/
/* Set the login name returned by `getlogin'. */
-extern int setlogin (__const char *__name) __THROW __nonnull ((1));
+extern int setlogin (const char *__name) __THROW __nonnull ((1));
#endif
@@ -841,42 +976,50 @@ extern int setlogin (__const char *__name) __THROW __nonnull ((1));
#endif
-#if defined __USE_BSD || defined __USE_UNIX98
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Put the name of the current host in no more than LEN bytes of NAME.
The result is null-terminated if LEN is large enough for the full
name and the terminator. */
extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1));
+libc_hidden_proto(gethostname)
#endif
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
/* Set the name of the current host to NAME, which is LEN bytes long.
This call is restricted to the super-user. */
-extern int sethostname (__const char *__name, size_t __len)
+extern int sethostname (const char *__name, size_t __len)
__THROW __nonnull ((1)) __wur;
/* Set the current machine's Internet number to ID.
This call is restricted to the super-user. */
extern int sethostid (long int __id) __THROW __wur;
-#if defined __UCLIBC_BSD_SPECIFIC__
+
+#if defined __UCLIBC_BSD_SPECIFIC__ || defined _LIBC
/* Get and set the NIS (aka YP) domain name, if any.
Called just like `gethostname' and `sethostname'.
The NIS domain name is usually the empty string when not using NIS. */
extern int getdomainname (char *__name, size_t __len)
__THROW __nonnull ((1)) __wur;
-extern int setdomainname (__const char *__name, size_t __len)
+libc_hidden_proto(getdomainname)
+#endif
+#if defined __UCLIBC_BSD_SPECIFIC__
+extern int setdomainname (const char *__name, size_t __len)
__THROW __nonnull ((1)) __wur;
#endif
+
+#if defined __UCLIBC_LINUX_SPECIFIC__
/* Revoke access permissions to all processes currently communicating
with the control terminal, and then send a SIGHUP signal to the process
group of the control terminal. */
extern int vhangup (void) __THROW;
+#endif
#if 0
/* Revoke the access of all descriptors currently open on FILE. */
-extern int revoke (__const char *__file) __THROW __nonnull ((1)) __wur;
+extern int revoke (const char *__file) __THROW __nonnull ((1)) __wur;
/* Enable statistical profiling, writing samples of the PC into at most
@@ -893,43 +1036,48 @@ extern int profil (unsigned short int *__sample_buffer, size_t __size,
/* Turn accounting on if NAME is an existing file. The system will then write
a record for each process as it terminates, to this file. If NAME is NULL,
turn accounting off. This call is restricted to the super-user. */
-extern int acct (__const char *__name) __THROW;
+extern int acct (const char *__name) __THROW;
/* Successive calls return the shells listed in `/etc/shells'. */
extern char *getusershell (void) __THROW;
extern void endusershell (void) __THROW; /* Discard cached info. */
+libc_hidden_proto(endusershell)
extern void setusershell (void) __THROW; /* Rewind and re-read the file. */
+libc_hidden_proto(setusershell)
-#ifdef __ARCH_USE_MMU__
/* Put the program in the background, and dissociate from the controlling
terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero,
redirects stdin, stdout, and stderr to /dev/null. */
extern int daemon (int __nochdir, int __noclose) __THROW __wur;
-#endif
#endif /* Use BSD || X/Open. */
#if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
/* Make PATH be the root directory (the starting point for absolute paths).
This call is restricted to the super-user. */
-extern int chroot (__const char *__path) __THROW __nonnull ((1)) __wur;
+extern int chroot (const char *__path) __THROW __nonnull ((1)) __wur;
/* Prompt with PROMPT and read a string from the terminal without echoing.
Uses /dev/tty if possible; otherwise stderr and stdin. */
-extern char *getpass (__const char *__prompt) __nonnull ((1));
+extern char *getpass (const char *__prompt) __nonnull ((1));
#endif /* Use BSD || X/Open. */
-#if defined __USE_BSD || defined __USE_XOPEN
+#if defined __USE_BSD || defined __USE_XOPEN || defined __USE_XOPEN2K
/* Make all changes done to FD actually appear on disk.
This function is a cancellation point and therefore not marked with
__THROW. */
extern int fsync (int __fd);
-#endif /* Use BSD || X/Open. */
+#endif /* Use BSD || X/Open || Unix98. */
+#if defined __USE_GNU
+/* Make all changes done to all files on the file system associated
+ * with FD actually appear on disk. */
+extern int syncfs (int __fd) __THROW;
+#endif
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
@@ -943,29 +1091,33 @@ extern void sync (void) __THROW;
/* Return the number of bytes in a page. This is the system's page size,
which is not necessarily the same as the hardware page size. */
extern int getpagesize (void) __THROW __attribute__ ((__const__));
+libc_hidden_proto(getpagesize)
/* Return the maximum number of file descriptors
the current process could possibly have. */
extern int getdtablesize (void) __THROW;
+libc_hidden_proto(getdtablesize)
/* Truncate FILE to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
-extern int truncate (__const char *__file, __off_t __length)
+extern int truncate (const char *__file, __off_t __length)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(truncate)
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (truncate,
- (__const char *__file, __off64_t __length),
+ (const char *__file, __off64_t __length),
truncate64) __nonnull ((1)) __wur;
# else
# define truncate truncate64
# endif
# endif
# ifdef __USE_LARGEFILE64
-extern int truncate64 (__const char *__file, __off64_t __length)
+extern int truncate64 (const char *__file, __off64_t __length)
__THROW __nonnull ((1)) __wur;
+libc_hidden_proto(truncate64)
# endif
#endif /* Use BSD || X/Open Unix. */
@@ -975,6 +1127,7 @@ extern int truncate64 (__const char *__file, __off64_t __length)
/* Truncate the file FD is open on to LENGTH bytes. */
# ifndef __USE_FILE_OFFSET64
extern int ftruncate (int __fd, __off_t __length) __THROW __wur;
+libc_hidden_proto(ftruncate)
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length),
@@ -985,6 +1138,7 @@ extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length),
# endif
# ifdef __USE_LARGEFILE64
extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
+libc_hidden_proto(ftruncate64)
# endif
#endif /* Use BSD || X/Open Unix || POSIX 2003. */
@@ -995,12 +1149,14 @@ extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur;
/* Set the end of accessible data space (aka "the break") to ADDR.
Returns zero on success and -1 for errors (with errno set). */
extern int brk (void *__addr) __THROW __wur;
+libc_hidden_proto(brk)
/* Increase or decrease the end of accessible data space by DELTA bytes.
If successful, returns the address the previous end of data space
(i.e. the beginning of the new space, if DELTA > 0);
returns (void *) -1 for errors (with errno set). */
extern void *sbrk (intptr_t __delta) __THROW;
+libc_hidden_proto(sbrk)
#endif
@@ -1019,6 +1175,20 @@ extern long int syscall (long int __sysno, ...) __THROW;
#endif /* Use misc. */
+/* Are we in a secure process environment or are we dealing with setuid
+ * stuff? This value is returned by issetugid().
+ */
+extern int _pe_secure;
+libc_hidden_proto(_pe_secure)
+
+#ifdef __USE_BSD
+/* issetugid() returns 1 if the process environment or memory address space
+ is considered tainted, and returns 0 otherwise. This happens, for example,
+ when a process's privileges are elevated by the setuid or setgid flags on
+ an executable belonging to root.
+*/
+extern int issetugid(void);
+#endif
#if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK
/* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both
@@ -1039,6 +1209,7 @@ extern long int syscall (long int __sysno, ...) __THROW;
# ifndef __USE_FILE_OFFSET64
extern int lockf (int __fd, int __cmd, __off_t __len) __wur;
+libc_hidden_proto(lockf)
# else
# ifdef __REDIRECT
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len),
@@ -1070,7 +1241,7 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __wur;
&& defined __UCLIBC_HAS_REALTIME__
/* Synchronize at least the data part of a file with the underlying
media. */
-extern int fdatasync (int __fildes) __THROW;
+extern int fdatasync (int __fildes);
#endif /* Use POSIX199309 */
@@ -1079,7 +1250,7 @@ extern int fdatasync (int __fildes) __THROW;
#ifdef __USE_XOPEN
# if defined __UCLIBC_HAS_CRYPT__
/* Encrypt at most 8 characters from KEY using salt to perturb DES. */
-extern char *crypt (__const char *__key, __const char *__salt)
+extern char *crypt (const char *__key, const char *__salt)
__THROW __nonnull ((1, 2));
/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
@@ -1092,33 +1263,34 @@ extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
FROM and copy the result to TO. The value of TO must not be in the
range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM
is without partner. */
-extern void swab (__const void *__restrict __from, void *__restrict __to,
+extern void swab (const void *__restrict __from, void *__restrict __to,
ssize_t __n) __THROW __nonnull ((1, 2));
#endif
/* The Single Unix specification demands this prototype to be here.
It is also found in <stdio.h>. */
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && !defined __USE_XOPEN2K
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
#endif
/* Define some macros helping to catch buffer overflows. */
-#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
+#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
# include <bits/unistd.h>
#endif
__END_DECLS
-#ifdef UCLIBC_INTERNAL
+#ifdef _LIBC
#ifndef smallint_type /* if arch didn't override it in bits/wordsize.h */
#define smallint_type int
#endif
typedef signed smallint_type smallint;
typedef unsigned smallint_type smalluint;
+extern size_t __pagesize attribute_hidden;
#endif
diff --git a/include/utime.h b/include/utime.h
index dd5d26570..45999ebb1 100644
--- a/include/utime.h
+++ b/include/utime.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 5.6.6 Set File Access and Modification Times <utime.h>
@@ -43,9 +42,10 @@ struct utimbuf
/* Set the access and modification times of FILE to those given in
*FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */
-extern int utime (__const char *__file,
- __const struct utimbuf *__file_times)
+extern int utime (const char *__file,
+ const struct utimbuf *__file_times)
__THROW __nonnull ((1));
+libc_hidden_proto(utime)
__END_DECLS
diff --git a/include/utmp.h b/include/utmp.h
index 585aad12d..8ecbb54e7 100644
--- a/include/utmp.h
+++ b/include/utmp.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _UTMP_H
#define _UTMP_H 1
@@ -37,27 +36,29 @@ __BEGIN_DECLS
+#ifdef __UCLIBC_HAS_LIBUTIL__
/* Make FD be the controlling terminal, stdin, stdout, and stderr;
then close FD. Returns 0 on success, nonzero on error. */
extern int login_tty (int __fd) __THROW;
-
+libutil_hidden_proto(login_tty)
/* Write the given entry into utmp and wtmp. */
-extern void login (__const struct utmp *__entry) __THROW;
+extern void login (const struct utmp *__entry) __THROW;
/* Write the utmp entry to say the user on UT_LINE has logged out. */
-extern int logout (__const char *__ut_line) __THROW;
+extern int logout (const char *__ut_line) __THROW;
/* Append to wtmp an entry for the current time and the given info. */
-extern void logwtmp (__const char *__ut_line, __const char *__ut_name,
- __const char *__ut_host) __THROW;
+extern void logwtmp (const char *__ut_line, const char *__ut_name,
+ const char *__ut_host) __THROW;
+#endif
/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
-extern void updwtmp (__const char *__wtmp_file, __const struct utmp *__utmp)
+extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
__THROW;
/* Change name of the utmp file to be examined. */
-extern int utmpname (__const char *__file) __THROW;
+extern int utmpname (const char *__file) __THROW;
/* Read next entry from a utmp-like file. */
extern struct utmp *getutent (void) __THROW;
@@ -70,24 +71,24 @@ extern void endutent (void) __THROW;
/* Search forward from the current point in the utmp file until the
next entry with a ut_type matching ID->ut_type. */
-extern struct utmp *getutid (__const struct utmp *__id) __THROW;
+extern struct utmp *getutid (const struct utmp *__id) __THROW;
/* Search forward from the current point in the utmp file until the
next entry with a ut_line matching LINE->ut_line. */
-extern struct utmp *getutline (__const struct utmp *__line) __THROW;
+extern struct utmp *getutline (const struct utmp *__line) __THROW;
/* Write out entry pointed to by UTMP_PTR into the utmp file. */
-extern struct utmp *pututline (__const struct utmp *__utmp_ptr) __THROW;
+extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
#if 0 /* def __USE_MISC */
/* Reentrant versions of the file for handling utmp files. */
extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __THROW;
-extern int getutid_r (__const struct utmp *__id, struct utmp *__buffer,
+extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
struct utmp **__result) __THROW;
-extern int getutline_r (__const struct utmp *__line,
+extern int getutline_r (const struct utmp *__line,
struct utmp *__buffer, struct utmp **__result) __THROW;
#endif /* Use misc. */
diff --git a/include/utmpx.h b/include/utmpx.h
new file mode 100644
index 000000000..f3481275d
--- /dev/null
+++ b/include/utmpx.h
@@ -0,0 +1,126 @@
+/* Copyright (C) 1997, 1998, 1999, 2003 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _UTMPX_H
+#define _UTMPX_H 1
+
+#include <features.h>
+#include <sys/time.h>
+
+/* Required according to Unix98. */
+#ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined
+#endif
+
+/* Get system dependent values and data structures. */
+#include <bits/utmpx.h>
+
+#ifdef __USE_GNU
+/* Compatibility names for the strings of the canonical file names. */
+# define UTMPX_FILE _PATH_UTMPX
+# define UTMPX_FILENAME _PATH_UTMPX
+# define WTMPX_FILE _PATH_WTMPX
+# define WTMPX_FILENAME _PATH_WTMPX
+#endif
+
+/* For the getutmp{,x} functions we need the `struct utmp'. */
+#ifdef __USE_GNU
+struct utmp;
+#endif
+
+
+__BEGIN_DECLS
+
+/* Open user accounting database.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern void setutxent (void);
+
+/* Close user accounting database.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern void endutxent (void);
+
+/* Get the next entry from the user accounting database.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern struct utmpx *getutxent (void);
+
+/* Get the user accounting database entry corresponding to ID.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern struct utmpx *getutxid (const struct utmpx *__id);
+
+/* Get the user accounting database entry corresponding to LINE.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern struct utmpx *getutxline (const struct utmpx *__line);
+
+/* Write the entry UTMPX into the user accounting database.
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+extern struct utmpx *pututxline (const struct utmpx *__utmpx);
+
+
+#ifdef __USE_GNU
+/* Change name of the utmpx file to be examined.
+
+ This function is not part of POSIX and therefore no official
+ cancellation point. But due to similarity with an POSIX interface
+ or due to the implementation it is a cancellation point and
+ therefore not marked with __THROW. */
+extern int utmpxname (const char *__file);
+
+/* Append entry UTMP to the wtmpx-like file WTMPX_FILE.
+
+ This function is not part of POSIX and therefore no official
+ cancellation point. But due to similarity with an POSIX interface
+ or due to the implementation it is a cancellation point and
+ therefore not marked with __THROW. */
+extern void updwtmpx (const char *__wtmpx_file,
+ const struct utmpx *__utmpx);
+
+
+/* Copy the information in UTMPX to UTMP.
+
+ This function is not part of POSIX and therefore no official
+ cancellation point. But due to similarity with an POSIX interface
+ or due to the implementation it is a cancellation point and
+ therefore not marked with __THROW. */
+extern void getutmp (const struct utmpx *__utmpx,
+ struct utmp *__utmp);
+
+/* Copy the information in UTMP to UTMPX.
+
+ This function is not part of POSIX and therefore no official
+ cancellation point. But due to similarity with an POSIX interface
+ or due to the implementation it is a cancellation point and
+ therefore not marked with __THROW. */
+extern void getutmpx (const struct utmp *__utmp,
+ struct utmpx *__utmpx);
+#endif
+
+__END_DECLS
+
+#endif /* utmpx.h */
diff --git a/include/values.h b/include/values.h
index d8bd8b50a..e0132e653 100644
--- a/include/values.h
+++ b/include/values.h
@@ -13,9 +13,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/* This interface is obsolete. New programs should use
<limits.h> and/or <float.h> instead of <values.h>. */
@@ -53,7 +52,9 @@
#include <float.h>
#define MAXDOUBLE DBL_MAX
+#ifdef __UCLIBC_SUSV4_LEGACY__
#define MAXFLOAT FLT_MAX
+#endif
#define MINDOUBLE DBL_MIN
#define MINFLOAT FLT_MIN
#define DMINEXP DBL_MIN_EXP
diff --git a/include/wchar-stub.h b/include/wchar-stub.h
new file mode 100644
index 000000000..918c78dd4
--- /dev/null
+++ b/include/wchar-stub.h
@@ -0,0 +1,13 @@
+/* This wchar.h is used if wchar support is disabled in uClibc.
+ * We still want to provide a few basic definitions as the basic
+ * C standard requires them. And it makes our lives easier with
+ * no additional overhead.
+ */
+
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+typedef unsigned int wint_t;
+#define WEOF (0xffffffffu)
+
+#endif
diff --git a/include/wchar.h b/include/wchar.h
index e461f7184..67f44b763 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.24
@@ -133,44 +132,46 @@ __BEGIN_NAMESPACE_STD
/* This incomplete type is defined in <time.h> but needed here because
of `wcsftime'. */
struct tm;
+__END_NAMESPACE_STD
/* XXX We have to clean this up at some point. Since tm is in the std
namespace but wcsftime is in __c99 the type wouldn't be found
without inserting it in the global namespace. */
__USING_NAMESPACE_STD(tm)
-__END_NAMESPACE_STD
__BEGIN_NAMESPACE_C99
/* Copy SRC to DEST. */
extern wchar_t *wcscpy (wchar_t *__restrict __dest,
- __const wchar_t *__restrict __src) __THROW;
+ const wchar_t *__restrict __src) __THROW;
/* Copy no more than N wide-characters of SRC to DEST. */
extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
- __const wchar_t *__restrict __src, size_t __n)
+ const wchar_t *__restrict __src, size_t __n)
__THROW;
/* Append SRC onto DEST. */
extern wchar_t *wcscat (wchar_t *__restrict __dest,
- __const wchar_t *__restrict __src) __THROW;
+ const wchar_t *__restrict __src) __THROW;
+libc_hidden_proto(wcscat)
/* Append no more than N wide-characters of SRC onto DEST. */
extern wchar_t *wcsncat (wchar_t *__restrict __dest,
- __const wchar_t *__restrict __src, size_t __n)
+ const wchar_t *__restrict __src, size_t __n)
__THROW;
/* Compare S1 and S2. */
-extern int wcscmp (__const wchar_t *__s1, __const wchar_t *__s2)
+extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
__THROW __attribute_pure__;
+libc_hidden_proto(wcscmp)
/* Compare N wide-characters of S1 and S2. */
-extern int wcsncmp (__const wchar_t *__s1, __const wchar_t *__s2, size_t __n)
+extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
__THROW __attribute_pure__;
__END_NAMESPACE_C99
#ifdef __USE_GNU
/* Compare S1 and S2, ignoring case. */
-extern int wcscasecmp (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
+extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
/* Compare no more than N chars of S1 and S2, ignoring case. */
-extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
+extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
size_t __n) __THROW;
#ifdef __UCLIBC_HAS_XLOCALE__
@@ -178,23 +179,26 @@ extern int wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
the provided locale and not the global locale. */
# include <xlocale.h>
-extern int wcscasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
__locale_t __loc) __THROW;
+libc_hidden_proto(wcscasecmp_l)
-extern int wcsncasecmp_l (__const wchar_t *__s1, __const wchar_t *__s2,
+extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
size_t __n, __locale_t __loc) __THROW;
+libc_hidden_proto(wcsncasecmp_l)
#endif /* __UCLIBC_HAS_XLOCALE__ */
#endif
__BEGIN_NAMESPACE_C99
/* Compare S1 and S2, both interpreted as appropriate to the
LC_COLLATE category of the current locale. */
-extern int wcscoll (__const wchar_t *__s1, __const wchar_t *__s2) __THROW;
+extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
+libc_hidden_proto(wcscoll)
/* Transform S2 into array pointed to by S1 such that if wcscmp is
applied to two transformed strings the result is the as applying
`wcscoll' to the original strings. */
extern size_t wcsxfrm (wchar_t *__restrict __s1,
- __const wchar_t *__restrict __s2, size_t __n) __THROW;
+ const wchar_t *__restrict __s2, size_t __n) __THROW;
__END_NAMESPACE_C99
#ifdef __USE_GNU
@@ -204,92 +208,104 @@ __END_NAMESPACE_C99
/* Compare S1 and S2, both interpreted as appropriate to the
LC_COLLATE category of the given locale. */
-extern int wcscoll_l (__const wchar_t *__s1, __const wchar_t *__s2,
+extern int wcscoll_l (const wchar_t *__s1, const wchar_t *__s2,
__locale_t __loc) __THROW;
+libc_hidden_proto(wcscoll_l)
/* Transform S2 into array pointed to by S1 such that if wcscmp is
applied to two transformed strings the result is the as applying
`wcscoll' to the original strings. */
-extern size_t wcsxfrm_l (wchar_t *__s1, __const wchar_t *__s2,
+extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
size_t __n, __locale_t __loc) __THROW;
+libc_hidden_proto(wcsxfrm_l)
#endif /* __UCLIBC_HAS_XLOCALE__ */
/* Duplicate S, returning an identical malloc'd string. */
-extern wchar_t *wcsdup (__const wchar_t *__s) __THROW __attribute_malloc__;
+extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
#endif
__BEGIN_NAMESPACE_C99
/* Find the first occurrence of WC in WCS. */
-extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
+extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
__THROW __attribute_pure__;
/* Find the last occurrence of WC in WCS. */
-extern wchar_t *wcsrchr (__const wchar_t *__wcs, wchar_t __wc)
+extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
__THROW __attribute_pure__;
__END_NAMESPACE_C99
#ifdef __USE_GNU
/* This function is similar to `wcschr'. But it returns a pointer to
the closing NUL wide character in case C is not found in S. */
-extern wchar_t *wcschrnul (__const wchar_t *__s, wchar_t __wc)
+extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
__THROW __attribute_pure__;
#endif
__BEGIN_NAMESPACE_C99
/* Return the length of the initial segmet of WCS which
consists entirely of wide characters not in REJECT. */
-extern size_t wcscspn (__const wchar_t *__wcs, __const wchar_t *__reject)
+extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
__THROW __attribute_pure__;
/* Return the length of the initial segmet of WCS which
consists entirely of wide characters in ACCEPT. */
-extern size_t wcsspn (__const wchar_t *__wcs, __const wchar_t *__accept)
+extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
__THROW __attribute_pure__;
+libc_hidden_proto(wcsspn)
/* Find the first occurrence in WCS of any character in ACCEPT. */
-extern wchar_t *wcspbrk (__const wchar_t *__wcs, __const wchar_t *__accept)
+extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
__THROW __attribute_pure__;
+libc_hidden_proto(wcspbrk)
/* Find the first occurrence of NEEDLE in HAYSTACK. */
-extern wchar_t *wcsstr (__const wchar_t *__haystack, __const wchar_t *__needle)
+/* SuSv uses restrict keyword, glibc does not */
+extern wchar_t *wcsstr (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
__THROW __attribute_pure__;
/* Divide WCS into tokens separated by characters in DELIM. */
extern wchar_t *wcstok (wchar_t *__restrict __s,
- __const wchar_t *__restrict __delim,
+ const wchar_t *__restrict __delim,
wchar_t **__restrict __ptr) __THROW;
/* Return the number of wide characters in S. */
-extern size_t wcslen (__const wchar_t *__s) __THROW __attribute_pure__;
+extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
+libc_hidden_proto(wcslen)
__END_NAMESPACE_C99
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN && defined __UCLIBC_SUSV3_LEGACY__
/* Another name for `wcsstr' from XPG4. */
-extern wchar_t *wcswcs (__const wchar_t *__haystack, __const wchar_t *__needle)
+/* SuSv3 did not use restrict keyword, probably because it was marked LEGACY
+ we do to be in sync with wcsstr */
+extern wchar_t *wcswcs (const wchar_t *__restrict __haystack, const wchar_t *__restrict __needle)
__THROW __attribute_pure__;
#endif
#ifdef __USE_GNU
/* Return the number of wide characters in S, but at most MAXLEN. */
-extern size_t wcsnlen (__const wchar_t *__s, size_t __maxlen)
+extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
__THROW __attribute_pure__;
+libc_hidden_proto(wcsnlen)
#endif
__BEGIN_NAMESPACE_C99
/* Search N wide characters of S for C. */
-extern wchar_t *wmemchr (__const wchar_t *__s, wchar_t __c, size_t __n)
+extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
__THROW __attribute_pure__;
+libc_hidden_proto(wmemchr)
/* Compare N wide characters of S1 and S2. */
-extern int wmemcmp (__const wchar_t *__restrict __s1,
- __const wchar_t *__restrict __s2, size_t __n)
+/* SuSv4 does not use restrict keyword for S1 and S2, glibc does */
+extern int wmemcmp (const wchar_t *__s1,
+ const wchar_t *__s2, size_t __n)
__THROW __attribute_pure__;
/* Copy N wide characters of SRC to DEST. */
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
- __const wchar_t *__restrict __s2, size_t __n) __THROW;
+ const wchar_t *__restrict __s2, size_t __n) __THROW;
+libc_hidden_proto(wmemcpy)
/* Copy N wide characters of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
-extern wchar_t *wmemmove (wchar_t *__s1, __const wchar_t *__s2, size_t __n)
+extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
__THROW;
/* Set N wide characters of S to C. */
@@ -300,8 +316,9 @@ __END_NAMESPACE_C99
/* Copy N wide characters of SRC to DEST and return pointer to following
wide character. */
extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
- __const wchar_t *__restrict __s2, size_t __n)
+ const wchar_t *__restrict __s2, size_t __n)
__THROW;
+libc_hidden_proto(wmempcpy)
#endif
@@ -309,6 +326,7 @@ __BEGIN_NAMESPACE_C99
/* Determine whether C constitutes a valid (one-byte) multibyte
character. */
extern wint_t btowc (int __c) __THROW;
+libc_hidden_proto(btowc)
/* Determine whether C corresponds to a member of the extended
character set whose multibyte representation is a single byte. */
@@ -316,37 +334,43 @@ extern int wctob (wint_t __c) __THROW;
/* Determine whether PS points to an object representing the initial
state. */
-extern int mbsinit (__const mbstate_t *__ps) __THROW __attribute_pure__;
+extern int mbsinit (const mbstate_t *__ps) __THROW __attribute_pure__;
+libc_hidden_proto(mbsinit)
/* Write wide character representation of multibyte character pointed
to by S to PWC. */
extern size_t mbrtowc (wchar_t *__restrict __pwc,
- __const char *__restrict __s, size_t __n,
+ const char *__restrict __s, size_t __n,
mbstate_t *__p) __THROW;
+libc_hidden_proto(mbrtowc)
/* Write multibyte representation of wide character WC to S. */
extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(wcrtomb)
/* Return number of bytes in multibyte character pointed to by S. */
#if 0 /* uClibc: disabled */
-extern size_t __mbrlen (__const char *__restrict __s, size_t __n,
+extern size_t __mbrlen (const char *__restrict __s, size_t __n,
mbstate_t *__restrict __ps) __THROW;
#endif
-extern size_t mbrlen (__const char *__restrict __s, size_t __n,
+extern size_t mbrlen (const char *__restrict __s, size_t __n,
mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(mbrlen)
/* Write wide character representation of multibyte character string
SRC to DST. */
extern size_t mbsrtowcs (wchar_t *__restrict __dst,
- __const char **__restrict __src, size_t __len,
+ const char **__restrict __src, size_t __len,
mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(mbsrtowcs)
/* Write multibyte character representation of wide character string
SRC to DST. */
extern size_t wcsrtombs (char *__restrict __dst,
- __const wchar_t **__restrict __src, size_t __len,
+ const wchar_t **__restrict __src, size_t __len,
mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(wcsrtombs)
__END_NAMESPACE_C99
@@ -354,15 +378,17 @@ __END_NAMESPACE_C99
/* Write wide character representation of at most NMC bytes of the
multibyte character string SRC to DST. */
extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
- __const char **__restrict __src, size_t __nmc,
+ const char **__restrict __src, size_t __nmc,
size_t __len, mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(mbsnrtowcs)
/* Write multibyte character representation of at most NWC characters
from the wide character string SRC to DST. */
extern size_t wcsnrtombs (char *__restrict __dst,
- __const wchar_t **__restrict __src,
+ const wchar_t **__restrict __src,
size_t __nwc, size_t __len,
mbstate_t *__restrict __ps) __THROW;
+libc_hidden_proto(wcsnrtombs)
#endif /* use GNU */
@@ -373,7 +399,8 @@ extern int wcwidth (wchar_t __c) __THROW;
/* Determine number of column positions required for first N wide
characters (or fewer if S ends before this) in S. */
-extern int wcswidth (__const wchar_t *__s, size_t __n) __THROW;
+extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
+libc_hidden_proto(wcswidth)
#endif /* Use X/Open. */
@@ -381,14 +408,14 @@ __BEGIN_NAMESPACE_C99
#ifdef __UCLIBC_HAS_FLOATS__
/* Convert initial portion of the wide string NPTR to `double'
representation. */
-extern double wcstod (__const wchar_t *__restrict __nptr,
+extern double wcstod (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr) __THROW;
#ifdef __USE_ISOC99
/* Likewise for `float' and `long double' sizes of floating-point numbers. */
-extern float wcstof (__const wchar_t *__restrict __nptr,
+extern float wcstof (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr) __THROW;
-extern long double wcstold (__const wchar_t *__restrict __nptr,
+extern long double wcstold (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr) __THROW;
#endif /* C99 */
#endif /* __UCLIBC_HAS_FLOATS__ */
@@ -396,44 +423,44 @@ extern long double wcstold (__const wchar_t *__restrict __nptr,
/* Convert initial portion of wide string NPTR to `long int'
representation. */
-extern long int wcstol (__const wchar_t *__restrict __nptr,
+extern long int wcstol (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base) __THROW;
/* Convert initial portion of wide string NPTR to `unsigned long int'
representation. */
-extern unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
+extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base)
__THROW;
#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_GNU)
-/* Convert initial portion of wide string NPTR to `long int'
+/* Convert initial portion of wide string NPTR to `long long int'
representation. */
__extension__
-extern long long int wcstoll (__const wchar_t *__restrict __nptr,
+extern long long int wcstoll (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base)
__THROW;
/* Convert initial portion of wide string NPTR to `unsigned long long int'
representation. */
__extension__
-extern unsigned long long int wcstoull (__const wchar_t *__restrict __nptr,
+extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base) __THROW;
#endif /* ISO C99 or GCC and GNU. */
__END_NAMESPACE_C99
#if defined __GNUC__ && defined __USE_GNU
-/* Convert initial portion of wide string NPTR to `long int'
+/* Convert initial portion of wide string NPTR to `long long int'
representation. */
__extension__
-extern long long int wcstoq (__const wchar_t *__restrict __nptr,
+extern long long int wcstoq (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base)
__THROW;
/* Convert initial portion of wide string NPTR to `unsigned long long int'
representation. */
__extension__
-extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
+extern unsigned long long int wcstouq (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base) __THROW;
#endif /* GCC and use GNU. */
@@ -457,35 +484,35 @@ extern unsigned long long int wcstouq (__const wchar_t *__restrict __nptr,
/* Special versions of the functions above which take the locale to
use as an additional parameter. */
-extern long int wcstol_l (__const wchar_t *__restrict __nptr,
+extern long int wcstol_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base,
__locale_t __loc) __THROW;
-extern unsigned long int wcstoul_l (__const wchar_t *__restrict __nptr,
+extern unsigned long int wcstoul_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base, __locale_t __loc) __THROW;
__extension__
-extern long long int wcstoll_l (__const wchar_t *__restrict __nptr,
+extern long long int wcstoll_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base, __locale_t __loc) __THROW;
__extension__
-extern unsigned long long int wcstoull_l (__const wchar_t *__restrict __nptr,
+extern unsigned long long int wcstoull_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
int __base, __locale_t __loc)
__THROW;
#ifdef __UCLIBC_HAS_FLOATS__
-extern double wcstod_l (__const wchar_t *__restrict __nptr,
+extern double wcstod_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, __locale_t __loc)
__THROW;
-extern float wcstof_l (__const wchar_t *__restrict __nptr,
+extern float wcstof_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, __locale_t __loc)
__THROW;
-extern long double wcstold_l (__const wchar_t *__restrict __nptr,
+extern long double wcstold_l (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
__locale_t __loc) __THROW;
#endif /* __UCLIBC_HAS_FLOATS__ */
@@ -496,11 +523,11 @@ extern long double wcstold_l (__const wchar_t *__restrict __nptr,
#ifdef __USE_GNU
/* Copy SRC to DEST, returning the address of the terminating L'\0' in
DEST. */
-extern wchar_t *wcpcpy (wchar_t *__dest, __const wchar_t *__src) __THROW;
+extern wchar_t *wcpcpy (wchar_t *__dest, const wchar_t *__src) __THROW;
/* Copy no more than N characters of SRC to DEST, returning the address of
the last character written into DEST. */
-extern wchar_t *wcpncpy (wchar_t *__dest, __const wchar_t *__src, size_t __n)
+extern wchar_t *wcpncpy (wchar_t *__dest, const wchar_t *__src, size_t __n)
__THROW;
#endif /* use GNU */
@@ -518,17 +545,17 @@ extern int fwide (__FILE *__fp, int __mode) __THROW;
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fwprintf (__FILE *__restrict __stream,
- __const wchar_t *__restrict __format, ...)
+ const wchar_t *__restrict __format, ...)
/* __attribute__ ((__format__ (__wprintf__, 2, 3))) */;
/* Write formatted output to stdout.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int wprintf (__const wchar_t *__restrict __format, ...)
+extern int wprintf (const wchar_t *__restrict __format, ...)
/* __attribute__ ((__format__ (__wprintf__, 1, 2))) */;
/* Write formatted output of at most N characters to S. */
extern int swprintf (wchar_t *__restrict __s, size_t __n,
- __const wchar_t *__restrict __format, ...)
+ const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wprintf__, 3, 4))) */;
/* Write formatted output to S from argument list ARG.
@@ -536,22 +563,24 @@ extern int swprintf (wchar_t *__restrict __s, size_t __n,
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfwprintf (__FILE *__restrict __s,
- __const wchar_t *__restrict __format,
+ const wchar_t *__restrict __format,
__gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
+libc_hidden_proto(vfwprintf)
/* Write formatted output to stdout from argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vwprintf (__const wchar_t *__restrict __format,
+extern int vwprintf (const wchar_t *__restrict __format,
__gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wprintf__, 1, 0))) */;
/* Write formatted output of at most N character to S from argument
list ARG. */
extern int vswprintf (wchar_t *__restrict __s, size_t __n,
- __const wchar_t *__restrict __format,
+ const wchar_t *__restrict __format,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wprintf__, 3, 0))) */;
+libc_hidden_proto(vswprintf)
/* Read formatted input from STREAM.
@@ -559,17 +588,17 @@ extern int vswprintf (wchar_t *__restrict __s, size_t __n,
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int fwscanf (__FILE *__restrict __stream,
- __const wchar_t *__restrict __format, ...)
+ const wchar_t *__restrict __format, ...)
/* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
/* Read formatted input from stdin.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int wscanf (__const wchar_t *__restrict __format, ...)
+extern int wscanf (const wchar_t *__restrict __format, ...)
/* __attribute__ ((__format__ (__wscanf__, 1, 2))) */;
/* Read formatted input from S. */
-extern int swscanf (__const wchar_t *__restrict __s,
- __const wchar_t *__restrict __format, ...)
+extern int swscanf (const wchar_t *__restrict __s,
+ const wchar_t *__restrict __format, ...)
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 3))) */;
__END_NAMESPACE_C99
@@ -583,21 +612,23 @@ __BEGIN_NAMESPACE_C99
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int vfwscanf (__FILE *__restrict __s,
- __const wchar_t *__restrict __format,
+ const wchar_t *__restrict __format,
__gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+libc_hidden_proto(vfwscanf)
/* Read formatted input from stdin into argument list ARG.
This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int vwscanf (__const wchar_t *__restrict __format,
+extern int vwscanf (const wchar_t *__restrict __format,
__gnuc_va_list __arg)
/* __attribute__ ((__format__ (__wscanf__, 1, 0))) */;
/* Read formatted input from S into argument list ARG. */
-extern int vswscanf (__const wchar_t *__restrict __s,
- __const wchar_t *__restrict __format,
+extern int vswscanf (const wchar_t *__restrict __s,
+ const wchar_t *__restrict __format,
__gnuc_va_list __arg)
__THROW /* __attribute__ ((__format__ (__wscanf__, 2, 0))) */;
+libc_hidden_proto(vswscanf)
__END_NAMESPACE_C99
#endif /* Use ISO C99. */
@@ -609,6 +640,7 @@ __BEGIN_NAMESPACE_C99
These functions are possible cancellation points and therefore not
marked with __THROW. */
extern wint_t fgetwc (__FILE *__stream);
+libc_hidden_proto(fgetwc)
extern wint_t getwc (__FILE *__stream);
/* Read a character from stdin.
@@ -623,11 +655,12 @@ extern wint_t getwchar (void);
These functions are possible cancellation points and therefore not
marked with __THROW. */
extern wint_t fputwc (wchar_t __wc, __FILE *__stream);
+libc_hidden_proto(fputwc)
extern wint_t putwc (wchar_t __wc, __FILE *__stream);
/* Write a character to stdout.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t putwchar (wchar_t __wc);
@@ -635,24 +668,26 @@ extern wint_t putwchar (wchar_t __wc);
/* Get a newline-terminated wide character string of finite length
from STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wchar_t *fgetws (wchar_t *__restrict __ws, int __n,
__FILE *__restrict __stream);
/* Write a string to STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
-extern int fputws (__const wchar_t *__restrict __ws,
+extern int fputws (const wchar_t *__restrict __ws,
__FILE *__restrict __stream);
+libc_hidden_proto(fputws)
/* Push a character back onto the input buffer of STREAM.
- This function is a possible cancellation points and therefore not
+ This function is a possible cancellation point and therefore not
marked with __THROW. */
extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
+libc_hidden_proto(ungetwc)
__END_NAMESPACE_C99
@@ -674,6 +709,7 @@ extern wint_t getwchar_unlocked (void);
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern wint_t fgetwc_unlocked (__FILE *__stream);
+libc_hidden_proto(fgetwc_unlocked)
/* Faster version when locking is not necessary.
@@ -682,6 +718,7 @@ extern wint_t fgetwc_unlocked (__FILE *__stream);
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern wint_t fputwc_unlocked (wchar_t __wc, __FILE *__stream);
+libc_hidden_proto(fputwc_unlocked)
/* These are defined to be equivalent to the `char' functions defined
in POSIX.1:1996.
@@ -702,6 +739,7 @@ extern wint_t putwchar_unlocked (wchar_t __wc);
therefore not marked with __THROW. */
extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
__FILE *__restrict __stream);
+libc_hidden_proto(fgetws_unlocked)
/* This function does the same as `fputws' but does not lock the stream.
@@ -709,8 +747,9 @@ extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int fputws_unlocked (__const wchar_t *__restrict __ws,
+extern int fputws_unlocked (const wchar_t *__restrict __ws,
__FILE *__restrict __stream);
+libc_hidden_proto(fputws_unlocked)
#endif
@@ -719,8 +758,8 @@ __BEGIN_NAMESPACE_C99
Write no more than MAXSIZE wide characters and return the number
of wide characters written, or 0 if it would exceed MAXSIZE. */
extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
- __const wchar_t *__restrict __format,
- __const struct tm *__restrict __tp) __THROW;
+ const wchar_t *__restrict __format,
+ const struct tm *__restrict __tp) __THROW;
__END_NAMESPACE_C99
# if defined __USE_GNU && defined __UCLIBC_HAS_XLOCALE__
@@ -729,9 +768,10 @@ __END_NAMESPACE_C99
/* Similar to `wcsftime' but takes the information from
the provided locale and not the global locale. */
extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
- __const wchar_t *__restrict __format,
- __const struct tm *__restrict __tp,
+ const wchar_t *__restrict __format,
+ const struct tm *__restrict __tp,
__locale_t __loc) __THROW;
+libc_hidden_proto(wcsftime_l)
# endif
/* The X/Open standard demands that most of the functions defined in
@@ -745,6 +785,11 @@ extern size_t wcsftime_l (wchar_t *__restrict __s, size_t __maxsize,
# include <wctype.h>
#endif
+#ifdef _LIBC
+extern size_t __wcslcpy(wchar_t *__restrict dst,
+ const wchar_t *__restrict src, size_t n) attribute_hidden;
+#endif
+
__END_DECLS
#endif /* _WCHAR_H defined */
diff --git a/include/wctype.h b/include/wctype.h
index 266ffab38..aa133bd60 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
/*
* ISO C99 Standard: 7.25
@@ -120,6 +119,7 @@ __BEGIN_NAMESPACE_C99
/* Test for any wide character for which `iswalpha' or `iswdigit' is
true. */
extern int iswalnum (wint_t __wc) __THROW;
+libc_hidden_proto(iswalnum)
/* Test for any wide character for which `iswupper' or 'iswlower' is
true, or any wide character that is one of a locale-specific set of
@@ -142,6 +142,7 @@ extern int iswgraph (wint_t __wc) __THROW;
or is one of a locale-specific set of wide characters for which
none of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
extern int iswlower (wint_t __wc) __THROW;
+libc_hidden_proto(iswlower)
/* Test for any printing wide character. */
extern int iswprint (wint_t __wc) __THROW;
@@ -155,11 +156,13 @@ extern int iswpunct (wint_t __wc) __THROW;
set of wide characters for which none of `iswalnum', `iswgraph', or
`iswpunct' is true. */
extern int iswspace (wint_t __wc) __THROW;
+libc_hidden_proto(iswspace)
/* Test for any wide character that corresponds to an uppercase letter
or is one of a locale-specific set of wide character for which none
of `iswcntrl', `iswdigit', `iswpunct', or `iswspace' is true. */
extern int iswupper (wint_t __wc) __THROW;
+libc_hidden_proto(iswupper)
/* Test for any wide character that corresponds to a hexadecimal-digit
character equivalent to that performed be the functions described
@@ -179,11 +182,13 @@ extern int iswblank (wint_t __wc) __THROW;
/* Construct value that describes a class of wide characters identified
by the string argument PROPERTY. */
-extern wctype_t wctype (__const char *__property) __THROW;
+extern wctype_t wctype (const char *__property) __THROW;
+libc_hidden_proto(wctype)
/* Determine whether the wide-character WC has the property described by
DESC. */
extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
+libc_hidden_proto(iswctype)
__END_NAMESPACE_C99
@@ -194,7 +199,7 @@ __END_NAMESPACE_C99
__BEGIN_NAMESPACE_C99
/* Scalar type that can hold values which represent locale-specific
character mappings. */
-/* uClibc note: glibc uses - typedef __const __int32_t *wctrans_t; */
+/* uClibc note: glibc uses - typedef const __int32_t *wctrans_t; */
typedef unsigned int wctrans_t;
__END_NAMESPACE_C99
#ifdef __USE_GNU
@@ -204,9 +209,11 @@ __USING_NAMESPACE_C99(wctrans_t)
__BEGIN_NAMESPACE_C99
/* Converts an uppercase letter to the corresponding lowercase letter. */
extern wint_t towlower (wint_t __wc) __THROW;
+libc_hidden_proto(towlower)
/* Converts an lowercase letter to the corresponding uppercase letter. */
extern wint_t towupper (wint_t __wc) __THROW;
+libc_hidden_proto(towupper)
__END_NAMESPACE_C99
__END_DECLS
@@ -227,10 +234,12 @@ __BEGIN_DECLS
__BEGIN_NAMESPACE_C99
/* Construct value that describes a mapping between wide characters
identified by the string argument PROPERTY. */
-extern wctrans_t wctrans (__const char *__property) __THROW;
+extern wctrans_t wctrans (const char *__property) __THROW;
+libc_hidden_proto(wctrans)
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
+libc_hidden_proto(towctrans)
__END_NAMESPACE_C99
#if defined(__USE_GNU) && defined(__UCLIBC_HAS_XLOCALE__)
@@ -275,6 +284,7 @@ extern int iswpunct_l (wint_t __wc, __locale_t __locale) __THROW;
set of wide characters for which none of `iswalnum', `iswgraph', or
`iswpunct' is true. */
extern int iswspace_l (wint_t __wc, __locale_t __locale) __THROW;
+libc_hidden_proto(iswspace_l)
/* Test for any wide character that corresponds to an uppercase letter
or is one of a locale-specific set of wide character for which none
@@ -293,13 +303,14 @@ extern int iswblank_l (wint_t __wc, __locale_t __locale) __THROW;
/* Construct value that describes a class of wide characters identified
by the string argument PROPERTY. */
-extern wctype_t wctype_l (__const char *__property, __locale_t __locale)
+extern wctype_t wctype_l (const char *__property, __locale_t __locale)
__THROW;
/* Determine whether the wide-character WC has the property described by
DESC. */
extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
__THROW;
+libc_hidden_proto(iswctype_l)
/*
@@ -308,18 +319,21 @@ extern int iswctype_l (wint_t __wc, wctype_t __desc, __locale_t __locale)
/* Converts an uppercase letter to the corresponding lowercase letter. */
extern wint_t towlower_l (wint_t __wc, __locale_t __locale) __THROW;
+libc_hidden_proto(towlower_l)
/* Converts an lowercase letter to the corresponding uppercase letter. */
extern wint_t towupper_l (wint_t __wc, __locale_t __locale) __THROW;
+libc_hidden_proto(towupper_l)
/* Construct value that describes a mapping between wide characters
identified by the string argument PROPERTY. */
-extern wctrans_t wctrans_l (__const char *__property, __locale_t __locale)
+extern wctrans_t wctrans_l (const char *__property, __locale_t __locale)
__THROW;
/* Map the wide character WC using the mapping described by DESC. */
extern wint_t towctrans_l (wint_t __wc, wctrans_t __desc,
__locale_t __locale) __THROW;
+libc_hidden_proto(towctrans_l)
# endif /* Use GNU. */
diff --git a/include/wordexp.h b/include/wordexp.h
index 1c40e6168..f270fd757 100644
--- a/include/wordexp.h
+++ b/include/wordexp.h
@@ -12,9 +12,8 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _WORDEXP_H
#define _WORDEXP_H 1
@@ -60,11 +59,12 @@ enum
};
/* Do word expansion of WORDS into PWORDEXP. */
-extern int wordexp (__const char *__restrict __words,
+extern int wordexp (const char *__restrict __words,
wordexp_t *__restrict __pwordexp, int __flags);
/* Free the storage allocated by a `wordexp' call. */
extern void wordfree (wordexp_t *__wordexp) __THROW;
+libc_hidden_proto(wordfree)
__END_DECLS
diff --git a/include/xlocale.h b/include/xlocale.h
index 6f726fef9..8f5a740f5 100644
--- a/include/xlocale.h
+++ b/include/xlocale.h
@@ -1,5 +1,5 @@
/* Definition of locale datatype.
- Copyright (C) 1997,2000,02 Free Software Foundation, Inc.
+ Copyright (C) 1997,2000,2002,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -14,22 +14,12 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#ifndef _XLOCALE_H
#define _XLOCALE_H 1
-#include <features.h>
-
-#ifndef __UCLIBC_HAS_XLOCALE__
-#error Attempted to include xlocale.h when uClibc built without extended locale support.
-#endif /* __UCLIBC_HAS_XLOCALE__ */
-
-#include <bits/uClibc_locale.h>
-/* #include <bits/uClibc_touplow.h> */
-
#if 0
/* Structure for reentrant locale using functions. This is an
(almost) opaque type for the user level programs. The file and
@@ -37,26 +27,22 @@
go away without warning. */
typedef struct __locale_struct
{
-#if 0
/* Note: LC_ALL is not a valid index into this array. */
struct locale_data *__locales[13]; /* 13 = __LC_LAST. */
-#endif
/* To increase the speed of this solution we add some special members. */
-/* const unsigned short int *__ctype_b; */
-/* const int *__ctype_tolower; */
-/* const int *__ctype_toupper; */
- const __uint16_t *__ctype_b;
- const __ctype_touplow_t *__ctype_tolower;
- const __ctype_touplow_t *__ctype_toupper;
+ const unsigned short int *__ctype_b;
+ const int *__ctype_tolower;
+ const int *__ctype_toupper;
- __uclibc_locale_t *__locale_ptr;
-
-#if 0
/* Note: LC_ALL is not a valid index into this array. */
const char *__names[13];
-#endif
} *__locale_t;
+#else
+# include <bits/uClibc_locale.h>
#endif
+/* POSIX 2008 makes locale_t official. */
+typedef __locale_t locale_t;
+
#endif /* xlocale.h */