summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorYuri Pankov <yuri.pankov@nexenta.com>2017-06-12 20:16:28 -0700
committerJoshua M. Clulow <josh@sysmgr.org>2017-06-12 20:16:28 -0700
commit4585130b259133a26efae68275dbe56b08366deb (patch)
tree1946c836807dbd490b3395f65326f4d4664baefc /usr/src
parent61304e4faaed38301307f7f985160d1843473587 (diff)
downloadillumos-joyent-4585130b259133a26efae68275dbe56b08366deb.tar.gz
5428 provide fts(), reallocarray(), and strtonum()
Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Joshua M. Clulow <josh@sysmgr.org>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/nc/Makefile2
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/nc/THIRDPARTYLICENSE15
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c1
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.h31
-rw-r--r--usr/src/cmd/mandoc/Makefile.common6
-rw-r--r--usr/src/cmd/mandoc/compat_strtonum.c76
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_cmds.c3
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_evset.c4
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_lex.l14
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_modapi.c4
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_string.c4
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_string.h4
-rw-r--r--usr/src/head/Makefile24
-rw-r--r--usr/src/head/fts.h126
-rw-r--r--usr/src/head/stdlib.h2
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/util.c12
-rw-r--r--usr/src/lib/fm/topo/modules/common/pcibus/util.h4
-rw-r--r--usr/src/lib/fm/topo/modules/sun4/hostbridge/hb_sun4.c6
-rw-r--r--usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c4
-rw-r--r--usr/src/lib/libc/amd64/Makefile44
-rw-r--r--usr/src/lib/libc/i386/Makefile.com48
-rw-r--r--usr/src/lib/libc/port/gen/fts.c1037
-rw-r--r--usr/src/lib/libc/port/gen/reallocarray.c (renamed from usr/src/cmd/mandoc/compat_reallocarray.c)18
-rw-r--r--usr/src/lib/libc/port/gen/strtonum.c (renamed from usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.c)26
-rw-r--r--usr/src/lib/libc/port/llib-lc18
-rw-r--r--usr/src/lib/libc/port/mapfile-vers11
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com48
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com50
-rw-r--r--usr/src/man/man3c/Makefile2559
-rw-r--r--usr/src/man/man3c/fts.3c825
-rw-r--r--usr/src/man/man3c/malloc.3c525
-rw-r--r--usr/src/man/man3c/strtonum.3c151
-rw-r--r--usr/src/pkg/manifests/system-header.mf3
-rw-r--r--usr/src/pkg/manifests/system-library.man3c.inc10
-rw-r--r--usr/src/tools/mandoc/Makefile9
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_deadlist.c4
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_scan.c2
-rw-r--r--usr/src/uts/common/fs/zfs/dsl_userhold.c2
-rw-r--r--usr/src/uts/common/fs/zfs/spa_errlog.c8
-rw-r--r--usr/src/uts/common/fs/zfs/spa_misc.c2
-rw-r--r--usr/src/uts/common/fs/zfs/sys/spa.h2
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vfsops.c2
42 files changed, 3964 insertions, 1782 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/nc/Makefile b/usr/src/cmd/cmd-inet/usr.bin/nc/Makefile
index e67f95d52c..b93a1c9132 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/nc/Makefile
+++ b/usr/src/cmd/cmd-inet/usr.bin/nc/Makefile
@@ -24,7 +24,7 @@
#
PROG= nc
-OBJS= atomicio.o netcat.o socks.o strtonum.o
+OBJS= atomicio.o netcat.o socks.o
SRCS= $(OBJS:%.o=%.c)
diff --git a/usr/src/cmd/cmd-inet/usr.bin/nc/THIRDPARTYLICENSE b/usr/src/cmd/cmd-inet/usr.bin/nc/THIRDPARTYLICENSE
index 24a3ba0738..5d5119c2bf 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/nc/THIRDPARTYLICENSE
+++ b/usr/src/cmd/cmd-inet/usr.bin/nc/THIRDPARTYLICENSE
@@ -52,18 +52,3 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Re-written nc(1) for OpenBSD. Original implementation by
*Hobbit* <hobbit@avian.org>.
-
-Copyright (c) 2004 Ted Unangst and Todd Miller
-All rights reserved.
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c b/usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c
index 13017f6e8f..435597be96 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/nc/netcat.c
@@ -65,7 +65,6 @@
#include <signal.h>
#include "atomicio.h"
-#include "strtonum.h"
#ifndef SUN_LEN
#define SUN_LEN(su) \
diff --git a/usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.h b/usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.h
deleted file mode 100644
index 771ebe37dd..0000000000
--- a/usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-#ifndef _STRTONUM_H
-#define _STRTONUM_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-unsigned int
-strtonum(const char *numstr, unsigned int minval, unsigned int maxval,
- const char **errstrp);
-
-#endif /* _STRTONUM_H */
diff --git a/usr/src/cmd/mandoc/Makefile.common b/usr/src/cmd/mandoc/Makefile.common
index a08580ca1a..c7df2d15a8 100644
--- a/usr/src/cmd/mandoc/Makefile.common
+++ b/usr/src/cmd/mandoc/Makefile.common
@@ -11,7 +11,7 @@
#
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
-# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2017 Nexenta Systems, Inc.
#
PROG= mandoc
@@ -61,9 +61,7 @@ OBJS= att.o \
term_ps.o \
tree.o
-OBJS += compat_ohash.o \
- compat_reallocarray.o \
- compat_strtonum.o
+OBJS += compat_ohash.o
CFLAGS += $(CC_VERBOSE)
C99MODE = $(C99_ENABLE)
diff --git a/usr/src/cmd/mandoc/compat_strtonum.c b/usr/src/cmd/mandoc/compat_strtonum.c
deleted file mode 100644
index 628e5d51b8..0000000000
--- a/usr/src/cmd/mandoc/compat_strtonum.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "config.h"
-
-#if HAVE_STRTONUM
-
-int dummy;
-
-#else
-
-/* $Id: compat_strtonum.c,v 1.1 2015/02/16 14:56:22 schwarze Exp $ */
-/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */
-
-/*
- * Copyright (c) 2004 Ted Unangst and Todd Miller
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define INVALID 1
-#define TOOSMALL 2
-#define TOOLARGE 3
-
-long long
-strtonum(const char *numstr, long long minval, long long maxval,
- const char **errstrp)
-{
- long long ll = 0;
- int error = 0;
- char *ep;
- struct errval {
- const char *errstr;
- int err;
- } ev[4] = {
- { NULL, 0 },
- { "invalid", EINVAL },
- { "too small", ERANGE },
- { "too large", ERANGE },
- };
-
- ev[0].err = errno;
- errno = 0;
- if (minval > maxval) {
- error = INVALID;
- } else {
- ll = strtoll(numstr, &ep, 10);
- if (numstr == ep || *ep != '\0')
- error = INVALID;
- else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval)
- error = TOOSMALL;
- else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval)
- error = TOOLARGE;
- }
- if (errstrp != NULL)
- *errstrp = ev[error].errstr;
- errno = ev[error].err;
- if (error)
- ll = 0;
-
- return (ll);
-}
-
-#endif /* !HAVE_STRTONUM */
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
index f8672df76c..3b61c9ec3f 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c
@@ -2785,7 +2785,8 @@ cmd_delete(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
spec.spec_base = mdb_get_dot();
else if (argv->a_type == MDB_TYPE_STRING &&
strcmp(argv->a_un.a_str, "all") != 0)
- spec.spec_id = (int)(intmax_t)strtonum(argv->a_un.a_str, 10);
+ spec.spec_id = (int)(intmax_t)mdb_strtonum(argv->a_un.a_str,
+ 10);
else if (argv->a_type == MDB_TYPE_IMMEDIATE)
spec.spec_id = (int)(intmax_t)argv->a_un.a_val;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_evset.c b/usr/src/cmd/mdb/common/mdb/mdb_evset.c
index a30b29b6c8..864d192583 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_evset.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_evset.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <mdb/mdb_target.h>
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_string.h>
@@ -110,7 +108,7 @@ cmd_evset(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
}
} else if (argv->a_un.a_str[0] != '-') {
idv[idc++] = (int)(intmax_t)
- strtonum(argv->a_un.a_str, 10);
+ mdb_strtonum(argv->a_un.a_str, 10);
} else
return (DCMD_USAGE);
} else
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_lex.l b/usr/src/cmd/mdb/common/mdb/mdb_lex.l
index eb2cc129df..b9bee245b6 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_lex.l
+++ b/usr/src/cmd/mdb/common/mdb/mdb_lex.l
@@ -316,7 +316,7 @@ RGX_COMMENT "//".*\n
* Immediate value -- in the format list, all immediates
* are assumed to be in decimal.
*/
- yylval.l_immediate = strtonum(yytext, 10);
+ yylval.l_immediate = mdb_strtonum(yytext, 10);
return (MDB_TOK_IMMEDIATE);
}
@@ -415,7 +415,7 @@ RGX_COMMENT "//".*\n
/*
* Binary immediate value.
*/
- yylval.l_immediate = strtonum(yytext + 2, 2);
+ yylval.l_immediate = mdb_strtonum(yytext + 2, 2);
return (MDB_TOK_IMMEDIATE);
}
@@ -424,7 +424,7 @@ RGX_COMMENT "//".*\n
/*
* Octal immediate value.
*/
- yylval.l_immediate = strtonum(yytext + 2, 8);
+ yylval.l_immediate = mdb_strtonum(yytext + 2, 8);
return (MDB_TOK_IMMEDIATE);
}
@@ -443,7 +443,7 @@ RGX_COMMENT "//".*\n
if ((p = strsplit(yytext, '.')) == NULL)
yyerror("internal scanning error -- expected '.'\n");
- d = (double)strtonum(yytext + 2, 10);
+ d = (double)mdb_strtonum(yytext + 2, 10);
for (i = 0; (c = *p++) != '\0'; i++)
d = d * 10 + c - '0';
@@ -461,7 +461,7 @@ RGX_COMMENT "//".*\n
/*
* Decimal immediate value.
*/
- yylval.l_immediate = strtonum(yytext + 2, 10);
+ yylval.l_immediate = mdb_strtonum(yytext + 2, 10);
return (MDB_TOK_IMMEDIATE);
}
@@ -470,7 +470,7 @@ RGX_COMMENT "//".*\n
/*
* Hexadecimal value.
*/
- yylval.l_immediate = strtonum(yytext + 2, 16);
+ yylval.l_immediate = mdb_strtonum(yytext + 2, 16);
return (MDB_TOK_IMMEDIATE);
}
@@ -488,7 +488,7 @@ RGX_COMMENT "//".*\n
MDB_TGT_OBJ_EVERY, yytext, &sym, NULL) == 0)
yylval.l_immediate = (uintmax_t)sym.st_value;
else
- yylval.l_immediate = strtonum(yytext, mdb.m_radix);
+ yylval.l_immediate = mdb_strtonum(yytext, mdb.m_radix);
return (MDB_TOK_IMMEDIATE);
}
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
index 45f161aed6..b803095843 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_modapi.c
@@ -204,7 +204,7 @@ mdb_lookup_by_obj(const char *obj, const char *name, GElf_Sym *sym)
int
mdb_lookup_by_addr(uintptr_t addr, uint_t flags, char *buf,
- size_t nbytes, GElf_Sym *sym)
+ size_t nbytes, GElf_Sym *sym)
{
return (mdb_tgt_lookup_by_addr(mdb.m_target, addr, flags,
buf, nbytes, sym, NULL));
@@ -246,7 +246,7 @@ mdb_strtoull(const char *s)
}
}
- return (strtonum(s, radix));
+ return (mdb_strtonum(s, radix));
}
size_t
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_string.c b/usr/src/cmd/mdb/common/mdb/mdb_string.c
index fc91b2c5e4..fbcfe82755 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_string.c
+++ b/usr/src/cmd/mdb/common/mdb/mdb_string.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <netinet/in.h>
#include <limits.h>
#include <sys/types.h>
@@ -110,7 +108,7 @@ numtostr(uintmax_t uvalue, int base, uint_t flags)
* error message and longjmp back to the main loop using yyerror().
*/
uintmax_t
-strtonum(const char *s, int base)
+mdb_strtonum(const char *s, int base)
{
uintmax_t multmax = (uintmax_t)ULLONG_MAX / (uintmax_t)(uint_t)base;
uintmax_t val = 0;
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_string.h b/usr/src/cmd/mdb/common/mdb/mdb_string.h
index 2373103423..d07b9a48da 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_string.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_string.h
@@ -27,8 +27,6 @@
#ifndef _MDB_STRING_H
#define _MDB_STRING_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <strings.h>
@@ -42,7 +40,7 @@ extern "C" {
#define NTOS_SHOWBASE 0x8 /* Show base under appropriate circumstances */
extern const char *numtostr(uintmax_t, int, uint_t);
-extern uintmax_t strtonum(const char *, int);
+extern uintmax_t mdb_strtonum(const char *, int);
extern ulong_t strntoul(const char *, size_t, int);
extern int strisnum(const char *);
extern int strisbasenum(const char *);
diff --git a/usr/src/head/Makefile b/usr/src/head/Makefile
index e6397736af..e5cd6e1ef0 100644
--- a/usr/src/head/Makefile
+++ b/usr/src/head/Makefile
@@ -24,26 +24,29 @@
# Use is subject to license terms.
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
# Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
-# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2017 Nexenta Systems, Inc.
#
-#
-# head/Makefile
-#
# include global definitions
include ../Makefile.master
sparc_HDRS=
i386_HDRS= stack_unwind.h
-# Headers are listed one per line so that TeamWare can auto-merge most changes
-
-KRB5HDRS= mit_copyright.h mit-sipb-copyright.h
+KRB5HDRS= \
+ mit_copyright.h \
+ mit-sipb-copyright.h
-ATTRDB_HDRS= secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \
- auth_list.h
+ATTRDB_HDRS= \
+ auth_attr.h \
+ auth_list.h \
+ exec_attr.h \
+ prof_attr.h \
+ secdb.h \
+ user_attr.h
-HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
+HDRS= $($(MACH)_HDRS) \
+ $(ATTRDB_HDRS) \
aio.h \
alloca.h \
apptrace.h \
@@ -81,6 +84,7 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
floatingpoint.h \
fmtmsg.h \
fnmatch.h \
+ fts.h \
ftw.h \
gelf.h \
getopt.h \
diff --git a/usr/src/head/fts.h b/usr/src/head/fts.h
new file mode 100644
index 0000000000..dc84d88183
--- /dev/null
+++ b/usr/src/head/fts.h
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#ifndef _FTS_H
+#define _FTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#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 */
+ size_t fts_pathlen; /* sizeof(path) */
+ int fts_nitems; /* elements in the sort array */
+ int (*fts_compar)(); /* compare function */
+
+#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_OPTIONMASK 0x00ff /* valid user option mask */
+
+#define FTS_NAMEONLY 0x1000 /* (private) child names only */
+#define FTS_STOP 0x2000 /* (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 */
+ size_t fts_pathlen; /* strlen(fts_path) */
+ size_t 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
+#define FTS_MAXLEVEL 0x7fffffff
+ int 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 */
+ unsigned 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 */
+ unsigned 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 */
+ unsigned short fts_instr; /* fts_set() instructions */
+
+ unsigned short fts_spare; /* unused */
+
+ struct stat *fts_statp; /* stat(2) information */
+ char fts_name[1]; /* file name */
+} FTSENT;
+
+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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_FTS_H */
diff --git a/usr/src/head/stdlib.h b/usr/src/head/stdlib.h
index 94eaab38fa..47b87d9ff5 100644
--- a/usr/src/head/stdlib.h
+++ b/usr/src/head/stdlib.h
@@ -290,6 +290,8 @@ extern char *ulltostr(unsigned long long, char *);
extern uint32_t arc4random(void);
extern void arc4random_buf(void *, size_t);
extern uint32_t arc4random_uniform(uint32_t);
+extern void *reallocarray(void *, size_t, size_t);
+extern long long strtonum(const char *, long long, long long, const char **);
#endif /* !_STRICT_SYBMOLS */
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/util.c b/usr/src/lib/fm/topo/modules/common/pcibus/util.c
index cab50058ff..7d1edae6cf 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/util.c
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/util.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h>
#include <string.h>
#include <strings.h>
@@ -50,7 +48,7 @@ child_range_add(topo_mod_t *mp, tnode_t *tn, const char *cnm,
}
ulong_t
-strtonum(topo_mod_t *mp, char *str, int *err)
+fm_strtonum(topo_mod_t *mp, char *str, int *err)
{
ulong_t r;
char *e;
@@ -74,17 +72,17 @@ get_pci_vpd_sn_pn(topo_mod_t *mp, di_node_t dn, char **serial, char **part)
if ((promtree = topo_mod_prominfo(mp)) == DI_PROM_HANDLE_NIL) {
topo_mod_dprintf(mp,
- "get vpd data: di_prom_handle_init failed.\n");
+ "get vpd data: di_prom_handle_init failed.\n");
return (-1);
}
/* Get Serial Number and Part Number */
if ((di_prom_prop_lookup_bytes(promtree, dn, "vpd-serial-number",
- (uchar_t **)&s) > 0) && (s != NULL))
+ (uchar_t **)&s) > 0) && (s != NULL))
*serial = topo_mod_strdup(mp, s);
if ((di_prom_prop_lookup_bytes(promtree, dn, "vpd-part-number",
- (uchar_t **)&p) > 0) && (p != NULL))
+ (uchar_t **)&p) > 0) && (p != NULL))
*part = topo_mod_strdup(mp, p);
return (0);
@@ -109,7 +107,7 @@ tnode_create(topo_mod_t *mp, tnode_t *parent,
(void) get_pci_vpd_sn_pn(mp, priv, &serial, &part);
fmri = topo_mod_hcfmri(mp, parent, FM_HC_SCHEME_VERSION, name, i, NULL,
- auth, part, NULL, serial);
+ auth, part, NULL, serial);
nvlist_free(auth);
topo_mod_strfree(mp, serial);
topo_mod_strfree(mp, part);
diff --git a/usr/src/lib/fm/topo/modules/common/pcibus/util.h b/usr/src/lib/fm/topo/modules/common/pcibus/util.h
index 8dda2b6304..60a72d09f4 100644
--- a/usr/src/lib/fm/topo/modules/common/pcibus/util.h
+++ b/usr/src/lib/fm/topo/modules/common/pcibus/util.h
@@ -27,8 +27,6 @@
#ifndef _UTIL_H
#define _UTIL_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fm/topo_mod.h>
#ifdef __cplusplus
@@ -39,7 +37,7 @@ extern int child_range_add(topo_mod_t *, tnode_t *, const char *,
topo_instance_t, topo_instance_t);
extern int labelmethod_inherit(topo_mod_t *, tnode_t *, nvlist_t *,
nvlist_t **);
-extern ulong_t strtonum(topo_mod_t *, char *, int *);
+extern ulong_t fm_strtonum(topo_mod_t *, char *, int *);
extern tnode_t *tnode_create(topo_mod_t *, tnode_t *, const char *,
topo_instance_t, void *);
diff --git a/usr/src/lib/fm/topo/modules/sun4/hostbridge/hb_sun4.c b/usr/src/lib/fm/topo/modules/sun4/hostbridge/hb_sun4.c
index 7494152283..700058c9a5 100644
--- a/usr/src/lib/fm/topo/modules/sun4/hostbridge/hb_sun4.c
+++ b/usr/src/lib/fm/topo/modules/sun4/hostbridge/hb_sun4.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <string.h>
#include <fm/topo_mod.h>
#include <libdevinfo.h>
@@ -52,7 +50,7 @@ busorrc_new(topo_mod_t *mod, const char *bus_addr, di_node_t di)
bac = topo_mod_strdup(mod, bus_addr);
if ((comma = strchr(bac, ',')) != NULL)
*comma = '\0';
- pp->br_ba_bc = strtonum(mod, bac, &e);
+ pp->br_ba_bc = fm_strtonum(mod, bac, &e);
if (e < 0) {
topo_mod_dprintf(mod,
"Trouble interpreting bus_addr before comma.\n");
@@ -67,7 +65,7 @@ busorrc_new(topo_mod_t *mod, const char *bus_addr, di_node_t di)
topo_mod_strfree(mod, bac);
return (pp);
}
- pp->br_ba_ac = strtonum(mod, comma + 1, &e);
+ pp->br_ba_ac = fm_strtonum(mod, comma + 1, &e);
if (e < 0) {
topo_mod_dprintf(mod,
"Trouble interpreting bus_addr after comma.\n");
diff --git a/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c b/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
index ad5bc5dcad..70f1108f1b 100644
--- a/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
+++ b/usr/src/lib/fm/topo/modules/sun4/ioboard/ioboard.c
@@ -239,7 +239,7 @@ split_bus_address(topo_mod_t *mod, di_node_t dp, uint_t baseaddr,
return (NULL);
}
*comma = '\0';
- bc = strtonum(mod, bac, &e);
+ bc = fm_strtonum(mod, bac, &e);
*comma = ',';
if (e < 0) {
topo_mod_dprintf(mod,
@@ -247,7 +247,7 @@ split_bus_address(topo_mod_t *mod, di_node_t dp, uint_t baseaddr,
topo_mod_strfree(mod, bac);
return (NULL);
}
- ac = strtonum(mod, comma + 1, &e);
+ ac = fm_strtonum(mod, comma + 1, &e);
if (e < 0) {
topo_mod_dprintf(mod,
"Trouble interpreting %s after comma.\n", bac);
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index e77dd63255..8cee9dee02 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -18,14 +18,13 @@
#
# CDDL HEADER END
#
+
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016 Joyent, Inc.
-#
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright 2017 Nexenta Systems, Inc.
#
LIBCBASE= .
@@ -350,13 +349,13 @@ PORTGEN= \
ascii_strcasecmp.o \
ascii_strncasecmp.o \
assert.o \
+ atexit.o \
+ atfork.o \
atof.o \
atoi.o \
atol.o \
atoll.o \
attropen.o \
- atexit.o \
- atfork.o \
basename.o \
calloc.o \
catgets.o \
@@ -398,8 +397,10 @@ PORTGEN= \
fmtmsg.o \
ftime.o \
ftok.o \
+ fts.o \
ftw.o \
gcvt.o \
+ get_nprocs.o \
getauxv.o \
getcwd.o \
getdate_err.o \
@@ -417,7 +418,6 @@ PORTGEN= \
getlogin.o \
getmntent.o \
getnetgrent.o \
- get_nprocs.o \
getopt.o \
getopt_long.o \
getpagesize.o \
@@ -498,8 +498,8 @@ PORTGEN= \
posix_madvise.o \
posix_memalign.o \
priocntl.o \
- privlib.o \
priv_str_xlate.o \
+ privlib.o \
psecflags.o \
psiginfo.o \
psignal.o \
@@ -512,6 +512,7 @@ PORTGEN= \
rctlops.o \
readdir.o \
readdir_r.o \
+ reallocarray.o \
realpath.o \
reboot.o \
regexpr.o \
@@ -555,6 +556,7 @@ PORTGEN= \
strtoimax.o \
strtok.o \
strtok_r.o \
+ strtonum.o \
strtoumax.o \
swab.o \
swapctl.o \
@@ -1088,24 +1090,24 @@ SRCS= \
$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
$(COMOBJS:%.o=$(SRC)/common/util/%.c) \
- $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
- $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
- $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
- $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
- $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
- $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
- $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
- $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
- $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
- $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
- $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
- $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
- $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
+ $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
+ $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
+ $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
+ $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
+ $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
+ $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
+ $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
+ $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
+ $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
+ $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
+ $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
+ $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
+ $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
$(THREADSMACHOBJS:%.o=threads/%.c) \
$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
$(UNWINDMACHOBJS:%.o=unwind/%.c) \
$(FPOBJS:%.o=fp/%.c) \
- $(I386FPOBJS:%.o=$(LIBCDIR)/i386/fp/%.c) \
+ $(I386FPOBJS:%.o=$(LIBCDIR)/i386/fp/%.c) \
$(LIBCBASE)/gen/ecvt.c \
$(LIBCBASE)/gen/makectxt.c \
$(LIBCBASE)/gen/siginfolst.c \
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 4d24e7f176..0a879e1508 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -18,14 +18,13 @@
#
# CDDL HEADER END
#
+
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016 Joyent, Inc.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
-#
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright 2017 Nexenta Systems, Inc.
#
LIBCDIR= $(SRC)/lib/libc
@@ -385,14 +384,14 @@ PORTGEN= \
ascii_strcasecmp.o \
ascii_strncasecmp.o \
assert.o \
+ atexit.o \
+ atfork.o \
atof.o \
atoi.o \
atol.o \
atoll.o \
attrat.o \
attropen.o \
- atexit.o \
- atfork.o \
basename.o \
calloc.o \
catgets.o \
@@ -434,8 +433,10 @@ PORTGEN= \
fmtmsg.o \
ftime.o \
ftok.o \
+ fts.o \
ftw.o \
gcvt.o \
+ get_nprocs.o \
getauxv.o \
getcwd.o \
getdate_err.o \
@@ -453,7 +454,6 @@ PORTGEN= \
getlogin.o \
getmntent.o \
getnetgrent.o \
- get_nprocs.o \
getopt.o \
getopt_long.o \
getpagesize.o \
@@ -534,8 +534,8 @@ PORTGEN= \
posix_madvise.o \
posix_memalign.o \
priocntl.o \
- privlib.o \
priv_str_xlate.o \
+ privlib.o \
psecflags.o \
psiginfo.o \
psignal.o \
@@ -548,6 +548,7 @@ PORTGEN= \
rctlops.o \
readdir.o \
readdir_r.o \
+ reallocarray.o \
realpath.o \
reboot.o \
regexpr.o \
@@ -587,6 +588,7 @@ PORTGEN= \
strtoimax.o \
strtok.o \
strtok_r.o \
+ strtonum.o \
strtoumax.o \
swab.o \
swapctl.o \
@@ -1151,23 +1153,23 @@ SRCS= \
$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
$(COMOBJS:%.o=$(SRC)/common/util/%.c) \
$(DTRACEOBJS:%.o=$(SRC)/common/dtrace/%.c) \
- $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
- $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
- $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
- $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
- $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
- $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
- $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
- $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
- $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
- $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
- $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
- $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
- $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
- $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
+ $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
+ $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
+ $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
+ $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
+ $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
+ $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
+ $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
+ $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
+ $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
+ $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
+ $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
+ $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
+ $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
+ $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
- $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
- $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
+ $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
+ $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
$(LIBCBASE)/gen/ecvt.c \
$(LIBCBASE)/gen/makectxt.c \
$(LIBCBASE)/gen/siginfolst.c \
diff --git a/usr/src/lib/libc/port/gen/fts.c b/usr/src/lib/libc/port/gen/fts.c
new file mode 100644
index 0000000000..eac375ee6a
--- /dev/null
+++ b/usr/src/lib/libc/port/gen/fts.c
@@ -0,0 +1,1037 @@
+/*
+ * Copyright (c) 1990, 1993, 1994
+ * 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.
+ * 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.
+ *
+ * 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.
+ */
+
+#include <sys/stat.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <fts.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
+#define ALIGNBYTES _POINTER_ALIGNMENT
+#define ALIGN(p) (((unsigned long)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+
+static FTSENT *fts_alloc(FTS *, char *, size_t);
+static FTSENT *fts_build(FTS *, int);
+static void fts_lfree(FTSENT *);
+static void fts_load(FTS *, FTSENT *);
+static size_t fts_maxarglen(char * const *);
+static void fts_padjust(FTS *, FTSENT *);
+static int fts_palloc(FTS *, size_t);
+static FTSENT *fts_sort(FTS *, FTSENT *, int);
+static ushort_t fts_stat(FTS *, FTSENT *, int, int);
+static int fts_safe_changedir(FTS *, FTSENT *, int, char *);
+
+#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
+
+#define CLR(opt) (sp->fts_options &= ~(opt))
+#define ISSET(opt) (sp->fts_options & (opt))
+#define SET(opt) (sp->fts_options |= (opt))
+
+#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd))
+
+/* fts_build flags */
+#define BCHILD 1 /* fts_children */
+#define BNAMES 2 /* fts_children, names only */
+#define BREAD 3 /* fts_read */
+
+FTS *
+fts_open(char * const *argv, int options,
+ int (*compar)(const FTSENT **, const FTSENT **))
+{
+ FTS *sp;
+ FTSENT *p, *root;
+ int nitems;
+ FTSENT *parent, *prev;
+
+ /* Options check. */
+ if (options & ~FTS_OPTIONMASK) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /* At least one path must be specified. */
+ if (*argv == NULL) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /* Allocate/initialize the stream */
+ if ((sp = calloc(1, sizeof (FTS))) == NULL)
+ return (NULL);
+ sp->fts_compar = compar;
+ sp->fts_options = options;
+
+ /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
+ if (ISSET(FTS_LOGICAL))
+ SET(FTS_NOCHDIR);
+
+ /*
+ * Start out with 1K of path space, and enough, in any case,
+ * to hold the user's paths.
+ */
+ if (fts_palloc(sp, MAXIMUM(fts_maxarglen(argv), PATH_MAX)))
+ goto mem1;
+
+ /* Allocate/initialize root's parent. */
+ if ((parent = fts_alloc(sp, "", 0)) == NULL)
+ goto mem2;
+ parent->fts_level = FTS_ROOTPARENTLEVEL;
+
+ /* Allocate/initialize root(s). */
+ for (root = prev = NULL, nitems = 0; *argv; ++argv, ++nitems) {
+ if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL)
+ goto mem3;
+ p->fts_level = FTS_ROOTLEVEL;
+ p->fts_parent = parent;
+ p->fts_accpath = p->fts_name;
+ p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW), -1);
+
+ /* Command-line "." and ".." are real directories. */
+ if (p->fts_info == FTS_DOT)
+ p->fts_info = FTS_D;
+
+ /*
+ * If comparison routine supplied, traverse in sorted
+ * order; otherwise traverse in the order specified.
+ */
+ if (compar) {
+ p->fts_link = root;
+ root = p;
+ } else {
+ p->fts_link = NULL;
+ if (root == NULL)
+ root = p;
+ else
+ prev->fts_link = p;
+ prev = p;
+ }
+ }
+ if (compar && nitems > 1)
+ root = fts_sort(sp, root, nitems);
+
+ /*
+ * Allocate a dummy pointer and make fts_read think that we've just
+ * finished the node before the root(s); set p->fts_info to FTS_INIT
+ * so that everything about the "current" node is ignored.
+ */
+ if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
+ goto mem3;
+ sp->fts_cur->fts_link = root;
+ sp->fts_cur->fts_info = FTS_INIT;
+
+ /*
+ * If using chdir(2), grab a file descriptor pointing to dot to ensure
+ * that we can get back here; this could be avoided for some paths,
+ * but almost certainly not worth the effort. Slashes, symbolic links,
+ * and ".." are all fairly nasty problems. Note, if we can't get the
+ * descriptor we run anyway, just more slowly.
+ */
+ if (!ISSET(FTS_NOCHDIR) &&
+ (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
+ SET(FTS_NOCHDIR);
+
+ if (nitems == 0)
+ free(parent);
+
+ return (sp);
+
+mem3: fts_lfree(root);
+ free(parent);
+mem2: free(sp->fts_path);
+mem1: free(sp);
+ return (NULL);
+}
+
+static void
+fts_load(FTS *sp, FTSENT *p)
+{
+ size_t len;
+ char *cp;
+
+ /*
+ * Load the stream structure for the next traversal. Since we don't
+ * actually enter the directory until after the preorder visit, set
+ * the fts_accpath field specially so the chdir gets done to the right
+ * place and the user can access the first node. From fts_open it's
+ * known that the path will fit.
+ */
+ len = p->fts_pathlen = p->fts_namelen;
+ (void) memmove(sp->fts_path, p->fts_name, len + 1);
+ if (((cp = strrchr(p->fts_name, '/')) != NULL) &&
+ (cp != p->fts_name || cp[1])) {
+ len = strlen(++cp);
+ (void) memmove(p->fts_name, cp, len + 1);
+ p->fts_namelen = len;
+ }
+ p->fts_accpath = p->fts_path = sp->fts_path;
+ sp->fts_dev = p->fts_dev;
+}
+
+int
+fts_close(FTS *sp)
+{
+ FTSENT *freep, *p;
+ int rfd, error = 0;
+
+ /*
+ * This still works if we haven't read anything -- the dummy structure
+ * points to the root list, so we step through to the end of the root
+ * list which has a valid parent pointer.
+ */
+ if (sp->fts_cur) {
+ for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL; ) {
+ freep = p;
+ p = p->fts_link ? p->fts_link : p->fts_parent;
+ free(freep);
+ }
+ free(p);
+ }
+
+ /* Stash the original directory fd if needed. */
+ rfd = ISSET(FTS_NOCHDIR) ? -1 : sp->fts_rfd;
+
+ /* Free up child linked list, sort array, path buffer, stream ptr. */
+ if (sp->fts_child)
+ fts_lfree(sp->fts_child);
+ free(sp->fts_array);
+ free(sp->fts_path);
+ free(sp);
+
+ /* Return to original directory, checking for error. */
+ if (rfd != -1) {
+ int saved_errno;
+ error = fchdir(rfd);
+ saved_errno = errno;
+ (void) close(rfd);
+ errno = saved_errno;
+ }
+
+ return (error);
+}
+
+/*
+ * Special case of "/" at the end of the path so that slashes aren't
+ * appended which would cause paths to be written as "....//foo".
+ */
+#define NAPPEND(p) \
+ (p->fts_path[p->fts_pathlen - 1] == '/' \
+ ? p->fts_pathlen - 1 : p->fts_pathlen)
+
+FTSENT *
+fts_read(FTS *sp)
+{
+ FTSENT *p, *tmp;
+ int instr;
+ char *t;
+ int saved_errno;
+
+ /* If finished or unrecoverable error, return NULL. */
+ if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+ return (NULL);
+
+ /* Set current node pointer. */
+ p = sp->fts_cur;
+
+ /* Save and zero out user instructions. */
+ instr = p->fts_instr;
+ p->fts_instr = FTS_NOINSTR;
+
+ /* Any type of file may be re-visited; re-stat and re-turn. */
+ if (instr == FTS_AGAIN) {
+ p->fts_info = fts_stat(sp, p, 0, -1);
+ return (p);
+ }
+
+ /*
+ * Following a symlink -- SLNONE test allows application to see
+ * SLNONE and recover. If indirecting through a symlink, have
+ * keep a pointer to current location. If unable to get that
+ * pointer, follow fails.
+ */
+ if (instr == FTS_FOLLOW &&
+ (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
+ p->fts_info = fts_stat(sp, p, 1, -1);
+ if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+ if ((p->fts_symfd =
+ open(".", O_RDONLY | O_CLOEXEC)) < 0) {
+ p->fts_errno = errno;
+ p->fts_info = FTS_ERR;
+ } else
+ p->fts_flags |= FTS_SYMFOLLOW;
+ }
+ return (p);
+ }
+
+ /* Directory in pre-order. */
+ if (p->fts_info == FTS_D) {
+ /* If skipped or crossed mount point, do post-order visit. */
+ if (instr == FTS_SKIP ||
+ (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
+ if (p->fts_flags & FTS_SYMFOLLOW)
+ (void) close(p->fts_symfd);
+ if (sp->fts_child) {
+ fts_lfree(sp->fts_child);
+ sp->fts_child = NULL;
+ }
+ p->fts_info = FTS_DP;
+ return (p);
+ }
+
+ /* Rebuild if only read the names and now traversing. */
+ if (sp->fts_child && ISSET(FTS_NAMEONLY)) {
+ CLR(FTS_NAMEONLY);
+ fts_lfree(sp->fts_child);
+ sp->fts_child = NULL;
+ }
+
+ /*
+ * Cd to the subdirectory.
+ *
+ * If have already read and now fail to chdir, whack the list
+ * to make the names come out right, and set the parent errno
+ * so the application will eventually get an error condition.
+ * Set the FTS_DONTCHDIR flag so that when we logically change
+ * directories back to the parent we don't do a chdir.
+ *
+ * If haven't read do so. If the read fails, fts_build sets
+ * FTS_STOP or the fts_info field of the node.
+ */
+ if (sp->fts_child) {
+ if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
+ p->fts_errno = errno;
+ p->fts_flags |= FTS_DONTCHDIR;
+ for (p = sp->fts_child; p; p = p->fts_link)
+ p->fts_accpath =
+ p->fts_parent->fts_accpath;
+ }
+ } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
+ if (ISSET(FTS_STOP))
+ return (NULL);
+ return (p);
+ }
+ p = sp->fts_child;
+ sp->fts_child = NULL;
+ goto name;
+ }
+
+ /* Move to the next node on this level. */
+next: tmp = p;
+ if ((p = p->fts_link) != NULL) {
+ free(tmp);
+
+ /*
+ * If reached the top, return to the original directory (or
+ * the root of the tree), and load the paths for the next root.
+ */
+ if (p->fts_level == FTS_ROOTLEVEL) {
+ if (FCHDIR(sp, sp->fts_rfd)) {
+ SET(FTS_STOP);
+ return (NULL);
+ }
+ fts_load(sp, p);
+ return (sp->fts_cur = p);
+ }
+
+ /*
+ * User may have called fts_set on the node. If skipped,
+ * ignore. If followed, get a file descriptor so we can
+ * get back if necessary.
+ */
+ if (p->fts_instr == FTS_SKIP)
+ goto next;
+ if (p->fts_instr == FTS_FOLLOW) {
+ p->fts_info = fts_stat(sp, p, 1, -1);
+ if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
+ if ((p->fts_symfd =
+ open(".", O_RDONLY | O_CLOEXEC)) < 0) {
+ p->fts_errno = errno;
+ p->fts_info = FTS_ERR;
+ } else
+ p->fts_flags |= FTS_SYMFOLLOW;
+ }
+ p->fts_instr = FTS_NOINSTR;
+ }
+
+name: t = sp->fts_path + NAPPEND(p->fts_parent);
+ *t++ = '/';
+ (void) memmove(t, p->fts_name, p->fts_namelen + 1);
+ return (sp->fts_cur = p);
+ }
+
+ /* Move up to the parent node. */
+ p = tmp->fts_parent;
+ free(tmp);
+
+ if (p->fts_level == FTS_ROOTPARENTLEVEL) {
+ /*
+ * Done; free everything up and set errno to 0 so the user
+ * can distinguish between error and EOF.
+ */
+ free(p);
+ errno = 0;
+ return (sp->fts_cur = NULL);
+ }
+
+ /* NUL terminate the pathname. */
+ sp->fts_path[p->fts_pathlen] = '\0';
+
+ /*
+ * Return to the parent directory. If at a root node or came through
+ * a symlink, go back through the file descriptor. Otherwise, cd up
+ * one directory.
+ */
+ if (p->fts_level == FTS_ROOTLEVEL) {
+ if (FCHDIR(sp, sp->fts_rfd)) {
+ SET(FTS_STOP);
+ sp->fts_cur = p;
+ return (NULL);
+ }
+ } else if (p->fts_flags & FTS_SYMFOLLOW) {
+ if (FCHDIR(sp, p->fts_symfd)) {
+ saved_errno = errno;
+ (void) close(p->fts_symfd);
+ errno = saved_errno;
+ SET(FTS_STOP);
+ sp->fts_cur = p;
+ return (NULL);
+ }
+ (void) close(p->fts_symfd);
+ } else if (!(p->fts_flags & FTS_DONTCHDIR) &&
+ fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
+ SET(FTS_STOP);
+ sp->fts_cur = p;
+ return (NULL);
+ }
+ p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
+ return (sp->fts_cur = p);
+}
+
+/*
+ * Fts_set takes the stream as an argument although it's not used in this
+ * implementation; it would be necessary if anyone wanted to add global
+ * semantics to fts using fts_set. An error return is allowed for similar
+ * reasons.
+ */
+/*ARGSUSED*/
+int
+fts_set(FTS *sp, FTSENT *p, int instr)
+{
+ if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
+ instr != FTS_NOINSTR && instr != FTS_SKIP) {
+ errno = EINVAL;
+ return (1);
+ }
+ p->fts_instr = instr;
+ return (0);
+}
+
+FTSENT *
+fts_children(FTS *sp, int instr)
+{
+ FTSENT *p;
+ int fd;
+
+ if (instr && instr != FTS_NAMEONLY) {
+ errno = EINVAL;
+ return (NULL);
+ }
+
+ /* Set current node pointer. */
+ p = sp->fts_cur;
+
+ /*
+ * Errno set to 0 so user can distinguish empty directory from
+ * an error.
+ */
+ errno = 0;
+
+ /* Fatal errors stop here. */
+ if (ISSET(FTS_STOP))
+ return (NULL);
+
+ /* Return logical hierarchy of user's arguments. */
+ if (p->fts_info == FTS_INIT)
+ return (p->fts_link);
+
+ /*
+ * If not a directory being visited in pre-order, stop here. Could
+ * allow FTS_DNR, assuming the user has fixed the problem, but the
+ * same effect is available with FTS_AGAIN.
+ */
+ if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
+ return (NULL);
+
+ /* Free up any previous child list. */
+ if (sp->fts_child)
+ fts_lfree(sp->fts_child);
+
+ if (instr == FTS_NAMEONLY) {
+ SET(FTS_NAMEONLY);
+ instr = BNAMES;
+ } else
+ instr = BCHILD;
+
+ /*
+ * If using chdir on a relative path and called BEFORE fts_read does
+ * its chdir to the root of a traversal, we can lose -- we need to
+ * chdir into the subdirectory, and we don't know where the current
+ * directory is, so we can't get back so that the upcoming chdir by
+ * fts_read will work.
+ */
+ if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
+ ISSET(FTS_NOCHDIR))
+ return (sp->fts_child = fts_build(sp, instr));
+
+ if ((fd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
+ return (NULL);
+ sp->fts_child = fts_build(sp, instr);
+ if (fchdir(fd)) {
+ (void) close(fd);
+ return (NULL);
+ }
+ (void) close(fd);
+ return (sp->fts_child);
+}
+
+/*
+ * This is the tricky part -- do not casually change *anything* in here. The
+ * idea is to build the linked list of entries that are used by fts_children
+ * and fts_read. There are lots of special cases.
+ *
+ * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is
+ * set and it's a physical walk (so that symbolic links can't be directories),
+ * we can do things quickly. First, if it's a 4.4BSD file system, the type
+ * of the file is in the directory entry. Otherwise, we assume that the number
+ * of subdirectories in a node is equal to the number of links to the parent.
+ * The former skips all stat calls. The latter skips stat calls in any leaf
+ * directories and for any files after the subdirectories in the directory have
+ * been found, cutting the stat calls by about 2/3.
+ */
+static FTSENT *
+fts_build(FTS *sp, int type)
+{
+ struct dirent *dp;
+ FTSENT *p, *head;
+ FTSENT *cur, *tail;
+ DIR *dirp;
+ void *oldaddr;
+ size_t len, maxlen;
+ int nitems, cderrno, descend, level, nlinks, doadjust;
+ int saved_errno;
+ char *cp;
+
+ /* Set current node pointer. */
+ cur = sp->fts_cur;
+
+ /*
+ * Open the directory for reading. If this fails, we're done.
+ * If being called from fts_read, set the fts_info field.
+ */
+ if ((dirp = opendir(cur->fts_accpath)) == NULL) {
+ if (type == BREAD) {
+ cur->fts_info = FTS_DNR;
+ cur->fts_errno = errno;
+ }
+ return (NULL);
+ }
+
+ /*
+ * Nlinks is the number of possible entries of type directory in the
+ * directory if we're cheating on stat calls, 0 if we're not doing
+ * any stat calls at all, -1 if we're doing stats on everything.
+ */
+ if (type == BNAMES)
+ nlinks = 0;
+ else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL))
+ nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2);
+ else
+ nlinks = -1;
+
+ /*
+ * If we're going to need to stat anything or we want to descend
+ * and stay in the directory, chdir. If this fails we keep going,
+ * but set a flag so we don't chdir after the post-order visit.
+ * We won't be able to stat anything, but we can still return the
+ * names themselves. Note, that since fts_read won't be able to
+ * chdir into the directory, it will have to return different path
+ * names than before, i.e. "a/b" instead of "b". Since the node
+ * has already been visited in pre-order, have to wait until the
+ * post-order visit to return the error. There is a special case
+ * here, if there was nothing to stat then it's not an error to
+ * not be able to stat. This is all fairly nasty. If a program
+ * needed sorted entries or stat information, they had better be
+ * checking FTS_NS on the returned nodes.
+ */
+ cderrno = 0;
+ if (nlinks || type == BREAD) {
+ if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
+ if (nlinks && type == BREAD)
+ cur->fts_errno = errno;
+ cur->fts_flags |= FTS_DONTCHDIR;
+ descend = 0;
+ cderrno = errno;
+ (void) closedir(dirp);
+ dirp = NULL;
+ } else
+ descend = 1;
+ } else
+ descend = 0;
+
+ /*
+ * Figure out the max file name length that can be stored in the
+ * current path -- the inner loop allocates more path as necessary.
+ * We really wouldn't have to do the maxlen calculations here, we
+ * could do them in fts_read before returning the path, but it's a
+ * lot easier here since the length is part of the dirent structure.
+ *
+ * If not changing directories set a pointer so that can just append
+ * each new name into the path.
+ */
+ len = NAPPEND(cur);
+ if (ISSET(FTS_NOCHDIR)) {
+ cp = sp->fts_path + len;
+ *cp++ = '/';
+ }
+ len++;
+ maxlen = sp->fts_pathlen - len;
+
+ /*
+ * fts_level is signed so we must prevent it from wrapping
+ * around to FTS_ROOTLEVEL and FTS_ROOTPARENTLEVEL.
+ */
+ level = cur->fts_level;
+ if (level < FTS_MAXLEVEL)
+ level++;
+
+ /* Read the directory, attaching each entry to the `link' pointer. */
+ doadjust = 0;
+ for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp)); ) {
+ if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
+ continue;
+
+ if (!(p = fts_alloc(sp, dp->d_name, strlen(dp->d_name))))
+ goto mem1;
+ if (strlen(dp->d_name) >= maxlen) { /* include space for NUL */
+ oldaddr = sp->fts_path;
+ if (fts_palloc(sp, strlen(dp->d_name) +len + 1)) {
+ /*
+ * No more memory for path or structures. Save
+ * errno, free up the current structure and the
+ * structures already allocated.
+ */
+mem1: saved_errno = errno;
+ free(p);
+ fts_lfree(head);
+ (void) closedir(dirp);
+ cur->fts_info = FTS_ERR;
+ SET(FTS_STOP);
+ errno = saved_errno;
+ return (NULL);
+ }
+ /* Did realloc() change the pointer? */
+ if (oldaddr != sp->fts_path) {
+ doadjust = 1;
+ if (ISSET(FTS_NOCHDIR))
+ cp = sp->fts_path + len;
+ }
+ maxlen = sp->fts_pathlen - len;
+ }
+
+ p->fts_level = level;
+ p->fts_parent = sp->fts_cur;
+ p->fts_pathlen = len + strlen(dp->d_name);
+ if (p->fts_pathlen < len) {
+ /*
+ * If we wrap, free up the current structure and
+ * the structures already allocated, then error
+ * out with ENAMETOOLONG.
+ */
+ free(p);
+ fts_lfree(head);
+ (void) closedir(dirp);
+ cur->fts_info = FTS_ERR;
+ SET(FTS_STOP);
+ errno = ENAMETOOLONG;
+ return (NULL);
+ }
+
+ if (cderrno) {
+ if (nlinks) {
+ p->fts_info = FTS_NS;
+ p->fts_errno = cderrno;
+ } else
+ p->fts_info = FTS_NSOK;
+ p->fts_accpath = cur->fts_accpath;
+ } else if (nlinks == 0) {
+ p->fts_accpath =
+ ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
+ p->fts_info = FTS_NSOK;
+ } else {
+ /* Build a file name for fts_stat to stat. */
+ if (ISSET(FTS_NOCHDIR)) {
+ p->fts_accpath = p->fts_path;
+ (void) memmove(cp, p->fts_name,
+ p->fts_namelen + 1);
+ p->fts_info = fts_stat(sp, p, 0, dirfd(dirp));
+ } else {
+ p->fts_accpath = p->fts_name;
+ p->fts_info = fts_stat(sp, p, 0, -1);
+ }
+
+ /* Decrement link count if applicable. */
+ if (nlinks > 0 && (p->fts_info == FTS_D ||
+ p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
+ --nlinks;
+ }
+
+ /* We walk in directory order so "ls -f" doesn't get upset. */
+ p->fts_link = NULL;
+ if (head == NULL)
+ head = tail = p;
+ else {
+ tail->fts_link = p;
+ tail = p;
+ }
+ ++nitems;
+ }
+ if (dirp)
+ (void) closedir(dirp);
+
+ /*
+ * If realloc() changed the address of the path, adjust the
+ * addresses for the rest of the tree and the dir list.
+ */
+ if (doadjust)
+ fts_padjust(sp, head);
+
+ /*
+ * If not changing directories, reset the path back to original
+ * state.
+ */
+ if (ISSET(FTS_NOCHDIR)) {
+ if (len == sp->fts_pathlen || nitems == 0)
+ --cp;
+ *cp = '\0';
+ }
+
+ /*
+ * If descended after called from fts_children or after called from
+ * fts_read and nothing found, get back. At the root level we use
+ * the saved fd; if one of fts_open()'s arguments is a relative path
+ * to an empty directory, we wind up here with no other way back. If
+ * can't get back, we're done.
+ */
+ if (descend && (type == BCHILD || !nitems) &&
+ (cur->fts_level == FTS_ROOTLEVEL ? FCHDIR(sp, sp->fts_rfd) :
+ fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
+ cur->fts_info = FTS_ERR;
+ SET(FTS_STOP);
+ return (NULL);
+ }
+
+ /* If didn't find anything, return NULL. */
+ if (!nitems) {
+ if (type == BREAD)
+ cur->fts_info = FTS_DP;
+ return (NULL);
+ }
+
+ /* Sort the entries. */
+ if (sp->fts_compar && nitems > 1)
+ head = fts_sort(sp, head, nitems);
+ return (head);
+}
+
+static ushort_t
+fts_stat(FTS *sp, FTSENT *p, int follow, int dfd)
+{
+ FTSENT *t;
+ dev_t dev;
+ ino_t ino;
+ struct stat *sbp, sb;
+ int saved_errno;
+ const char *path;
+
+ if (dfd == -1) {
+ path = p->fts_accpath;
+ dfd = AT_FDCWD;
+ } else
+ path = p->fts_name;
+
+ /* If user needs stat info, stat buffer already allocated. */
+ sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
+
+ /*
+ * If doing a logical walk, or application requested FTS_FOLLOW, do
+ * a stat(2). If that fails, check for a non-existent symlink. If
+ * fail, set the errno from the stat call.
+ */
+ if (ISSET(FTS_LOGICAL) || follow) {
+ if (fstatat(dfd, path, sbp, 0)) {
+ saved_errno = errno;
+ if (!fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) {
+ errno = 0;
+ return (FTS_SLNONE);
+ }
+ p->fts_errno = saved_errno;
+ goto err;
+ }
+ } else if (fstatat(dfd, path, sbp, AT_SYMLINK_NOFOLLOW)) {
+ p->fts_errno = errno;
+err: (void) memset(sbp, 0, sizeof (struct stat));
+ return (FTS_NS);
+ }
+
+ if (S_ISDIR(sbp->st_mode)) {
+ /*
+ * Set the device/inode. Used to find cycles and check for
+ * crossing mount points. Also remember the link count, used
+ * in fts_build to limit the number of stat calls. It is
+ * understood that these fields are only referenced if fts_info
+ * is set to FTS_D.
+ */
+ dev = p->fts_dev = sbp->st_dev;
+ ino = p->fts_ino = sbp->st_ino;
+ p->fts_nlink = sbp->st_nlink;
+
+ if (ISDOT(p->fts_name))
+ return (FTS_DOT);
+
+ /*
+ * Cycle detection is done by brute force when the directory
+ * is first encountered. If the tree gets deep enough or the
+ * number of symbolic links to directories is high enough,
+ * something faster might be worthwhile.
+ */
+ for (t = p->fts_parent;
+ t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
+ if (ino == t->fts_ino && dev == t->fts_dev) {
+ p->fts_cycle = t;
+ return (FTS_DC);
+ }
+ return (FTS_D);
+ }
+ if (S_ISLNK(sbp->st_mode))
+ return (FTS_SL);
+ if (S_ISREG(sbp->st_mode))
+ return (FTS_F);
+ return (FTS_DEFAULT);
+}
+
+static FTSENT *
+fts_sort(FTS *sp, FTSENT *head, int nitems)
+{
+ FTSENT **ap, *p;
+
+ /*
+ * Construct an array of pointers to the structures and call qsort(3).
+ * Reassemble the array in the order returned by qsort. If unable to
+ * sort for memory reasons, return the directory entries in their
+ * current order. Allocate enough space for the current needs plus
+ * 40 so don't realloc one entry at a time.
+ */
+ if (nitems > sp->fts_nitems) {
+ struct _ftsent **a;
+
+ sp->fts_nitems = nitems + 40;
+ if ((a = reallocarray(sp->fts_array,
+ sp->fts_nitems, sizeof (FTSENT *))) == NULL) {
+ free(sp->fts_array);
+ sp->fts_array = NULL;
+ sp->fts_nitems = 0;
+ return (head);
+ }
+ sp->fts_array = a;
+ }
+ for (ap = sp->fts_array, p = head; p; p = p->fts_link)
+ *ap++ = p;
+ qsort(sp->fts_array, nitems, sizeof (FTSENT *), sp->fts_compar);
+ for (head = *(ap = sp->fts_array); --nitems; ++ap)
+ ap[0]->fts_link = ap[1];
+ ap[0]->fts_link = NULL;
+ return (head);
+}
+
+static FTSENT *
+fts_alloc(FTS *sp, char *name, size_t namelen)
+{
+ FTSENT *p;
+ size_t len;
+
+ /*
+ * The file name is a variable length array and no stat structure is
+ * necessary if the user has set the nostat bit. Allocate the FTSENT
+ * structure, the file name and the stat structure in one chunk, but
+ * be careful that the stat structure is reasonably aligned. Since the
+ * fts_name field is declared to be of size 1, the fts_name pointer is
+ * namelen + 2 before the first possible address of the stat structure.
+ */
+ len = sizeof (FTSENT) + namelen;
+ if (!ISSET(FTS_NOSTAT))
+ len += sizeof (struct stat) + ALIGNBYTES;
+ if ((p = calloc(1, len)) == NULL)
+ return (NULL);
+
+ p->fts_path = sp->fts_path;
+ p->fts_namelen = namelen;
+ p->fts_instr = FTS_NOINSTR;
+ if (!ISSET(FTS_NOSTAT))
+ p->fts_statp = (struct stat *)ALIGN(p->fts_name + namelen + 2);
+ (void) memcpy(p->fts_name, name, namelen);
+
+ return (p);
+}
+
+static void
+fts_lfree(FTSENT *head)
+{
+ FTSENT *p;
+
+ /* Free a linked list of structures. */
+ while ((p = head) != NULL) {
+ head = head->fts_link;
+ free(p);
+ }
+}
+
+/*
+ * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
+ * Most systems will allow creation of paths much longer than PATH_MAX, even
+ * though the kernel won't resolve them. Add the size (not just what's needed)
+ * plus 256 bytes so don't realloc the path 2 bytes at a time.
+ */
+static int
+fts_palloc(FTS *sp, size_t more)
+{
+ char *p;
+
+ /*
+ * Check for possible wraparound.
+ */
+ more += 256;
+ if (sp->fts_pathlen + more < sp->fts_pathlen) {
+ free(sp->fts_path);
+ sp->fts_path = NULL;
+ errno = ENAMETOOLONG;
+ return (1);
+ }
+ sp->fts_pathlen += more;
+ p = realloc(sp->fts_path, sp->fts_pathlen);
+ if (p == NULL) {
+ free(sp->fts_path);
+ sp->fts_path = NULL;
+ return (1);
+ }
+ sp->fts_path = p;
+ return (0);
+}
+
+/*
+ * When the path is realloc'd, have to fix all of the pointers in structures
+ * already returned.
+ */
+static void
+fts_padjust(FTS *sp, FTSENT *head)
+{
+ FTSENT *p;
+ char *addr = sp->fts_path;
+
+#define ADJUST(p) { \
+ if ((p)->fts_accpath != (p)->fts_name) { \
+ (p)->fts_accpath = \
+ (char *)addr + ((p)->fts_accpath - (p)->fts_path); \
+ } \
+ (p)->fts_path = addr; \
+}
+ /* Adjust the current set of children. */
+ for (p = sp->fts_child; p; p = p->fts_link)
+ ADJUST(p);
+
+ /* Adjust the rest of the tree, including the current level. */
+ for (p = head; p->fts_level >= FTS_ROOTLEVEL; ) {
+ ADJUST(p);
+ p = p->fts_link ? p->fts_link : p->fts_parent;
+ }
+}
+
+static size_t
+fts_maxarglen(char * const *argv)
+{
+ size_t len, max;
+
+ for (max = 0; *argv; ++argv)
+ if ((len = strlen(*argv)) > max)
+ max = len;
+ return (max + 1);
+}
+
+/*
+ * Change to dir specified by fd or p->fts_accpath without getting
+ * tricked by someone changing the world out from underneath us.
+ * Assumes p->fts_dev and p->fts_ino are filled in.
+ */
+static int
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
+{
+ int ret, oerrno, newfd;
+ struct stat sb;
+
+ newfd = fd;
+ if (ISSET(FTS_NOCHDIR))
+ return (0);
+ /*
+ * This originally specified O_DIRECTORY as well - restore once/if we
+ * implement the flag.
+ */
+ if (fd < 0 && (newfd = open(path, O_RDONLY|O_CLOEXEC)) < 0)
+ return (-1);
+ if (fstat(newfd, &sb)) {
+ ret = -1;
+ goto bail;
+ }
+ if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
+ errno = ENOENT; /* disinformation */
+ ret = -1;
+ goto bail;
+ }
+ ret = fchdir(newfd);
+bail:
+ oerrno = errno;
+ if (fd < 0)
+ (void) close(newfd);
+ errno = oerrno;
+ return (ret);
+}
diff --git a/usr/src/cmd/mandoc/compat_reallocarray.c b/usr/src/lib/libc/port/gen/reallocarray.c
index 6615190425..ecc4d25fa9 100644
--- a/usr/src/cmd/mandoc/compat_reallocarray.c
+++ b/usr/src/lib/libc/port/gen/reallocarray.c
@@ -1,13 +1,3 @@
-#include "config.h"
-
-#if HAVE_REALLOCARRAY
-
-int dummy;
-
-#else
-
-/* $Id: compat_reallocarray.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */
-/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -33,7 +23,7 @@ int dummy;
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
*/
-#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof (size_t) * 4))
void *
reallocarray(void *optr, size_t nmemb, size_t size)
@@ -41,9 +31,7 @@ reallocarray(void *optr, size_t nmemb, size_t size)
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
nmemb > 0 && SIZE_MAX / nmemb < size) {
errno = ENOMEM;
- return NULL;
+ return (NULL);
}
- return realloc(optr, size * nmemb);
+ return (realloc(optr, size * nmemb));
}
-
-#endif /*!HAVE_REALLOCARRAY*/
diff --git a/usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.c b/usr/src/lib/libc/port/gen/strtonum.c
index 9752bb29fa..e180769313 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/nc/strtonum.c
+++ b/usr/src/lib/libc/port/gen/strtonum.c
@@ -1,5 +1,3 @@
-/* $OpenBSD: strtonum.c,v 1.6 2004/08/03 19:38:01 millert Exp $ */
-
/*
* Copyright (c) 2004 Ted Unangst and Todd Miller
* All rights reserved.
@@ -17,23 +15,21 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
-#define INVALID 1
-#define TOOSMALL 2
-#define TOOLARGE 3
+#define INVALID 1
+#define TOOSMALL 2
+#define TOOLARGE 3
-unsigned int
-strtonum(const char *numstr, unsigned int minval, unsigned int maxval,
+long long
+strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp)
{
long long ll = 0;
- char *ep;
int error = 0;
+ char *ep;
struct errval {
const char *errstr;
int err;
@@ -46,9 +42,9 @@ strtonum(const char *numstr, unsigned int minval, unsigned int maxval,
ev[0].err = errno;
errno = 0;
- if (minval > maxval)
+ if (minval > maxval) {
error = INVALID;
- else {
+ } else {
ll = strtoll(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = INVALID;
@@ -63,9 +59,5 @@ strtonum(const char *numstr, unsigned int minval, unsigned int maxval,
if (error)
ll = 0;
- /*
- * we have already checked boundaries above so we can safely
- * convert return type here
- */
- return ((unsigned int)ll);
+ return (ll);
}
diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc
index d33a1d39c2..db73a140f9 100644
--- a/usr/src/lib/libc/port/llib-lc
+++ b/usr/src/lib/libc/port/llib-lc
@@ -21,7 +21,7 @@
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
* Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved.
* Copyright (c) 2013 Gary Mills
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
@@ -50,6 +50,7 @@
#include <float.h>
#include <fmtmsg.h>
#include <fnmatch.h>
+#include <fts.h>
#include <ftw.h>
#include <glob.h>
#include <getwidth.h>
@@ -435,7 +436,7 @@ int flock(int filedes, int operation);
/* fmtmsg.c */
int addseverity(int value, const char *string);
int fmtmsg(long class, const char *label, int severity, const char *text,
- const char *action, const char *tag);
+ const char *action, const char *tag);
/* ftime.c */
int ftime(struct timeb *tp);
@@ -443,6 +444,13 @@ int ftime(struct timeb *tp);
/* ftok.c */
key_t ftok(const char *path, int id);
+/* fts.c */
+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);
+
/* gcvt.c */
char *gcvt(double number, int ndigit, char *buf);
@@ -820,6 +828,9 @@ size_t rctlblk_size(void);
/* readdir.c */
struct dirent *readdir(DIR *dirp);
+/* reallocarray.c */
+void *reallocarray(void *, size_t, size_t);
+
/* realpath.c */
char *realpath(const char *_RESTRICT_KYWD raw, char *_RESTRICT_KYWD canon);
@@ -973,6 +984,9 @@ char *strtok_r(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
long strtol(const char *_RESTRICT_KYWD str, char **_RESTRICT_KYWD nptr,
int base);
+/* strtonum.c */
+long long strtonum(const char *, long long, long long, const char **);
+
/* strtoul.c */
unsigned long strtoul(const char *_RESTRICT_KYWD str,
char **_RESTRICT_KYWD nptr, int base);
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 9392abc540..c9e03580e2 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -93,6 +93,17 @@ $if _x86 && _ELF64
$add amd64
$endif
+SYMBOL_VERSION ILLUMOS_0.23 { # openbsd compat
+ protected:
+ fts_children;
+ fts_close;
+ fts_open;
+ fts_read;
+ fts_set;
+ reallocarray;
+ strtonum;
+} ILLUMOS_0.22;
+
SYMBOL_VERSION ILLUMOS_0.22 { # endian(3C)
protected:
htobe16;
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index 7c8f14372d..b478c61a74 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -18,14 +18,13 @@
#
# CDDL HEADER END
#
+
#
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2016 Joyent, Inc.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
-#
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright 2017 Nexenta Systems, Inc.
#
LIBCDIR= $(SRC)/lib/libc
@@ -410,14 +409,14 @@ PORTGEN= \
addsev.o \
ascii_strncasecmp.o \
assert.o \
+ atexit.o \
+ atfork.o \
atof.o \
atoi.o \
atol.o \
atoll.o \
attrat.o \
attropen.o \
- atexit.o \
- atfork.o \
basename.o \
calloc.o \
catgets.o \
@@ -459,8 +458,10 @@ PORTGEN= \
fmtmsg.o \
ftime.o \
ftok.o \
+ fts.o \
ftw.o \
gcvt.o \
+ get_nprocs.o \
getauxv.o \
getcwd.o \
getdate_err.o \
@@ -478,7 +479,6 @@ PORTGEN= \
getlogin.o \
getmntent.o \
getnetgrent.o \
- get_nprocs.o \
getopt.o \
getopt_long.o \
getpagesize.o \
@@ -560,8 +560,8 @@ PORTGEN= \
posix_madvise.o \
posix_memalign.o \
priocntl.o \
- privlib.o \
priv_str_xlate.o \
+ privlib.o \
psecflags.o \
psiginfo.o \
psignal.o \
@@ -574,6 +574,7 @@ PORTGEN= \
rctlops.o \
readdir.o \
readdir_r.o \
+ reallocarray.o \
realpath.o \
reboot.o \
regexpr.o \
@@ -615,6 +616,7 @@ PORTGEN= \
strtoimax.o \
strtok.o \
strtok_r.o \
+ strtonum.o \
strtoumax.o \
swab.o \
swapctl.o \
@@ -1175,23 +1177,23 @@ SRCS= \
$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
$(COMOBJS:%.o=$(SRC)/common/util/%.c) \
$(DTRACEOBJS:%.o=$(SRC)/common/dtrace/%.c) \
- $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
- $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
- $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
- $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
- $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
- $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
- $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
- $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
- $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
- $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
- $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
- $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
- $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
- $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
+ $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
+ $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
+ $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
+ $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
+ $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
+ $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
+ $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
+ $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
+ $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
+ $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
+ $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
+ $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
+ $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
+ $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
- $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
- $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
+ $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
+ $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
$(LIBCBASE)/crt/_ftou.c \
$(LIBCBASE)/gen/_xregs_clrptr.c \
$(LIBCBASE)/gen/byteorder.c \
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 6744289046..70d1fdea43 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -18,15 +18,14 @@
#
# CDDL HEADER END
#
+
#
# Copyright 2016 Gary Mills
# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2015, Joyent, Inc. All rights reserved.
# Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
-#
-# Copyright 2011 Nexenta Systems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright 2017 Nexenta Systems, Inc.
#
LIBCDIR= $(SRC)/lib/libc
@@ -368,14 +367,14 @@ PORTGEN= \
addsev.o \
ascii_strncasecmp.o \
assert.o \
- attrat.o \
+ atexit.o \
+ atfork.o \
atof.o \
atoi.o \
atol.o \
atoll.o \
+ attrat.o \
attropen.o \
- atexit.o \
- atfork.o \
basename.o \
calloc.o \
catgets.o \
@@ -417,8 +416,10 @@ PORTGEN= \
fmtmsg.o \
ftime.o \
ftok.o \
+ fts.o \
ftw.o \
gcvt.o \
+ get_nprocs.o \
getauxv.o \
getcwd.o \
getdate_err.o \
@@ -436,7 +437,6 @@ PORTGEN= \
getlogin.o \
getmntent.o \
getnetgrent.o \
- get_nprocs.o \
getopt.o \
getopt_long.o \
getpagesize.o \
@@ -518,8 +518,8 @@ PORTGEN= \
posix_madvise.o \
posix_memalign.o \
priocntl.o \
- privlib.o \
priv_str_xlate.o \
+ privlib.o \
psecflags.o \
psiginfo.o \
psignal.o \
@@ -532,6 +532,7 @@ PORTGEN= \
rctlops.o \
readdir.o \
readdir_r.o \
+ reallocarray.o \
realpath.o \
reboot.o \
regexpr.o \
@@ -573,6 +574,7 @@ PORTGEN= \
strtoimax.o \
strtok.o \
strtok_r.o \
+ strtonum.o \
strtoumax.o \
swab.o \
swapctl.o \
@@ -1105,23 +1107,23 @@ SRCS= \
$(ATOMICOBJS:%.o=$(SRC)/common/atomic/%.c) \
$(XATTROBJS:%.o=$(SRC)/common/xattr/%.c) \
$(COMOBJS:%.o=$(SRC)/common/util/%.c) \
- $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
- $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
- $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
- $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
- $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
- $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
- $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
- $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
- $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
- $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
- $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
- $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
- $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
- $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
+ $(PORTFP:%.o=$(LIBCDIR)/port/fp/%.c) \
+ $(PORTGEN:%.o=$(LIBCDIR)/port/gen/%.c) \
+ $(PORTI18N:%.o=$(LIBCDIR)/port/i18n/%.c) \
+ $(PORTLOCALE:%.o=$(LIBCDIR)/port/locale/%.c) \
+ $(PORTPRINT:%.o=$(LIBCDIR)/port/print/%.c) \
+ $(PORTREGEX:%.o=$(LIBCDIR)/port/regex/%.c) \
+ $(PORTSTDIO:%.o=$(LIBCDIR)/port/stdio/%.c) \
+ $(PORTSYS:%.o=$(LIBCDIR)/port/sys/%.c) \
+ $(AIOOBJS:%.o=$(LIBCDIR)/port/aio/%.c) \
+ $(RTOBJS:%.o=$(LIBCDIR)/port/rt/%.c) \
+ $(SECFLAGSOBJS:%.o=$(SRC)/common/secflags/%.c) \
+ $(TPOOLOBJS:%.o=$(LIBCDIR)/port/tpool/%.c) \
+ $(THREADSOBJS:%.o=$(LIBCDIR)/port/threads/%.c) \
+ $(THREADSMACHOBJS:%.o=$(LIBCDIR)/$(MACH)/threads/%.c) \
$(UNICODEOBJS:%.o=$(SRC)/common/unicode/%.c) \
- $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
- $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
+ $(UNWINDMACHOBJS:%.o=$(LIBCDIR)/port/unwind/%.c) \
+ $(FPOBJS:%.o=$(LIBCDIR)/$(MACH)/fp/%.c) \
$(FPOBJS64:%.o=$(LIBCBASE)/fp/%.c) \
$(LIBCBASE)/crt/_ftou.c \
$(LIBCBASE)/gen/_xregs_clrptr.c \
diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile
index 64e8b512cc..0d8c89c217 100644
--- a/usr/src/man/man3c/Makefile
+++ b/usr/src/man/man3c/Makefile
@@ -11,7 +11,7 @@
#
# Copyright 2011, Richard Lowe
-# Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2017 Nexenta Systems, Inc.
# Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
# Copyright 2016 Joyent, Inc.
@@ -19,466 +19,468 @@
include $(SRC)/Makefile.master
-MANSECT= 3c
-
-MANFILES= __fbufsize.3c \
- _longjmp.3c \
- _stack_grow.3c \
- a64l.3c \
- abort.3c \
- abs.3c \
- addsev.3c \
- addseverity.3c \
- aio_cancel.3c \
- aio_error.3c \
- aio_fsync.3c \
- aio_read.3c \
- aio_return.3c \
- aio_suspend.3c \
- aio_waitn.3c \
- aio_write.3c \
- aiocancel.3c \
- aioread.3c \
- aiowait.3c \
+MANSECT= 3c
+
+MANFILES= __fbufsize.3c \
+ _longjmp.3c \
+ _stack_grow.3c \
+ a64l.3c \
+ abort.3c \
+ abs.3c \
+ addsev.3c \
+ addseverity.3c \
+ aio_cancel.3c \
+ aio_error.3c \
+ aio_fsync.3c \
+ aio_read.3c \
+ aio_return.3c \
+ aio_suspend.3c \
+ aio_waitn.3c \
+ aio_write.3c \
+ aiocancel.3c \
+ aioread.3c \
+ aiowait.3c \
aligned_alloc.3c \
arc4random.3c \
- assert.3c \
- atexit.3c \
- atomic_add.3c \
- atomic_and.3c \
- atomic_bits.3c \
- atomic_cas.3c \
- atomic_dec.3c \
- atomic_inc.3c \
- atomic_ops.3c \
- atomic_or.3c \
- atomic_swap.3c \
- attropen.3c \
- basename.3c \
- bsd_signal.3c \
- bsearch.3c \
- bstring.3c \
- btowc.3c \
+ assert.3c \
+ atexit.3c \
+ atomic_add.3c \
+ atomic_and.3c \
+ atomic_bits.3c \
+ atomic_cas.3c \
+ atomic_dec.3c \
+ atomic_inc.3c \
+ atomic_ops.3c \
+ atomic_or.3c \
+ atomic_swap.3c \
+ attropen.3c \
+ basename.3c \
+ bsd_signal.3c \
+ bsearch.3c \
+ bstring.3c \
+ btowc.3c \
call_once.3c \
- catgets.3c \
- catopen.3c \
- cfgetispeed.3c \
- cfsetispeed.3c \
+ catgets.3c \
+ catopen.3c \
+ cfgetispeed.3c \
+ cfsetispeed.3c \
clearenv.3c \
- clock.3c \
- clock_nanosleep.3c \
- clock_settime.3c \
- closedir.3c \
- closefrom.3c \
+ clock.3c \
+ clock_nanosleep.3c \
+ clock_settime.3c \
+ closedir.3c \
+ closefrom.3c \
cnd.3c \
- cond_init.3c \
- confstr.3c \
- crypt.3c \
- crypt_genhash_impl.3c \
- crypt_gensalt.3c \
- crypt_gensalt_impl.3c \
- cset.3c \
- ctermid.3c \
- ctime.3c \
- ctype.3c \
- cuserid.3c \
- daemon.3c \
- decimal_to_floating.3c \
- difftime.3c \
- directio.3c \
- dirfd.3c \
- dirname.3c \
- div.3c \
- dladdr.3c \
- dlclose.3c \
- dldump.3c \
- dlerror.3c \
- dlinfo.3c \
- dlopen.3c \
- dlsym.3c \
- door_bind.3c \
- door_call.3c \
- door_create.3c \
- door_cred.3c \
- door_getparam.3c \
- door_info.3c \
- door_return.3c \
- door_revoke.3c \
- door_server_create.3c \
- door_ucred.3c \
- drand48.3c \
- dup2.3c \
- econvert.3c \
- ecvt.3c \
- enable_extended_FILE_stdio.3c \
- encrypt.3c \
- end.3c \
+ cond_init.3c \
+ confstr.3c \
+ crypt.3c \
+ crypt_genhash_impl.3c \
+ crypt_gensalt.3c \
+ crypt_gensalt_impl.3c \
+ cset.3c \
+ ctermid.3c \
+ ctime.3c \
+ ctype.3c \
+ cuserid.3c \
+ daemon.3c \
+ decimal_to_floating.3c \
+ difftime.3c \
+ directio.3c \
+ dirfd.3c \
+ dirname.3c \
+ div.3c \
+ dladdr.3c \
+ dlclose.3c \
+ dldump.3c \
+ dlerror.3c \
+ dlinfo.3c \
+ dlopen.3c \
+ dlsym.3c \
+ door_bind.3c \
+ door_call.3c \
+ door_create.3c \
+ door_cred.3c \
+ door_getparam.3c \
+ door_info.3c \
+ door_return.3c \
+ door_revoke.3c \
+ door_server_create.3c \
+ door_ucred.3c \
+ drand48.3c \
+ dup2.3c \
+ econvert.3c \
+ ecvt.3c \
+ enable_extended_FILE_stdio.3c \
+ encrypt.3c \
+ end.3c \
endian.3c \
- epoll_create.3c \
- epoll_ctl.3c \
- epoll_wait.3c \
- err.3c \
- euclen.3c \
+ epoll_create.3c \
+ epoll_ctl.3c \
+ epoll_wait.3c \
+ err.3c \
+ euclen.3c \
eventfd.3c \
- exit.3c \
- fattach.3c \
- fclose.3c \
+ exit.3c \
+ fattach.3c \
+ fclose.3c \
fcloseall.3c \
- fdatasync.3c \
- fdetach.3c \
- fdopen.3c \
- ferror.3c \
- fflush.3c \
- ffs.3c \
- fgetattr.3c \
- fgetc.3c \
- fgetpos.3c \
- fgetwc.3c \
- floating_to_decimal.3c \
+ fdatasync.3c \
+ fdetach.3c \
+ fdopen.3c \
+ ferror.3c \
+ fflush.3c \
+ ffs.3c \
+ fgetattr.3c \
+ fgetc.3c \
+ fgetpos.3c \
+ fgetwc.3c \
+ floating_to_decimal.3c \
flock.3c \
- flockfile.3c \
- fmtmsg.3c \
- fnmatch.3c \
- fopen.3c \
- fpgetround.3c \
- fputc.3c \
- fputwc.3c \
- fputws.3c \
- fread.3c \
- freopen.3c \
- fseek.3c \
- fsetpos.3c \
- fsync.3c \
- ftell.3c \
- ftime.3c \
- ftok.3c \
- ftw.3c \
- fwide.3c \
- fwprintf.3c \
- fwrite.3c \
- fwscanf.3c \
- getcpuid.3c \
- getcwd.3c \
- getdate.3c \
- getdtablesize.3c \
+ flockfile.3c \
+ fmtmsg.3c \
+ fnmatch.3c \
+ fopen.3c \
+ fpgetround.3c \
+ fputc.3c \
+ fputwc.3c \
+ fputws.3c \
+ fread.3c \
+ freopen.3c \
+ fseek.3c \
+ fsetpos.3c \
+ fsync.3c \
+ ftell.3c \
+ ftime.3c \
+ ftok.3c \
+ fts.3c \
+ ftw.3c \
+ fwide.3c \
+ fwprintf.3c \
+ fwrite.3c \
+ fwscanf.3c \
+ get_nprocs.3c \
+ getcpuid.3c \
+ getcwd.3c \
+ getdate.3c \
+ getdtablesize.3c \
getentropy.3c \
- getenv.3c \
- getexecname.3c \
- getgrnam.3c \
- gethostid.3c \
- gethostname.3c \
- gethrtime.3c \
+ getenv.3c \
+ getexecname.3c \
+ getgrnam.3c \
+ gethostid.3c \
+ gethostname.3c \
+ gethrtime.3c \
getline.3c \
- getloadavg.3c \
- getlogin.3c \
- getmntent.3c \
- getnetgrent.3c \
- get_nprocs.3c \
- getopt.3c \
- getpagesize.3c \
- getpagesizes.3c \
- getpass.3c \
- getpeerucred.3c \
- getpriority.3c \
+ getloadavg.3c \
+ getlogin.3c \
+ getmntent.3c \
+ getnetgrent.3c \
+ getopt.3c \
+ getpagesize.3c \
+ getpagesizes.3c \
+ getpass.3c \
+ getpeerucred.3c \
+ getpriority.3c \
getprogname.3c \
- getpw.3c \
- getpwnam.3c \
- getrusage.3c \
- gets.3c \
- getspnam.3c \
- getsubopt.3c \
- gettext.3c \
- gettimeofday.3c \
- gettxt.3c \
- getusershell.3c \
- getutent.3c \
- getutxent.3c \
- getvfsent.3c \
- getwc.3c \
- getwchar.3c \
- getwd.3c \
- getwidth.3c \
- getws.3c \
- getzoneid.3c \
- glob.3c \
- grantpt.3c \
- hsearch.3c \
- iconv.3c \
- iconv_close.3c \
- iconv_open.3c \
- imaxabs.3c \
- imaxdiv.3c \
- index.3c \
- initgroups.3c \
- insque.3c \
- is_system_labeled.3c \
- isaexec.3c \
- isastream.3c \
- isatty.3c \
- isnand.3c \
- iswalpha.3c \
- iswctype.3c \
- killpg.3c \
- lckpwdf.3c \
- lfmt.3c \
- lio_listio.3c \
- localeconv.3c \
- lockf.3c \
- lsearch.3c \
- madvise.3c \
- makecontext.3c \
- makedev.3c \
- malloc.3c \
- mblen.3c \
- mbrlen.3c \
- mbrtowc.3c \
- mbsinit.3c \
- mbsrtowcs.3c \
+ getpw.3c \
+ getpwnam.3c \
+ getrusage.3c \
+ gets.3c \
+ getspnam.3c \
+ getsubopt.3c \
+ gettext.3c \
+ gettimeofday.3c \
+ gettxt.3c \
+ getusershell.3c \
+ getutent.3c \
+ getutxent.3c \
+ getvfsent.3c \
+ getwc.3c \
+ getwchar.3c \
+ getwd.3c \
+ getwidth.3c \
+ getws.3c \
+ getzoneid.3c \
+ glob.3c \
+ grantpt.3c \
+ hsearch.3c \
+ iconv.3c \
+ iconv_close.3c \
+ iconv_open.3c \
+ imaxabs.3c \
+ imaxdiv.3c \
+ index.3c \
+ initgroups.3c \
+ insque.3c \
+ is_system_labeled.3c \
+ isaexec.3c \
+ isastream.3c \
+ isatty.3c \
+ isnand.3c \
+ iswalpha.3c \
+ iswctype.3c \
+ killpg.3c \
+ lckpwdf.3c \
+ lfmt.3c \
+ lio_listio.3c \
+ localeconv.3c \
+ lockf.3c \
+ lsearch.3c \
+ madvise.3c \
+ makecontext.3c \
+ makedev.3c \
+ malloc.3c \
+ mblen.3c \
+ mbrlen.3c \
+ mbrtowc.3c \
+ mbsinit.3c \
+ mbsrtowcs.3c \
mbstowcs.3c \
- mbtowc.3c \
- membar_ops.3c \
- memory.3c \
- mkfifo.3c \
- mkstemp.3c \
- mktemp.3c \
- mktime.3c \
- mlock.3c \
- mlockall.3c \
- monitor.3c \
- mq_close.3c \
- mq_getattr.3c \
- mq_notify.3c \
- mq_open.3c \
- mq_receive.3c \
- mq_send.3c \
- mq_setattr.3c \
- mq_unlink.3c \
- msync.3c \
+ mbtowc.3c \
+ membar_ops.3c \
+ memory.3c \
+ mkfifo.3c \
+ mkstemp.3c \
+ mktemp.3c \
+ mktime.3c \
+ mlock.3c \
+ mlockall.3c \
+ monitor.3c \
+ mq_close.3c \
+ mq_getattr.3c \
+ mq_notify.3c \
+ mq_open.3c \
+ mq_receive.3c \
+ mq_send.3c \
+ mq_setattr.3c \
+ mq_unlink.3c \
+ msync.3c \
mtx.3c \
- mutex_init.3c \
- nanosleep.3c \
- ndbm.3c \
- newlocale.3c \
- nl_langinfo.3c \
- offsetof.3c \
- opendir.3c \
- perror.3c \
- pfmt.3c \
- plock.3c \
- popen.3c \
- port_alert.3c \
- port_associate.3c \
- port_create.3c \
- port_get.3c \
- port_send.3c \
- posix_fadvise.3c \
- posix_fallocate.3c \
- posix_madvise.3c \
- posix_memalign.3c \
- posix_openpt.3c \
- posix_spawn.3c \
- posix_spawn_file_actions_addclose.3c \
- posix_spawn_file_actions_addclosefrom_np.3c \
- posix_spawn_file_actions_adddup2.3c \
- posix_spawn_file_actions_destroy.3c \
- posix_spawn_pipe_np.3c \
- posix_spawnattr_destroy.3c \
- posix_spawnattr_getflags.3c \
- posix_spawnattr_getpgroup.3c \
- posix_spawnattr_getschedparam.3c \
- posix_spawnattr_getschedpolicy.3c \
- posix_spawnattr_getsigdefault.3c \
- posix_spawnattr_getsigignore_np.3c \
- posix_spawnattr_getsigmask.3c \
- printf.3c \
- priv_addset.3c \
- priv_set.3c \
- priv_str_to_set.3c \
- pset_getloadavg.3c \
- psignal.3c \
- pthread_atfork.3c \
- pthread_attr_getdetachstate.3c \
- pthread_attr_getguardsize.3c \
- pthread_attr_getinheritsched.3c \
- pthread_attr_getschedparam.3c \
- pthread_attr_getschedpolicy.3c \
- pthread_attr_getscope.3c \
- pthread_attr_getstack.3c \
- pthread_attr_getstackaddr.3c \
- pthread_attr_getstacksize.3c \
+ mutex_init.3c \
+ nanosleep.3c \
+ ndbm.3c \
+ newlocale.3c \
+ nl_langinfo.3c \
+ offsetof.3c \
+ opendir.3c \
+ perror.3c \
+ pfmt.3c \
+ plock.3c \
+ popen.3c \
+ port_alert.3c \
+ port_associate.3c \
+ port_create.3c \
+ port_get.3c \
+ port_send.3c \
+ posix_fadvise.3c \
+ posix_fallocate.3c \
+ posix_madvise.3c \
+ posix_memalign.3c \
+ posix_openpt.3c \
+ posix_spawn.3c \
+ posix_spawn_file_actions_addclose.3c \
+ posix_spawn_file_actions_addclosefrom_np.3c \
+ posix_spawn_file_actions_adddup2.3c \
+ posix_spawn_file_actions_destroy.3c \
+ posix_spawn_pipe_np.3c \
+ posix_spawnattr_destroy.3c \
+ posix_spawnattr_getflags.3c \
+ posix_spawnattr_getpgroup.3c \
+ posix_spawnattr_getschedparam.3c \
+ posix_spawnattr_getschedpolicy.3c \
+ posix_spawnattr_getsigdefault.3c \
+ posix_spawnattr_getsigignore_np.3c \
+ posix_spawnattr_getsigmask.3c \
+ printf.3c \
+ priv_addset.3c \
+ priv_set.3c \
+ priv_str_to_set.3c \
+ pset_getloadavg.3c \
+ psignal.3c \
+ pthread_atfork.3c \
pthread_attr_get_np.3c \
- pthread_attr_init.3c \
- pthread_barrier_destroy.3c \
- pthread_barrier_wait.3c \
- pthread_barrierattr_destroy.3c \
- pthread_barrierattr_getpshared.3c \
- pthread_cancel.3c \
- pthread_cleanup_pop.3c \
- pthread_cleanup_push.3c \
- pthread_cond_init.3c \
- pthread_cond_signal.3c \
- pthread_cond_wait.3c \
- pthread_condattr_getclock.3c \
- pthread_condattr_getpshared.3c \
- pthread_condattr_init.3c \
- pthread_create.3c \
- pthread_detach.3c \
- pthread_equal.3c \
- pthread_exit.3c \
- pthread_getconcurrency.3c \
- pthread_getschedparam.3c \
- pthread_getspecific.3c \
- pthread_join.3c \
- pthread_key_create.3c \
- pthread_key_delete.3c \
- pthread_kill.3c \
+ pthread_attr_getdetachstate.3c \
+ pthread_attr_getguardsize.3c \
+ pthread_attr_getinheritsched.3c \
+ pthread_attr_getschedparam.3c \
+ pthread_attr_getschedpolicy.3c \
+ pthread_attr_getscope.3c \
+ pthread_attr_getstack.3c \
+ pthread_attr_getstackaddr.3c \
+ pthread_attr_getstacksize.3c \
+ pthread_attr_init.3c \
+ pthread_barrier_destroy.3c \
+ pthread_barrier_wait.3c \
+ pthread_barrierattr_destroy.3c \
+ pthread_barrierattr_getpshared.3c \
+ pthread_cancel.3c \
+ pthread_cleanup_pop.3c \
+ pthread_cleanup_push.3c \
+ pthread_cond_init.3c \
+ pthread_cond_signal.3c \
+ pthread_cond_wait.3c \
+ pthread_condattr_getclock.3c \
+ pthread_condattr_getpshared.3c \
+ pthread_condattr_init.3c \
+ pthread_create.3c \
+ pthread_detach.3c \
+ pthread_equal.3c \
+ pthread_exit.3c \
+ pthread_getconcurrency.3c \
+ pthread_getschedparam.3c \
+ pthread_getspecific.3c \
+ pthread_join.3c \
+ pthread_key_create.3c \
+ pthread_key_delete.3c \
+ pthread_kill.3c \
pthread_mutex_consistent.3c \
- pthread_mutex_getprioceiling.3c \
- pthread_mutex_init.3c \
- pthread_mutex_lock.3c \
- pthread_mutex_timedlock.3c \
- pthread_mutexattr_getprioceiling.3c \
- pthread_mutexattr_getprotocol.3c \
- pthread_mutexattr_getpshared.3c \
+ pthread_mutex_getprioceiling.3c \
+ pthread_mutex_init.3c \
+ pthread_mutex_lock.3c \
+ pthread_mutex_timedlock.3c \
+ pthread_mutexattr_getprioceiling.3c \
+ pthread_mutexattr_getprotocol.3c \
+ pthread_mutexattr_getpshared.3c \
pthread_mutexattr_getrobust.3c \
- pthread_mutexattr_gettype.3c \
- pthread_mutexattr_init.3c \
- pthread_once.3c \
- pthread_rwlock_init.3c \
- pthread_rwlock_rdlock.3c \
- pthread_rwlock_timedrdlock.3c \
- pthread_rwlock_timedwrlock.3c \
- pthread_rwlock_unlock.3c \
- pthread_rwlock_wrlock.3c \
- pthread_rwlockattr_getpshared.3c \
- pthread_rwlockattr_init.3c \
- pthread_self.3c \
- pthread_setcancelstate.3c \
- pthread_setcanceltype.3c \
- pthread_setschedprio.3c \
- pthread_sigmask.3c \
- pthread_spin_destroy.3c \
- pthread_spin_lock.3c \
- pthread_spin_unlock.3c \
- pthread_testcancel.3c \
- ptrace.3c \
- ptsname.3c \
- putenv.3c \
- putpwent.3c \
- puts.3c \
- putspent.3c \
- putws.3c \
- qsort.3c \
+ pthread_mutexattr_gettype.3c \
+ pthread_mutexattr_init.3c \
+ pthread_once.3c \
+ pthread_rwlock_init.3c \
+ pthread_rwlock_rdlock.3c \
+ pthread_rwlock_timedrdlock.3c \
+ pthread_rwlock_timedwrlock.3c \
+ pthread_rwlock_unlock.3c \
+ pthread_rwlock_wrlock.3c \
+ pthread_rwlockattr_getpshared.3c \
+ pthread_rwlockattr_init.3c \
+ pthread_self.3c \
+ pthread_setcancelstate.3c \
+ pthread_setcanceltype.3c \
+ pthread_setschedprio.3c \
+ pthread_sigmask.3c \
+ pthread_spin_destroy.3c \
+ pthread_spin_lock.3c \
+ pthread_spin_unlock.3c \
+ pthread_testcancel.3c \
+ ptrace.3c \
+ ptsname.3c \
+ putenv.3c \
+ putpwent.3c \
+ puts.3c \
+ putspent.3c \
+ putws.3c \
+ qsort.3c \
quick_exit.3c \
- raise.3c \
- rand.3c \
- random.3c \
- rctl_walk.3c \
- rctlblk_set_value.3c \
- re_comp.3c \
- readdir.3c \
- realpath.3c \
- reboot.3c \
- regcmp.3c \
- regcomp.3c \
- remove.3c \
- rewind.3c \
- rewinddir.3c \
- rwlock.3c \
- scandir.3c \
- scanf.3c \
- sched_get_priority_max.3c \
- sched_getparam.3c \
- sched_getscheduler.3c \
- sched_rr_get_interval.3c \
- sched_setparam.3c \
- sched_setscheduler.3c \
- sched_yield.3c \
- schedctl_init.3c \
- seekdir.3c \
- select.3c \
- sem_close.3c \
- sem_destroy.3c \
- sem_getvalue.3c \
- sem_init.3c \
- sem_open.3c \
- sem_post.3c \
- sem_timedwait.3c \
- sem_unlink.3c \
- sem_wait.3c \
- semaphore.3c \
- setbuf.3c \
- setbuffer.3c \
- setcat.3c \
- setenv.3c \
- setjmp.3c \
- setkey.3c \
- setlabel.3c \
- setlocale.3c \
- shm_open.3c \
- shm_unlink.3c \
- sigfpe.3c \
- siginterrupt.3c \
- signal.3c \
+ raise.3c \
+ rand.3c \
+ random.3c \
+ rctl_walk.3c \
+ rctlblk_set_value.3c \
+ re_comp.3c \
+ readdir.3c \
+ realpath.3c \
+ reboot.3c \
+ regcmp.3c \
+ regcomp.3c \
+ remove.3c \
+ rewind.3c \
+ rewinddir.3c \
+ rwlock.3c \
+ scandir.3c \
+ scanf.3c \
+ sched_get_priority_max.3c \
+ sched_getparam.3c \
+ sched_getscheduler.3c \
+ sched_rr_get_interval.3c \
+ sched_setparam.3c \
+ sched_setscheduler.3c \
+ sched_yield.3c \
+ schedctl_init.3c \
+ seekdir.3c \
+ select.3c \
+ sem_close.3c \
+ sem_destroy.3c \
+ sem_getvalue.3c \
+ sem_init.3c \
+ sem_open.3c \
+ sem_post.3c \
+ sem_timedwait.3c \
+ sem_unlink.3c \
+ sem_wait.3c \
+ semaphore.3c \
+ setbuf.3c \
+ setbuffer.3c \
+ setcat.3c \
+ setenv.3c \
+ setjmp.3c \
+ setkey.3c \
+ setlabel.3c \
+ setlocale.3c \
+ shm_open.3c \
+ shm_unlink.3c \
+ sigfpe.3c \
+ siginterrupt.3c \
+ signal.3c \
signalfd.3c \
- sigqueue.3c \
- sigsetops.3c \
- sigstack.3c \
- sigwaitinfo.3c \
- sleep.3c \
- ssignal.3c \
+ sigqueue.3c \
+ sigsetops.3c \
+ sigstack.3c \
+ sigwaitinfo.3c \
+ sleep.3c \
smt_pause.3c \
- stack_getbounds.3c \
- stack_inbounds.3c \
- stack_setbounds.3c \
- stack_violation.3c \
- stdio.3c \
- str2sig.3c \
- strcoll.3c \
- strerror.3c \
- strfmon.3c \
- strftime.3c \
- string.3c \
- string_to_decimal.3c \
- strptime.3c \
- strsignal.3c \
- strtod.3c \
- strtoimax.3c \
- strtol.3c \
- strtoul.3c \
- strtows.3c \
- strxfrm.3c \
- swab.3c \
- sync_instruction_memory.3c \
- sysconf.3c \
- syslog.3c \
- system.3c \
- tcdrain.3c \
- tcflow.3c \
- tcflush.3c \
- tcgetattr.3c \
- tcgetpgrp.3c \
- tcgetsid.3c \
- tcsendbreak.3c \
- tcsetattr.3c \
- tcsetpgrp.3c \
- tell.3c \
- telldir.3c \
- termios.3c \
- thr_create.3c \
- thr_exit.3c \
- thr_getconcurrency.3c \
- thr_getprio.3c \
- thr_join.3c \
- thr_keycreate.3c \
- thr_kill.3c \
- thr_main.3c \
- thr_min_stack.3c \
- thr_self.3c \
- thr_sigsetmask.3c \
- thr_stksegment.3c \
- thr_suspend.3c \
- thr_yield.3c \
+ ssignal.3c \
+ stack_getbounds.3c \
+ stack_inbounds.3c \
+ stack_setbounds.3c \
+ stack_violation.3c \
+ stdio.3c \
+ str2sig.3c \
+ strcoll.3c \
+ strerror.3c \
+ strfmon.3c \
+ strftime.3c \
+ string.3c \
+ string_to_decimal.3c \
+ strptime.3c \
+ strsignal.3c \
+ strtod.3c \
+ strtoimax.3c \
+ strtol.3c \
+ strtonum.3c \
+ strtoul.3c \
+ strtows.3c \
+ strxfrm.3c \
+ swab.3c \
+ sync_instruction_memory.3c \
+ sysconf.3c \
+ syslog.3c \
+ system.3c \
+ tcdrain.3c \
+ tcflow.3c \
+ tcflush.3c \
+ tcgetattr.3c \
+ tcgetpgrp.3c \
+ tcgetsid.3c \
+ tcsendbreak.3c \
+ tcsetattr.3c \
+ tcsetpgrp.3c \
+ tell.3c \
+ telldir.3c \
+ termios.3c \
+ thr_create.3c \
+ thr_exit.3c \
+ thr_getconcurrency.3c \
+ thr_getprio.3c \
+ thr_join.3c \
+ thr_keycreate.3c \
+ thr_kill.3c \
+ thr_main.3c \
+ thr_min_stack.3c \
+ thr_self.3c \
+ thr_sigsetmask.3c \
+ thr_stksegment.3c \
+ thr_suspend.3c \
+ thr_yield.3c \
thrd_create.3c \
thrd_current.3c \
thrd_detach.3c \
@@ -486,917 +488,923 @@ MANFILES= __fbufsize.3c \
thrd_exit.3c \
thrd_join.3c \
thrd_yield.3c \
- timer_create.3c \
- timer_delete.3c \
- timer_settime.3c \
- timeradd.3c \
+ timer_create.3c \
+ timer_delete.3c \
+ timer_settime.3c \
+ timeradd.3c \
timerfd_create.3c \
timespec_get.3c \
- tmpfile.3c \
- tmpnam.3c \
- toascii.3c \
- tolower.3c \
- toupper.3c \
- towlower.3c \
- towupper.3c \
- truncate.3c \
- tsearch.3c \
+ tmpfile.3c \
+ tmpnam.3c \
+ toascii.3c \
+ tolower.3c \
+ toupper.3c \
+ towlower.3c \
+ towupper.3c \
+ truncate.3c \
+ tsearch.3c \
tss.3c \
- ttyname.3c \
- ttyslot.3c \
- u8_strcmp.3c \
- u8_textprep_str.3c \
- u8_validate.3c \
- ualarm.3c \
- uconv_u16tou32.3c \
- ucred.3c \
- ungetc.3c \
- ungetwc.3c \
- unlockpt.3c \
- unsetenv.3c \
- uselocale.3c \
- usleep.3c \
- vfwprintf.3c \
- vlfmt.3c \
- vpfmt.3c \
- vprintf.3c \
- vsyslog.3c \
- wait.3c \
- wait3.3c \
- waitpid.3c \
- walkcontext.3c \
+ ttyname.3c \
+ ttyslot.3c \
+ u8_strcmp.3c \
+ u8_textprep_str.3c \
+ u8_validate.3c \
+ ualarm.3c \
+ uconv_u16tou32.3c \
+ ucred.3c \
+ ungetc.3c \
+ ungetwc.3c \
+ unlockpt.3c \
+ unsetenv.3c \
+ uselocale.3c \
+ usleep.3c \
+ vfwprintf.3c \
+ vlfmt.3c \
+ vpfmt.3c \
+ vprintf.3c \
+ vsyslog.3c \
+ wait.3c \
+ wait3.3c \
+ waitpid.3c \
+ walkcontext.3c \
wcpcpy.3c \
- wcrtomb.3c \
+ wcrtomb.3c \
wcscasecmp.3c \
- wcscoll.3c \
+ wcscoll.3c \
wcsdup.3c \
+ wcsftime.3c \
wcslen.3c \
- wcsftime.3c \
- wcsrtombs.3c \
- wcsstr.3c \
- wcstod.3c \
- wcstoimax.3c \
- wcstol.3c \
+ wcsrtombs.3c \
+ wcsstr.3c \
+ wcstod.3c \
+ wcstoimax.3c \
+ wcstol.3c \
wcstombs.3c \
- wcstoul.3c \
- wcstring.3c \
- wcswidth.3c \
- wcsxfrm.3c \
- wctob.3c \
- wctomb.3c \
- wctrans.3c \
- wctype.3c \
- wcwidth.3c \
- wmemchr.3c \
- wmemcmp.3c \
- wmemcpy.3c \
- wmemmove.3c \
- wmemset.3c \
- wordexp.3c \
- wsprintf.3c \
- wsscanf.3c \
- wstring.3c \
+ wcstoul.3c \
+ wcstring.3c \
+ wcswidth.3c \
+ wcsxfrm.3c \
+ wctob.3c \
+ wctomb.3c \
+ wctrans.3c \
+ wctype.3c \
+ wcwidth.3c \
+ wmemchr.3c \
+ wmemcmp.3c \
+ wmemcpy.3c \
+ wmemmove.3c \
+ wmemset.3c \
+ wordexp.3c \
+ wsprintf.3c \
+ wsscanf.3c \
+ wstring.3c \
MANLINKS= FD_CLR.3c \
- FD_ISSET.3c \
- FD_SET.3c \
- FD_ZERO.3c \
- __flbf.3c \
- __fpending.3c \
- __fpurge.3c \
- __freadable.3c \
- __freading.3c \
- __fsetlocking.3c \
- __fwritable.3c \
- __fwriting.3c \
- _edata.3c \
- _end.3c \
- _etext.3c \
- _exithandle.3c \
- _flushlbf.3c \
- _setjmp.3c \
- addrtosymstr.3c \
- aiowrite.3c \
- alloca.3c \
- alphasort.3c \
- ascftime.3c \
- asctime.3c \
- asctime_r.3c \
- asprintf.3c \
- at_quick_exit.3c \
- atof.3c \
- atoi.3c \
- atol.3c \
- atoll.3c \
+ FD_ISSET.3c \
+ FD_SET.3c \
+ FD_ZERO.3c \
+ __flbf.3c \
+ __fpending.3c \
+ __fpurge.3c \
+ __freadable.3c \
+ __freading.3c \
+ __fsetlocking.3c \
+ __fwritable.3c \
+ __fwriting.3c \
+ _edata.3c \
+ _end.3c \
+ _etext.3c \
+ _exithandle.3c \
+ _flushlbf.3c \
+ _setjmp.3c \
+ addrtosymstr.3c \
+ aiowrite.3c \
+ alloca.3c \
+ alphasort.3c \
arc4random_buf.3c \
arc4random_uniform.3c \
- atomic_add_16.3c \
- atomic_add_16_nv.3c \
- atomic_add_32.3c \
- atomic_add_32_nv.3c \
- atomic_add_64.3c \
- atomic_add_64_nv.3c \
- atomic_add_8.3c \
- atomic_add_8_nv.3c \
- atomic_add_char.3c \
- atomic_add_char_nv.3c \
- atomic_add_int.3c \
- atomic_add_int_nv.3c \
- atomic_add_long.3c \
- atomic_add_long_nv.3c \
- atomic_add_ptr.3c \
- atomic_add_ptr_nv.3c \
- atomic_add_short.3c \
- atomic_add_short_nv.3c \
- atomic_and_16.3c \
- atomic_and_16_nv.3c \
- atomic_and_32.3c \
- atomic_and_32_nv.3c \
- atomic_and_64.3c \
- atomic_and_64_nv.3c \
- atomic_and_8.3c \
- atomic_and_8_nv.3c \
- atomic_and_uchar.3c \
- atomic_and_uchar_nv.3c \
- atomic_and_uint.3c \
- atomic_and_uint_nv.3c \
- atomic_and_ulong.3c \
- atomic_and_ulong_nv.3c \
- atomic_and_ushort.3c \
- atomic_and_ushort_nv.3c \
- atomic_cas_16.3c \
- atomic_cas_32.3c \
- atomic_cas_64.3c \
- atomic_cas_8.3c \
- atomic_cas_ptr.3c \
- atomic_cas_uchar.3c \
- atomic_cas_uint.3c \
- atomic_cas_ulong.3c \
- atomic_cas_ushort.3c \
- atomic_clear_long_excl.3c \
- atomic_dec_16.3c \
- atomic_dec_16_nv.3c \
- atomic_dec_32.3c \
- atomic_dec_32_nv.3c \
- atomic_dec_64.3c \
- atomic_dec_64_nv.3c \
- atomic_dec_8.3c \
- atomic_dec_8_nv.3c \
- atomic_dec_ptr.3c \
- atomic_dec_ptr_nv.3c \
- atomic_dec_uchar.3c \
- atomic_dec_uchar_nv.3c \
- atomic_dec_uint.3c \
- atomic_dec_uint_nv.3c \
- atomic_dec_ulong.3c \
- atomic_dec_ulong_nv.3c \
- atomic_dec_ushort.3c \
- atomic_dec_ushort_nv.3c \
- atomic_inc_16.3c \
- atomic_inc_16_nv.3c \
- atomic_inc_32.3c \
- atomic_inc_32_nv.3c \
- atomic_inc_64.3c \
- atomic_inc_64_nv.3c \
- atomic_inc_8.3c \
- atomic_inc_8_nv.3c \
- atomic_inc_ptr.3c \
- atomic_inc_ptr_nv.3c \
- atomic_inc_uchar.3c \
- atomic_inc_uchar_nv.3c \
- atomic_inc_uint.3c \
- atomic_inc_uint_nv.3c \
- atomic_inc_ulong.3c \
- atomic_inc_ulong_nv.3c \
- atomic_inc_ushort.3c \
- atomic_inc_ushort_nv.3c \
- atomic_or_16.3c \
- atomic_or_16_nv.3c \
- atomic_or_32.3c \
- atomic_or_32_nv.3c \
- atomic_or_64.3c \
- atomic_or_64_nv.3c \
- atomic_or_8.3c \
- atomic_or_8_nv.3c \
- atomic_or_uchar.3c \
- atomic_or_uchar_nv.3c \
- atomic_or_uint.3c \
- atomic_or_uint_nv.3c \
- atomic_or_ulong.3c \
- atomic_or_ulong_nv.3c \
- atomic_or_ushort.3c \
- atomic_or_ushort_nv.3c \
- atomic_set_long_excl.3c \
- atomic_swap_16.3c \
- atomic_swap_32.3c \
- atomic_swap_64.3c \
- atomic_swap_8.3c \
- atomic_swap_ptr.3c \
- atomic_swap_uchar.3c \
- atomic_swap_uint.3c \
- atomic_swap_ulong.3c \
- atomic_swap_ushort.3c \
- backtrace.3c \
- backtrace_symbols.3c \
- backtrace_symbols_fd.3c \
- bcmp.3c \
- bcopy.3c \
+ ascftime.3c \
+ asctime.3c \
+ asctime_r.3c \
+ asprintf.3c \
+ at_quick_exit.3c \
+ atof.3c \
+ atoi.3c \
+ atol.3c \
+ atoll.3c \
+ atomic_add_16.3c \
+ atomic_add_16_nv.3c \
+ atomic_add_32.3c \
+ atomic_add_32_nv.3c \
+ atomic_add_64.3c \
+ atomic_add_64_nv.3c \
+ atomic_add_8.3c \
+ atomic_add_8_nv.3c \
+ atomic_add_char.3c \
+ atomic_add_char_nv.3c \
+ atomic_add_int.3c \
+ atomic_add_int_nv.3c \
+ atomic_add_long.3c \
+ atomic_add_long_nv.3c \
+ atomic_add_ptr.3c \
+ atomic_add_ptr_nv.3c \
+ atomic_add_short.3c \
+ atomic_add_short_nv.3c \
+ atomic_and_16.3c \
+ atomic_and_16_nv.3c \
+ atomic_and_32.3c \
+ atomic_and_32_nv.3c \
+ atomic_and_64.3c \
+ atomic_and_64_nv.3c \
+ atomic_and_8.3c \
+ atomic_and_8_nv.3c \
+ atomic_and_uchar.3c \
+ atomic_and_uchar_nv.3c \
+ atomic_and_uint.3c \
+ atomic_and_uint_nv.3c \
+ atomic_and_ulong.3c \
+ atomic_and_ulong_nv.3c \
+ atomic_and_ushort.3c \
+ atomic_and_ushort_nv.3c \
+ atomic_cas_16.3c \
+ atomic_cas_32.3c \
+ atomic_cas_64.3c \
+ atomic_cas_8.3c \
+ atomic_cas_ptr.3c \
+ atomic_cas_uchar.3c \
+ atomic_cas_uint.3c \
+ atomic_cas_ulong.3c \
+ atomic_cas_ushort.3c \
+ atomic_clear_long_excl.3c \
+ atomic_dec_16.3c \
+ atomic_dec_16_nv.3c \
+ atomic_dec_32.3c \
+ atomic_dec_32_nv.3c \
+ atomic_dec_64.3c \
+ atomic_dec_64_nv.3c \
+ atomic_dec_8.3c \
+ atomic_dec_8_nv.3c \
+ atomic_dec_ptr.3c \
+ atomic_dec_ptr_nv.3c \
+ atomic_dec_uchar.3c \
+ atomic_dec_uchar_nv.3c \
+ atomic_dec_uint.3c \
+ atomic_dec_uint_nv.3c \
+ atomic_dec_ulong.3c \
+ atomic_dec_ulong_nv.3c \
+ atomic_dec_ushort.3c \
+ atomic_dec_ushort_nv.3c \
+ atomic_inc_16.3c \
+ atomic_inc_16_nv.3c \
+ atomic_inc_32.3c \
+ atomic_inc_32_nv.3c \
+ atomic_inc_64.3c \
+ atomic_inc_64_nv.3c \
+ atomic_inc_8.3c \
+ atomic_inc_8_nv.3c \
+ atomic_inc_ptr.3c \
+ atomic_inc_ptr_nv.3c \
+ atomic_inc_uchar.3c \
+ atomic_inc_uchar_nv.3c \
+ atomic_inc_uint.3c \
+ atomic_inc_uint_nv.3c \
+ atomic_inc_ulong.3c \
+ atomic_inc_ulong_nv.3c \
+ atomic_inc_ushort.3c \
+ atomic_inc_ushort_nv.3c \
+ atomic_or_16.3c \
+ atomic_or_16_nv.3c \
+ atomic_or_32.3c \
+ atomic_or_32_nv.3c \
+ atomic_or_64.3c \
+ atomic_or_64_nv.3c \
+ atomic_or_8.3c \
+ atomic_or_8_nv.3c \
+ atomic_or_uchar.3c \
+ atomic_or_uchar_nv.3c \
+ atomic_or_uint.3c \
+ atomic_or_uint_nv.3c \
+ atomic_or_ulong.3c \
+ atomic_or_ulong_nv.3c \
+ atomic_or_ushort.3c \
+ atomic_or_ushort_nv.3c \
+ atomic_set_long_excl.3c \
+ atomic_swap_16.3c \
+ atomic_swap_32.3c \
+ atomic_swap_64.3c \
+ atomic_swap_8.3c \
+ atomic_swap_ptr.3c \
+ atomic_swap_uchar.3c \
+ atomic_swap_uint.3c \
+ atomic_swap_ulong.3c \
+ atomic_swap_ushort.3c \
+ backtrace.3c \
+ backtrace_symbols.3c \
+ backtrace_symbols_fd.3c \
+ bcmp.3c \
+ bcopy.3c \
be16toh.3c \
be32toh.3c \
be64toh.3c \
betoh16.3c \
betoh32.3c \
betoh64.3c \
- bind_textdomain_codeset.3c \
- bindtextdomain.3c \
- btowc_l.3c \
- bzero.3c \
- calloc.3c \
+ bind_textdomain_codeset.3c \
+ bindtextdomain.3c \
+ btowc_l.3c \
+ bzero.3c \
+ calloc.3c \
canonicalize_file_name.3c \
- catclose.3c \
- cfgetospeed.3c \
- cfsetospeed.3c \
- cftime.3c \
- clearerr.3c \
- clock_getres.3c \
- clock_gettime.3c \
- closelog.3c \
+ catclose.3c \
+ cfgetospeed.3c \
+ cfsetospeed.3c \
+ cftime.3c \
+ clearerr.3c \
+ clock_getres.3c \
+ clock_gettime.3c \
+ closelog.3c \
cnd_broadcast.3c \
cnd_destroy.3c \
cnd_init.3c \
cnd_signal.3c \
cnd_timedwait.3c \
cnd_wait.3c \
- cond_broadcast.3c \
- cond_destroy.3c \
- cond_reltimedwait.3c \
- cond_signal.3c \
- cond_timedwait.3c \
- cond_wait.3c \
- csetcol.3c \
- csetlen.3c \
- csetno.3c \
- ctermid_r.3c \
- ctime_r.3c \
- dbm_clearerr.3c \
- dbm_close.3c \
- dbm_delete.3c \
- dbm_error.3c \
- dbm_fetch.3c \
- dbm_firstkey.3c \
- dbm_nextkey.3c \
- dbm_open.3c \
- dbm_store.3c \
- dcgettext.3c \
- dcngettext.3c \
- decimal_to_double.3c \
- decimal_to_extended.3c \
- decimal_to_quadruple.3c \
- decimal_to_single.3c \
- dgettext.3c \
- dladdr1.3c \
- dlmopen.3c \
- dngettext.3c \
- door_setparam.3c \
- door_unbind.3c \
- double_to_decimal.3c \
+ cond_broadcast.3c \
+ cond_destroy.3c \
+ cond_reltimedwait.3c \
+ cond_signal.3c \
+ cond_timedwait.3c \
+ cond_wait.3c \
+ csetcol.3c \
+ csetlen.3c \
+ csetno.3c \
+ ctermid_r.3c \
+ ctime_r.3c \
+ dbm_clearerr.3c \
+ dbm_close.3c \
+ dbm_delete.3c \
+ dbm_error.3c \
+ dbm_fetch.3c \
+ dbm_firstkey.3c \
+ dbm_nextkey.3c \
+ dbm_open.3c \
+ dbm_store.3c \
+ dcgettext.3c \
+ dcngettext.3c \
+ decimal_to_double.3c \
+ decimal_to_extended.3c \
+ decimal_to_quadruple.3c \
+ decimal_to_single.3c \
+ dgettext.3c \
+ dladdr1.3c \
+ dlmopen.3c \
+ dngettext.3c \
+ door_setparam.3c \
+ door_unbind.3c \
+ double_to_decimal.3c \
dup3.3c \
- duplocale.3c \
- edata.3c \
- endgrent.3c \
- endnetgrent.3c \
- endpwent.3c \
- endspent.3c \
- endusershell.3c \
- endutent.3c \
- endutxent.3c \
- epoll_create1.3c \
- epoll_pwait.3c \
- erand48.3c \
- errno.3c \
- errx.3c \
- etext.3c \
- euccol.3c \
- eucscol.3c \
+ duplocale.3c \
+ edata.3c \
+ endgrent.3c \
+ endnetgrent.3c \
+ endpwent.3c \
+ endspent.3c \
+ endusershell.3c \
+ endutent.3c \
+ endutxent.3c \
+ epoll_create1.3c \
+ epoll_pwait.3c \
+ erand48.3c \
+ errno.3c \
+ errx.3c \
+ etext.3c \
+ euccol.3c \
+ eucscol.3c \
explicit_bzero.3c \
- extended_to_decimal.3c \
- fconvert.3c \
- fcvt.3c \
- fdopendir.3c \
- fdwalk.3c \
- feof.3c \
+ extended_to_decimal.3c \
+ fconvert.3c \
+ fcvt.3c \
+ fdopendir.3c \
+ fdwalk.3c \
+ feof.3c \
ffsl.3c \
ffsll.3c \
- fgetgrent.3c \
- fgetgrent_r.3c \
- fgetpwent.3c \
- fgetpwent_r.3c \
- fgets.3c \
- fgetspent.3c \
- fgetspent_r.3c \
- fgetwc_l.3c \
- fgetws.3c \
- file_to_decimal.3c \
- fileno.3c \
- finite.3c \
+ fgetgrent.3c \
+ fgetgrent_r.3c \
+ fgetpwent.3c \
+ fgetpwent_r.3c \
+ fgets.3c \
+ fgetspent.3c \
+ fgetspent_r.3c \
+ fgetwc_l.3c \
+ fgetws.3c \
+ file_to_decimal.3c \
+ fileno.3c \
+ finite.3c \
fls.3c \
flsl.3c \
flsll.3c \
- fpclass.3c \
- fpgetmask.3c \
- fpgetsticky.3c \
- fprintf.3c \
- fpsetmask.3c \
- fpsetround.3c \
- fpsetsticky.3c \
- fputs.3c \
- free.3c \
- freelocale.3c \
- fscanf.3c \
- fseeko.3c \
- fsetattr.3c \
- ftello.3c \
- ftruncate.3c \
- ftrylockfile.3c \
- func_to_decimal.3c \
- funlockfile.3c \
- gconvert.3c \
- gcvt.3c \
- getattrat.3c \
- getc.3c \
- getc_unlocked.3c \
- getchar.3c \
- getchar_unlocked.3c \
- getdelim.3c \
- getextmntent.3c \
- getgrent.3c \
- getgrent_r.3c \
- getgrgid.3c \
- getgrgid_r.3c \
- getgrnam_r.3c \
- gethomelgroup.3c \
- gethrvtime.3c \
- getlogin_r.3c \
- getmntany.3c \
- getnetgrent_r.3c \
+ fpclass.3c \
+ fpgetmask.3c \
+ fpgetsticky.3c \
+ fprintf.3c \
+ fpsetmask.3c \
+ fpsetround.3c \
+ fpsetsticky.3c \
+ fputs.3c \
+ free.3c \
+ freelocale.3c \
+ fscanf.3c \
+ fseeko.3c \
+ fsetattr.3c \
+ ftello.3c \
+ ftruncate.3c \
+ ftrylockfile.3c \
+ fts_children.3c \
+ fts_close.3c \
+ fts_open.3c \
+ fts_read.3c \
+ fts_set.3c \
+ func_to_decimal.3c \
+ funlockfile.3c \
+ gconvert.3c \
+ gcvt.3c \
get_nprocs_conf.3c \
- getpassphrase.3c \
- getpwent.3c \
- getpwent_r.3c \
- getpwnam_r.3c \
- getpwuid.3c \
- getpwuid_r.3c \
- getspent.3c \
- getspent_r.3c \
- getspnam_r.3c \
- getutid.3c \
- getutline.3c \
- getutmp.3c \
- getutmpx.3c \
- getutxid.3c \
- getutxline.3c \
- getvfsany.3c \
- getvfsfile.3c \
- getvfsspec.3c \
- getw.3c \
- getwc_l.3c \
- getwchar_l.3c \
- getzoneidbyname.3c \
- getzonenamebyid.3c \
- globfree.3c \
- gmtime.3c \
- gmtime_r.3c \
- gsignal.3c \
- hasmntopt.3c \
- hcreate.3c \
- hdestroy.3c \
+ getattrat.3c \
+ getc.3c \
+ getc_unlocked.3c \
+ getchar.3c \
+ getchar_unlocked.3c \
+ getdelim.3c \
+ getextmntent.3c \
+ getgrent.3c \
+ getgrent_r.3c \
+ getgrgid.3c \
+ getgrgid_r.3c \
+ getgrnam_r.3c \
+ gethomelgroup.3c \
+ gethrvtime.3c \
+ getlogin_r.3c \
+ getmntany.3c \
+ getnetgrent_r.3c \
+ getpassphrase.3c \
+ getpwent.3c \
+ getpwent_r.3c \
+ getpwnam_r.3c \
+ getpwuid.3c \
+ getpwuid_r.3c \
+ getspent.3c \
+ getspent_r.3c \
+ getspnam_r.3c \
+ getutid.3c \
+ getutline.3c \
+ getutmp.3c \
+ getutmpx.3c \
+ getutxid.3c \
+ getutxline.3c \
+ getvfsany.3c \
+ getvfsfile.3c \
+ getvfsspec.3c \
+ getw.3c \
+ getwc_l.3c \
+ getwchar_l.3c \
+ getzoneidbyname.3c \
+ getzonenamebyid.3c \
+ globfree.3c \
+ gmtime.3c \
+ gmtime_r.3c \
+ gsignal.3c \
+ hasmntopt.3c \
+ hcreate.3c \
+ hdestroy.3c \
htobe16.3c \
htobe32.3c \
htobe64.3c \
htole16.3c \
htole32.3c \
htole64.3c \
- initstate.3c \
- innetgr.3c \
- isalnum.3c \
- isalnum_l.3c \
- isalpha.3c \
- isalpha_l.3c \
- isascii.3c \
- isblank.3c \
- isblank_l.3c \
- iscntrl.3c \
- iscntrl_l.3c \
- isdigit.3c \
- isdigit_l.3c \
- isenglish.3c \
- isgraph.3c \
- isgraph_l.3c \
- isideogram.3c \
- islower.3c \
- islower_l.3c \
- isnanf.3c \
- isnumber.3c \
- isphonogram.3c \
- isprint.3c \
- isprint_l.3c \
- ispunct.3c \
- ispunct_l.3c \
- isspace.3c \
- isspace_l.3c \
- isspecial.3c \
- isupper.3c \
- isupper_l.3c \
- iswalnum.3c \
- iswalnum_l.3c \
- iswalpha_l.3c \
- iswascii.3c \
- iswblank.3c \
- iswblank_l.3c \
- iswcntrl.3c \
- iswcntrl_l.3c \
- iswctype_l.3c \
- iswdigit.3c \
- iswdigit_l.3c \
- iswgraph.3c \
- iswgraph_l.3c \
- iswideogram.3c \
- iswideogram_l.3c \
- iswhexnumber.3c \
- iswhexnumber_l.3c \
- iswlower.3c \
- iswlower_l.3c \
- iswnumber.3c \
- iswnumber_l.3c \
- iswphonogram.3c \
- iswphonogram_l.3c \
- iswprint.3c \
- iswprint_l.3c \
- iswpunct.3c \
- iswpunct_l.3c \
- iswspace.3c \
- iswspace_l.3c \
- iswspecial.3c \
- iswspecial_l.3c \
- iswupper.3c \
- iswupper_l.3c \
- iswxdigit.3c \
- iswxdigit_l.3c \
- isxdigit.3c \
- isxdigit_l.3c \
- jrand48.3c \
- l64a.3c \
- labs.3c \
- lcong48.3c \
- ldiv.3c \
+ initstate.3c \
+ innetgr.3c \
+ isalnum.3c \
+ isalnum_l.3c \
+ isalpha.3c \
+ isalpha_l.3c \
+ isascii.3c \
+ isblank.3c \
+ isblank_l.3c \
+ iscntrl.3c \
+ iscntrl_l.3c \
+ isdigit.3c \
+ isdigit_l.3c \
+ isenglish.3c \
+ isgraph.3c \
+ isgraph_l.3c \
+ isideogram.3c \
+ islower.3c \
+ islower_l.3c \
+ isnanf.3c \
+ isnumber.3c \
+ isphonogram.3c \
+ isprint.3c \
+ isprint_l.3c \
+ ispunct.3c \
+ ispunct_l.3c \
+ isspace.3c \
+ isspace_l.3c \
+ isspecial.3c \
+ isupper.3c \
+ isupper_l.3c \
+ iswalnum.3c \
+ iswalnum_l.3c \
+ iswalpha_l.3c \
+ iswascii.3c \
+ iswblank.3c \
+ iswblank_l.3c \
+ iswcntrl.3c \
+ iswcntrl_l.3c \
+ iswctype_l.3c \
+ iswdigit.3c \
+ iswdigit_l.3c \
+ iswgraph.3c \
+ iswgraph_l.3c \
+ iswhexnumber.3c \
+ iswhexnumber_l.3c \
+ iswideogram.3c \
+ iswideogram_l.3c \
+ iswlower.3c \
+ iswlower_l.3c \
+ iswnumber.3c \
+ iswnumber_l.3c \
+ iswphonogram.3c \
+ iswphonogram_l.3c \
+ iswprint.3c \
+ iswprint_l.3c \
+ iswpunct.3c \
+ iswpunct_l.3c \
+ iswspace.3c \
+ iswspace_l.3c \
+ iswspecial.3c \
+ iswspecial_l.3c \
+ iswupper.3c \
+ iswupper_l.3c \
+ iswxdigit.3c \
+ iswxdigit_l.3c \
+ isxdigit.3c \
+ isxdigit_l.3c \
+ jrand48.3c \
+ l64a.3c \
+ labs.3c \
+ lcong48.3c \
+ ldiv.3c \
le16toh.3c \
le32toh.3c \
le64toh.3c \
letoh16.3c \
letoh32.3c \
letoh64.3c \
- lfind.3c \
- llabs.3c \
- lldiv.3c \
- lltostr.3c \
- localtime.3c \
- localtime_r.3c \
- longjmp.3c \
- lrand48.3c \
- major.3c \
- mblen_l.3c \
- mbrlen_l.3c \
- mbrtowc_l.3c \
- mbsinit_l.3c \
- mbsnrtowcs.3c \
- mbsnrtowcs_l.3c \
- mbsrtowcs_l.3c \
- mbstowcs_l.3c \
- mbtowc_l.3c \
- memalign.3c \
- membar_consumer.3c \
- membar_enter.3c \
- membar_exit.3c \
- membar_producer.3c \
- memccpy.3c \
- memchr.3c \
- memcmp.3c \
- memcpy.3c \
- memmem.3c \
- memmove.3c \
- memset.3c \
- minor.3c \
- mkdtemp.3c \
+ lfind.3c \
+ llabs.3c \
+ lldiv.3c \
+ lltostr.3c \
+ localtime.3c \
+ localtime_r.3c \
+ longjmp.3c \
+ lrand48.3c \
+ major.3c \
+ mblen_l.3c \
+ mbrlen_l.3c \
+ mbrtowc_l.3c \
+ mbsinit_l.3c \
+ mbsnrtowcs.3c \
+ mbsnrtowcs_l.3c \
+ mbsrtowcs_l.3c \
+ mbstowcs_l.3c \
+ mbtowc_l.3c \
+ memalign.3c \
+ membar_consumer.3c \
+ membar_enter.3c \
+ membar_exit.3c \
+ membar_producer.3c \
+ memccpy.3c \
+ memchr.3c \
+ memcmp.3c \
+ memcpy.3c \
+ memmem.3c \
+ memmove.3c \
+ memset.3c \
+ minor.3c \
+ mkdtemp.3c \
mkfifoat.3c \
mkostemp.3c \
mkostemps.3c \
- mkstemps.3c \
- mq_reltimedreceive_np.3c \
- mq_reltimedsend_np.3c \
- mq_timedreceive.3c \
- mq_timedsend.3c \
- mrand48.3c \
+ mkstemps.3c \
+ mq_reltimedreceive_np.3c \
+ mq_reltimedsend_np.3c \
+ mq_timedreceive.3c \
+ mq_timedsend.3c \
+ mrand48.3c \
mtx_destroy.3c \
mtx_init.3c \
mtx_lock.3c \
mtx_timedlock.3c \
mtx_trylock.3c \
mtx_unlock.3c \
- munlock.3c \
- munlockall.3c \
- mutex_consistent.3c \
- mutex_destroy.3c \
- mutex_lock.3c \
- mutex_trylock.3c \
- mutex_unlock.3c \
- nl_langinfo_l.3c \
- nftw.3c \
- ngettext.3c \
- nrand48.3c \
- openlog.3c \
- pclose.3c \
- port_dissociate.3c \
- port_getn.3c \
- port_sendn.3c \
- posix_spawn_file_actions_addopen.3c \
- posix_spawn_file_actions_init.3c \
- posix_spawnattr_init.3c \
- posix_spawnattr_setflags.3c \
- posix_spawnattr_setpgroup.3c \
- posix_spawnattr_setschedparam.3c \
- posix_spawnattr_setschedpolicy.3c \
- posix_spawnattr_setsigdefault.3c \
- posix_spawnattr_setsigignore_np.3c \
- posix_spawnattr_setsigmask.3c \
- posix_spawnp.3c \
- printstack.3c \
- priv_allocset.3c \
- priv_basicset.3c \
- priv_copyset.3c \
- priv_delset.3c \
- priv_emptyset.3c \
- priv_fillset.3c \
- priv_freeset.3c \
- priv_getbyname.3c \
- priv_getbynum.3c \
- priv_getsetbyname.3c \
- priv_getsetbynum.3c \
- priv_gettext.3c \
- priv_ineffect.3c \
- priv_intersect.3c \
- priv_inverse.3c \
- priv_isemptyset.3c \
- priv_isequalset.3c \
- priv_isfullset.3c \
- priv_ismember.3c \
- priv_issubset.3c \
- priv_set_to_str.3c \
- priv_union.3c \
- pselect.3c \
- psiginfo.3c \
- pthread_attr_destroy.3c \
- pthread_attr_setdetachstate.3c \
- pthread_attr_setguardsize.3c \
- pthread_attr_setinheritsched.3c \
- pthread_attr_setschedparam.3c \
- pthread_attr_setschedpolicy.3c \
- pthread_attr_setscope.3c \
- pthread_attr_setstack.3c \
- pthread_attr_setstackaddr.3c \
- pthread_attr_setstacksize.3c \
- pthread_barrier_init.3c \
- pthread_barrierattr_init.3c \
- pthread_barrierattr_setpshared.3c \
- pthread_cond_broadcast.3c \
- pthread_cond_destroy.3c \
- pthread_cond_reltimedwait_np.3c \
- pthread_cond_timedwait.3c \
- pthread_condattr_destroy.3c \
- pthread_condattr_setclock.3c \
- pthread_condattr_setpshared.3c \
- pthread_key_create_once_np.3c \
- pthread_mutex_destroy.3c \
- pthread_mutex_reltimedlock_np.3c \
- pthread_mutex_setprioceiling.3c \
- pthread_mutex_trylock.3c \
- pthread_mutex_unlock.3c \
- pthread_mutexattr_destroy.3c \
- pthread_mutexattr_setprioceiling.3c \
- pthread_mutexattr_setprotocol.3c \
- pthread_mutexattr_setpshared.3c \
- pthread_mutexattr_setrobust.3c \
- pthread_mutexattr_settype.3c \
- pthread_rwlock_destroy.3c \
- pthread_rwlock_reltimedrdlock_np.3c \
- pthread_rwlock_reltimedwrlock_np.3c \
- pthread_rwlock_tryrdlock.3c \
- pthread_rwlock_trywrlock.3c \
- pthread_rwlockattr_destroy.3c \
- pthread_rwlockattr_setpshared.3c \
- pthread_setconcurrency.3c \
- pthread_setschedparam.3c \
- pthread_setspecific.3c \
- pthread_spin_init.3c \
- pthread_spin_trylock.3c \
- putc.3c \
- putc_unlocked.3c \
- putchar.3c \
- putchar_unlocked.3c \
- putmntent.3c \
- pututline.3c \
- pututxline.3c \
- putw.3c \
- putwc.3c \
- putwchar.3c \
- qeconvert.3c \
- qfconvert.3c \
- qgconvert.3c \
- quadruple_to_decimal.3c \
- rand_r.3c \
- rctlblk_get_enforced_value.3c \
- rctlblk_get_firing_time.3c \
- rctlblk_get_global_action.3c \
- rctlblk_get_global_flags.3c \
- rctlblk_get_local_action.3c \
- rctlblk_get_local_flags.3c \
- rctlblk_get_privilege.3c \
- rctlblk_get_recipient_pid.3c \
- rctlblk_get_value.3c \
- rctlblk_set_local_action.3c \
- rctlblk_set_local_flags.3c \
- rctlblk_set_privilege.3c \
- rctlblk_set_recipient_pid.3c \
- rctlblk_size.3c \
- re_exec.3c \
- readdir_r.3c \
- realloc.3c \
- regerror.3c \
- regex.3c \
- regexec.3c \
- regfree.3c \
- remque.3c \
- resetmnttab.3c \
- rindex.3c \
- rw_rdlock.3c \
- rw_tryrdlock.3c \
- rw_trywrlock.3c \
- rw_unlock.3c \
- rw_wrlock.3c \
- rwlock_destroy.3c \
- rwlock_init.3c \
- sched_get_priority_min.3c \
- schedctl_exit.3c \
- schedctl_lookup.3c \
- schedctl_start.3c \
- schedctl_stop.3c \
- seconvert.3c \
- seed48.3c \
- sem_reltimedwait_np.3c \
- sem_trywait.3c \
- sema_destroy.3c \
- sema_init.3c \
- sema_post.3c \
- sema_trywait.3c \
- sema_wait.3c \
- setattrat.3c \
- setgrent.3c \
- sethostname.3c \
- setlinebuf.3c \
- setlogmask.3c \
- setnetgrent.3c \
- setpriority.3c \
+ munlock.3c \
+ munlockall.3c \
+ mutex_consistent.3c \
+ mutex_destroy.3c \
+ mutex_lock.3c \
+ mutex_trylock.3c \
+ mutex_unlock.3c \
+ nftw.3c \
+ ngettext.3c \
+ nl_langinfo_l.3c \
+ nrand48.3c \
+ openlog.3c \
+ pclose.3c \
+ port_dissociate.3c \
+ port_getn.3c \
+ port_sendn.3c \
+ posix_spawn_file_actions_addopen.3c \
+ posix_spawn_file_actions_init.3c \
+ posix_spawnattr_init.3c \
+ posix_spawnattr_setflags.3c \
+ posix_spawnattr_setpgroup.3c \
+ posix_spawnattr_setschedparam.3c \
+ posix_spawnattr_setschedpolicy.3c \
+ posix_spawnattr_setsigdefault.3c \
+ posix_spawnattr_setsigignore_np.3c \
+ posix_spawnattr_setsigmask.3c \
+ posix_spawnp.3c \
+ printstack.3c \
+ priv_allocset.3c \
+ priv_basicset.3c \
+ priv_copyset.3c \
+ priv_delset.3c \
+ priv_emptyset.3c \
+ priv_fillset.3c \
+ priv_freeset.3c \
+ priv_getbyname.3c \
+ priv_getbynum.3c \
+ priv_getsetbyname.3c \
+ priv_getsetbynum.3c \
+ priv_gettext.3c \
+ priv_ineffect.3c \
+ priv_intersect.3c \
+ priv_inverse.3c \
+ priv_isemptyset.3c \
+ priv_isequalset.3c \
+ priv_isfullset.3c \
+ priv_ismember.3c \
+ priv_issubset.3c \
+ priv_set_to_str.3c \
+ priv_union.3c \
+ pselect.3c \
+ psiginfo.3c \
+ pthread_attr_destroy.3c \
+ pthread_attr_setdetachstate.3c \
+ pthread_attr_setguardsize.3c \
+ pthread_attr_setinheritsched.3c \
+ pthread_attr_setschedparam.3c \
+ pthread_attr_setschedpolicy.3c \
+ pthread_attr_setscope.3c \
+ pthread_attr_setstack.3c \
+ pthread_attr_setstackaddr.3c \
+ pthread_attr_setstacksize.3c \
+ pthread_barrier_init.3c \
+ pthread_barrierattr_init.3c \
+ pthread_barrierattr_setpshared.3c \
+ pthread_cond_broadcast.3c \
+ pthread_cond_destroy.3c \
+ pthread_cond_reltimedwait_np.3c \
+ pthread_cond_timedwait.3c \
+ pthread_condattr_destroy.3c \
+ pthread_condattr_setclock.3c \
+ pthread_condattr_setpshared.3c \
+ pthread_key_create_once_np.3c \
+ pthread_mutex_destroy.3c \
+ pthread_mutex_reltimedlock_np.3c \
+ pthread_mutex_setprioceiling.3c \
+ pthread_mutex_trylock.3c \
+ pthread_mutex_unlock.3c \
+ pthread_mutexattr_destroy.3c \
+ pthread_mutexattr_setprioceiling.3c \
+ pthread_mutexattr_setprotocol.3c \
+ pthread_mutexattr_setpshared.3c \
+ pthread_mutexattr_setrobust.3c \
+ pthread_mutexattr_settype.3c \
+ pthread_rwlock_destroy.3c \
+ pthread_rwlock_reltimedrdlock_np.3c \
+ pthread_rwlock_reltimedwrlock_np.3c \
+ pthread_rwlock_tryrdlock.3c \
+ pthread_rwlock_trywrlock.3c \
+ pthread_rwlockattr_destroy.3c \
+ pthread_rwlockattr_setpshared.3c \
+ pthread_setconcurrency.3c \
+ pthread_setschedparam.3c \
+ pthread_setspecific.3c \
+ pthread_spin_init.3c \
+ pthread_spin_trylock.3c \
+ putc.3c \
+ putc_unlocked.3c \
+ putchar.3c \
+ putchar_unlocked.3c \
+ putmntent.3c \
+ pututline.3c \
+ pututxline.3c \
+ putw.3c \
+ putwc.3c \
+ putwchar.3c \
+ qeconvert.3c \
+ qfconvert.3c \
+ qgconvert.3c \
+ quadruple_to_decimal.3c \
+ rand_r.3c \
+ rctlblk_get_enforced_value.3c \
+ rctlblk_get_firing_time.3c \
+ rctlblk_get_global_action.3c \
+ rctlblk_get_global_flags.3c \
+ rctlblk_get_local_action.3c \
+ rctlblk_get_local_flags.3c \
+ rctlblk_get_privilege.3c \
+ rctlblk_get_recipient_pid.3c \
+ rctlblk_get_value.3c \
+ rctlblk_set_local_action.3c \
+ rctlblk_set_local_flags.3c \
+ rctlblk_set_privilege.3c \
+ rctlblk_set_recipient_pid.3c \
+ rctlblk_size.3c \
+ re_exec.3c \
+ readdir_r.3c \
+ realloc.3c \
+ reallocarray.3c \
+ regerror.3c \
+ regex.3c \
+ regexec.3c \
+ regfree.3c \
+ remque.3c \
+ resetmnttab.3c \
+ rindex.3c \
+ rw_rdlock.3c \
+ rw_tryrdlock.3c \
+ rw_trywrlock.3c \
+ rw_unlock.3c \
+ rw_wrlock.3c \
+ rwlock_destroy.3c \
+ rwlock_init.3c \
+ sched_get_priority_min.3c \
+ schedctl_exit.3c \
+ schedctl_lookup.3c \
+ schedctl_start.3c \
+ schedctl_stop.3c \
+ seconvert.3c \
+ seed48.3c \
+ sem_reltimedwait_np.3c \
+ sem_trywait.3c \
+ sema_destroy.3c \
+ sema_init.3c \
+ sema_post.3c \
+ sema_trywait.3c \
+ sema_wait.3c \
+ setattrat.3c \
+ setgrent.3c \
+ sethostname.3c \
+ setlinebuf.3c \
+ setlogmask.3c \
+ setnetgrent.3c \
+ setpriority.3c \
setprogname.3c \
- setpwent.3c \
- setspent.3c \
- setstate.3c \
- settimeofday.3c \
- setusershell.3c \
- setutent.3c \
- setutxent.3c \
- setvbuf.3c \
- sfconvert.3c \
- sgconvert.3c \
- sig2str.3c \
- sigaddset.3c \
- sigdelset.3c \
- sigemptyset.3c \
- sigfillset.3c \
- sighold.3c \
- sigignore.3c \
- sigismember.3c \
- siglongjmp.3c \
- sigpause.3c \
- sigrelse.3c \
- sigset.3c \
- sigsetjmp.3c \
- sigtimedwait.3c \
- single_to_decimal.3c \
- snprintf.3c \
- sprintf.3c \
- srand.3c \
- srand48.3c \
- srandom.3c \
- sscanf.3c \
+ setpwent.3c \
+ setspent.3c \
+ setstate.3c \
+ settimeofday.3c \
+ setusershell.3c \
+ setutent.3c \
+ setutxent.3c \
+ setvbuf.3c \
+ sfconvert.3c \
+ sgconvert.3c \
+ sig2str.3c \
+ sigaddset.3c \
+ sigdelset.3c \
+ sigemptyset.3c \
+ sigfillset.3c \
+ sighold.3c \
+ sigignore.3c \
+ sigismember.3c \
+ siglongjmp.3c \
+ sigpause.3c \
+ sigrelse.3c \
+ sigset.3c \
+ sigsetjmp.3c \
+ sigtimedwait.3c \
+ single_to_decimal.3c \
+ snprintf.3c \
+ sprintf.3c \
+ srand.3c \
+ srand48.3c \
+ srandom.3c \
+ sscanf.3c \
stderr.3c \
stdin.3c \
stdout.3c \
stpcpy.3c \
stpncpy.3c \
- strcasecmp.3c \
- strcasecmp_l.3c \
+ strcasecmp.3c \
+ strcasecmp_l.3c \
strcasestr.3c \
strcasestr_l.3c \
- strcat.3c \
- strchr.3c \
+ strcat.3c \
+ strchr.3c \
strchrnul.3c \
- strcmp.3c \
- strcoll_l.3c \
- strcpy.3c \
- strcspn.3c \
- strdup.3c \
- strdupa.3c \
- strerror_l.3c \
- strerror_r.3c \
- strfmon_l.3c \
- strftime_l.3c \
- strlcat.3c \
- strlcpy.3c \
- strlen.3c \
- strncasecmp.3c \
- strncasecmp_l.3c \
- strncat.3c \
- strncmp.3c \
- strncpy.3c \
+ strcmp.3c \
+ strcoll_l.3c \
+ strcpy.3c \
+ strcspn.3c \
+ strdup.3c \
+ strdupa.3c \
+ strerror_l.3c \
+ strerror_r.3c \
+ strfmon_l.3c \
+ strftime_l.3c \
+ strlcat.3c \
+ strlcpy.3c \
+ strlen.3c \
+ strncasecmp.3c \
+ strncasecmp_l.3c \
+ strncat.3c \
+ strncmp.3c \
+ strncpy.3c \
strndup.3c \
strndupa.3c \
- strnlen.3c \
+ strnlen.3c \
strnstr.3c \
- strpbrk.3c \
- strptime_l.3c \
- strrchr.3c \
- strsep.3c \
- strspn.3c \
- strstr.3c \
- strtof.3c \
- strtok.3c \
- strtok_r.3c \
- strtold.3c \
- strtoll.3c \
- strtoull.3c \
- strtoumax.3c \
- strxfrm_l.3c \
- swapcontext.3c \
- swprintf.3c \
- swscanf.3c \
- tdelete.3c \
- tempnam.3c \
- textdomain.3c \
- tfind.3c \
- thr_continue.3c \
- thr_getspecific.3c \
- thr_keycreate_once.3c \
- thr_setconcurrency.3c \
- thr_setprio.3c \
- thr_setspecific.3c \
+ strpbrk.3c \
+ strptime_l.3c \
+ strrchr.3c \
+ strsep.3c \
+ strspn.3c \
+ strstr.3c \
+ strtof.3c \
+ strtok.3c \
+ strtok_r.3c \
+ strtold.3c \
+ strtoll.3c \
+ strtoull.3c \
+ strtoumax.3c \
+ strxfrm_l.3c \
+ swapcontext.3c \
+ swprintf.3c \
+ swscanf.3c \
+ tdelete.3c \
+ tempnam.3c \
+ textdomain.3c \
+ tfind.3c \
+ thr_continue.3c \
+ thr_getspecific.3c \
+ thr_keycreate_once.3c \
+ thr_setconcurrency.3c \
+ thr_setprio.3c \
+ thr_setspecific.3c \
thrd_sleep.3c \
timegm.3c \
- timer_getoverrun.3c \
- timer_gettime.3c \
- timerclear.3c \
- timercmp.3c \
+ timer_getoverrun.3c \
+ timer_gettime.3c \
+ timerclear.3c \
+ timercmp.3c \
timerfd_gettime.3c \
timerfd_settime.3c \
- timerisset.3c \
- timersub.3c \
- tmpnam_r.3c \
- tolower_l.3c \
- toupper_l.3c \
- towctrans.3c \
- towctrans_l.3c \
- towlower_l.3c \
- towupper_l.3c \
+ timerisset.3c \
+ timersub.3c \
+ tmpnam_r.3c \
+ tolower_l.3c \
+ toupper_l.3c \
+ towctrans.3c \
+ towctrans_l.3c \
+ towlower_l.3c \
+ towupper_l.3c \
tss_create.3c \
tss_delete.3c \
tss_get.3c \
tss_set.3c \
- ttyname_r.3c \
- twalk.3c \
- tzset.3c \
- uconv_u16tou8.3c \
- uconv_u32tou16.3c \
- uconv_u32tou8.3c \
- uconv_u8tou16.3c \
- uconv_u8tou32.3c \
- ucred_free.3c \
- ucred_get.3c \
- ucred_getegid.3c \
- ucred_geteuid.3c \
- ucred_getgroups.3c \
- ucred_getlabel.3c \
- ucred_getpflags.3c \
- ucred_getpid.3c \
- ucred_getprivset.3c \
- ucred_getprojid.3c \
- ucred_getrgid.3c \
- ucred_getruid.3c \
- ucred_getsgid.3c \
- ucred_getsuid.3c \
- ucred_getzoneid.3c \
- ucred_size.3c \
- ulckpwdf.3c \
- ulltostr.3c \
- unordered.3c \
- updwtmp.3c \
- updwtmpx.3c \
- utmpname.3c \
- utmpxname.3c \
- valloc.3c \
- vasprintf.3c \
- verr.3c \
- verrx.3c \
- vfprintf.3c \
- vfscanf.3c \
- vfwscanf.3c \
- vscanf.3c \
- vsnprintf.3c \
- vsprintf.3c \
- vsscanf.3c \
- vswprintf.3c \
- vswscanf.3c \
- vwarn.3c \
- vwarnx.3c \
- vwprintf.3c \
- vwscanf.3c \
- wait4.3c \
- warn.3c \
- warnx.3c \
- watof.3c \
- watoi.3c \
- watol.3c \
- watoll.3c \
+ ttyname_r.3c \
+ twalk.3c \
+ tzset.3c \
+ uconv_u16tou8.3c \
+ uconv_u32tou16.3c \
+ uconv_u32tou8.3c \
+ uconv_u8tou16.3c \
+ uconv_u8tou32.3c \
+ ucred_free.3c \
+ ucred_get.3c \
+ ucred_getegid.3c \
+ ucred_geteuid.3c \
+ ucred_getgroups.3c \
+ ucred_getlabel.3c \
+ ucred_getpflags.3c \
+ ucred_getpid.3c \
+ ucred_getprivset.3c \
+ ucred_getprojid.3c \
+ ucred_getrgid.3c \
+ ucred_getruid.3c \
+ ucred_getsgid.3c \
+ ucred_getsuid.3c \
+ ucred_getzoneid.3c \
+ ucred_size.3c \
+ ulckpwdf.3c \
+ ulltostr.3c \
+ unordered.3c \
+ updwtmp.3c \
+ updwtmpx.3c \
+ utmpname.3c \
+ utmpxname.3c \
+ valloc.3c \
+ vasprintf.3c \
+ verr.3c \
+ verrx.3c \
+ vfprintf.3c \
+ vfscanf.3c \
+ vfwscanf.3c \
+ vscanf.3c \
+ vsnprintf.3c \
+ vsprintf.3c \
+ vsscanf.3c \
+ vswprintf.3c \
+ vswscanf.3c \
+ vwarn.3c \
+ vwarnx.3c \
+ vwprintf.3c \
+ vwscanf.3c \
+ wait4.3c \
+ warn.3c \
+ warnx.3c \
+ watof.3c \
+ watoi.3c \
+ watol.3c \
+ watoll.3c \
wcpncpy.3c \
- wcrtomb_l.3c \
+ wcrtomb_l.3c \
wcscasecmp_l.3c \
- wcscat.3c \
- wcschr.3c \
- wcscmp.3c \
- wcscoll_l.3c \
- wcscpy.3c \
- wcscspn.3c \
- wcsetno.3c \
+ wcscat.3c \
+ wcschr.3c \
+ wcscmp.3c \
+ wcscoll_l.3c \
+ wcscpy.3c \
+ wcscspn.3c \
+ wcsetno.3c \
wcsncasecmp.3c \
wcsncasecmp_l.3c \
- wcsncat.3c \
- wcsncmp.3c \
- wcsncpy.3c \
- wcsnlen.3c \
+ wcsncat.3c \
+ wcsncmp.3c \
+ wcsncpy.3c \
+ wcsnlen.3c \
wcsnrtombs.3c \
wcsnrtombs_l.3c \
- wcspbrk.3c \
- wcsrchr.3c \
+ wcspbrk.3c \
+ wcsrchr.3c \
wcsrtombs_l.3c \
- wcsspn.3c \
- wcstof.3c \
- wcstok.3c \
- wcstold.3c \
- wcstoll.3c \
+ wcsspn.3c \
+ wcstof.3c \
+ wcstok.3c \
+ wcstold.3c \
+ wcstoll.3c \
wcstombs_l.3c \
- wcstoull.3c \
- wcstoumax.3c \
- wcswcs.3c \
- wcswidth_l.3c \
- wctob_l.3c \
- wctomb_l.3c \
- wctrans_l.3c \
- wctype_l.3c \
- wcwidth_l.3c \
- windex.3c \
- wordfree.3c \
- wprintf.3c \
- wrindex.3c \
- wscanf.3c \
- wscasecmp.3c \
- wscat.3c \
- wschr.3c \
- wscmp.3c \
- wscol.3c \
- wscoll.3c \
- wscpy.3c \
- wscspn.3c \
- wsdup.3c \
- wslen.3c \
- wsncasecmp.3c \
- wsncat.3c \
- wsncmp.3c \
- wsncpy.3c \
- wspbrk.3c \
- wsrchr.3c \
- wsspn.3c \
- wstod.3c \
- wstok.3c \
- wstol.3c \
- wstostr.3c \
- wsxfrm.3c
+ wcstoull.3c \
+ wcstoumax.3c \
+ wcswcs.3c \
+ wcswidth_l.3c \
+ wctob_l.3c \
+ wctomb_l.3c \
+ wctrans_l.3c \
+ wctype_l.3c \
+ wcwidth_l.3c \
+ windex.3c \
+ wordfree.3c \
+ wprintf.3c \
+ wrindex.3c \
+ wscanf.3c \
+ wscasecmp.3c \
+ wscat.3c \
+ wschr.3c \
+ wscmp.3c \
+ wscol.3c \
+ wscoll.3c \
+ wscpy.3c \
+ wscspn.3c \
+ wsdup.3c \
+ wslen.3c \
+ wsncasecmp.3c \
+ wsncat.3c \
+ wsncmp.3c \
+ wsncpy.3c \
+ wspbrk.3c \
+ wsrchr.3c \
+ wsspn.3c \
+ wstod.3c \
+ wstok.3c \
+ wstol.3c \
+ wstostr.3c \
+ wsxfrm.3c
__flbf.3c := LINKSRC = __fbufsize.3c
__fpending.3c := LINKSRC = __fbufsize.3c
@@ -1740,6 +1748,12 @@ fseeko.3c := LINKSRC = fseek.3c
ftello.3c := LINKSRC = ftell.3c
+fts_children.3c := LINKSRC = fts.3c
+fts_close.3c := LINKSRC = fts.3c
+fts_open.3c := LINKSRC = fts.3c
+fts_read.3c := LINKSRC = fts.3c
+fts_set.3c := LINKSRC = fts.3c
+
nftw.3c := LINKSRC = ftw.3c
swprintf.3c := LINKSRC = fwprintf.3c
@@ -1925,6 +1939,7 @@ calloc.3c := LINKSRC = malloc.3c
free.3c := LINKSRC = malloc.3c
memalign.3c := LINKSRC = malloc.3c
realloc.3c := LINKSRC = malloc.3c
+reallocarray.3c := LINKSRC = malloc.3c
valloc.3c := LINKSRC = malloc.3c
mblen_l.3c := LINKSRC = mblen.3c
@@ -2349,8 +2364,8 @@ timercmp.3c := LINKSRC = timeradd.3c
timerisset.3c := LINKSRC = timeradd.3c
timersub.3c := LINKSRC = timeradd.3c
-timerfd_gettime.3c := LINKSRC = timerfd_create.3c
-timerfd_settime.3c := LINKSRC = timerfd_create.3c
+timerfd_gettime.3c := LINKSRC = timerfd_create.3c
+timerfd_settime.3c := LINKSRC = timerfd_create.3c
tempnam.3c := LINKSRC = tmpnam.3c
tmpnam_r.3c := LINKSRC = tmpnam.3c
diff --git a/usr/src/man/man3c/fts.3c b/usr/src/man/man3c/fts.3c
new file mode 100644
index 0000000000..974c79552d
--- /dev/null
+++ b/usr/src/man/man3c/fts.3c
@@ -0,0 +1,825 @@
+.\"
+.\" Copyright (c) 1989, 1991, 1993C, 1994
+.\" 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.
+.\" 3C. 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.
+.\"
+.\"
+.Dd March 28, 2017
+.Dt FTS 3C
+.Os
+.Sh NAME
+.Nm fts_open ,
+.Nm fts_read ,
+.Nm fts_children ,
+.Nm fts_set ,
+.Nm fts_close
+.Nd traverse a file hierarchy
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/stat.h
+.In fts.h
+.Ft FTS *
+.Fo fts_open
+.Fa "char * const *path_argv"
+.Fa "int options"
+.Fa "int (*compar)(const FTSENT **, const FTSENT **)"
+.Fc
+.Ft FTSENT *
+.Fn fts_read "FTS *ftsp"
+.Ft FTSENT *
+.Fn fts_children "FTS *ftsp" "int options"
+.Ft int
+.Fn fts_set "FTS *ftsp" "FTSENT *f" "int option"
+.Ft int
+.Fn fts_close "FTS *ftsp"
+.Sh DESCRIPTION
+The
+.Nm fts
+functions are provided for traversing
+.Ux
+file hierarchies.
+The
+.Fn fts_open
+function returns a
+.Dq handle
+on a file hierarchy, which is then supplied to
+the other
+.Nm fts
+functions.
+The function
+.Fn fts_read
+returns a pointer to a structure describing one of the files in the file
+hierarchy.
+The function
+.Fn fts_children
+returns a pointer to a linked list of structures, each of which describes
+one of the files contained in a directory within the hierarchy.
+.Pp
+In general, directories are visited two distinguishable times; in pre-order
+.Pq before any of their descendants are visited
+and in post-order
+.Pq after all of their descendants have been visited .
+Files are visited once.
+It is possible to walk the hierarchy
+.Dq logically
+.Pq following symbolic links
+or
+.Dq physically
+.Pq not following symbolic links ,
+order the walk of the hierarchy, or
+prune and/or re-visit portions of the hierarchy.
+.Pp
+Two structures are defined
+.Pq and typedef'd
+in the include file
+.In fts.h .
+The first is
+.Dv FTS ,
+the structure that represents the file hierarchy itself.
+The second is
+.Li FTSENT ,
+the structure that represents a file in the file
+hierarchy.
+Normally, an
+.Li FTSENT
+structure is returned for every file in the file
+hierarchy.
+In this manual page,
+.Dq file
+and
+.Dq Li FTSENT No structure
+are generally
+interchangeable.
+.Pp
+The
+.Li FTSENT
+structure contains at least the following fields, which are
+described in greater detail below:
+.Bd -literal
+typedef struct _ftsent {
+ unsigned short fts_info; /* flags for FTSENT structure */
+ char *fts_accpath; /* access path */
+ char *fts_path; /* root path */
+ size_t fts_pathlen; /* strlen(fts_path) */
+ char *fts_name; /* file name */
+ size_t fts_namelen; /* strlen(fts_name) */
+ int fts_level; /* depth (-1 to N) */
+ int fts_errno; /* file errno */
+ long fts_number; /* local numeric value */
+ void *fts_pointer; /* local address value */
+ struct _ftsent *fts_parent; /* parent directory */
+ struct _ftsent *fts_link; /* next file structure */
+ struct _ftsent *fts_cycle; /* cycle structure */
+ struct stat *fts_statp; /* stat(2) information */
+} FTSENT;
+.Ed
+.Pp
+These fields are defined as follows:
+.Bl -tag -width "fts_namelen"
+.It Fa fts_info
+One of the following flags describing the returned
+.Li FTSENT
+structure and
+the file it represents.
+With the exception of directories without errors
+.Pq Dv FTS_D ,
+all of these
+entries are terminal, that is, they will not be revisited, nor will any
+of their descendants be visited.
+.Bl -tag -width FTS_DEFAULT
+.It Dv FTS_D
+A directory being visited in pre-order.
+.It Dv FTS_DC
+A directory that causes a cycle in the tree.
+.Po The
+.Fa fts_cycle
+field of the
+.Li FTSENT
+structure will be filled in as well.
+.Pc
+.It Dv FTS_DEFAULT
+Any
+.Li FTSENT
+structure that represents a file type not explicitly described
+by one of the other
+.Fa fts_info
+values.
+.It Dv FTS_DNR
+A directory which cannot be read.
+This is an error return, and the
+.Fa fts_errno
+field will be set to indicate what caused the error.
+.It Dv FTS_DOT
+A file named
+.Dq \&.
+or
+.Dq ..
+which was not specified as a file name to
+.Fn fts_open
+.Pq see Dv FTS_SEEDOT .
+.It Dv FTS_DP
+A directory being visited in post-order.
+The contents of the
+.Li FTSENT
+structure will be unchanged from when
+it was returned in pre-order, i.e., with the
+.Fa fts_info
+field set to
+.Dv FTS_D .
+.It Dv FTS_ERR
+This is an error return, and the
+.Fa fts_errno
+field will be set to indicate what caused the error.
+.It Dv FTS_F
+A regular file.
+.It Dv FTS_NS
+A file for which no
+.Xr stat 2
+information was available.
+The contents of the
+.Fa fts_statp
+field are undefined.
+This is an error return, and the
+.Fa fts_errno
+field will be set to indicate what caused the error.
+.It Dv FTS_NSOK
+A file for which no
+.Xr stat 2
+information was requested.
+The contents of the
+.Fa fts_statp
+field are undefined.
+.It Dv FTS_SL
+A symbolic link.
+.It Dv FTS_SLNONE
+A symbolic link with a non-existent target.
+The contents of the
+.Fa fts_statp
+field reference the file characteristic information for the symbolic link
+itself.
+.El
+.It Fa fts_accpath
+A path for accessing the file from the current directory.
+.It Fa fts_path
+The path for the file relative to the root of the traversal.
+This path contains the path specified to
+.Fn fts_open
+as a prefix.
+.It Fa fts_pathlen
+The length of the string referenced by
+.Fa fts_path .
+.It Fa fts_name
+The name of the file.
+.It Fa fts_namelen
+The length of the string referenced by
+.Fa fts_name .
+.It Fa fts_level
+The depth of the traversal, numbered from \-1 to N, where this file
+was found.
+The
+.Li FTSENT
+structure representing the parent of the starting point
+.Pq or root
+of the traversal is numbered
+.Dv FTS_ROOTPARENTLEVEL
+.Pq \-1 ,
+and the
+.Li FTSENT
+structure for the root
+itself is numbered
+.Dv FTS_ROOTLEVEL
+.Pq 0 .
+Note that while
+.Fa fts_level
+cannot hold a number of levels greater than
+.Dv FTS_MAXLEVEL ,
+the
+.Nm fts
+functions themselves are not limited to a fixed number
+of levels.
+Application code that inspects
+.Fa fts_level
+should be written with this in mind.
+.It Fa fts_errno
+Upon return of an
+.Li FTSENT
+structure from the
+.Fn fts_children
+or
+.Fn fts_read
+functions, with its
+.Fa fts_info
+field set to
+.Dv FTS_DNR ,
+.Dv FTS_ERR
+or
+.Dv FTS_NS ,
+the
+.Fa fts_errno
+field contains the value of the external variable
+.Va errno
+specifying the cause of the error.
+Otherwise, the contents of the
+.Fa fts_errno
+field are undefined.
+.It Fa fts_number
+This field is provided for the use of the application program and is
+not modified by the
+.Nm fts
+functions.
+It is initialized to 0.
+.It Fa fts_pointer
+This field is provided for the use of the application program and is
+not modified by the
+.Nm fts
+functions.
+It is initialized to
+.Dv NULL .
+.It Fa fts_parent
+A pointer to the
+.Li FTSENT
+structure referencing the file in the hierarchy
+immediately above the current file, i.e., the directory of which this
+file is a member.
+A parent structure for the initial entry point is provided as well,
+however, only the
+.Fa fts_level ,
+.Fa fts_number
+and
+.Fa fts_pointer
+fields are guaranteed to be initialized.
+.It Fa fts_link
+Upon return from the
+.Fn fts_children
+function, the
+.Fa fts_link
+field points to the next structure in the null-terminated
+linked list of directory members.
+Otherwise, the contents of the
+.Fa fts_link
+field are undefined.
+.It Fa fts_cycle
+If a directory causes a cycle in the hierarchy
+.Pq see Dv FTS_DC ,
+either because of a hard link between two directories, or a symbolic link
+pointing to a directory, the
+.Fa fts_cycle
+field of the structure will point to the
+.Li FTSENT
+structure in the hierarchy that references the same file as the current
+.Li FTSENT
+structure.
+Otherwise, the contents of the
+.Fa fts_cycle
+field are undefined.
+.It Fa fts_statp
+A pointer to
+.Xr stat 2
+information for the file.
+.El
+.Pp
+A single buffer is used for all of the paths of all of the files in the
+file hierarchy.
+Therefore, the
+.Fa fts_path
+and
+.Fa fts_accpath
+fields are guaranteed to be NUL terminated
+.Em only
+for the file most recently returned by
+.Fn fts_read .
+To use these fields to reference any files represented by other
+.Li FTSENT
+structures will require that the path buffer be modified using the
+information contained in that
+.Li FTSENT
+structure's
+.Fa fts_pathlen
+field.
+Any such modifications should be undone before further calls to
+.Fn fts_read
+are attempted.
+The
+.Fa fts_name
+field is always NUL terminated.
+.Ss FTS_OPEN
+The
+.Fn fts_open
+function takes a pointer to an array of character pointers naming one
+or more paths which make up a logical file hierarchy to be traversed.
+The array must be terminated by a null pointer.
+.Pp
+There are
+a number of options, at least one of which
+.Po either
+.Dv FTS_LOGICAL
+or
+.Dv FTS_PHYSICAL
+.Pc
+must be specified.
+The
+.Fa options
+are selected by
+.Tn OR Ns 'ing
+the following values:
+.Bl -tag -width "FTS_COMFOLLOW"
+.It Dv FTS_COMFOLLOW
+This option causes any symbolic link specified as a root path to be
+followed immediately whether or not
+.Dv FTS_LOGICAL
+is also specified.
+.It Dv FTS_LOGICAL
+This option causes the
+.Nm fts
+routines to return
+.Li FTSENT
+structures for the targets of symbolic links
+instead of the symbolic links themselves.
+If this option is set, the only symbolic links for which
+.Li FTSENT
+structures
+are returned to the application are those referencing non-existent files.
+Either
+.Dv FTS_LOGICAL
+or
+.Dv FTS_PHYSICAL
+.Em must
+be provided to the
+.Fn fts_open
+function.
+.It Dv FTS_NOCHDIR
+As a performance optimization, the
+.Nm fts
+functions change directories as they walk the file hierarchy.
+This has the side-effect that an application cannot rely on being
+in any particular directory during the traversal.
+The
+.Dv FTS_NOCHDIR
+option turns off this optimization, and the
+.Nm fts
+functions will not change the current directory.
+Note that applications should not themselves change their current directory
+and try to access files unless
+.Dv FTS_NOCHDIR
+is specified and absolute
+pathnames were provided as arguments to
+.Fn fts_open .
+.It Dv FTS_NOSTAT
+By default, returned
+.Li FTSENT
+structures reference file characteristic information
+.Po the
+.Fa statp
+field
+.Pc
+for each file visited.
+This option relaxes that requirement as a performance optimization,
+allowing the
+.Nm fts
+functions to set the
+.Fa fts_info
+field to
+.Dv FTS_NSOK
+and leave the contents of the
+.Fa statp
+field undefined.
+.It Dv FTS_PHYSICAL
+This option causes the
+.Nm fts
+routines to return
+.Li FTSENT
+structures for symbolic links themselves instead
+of the target files they point to.
+If this option is set,
+.Li FTSENT
+structures for all symbolic links in the
+hierarchy are returned to the application.
+Either
+.Dv FTS_LOGICAL
+or
+.Dv FTS_PHYSICAL
+.Em must
+be provided to the
+.Fn fts_open
+function.
+.It Dv FTS_SEEDOT
+By default, unless they are specified as path arguments to
+.Fn fts_open ,
+any files named
+.Dq \&.
+or
+.Dq ..
+encountered in the file hierarchy are ignored.
+This option causes the
+.Nm fts
+routines to return
+.Li FTSENT
+structures for them.
+.It Dv FTS_XDEV
+This option prevents
+.Nm fts
+from descending into directories that have a different device number
+than the file from which the descent began.
+.El
+.Pp
+The
+.Fa compar
+argument
+specifies a user-defined function which may be used to order the traversal
+of the hierarchy.
+It
+takes two pointers to pointers to
+.Li FTSENT
+structures as arguments and
+should return a negative value, zero, or a positive value to indicate
+if the file referenced by its first argument comes before, in any order
+with respect to, or after, the file referenced by its second argument.
+The
+.Fa fts_accpath ,
+.Fa fts_path
+and
+.Fa fts_pathlen
+fields of the
+.Li FTSENT
+structures may
+.Em never
+be used in this comparison.
+If the
+.Fa fts_info
+field is set to
+.Dv FTS_NS
+or
+.Dv FTS_NSOK ,
+the
+.Fa fts_statp
+field may not either.
+If the
+.Fa compar
+argument is
+.Dv NULL ,
+the directory traversal order is in the order listed in
+.Fa path_argv
+for the root paths, and in the order listed in the directory for
+everything else.
+.Pp
+If an error occurs,
+.Fn fts_open
+returns
+.Dv NULL
+and sets
+.Va errno
+appropriately.
+.Ss FTS_READ
+The
+.Fn fts_read
+function returns a pointer to an
+.Li FTSENT
+structure describing a file in
+the hierarchy.
+Directories
+.Pq that are readable and do not cause cycles
+are visited at least twice, once in pre-order and once in post-order.
+All other files are visited at least once.
+.Po Hard links between directories that do not cause cycles or symbolic
+links to symbolic links may cause files to be visited more than once,
+or directories more than twice.
+.Pc
+.Pp
+If all the members of the hierarchy have been returned,
+.Fn fts_read
+returns
+.Dv NULL
+and sets the external variable
+.Va errno
+to 0.
+If an error unrelated to a file in the hierarchy occurs,
+.Fn fts_read
+returns
+.Dv NULL
+and sets
+.Va errno
+appropriately.
+If an error related to a returned file occurs, a pointer to an
+.Li FTSENT
+structure is returned, and
+.Va errno
+may or may not have been set
+.Pq see Fa fts_info .
+.Pp
+The
+.Li FTSENT
+structures returned by
+.Fn fts_read
+may be overwritten after a call to
+.Fn fts_close
+on the same file hierarchy stream or, after a call to
+.Fn fts_read ,
+on the same file hierarchy stream unless they represent a file of type
+directory, in which case they will not be overwritten until after a call to
+.Fn fts_read
+after the
+.Li FTSENT
+structure has been returned by the function
+.Fn fts_read
+in post-order.
+.Ss FTS_CHILDREN
+The
+.Fn fts_children
+function returns a pointer to an
+.Li FTSENT
+structure describing the first entry in a null-terminated
+linked list of
+the files in the directory represented by the
+.Li FTSENT
+structure most recently returned by
+.Fn fts_read .
+The list is linked through the
+.Fa fts_link
+field of the
+.Li FTSENT
+structure, and is ordered by the user-specified comparison function, if any.
+Repeated calls to
+.Fn fts_children
+will recreate this linked list.
+.Pp
+As a special case, if
+.Fn fts_read
+has not yet been called for a hierarchy,
+.Fn fts_children
+will return a pointer to the files in the logical directory specified to
+.Fn fts_open ,
+i.e., the arguments specified to
+.Fn fts_open .
+Otherwise, if the
+.Li FTSENT
+structure most recently returned by
+.Fn fts_read
+is not a directory being visited in pre-order,
+or the directory does not contain any files,
+.Fn fts_children
+returns
+.Dv NULL
+and sets
+.Va errno
+to 0.
+If an error occurs,
+.Fn fts_children
+returns
+.Dv NULL
+and sets
+.Va errno
+appropriately.
+.Pp
+The
+.Li FTSENT
+structures returned by
+.Fn fts_children
+may be overwritten after a call to
+.Fn fts_children ,
+.Fn fts_close
+or
+.Fn fts_read
+on the same file hierarchy stream.
+.Pp
+.Fa options
+may be set to the following value:
+.Bl -tag -width FTS_NAMEONLY
+.It Dv FTS_NAMEONLY
+Only the names of the files are needed.
+The contents of all the fields in the returned linked list of structures
+are undefined with the exception of the
+.Fa fts_name
+and
+.Fa fts_namelen
+fields.
+.El
+.Ss FTS_SET
+The function
+.Fn fts_set
+allows the user application to determine further processing for the file
+.Fa f
+of the stream
+.Fa ftsp .
+The
+.Fn fts_set
+function returns 0 on success or \-1 if an error occurred.
+.Fa option
+must be set to one of the following values:
+.Bl -tag -width FTS_PHYSICAL
+.It Dv FTS_AGAIN
+Re-visit the file; any file type may be re-visited.
+The next call to
+.Fn fts_read
+will return the referenced file.
+The
+.Fa fts_stat
+and
+.Fa fts_info
+fields of the structure will be reinitialized at that time,
+but no other fields will have been changed.
+This option is meaningful only for the most recently returned
+file from
+.Fn fts_read .
+Normal use is for post-order directory visits, where it causes the
+directory to be re-visited
+.Pq in both pre and post-order
+as well as all of its descendants.
+.It Dv FTS_FOLLOW
+The referenced file must be a symbolic link.
+If the referenced file is the one most recently returned by
+.Fn fts_read ,
+the next call to
+.Fn fts_read
+returns the file with the
+.Fa fts_info
+and
+.Fa fts_statp
+fields reinitialized to reflect the target of the symbolic link instead
+of the symbolic link itself.
+If the file is one of those most recently returned by
+.Fn fts_children ,
+the
+.Fa fts_info
+and
+.Fa fts_statp
+fields of the structure, when returned by
+.Fn fts_read ,
+will reflect the target of the symbolic link instead of the symbolic link
+itself.
+In either case if the target of the symbolic link does not exist, the
+fields of the returned structure will be unchanged and the
+.Fa fts_info
+field will be set to
+.Dv FTS_SLNONE .
+.Pp
+If the target of the link is a directory, the pre-order return, followed
+by the return of all of its descendants, followed by a post-order return,
+is done.
+.It Dv FTS_SKIP
+No descendants of this file are visited.
+The file may be one of those most recently returned by either
+.Fn fts_children
+or
+.Fn fts_read .
+.El
+.Ss FTS_CLOSE
+The
+.Fn fts_close
+function closes a file hierarchy stream
+.Fa ftsp
+and restores the current directory to the directory from which
+.Fn fts_open
+was called to open
+.Fa ftsp .
+.Rv -std fts_close
+.Ss Locking
+The fts routines provide no locking.
+While the
+.Fn fts_open
+function is
+.Sy Safe
+and can be called from multiple threads simultaneously, the individual
+handles returned from the
+.Fn fts_open
+function are not thread-safe.
+If callers need to operate on a single
+.Vt FTS
+structure, then it is their responsibility to ensure that none of the
+other functions are called from multiple threads simultaneously.
+This implies that the
+.Fn fts_read ,
+.Fn fts_children ,
+.Fn fts_set ,
+and
+.Fn fts_close
+functions are
+.Sy Unsafe .
+.Pp
+These routines are not
+.Sy Async-Signal-Safe
+and callers should not assume that the implementation of these functions
+will be
+.Sy Fork-Safe .
+If callers implement their own locking structures around the use of
+these routines, they must ensure that those locks are accounted for when
+forking by the use of routines such as
+.Xr pthread_atfork 3C .
+.Sh ERRORS
+The function
+.Fn fts_open
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
+.Xr open 2
+and
+.Xr malloc 3C .
+.Pp
+The function
+.Fn fts_close
+may fail and set
+.Va errno
+for any of the errors specified for the library function
+.Xr fchdir 2 .
+.Pp
+The functions
+.Fn fts_read
+and
+.Fn fts_children
+may fail and set
+.Va errno
+for any of the errors specified for the library functions
+.Xr chdir 2 ,
+.Xr malloc 3C ,
+.Xr opendir 3C ,
+.Xr readdir 3C
+and
+.Xr stat 2 .
+.Pp
+In addition,
+.Fn fts_children ,
+.Fn fts_open
+and
+.Fn fts_set
+may fail and set
+.Va errno
+as follows:
+.Bl -tag -width Er
+.It Er EINVAL
+A specified option is invalid or
+.Fa path_argv
+is empty.
+.El
+.Sh INTERFACE STABILITY
+.Sy Committed .
+.Sh MT-LEVEL
+See
+.Sx Locking .
+.Sh SEE ALSO
+.Xr find 1 ,
+.Xr chdir 2 ,
+.Xr stat 2 ,
+.Xr qsort 3C ,
+.Xr attributes 5
diff --git a/usr/src/man/man3c/malloc.3c b/usr/src/man/man3c/malloc.3c
index 9286b20784..f0c69f02f5 100644
--- a/usr/src/man/man3c/malloc.3c
+++ b/usr/src/man/man3c/malloc.3c
@@ -1,203 +1,332 @@
-'\" te
-.\" Copyright 1989 AT&T. Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
-.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
-.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
-.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH MALLOC 3C "Mar 21, 2005"
-.SH NAME
-malloc, calloc, free, memalign, realloc, valloc, alloca \- memory allocator
-.SH SYNOPSIS
-.LP
-.nf
-#include <stdlib.h>
-
-\fBvoid *\fR\fBmalloc\fR(\fBsize_t\fR \fIsize\fR);
-.fi
-
-.LP
-.nf
-\fBvoid *\fR\fBcalloc\fR(\fBsize_t\fR \fInelem\fR, \fBsize_t\fR \fIelsize\fR);
-.fi
-
-.LP
-.nf
-\fBvoid\fR \fBfree\fR(\fBvoid *\fR\fIptr\fR);
-.fi
-
-.LP
-.nf
-\fBvoid *\fR\fBmemalign\fR(\fBsize_t\fR \fIalignment\fR, \fBsize_t\fR \fIsize\fR);
-.fi
-
-.LP
-.nf
-\fBvoid *\fR\fBrealloc\fR(\fBvoid *\fR\fIptr\fR, \fBsize_t\fR \fIsize\fR);
-.fi
-
-.LP
-.nf
-\fBvoid *\fR\fBvalloc\fR(\fBsize_t\fR \fIsize\fR);
-.fi
-
-.LP
-.nf
-#include <alloca.h>
-
-\fBvoid *\fR\fBalloca\fR(\fBsize_t\fR \fIsize\fR);
-.fi
-
-.SH DESCRIPTION
-.sp
-.LP
-The \fBmalloc()\fR and \fBfree()\fR functions provide a simple, general-purpose
-memory allocation package. The \fBmalloc()\fR function returns a pointer to a
-block of at least \fIsize\fR bytes suitably aligned for any use. If the space
-assigned by \fBmalloc()\fR is overrun, the results are undefined.
-.sp
-.LP
-The argument to \fBfree()\fR is a pointer to a block previously allocated by
-\fBmalloc()\fR, \fBcalloc()\fR, or \fBrealloc()\fR. After \fBfree()\fR is
-executed, this space is made available for further allocation by the
-application, though not returned to the system. Memory is returned to the
-system only upon termination of the application. If \fIptr\fR is a null
-pointer, no action occurs. If a random number is passed to \fBfree()\fR, the
-results are undefined.
-.sp
-.LP
-The \fBcalloc()\fR function allocates space for an array of \fInelem\fR
-elements of size \fIelsize\fR. The space is initialized to zeros.
-.sp
-.LP
-The \fBmemalign()\fR function allocates \fIsize\fR bytes on a specified
-alignment boundary and returns a pointer to the allocated block. The value of
-the returned address is guaranteed to be an even multiple of \fIalignment\fR.
-The value of \fIalignment\fR must be a power of two and must be greater than or
-equal to the size of a word.
-.sp
-.LP
-The \fBrealloc()\fR function changes the size of the block pointed to by
-\fIptr\fR to \fIsize\fR bytes and returns a pointer to the (possibly moved)
-block. The contents will be unchanged up to the lesser of the new and old
-sizes. If the new size of the block requires movement of the block, the space
-for the previous instantiation of the block is freed. If the new size is
-larger, the contents of the newly allocated portion of the block are
-unspecified. If \fIptr\fR is \fINULL\fR, \fBrealloc()\fR behaves like
-\fBmalloc()\fR for the specified size. If \fIsize\fR is 0 and \fIptr\fR is not
-a null pointer, the space pointed to is freed.
-.sp
-.LP
-The \fBvalloc()\fR function has the same effect as \fBmalloc()\fR, except that
-the allocated memory will be aligned to a multiple of the value returned by
-\fBsysconf\fR(\fB_SC_PAGESIZE\fR).
-.sp
-.LP
-The \fBalloca()\fR function allocates \fIsize\fR bytes of space in the stack
-frame of the caller, and returns a pointer to the allocated block. This
-temporary space is automatically freed when the caller returns. If the
-allocated block is beyond the current stack limit, the resulting behavior is
-undefined.
-.SH RETURN VALUES
-.sp
-.LP
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [yyyy] [name of copyright owner]
+.\"
+.\"
+.\" Copyright 1989 AT&T
+.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
+.\"
+.Dd March 10, 2017
+.Dt MALLOC 3C
+.Os
+.Sh NAME
+.Nm malloc ,
+.Nm calloc ,
+.Nm free ,
+.Nm memalign ,
+.Nm realloc ,
+.Nm reallocarray ,
+.Nm valloc ,
+.Nm alloca
+.Nd memory allocator
+.Sh SYNOPSIS
+.In stdlib.h
+.Ft void *
+.Fo malloc
+.Fa "size_t size"
+.Fc
+.Ft void *
+.Fo calloc
+.Fa "size_t nelem"
+.Fa "size_t elsize"
+.Fc
+.Ft void
+.Fo free
+.Fa "void *ptr"
+.Fc
+.Ft void *
+.Fo memalign
+.Fa "size_t alignment"
+.Fa "size_t size"
+.Fc
+.Ft void *
+.Fo realloc
+.Fa "void *ptr"
+.Fa "size_t size"
+.Fc
+.Ft void *
+.Fo reallocarray
+.Fa "void *ptr"
+.Fa "size_t nelem"
+.Fa "size_t elsize"
+.Fc
+.Ft void *
+.Fo valloc
+.Fa "size_t size"
+.Fc
+.In alloca.h
+.Ft void *
+.Fo alloca
+.Fa "size_t size"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn malloc
+and
+.Fn free
+functions provide a simple, general-purpose memory allocation package.
+The
+.Fn malloc
+function returns a pointer to a block of at least
+.Fa size
+bytes suitably aligned for any use.
+If the space assigned by
+.Fn malloc
+is overrun, the results are undefined.
+.Pp
+The argument to
+.Fn free
+is a pointer to a block previously allocated by
+.Fn malloc ,
+.Fn calloc ,
+.Fn realloc ,
+or
+.Fn reallocarray .
+After
+.Fn free
+is executed, this space is made available for further allocation by the
+application, though not returned to the system.
+Memory is returned to the system only upon termination of the application.
+If
+.Fa ptr
+is a null pointer, no action occurs.
+If a random number is passed to
+.Fn free ,
+the results are undefined.
+.Pp
+The
+.Fn calloc
+function allocates space for an array of
+.Fa nelem
+elements of size
+.Fa elsize .
+The space is initialized to zeros.
+.Pp
+The
+.Fn memalign
+function allocates
+.Fa size
+bytes on a specified alignment boundary and returns a pointer to the allocated
+block.
+The value of the returned address is guaranteed to be an even multiple of
+.Fa alignment .
+The value of
+.Fa alignment
+must be a power of two and must be greater than or equal to the size of a word.
+.Pp
+The
+.Fn realloc
+function changes the size of the block pointed to by
+.Fa ptr
+to
+.Fa size
+bytes and returns a pointer to the
+.Pq possibly moved
+block.
+The contents will be unchanged up to the lesser of the new and old sizes.
+If the new size of the block requires movement of the block, the space for the
+previous instantiation of the block is freed.
+If the new size is larger, the contents of the newly allocated portion of the
+block are unspecified.
+If
+.Fa ptr
+is
+.Dv NULL ,
+.Fn realloc
+behaves like
+.Fn malloc
+for the specified size.
+If
+.Fa size
+is 0 and
+.Fa ptr
+is not a null pointer, the space pointed to is freed.
+.Pp
+The
+.Fn reallocarray
+function is similar to
+.Fn realloc ,
+but operates on
+.Fa nelem
+elements of size
+.Fa elsize
+and checks for overflow in
+.Fa nelem Ns * Ns Fa elsize
+calculation.
+.Pp
+The
+.Fn valloc
+function has the same effect as
+.Fn malloc ,
+except that the allocated memory will be aligned to a multiple of the value
+returned by
+.Nm sysconf Ns Pq Dv _SC_PAGESIZE .
+.Pp
+The
+.Fn alloca
+function allocates
+.Fa size
+bytes of space in the stack frame of the caller, and returns a pointer to the
+allocated block.
+This temporary space is automatically freed when the caller returns.
+If the allocated block is beyond the current stack limit, the resulting behavior
+is undefined.
+.Sh RETURN VALUES
Upon successful completion, each of the allocation functions returns a pointer
-to space suitably aligned (after possible pointer coercion) for storage of any
-type of object.
-.sp
-.LP
-If there is no available memory, \fBmalloc()\fR, \fBrealloc()\fR,
-\fBmemalign()\fR, \fBvalloc()\fR, and \fBcalloc()\fR return a null pointer.
-When \fBrealloc()\fR is called with \fIsize\fR > 0 and returns \fINULL\fR, the
-block pointed to by \fIptr\fR is left intact. If \fIsize\fR, \fInelem\fR, or
-\fIelsize\fR is 0, either a null pointer or a unique pointer that can be passed
-to \fBfree()\fR is returned.
-.sp
-.LP
-If \fBmalloc()\fR, \fBcalloc()\fR, or \fBrealloc()\fR returns unsuccessfully,
-\fBerrno\fR will be set to indicate the error. The \fBfree()\fR function does
-not set \fBerrno\fR.
-.SH ERRORS
-.sp
-.LP
-The \fBmalloc()\fR, \fBcalloc()\fR, and \fBrealloc()\fR functions will fail if:
-.sp
-.ne 2
-.na
-\fB\fBENOMEM\fR\fR
-.ad
-.RS 10n
-The physical limits of the system are exceeded by \fIsize\fR bytes of memory
-which cannot be allocated.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBEAGAIN\fR\fR
-.ad
-.RS 10n
-There is not enough memory available to allocate \fIsize\fR bytes of memory;
-but the application could try again later.
-.RE
-
-.SH USAGE
-.sp
-.LP
-Portable applications should avoid using \fBvalloc()\fR but should instead use
-\fBmalloc()\fR or \fBmmap\fR(2). On systems with a large page size, the number
-of successful \fBvalloc()\fR operations might be 0.
-.sp
-.LP
+to space suitably aligned
+.Pq after possible pointer coercion
+for storage of any type of object.
+.Pp
+If there is no available memory,
+.Fn malloc ,
+.Fn realloc ,
+.Fn reallocarray ,
+.Fn memalign ,
+.Fn valloc ,
+and
+.Fn calloc
+return a null pointer.
+.Pp
+When
+.Fn realloc
+or
+.Fn reallocarray
+is called with
+.Fa size
+> 0 and returns
+.Dv NULL ,
+the block pointed to by
+.Fa ptr
+is left intact.
+If
+.Fa size ,
+.Fa nelem ,
+or
+.Fa elsize
+is 0, either a null pointer or a unique pointer that can be passed to
+.Fn free
+is returned.
+.Pp
+If
+.Fn malloc ,
+.Fn calloc ,
+.Fn realloc ,
+or
+.Fn reallocarray
+returns unsuccessfully,
+.Va errno
+will be set to indicate the error.
+The
+.Fn free
+function does not set
+.Va errno .
+.Sh ERRORS
+The
+.Fn malloc ,
+.Fn calloc ,
+.Fn realloc ,
+and
+.Fn reallocarray
+functions will fail if:
+.Bl -tag -width "ENOMEM"
+.It Er ENOMEM
+The physical limits of the system are exceeded by
+.Fa size
+bytes of memory which cannot be allocated, or there's integer overflow in
+.Fn reallocarray .
+.It Er EAGAIN
+There is not enough memory available to allocate
+.Fa size
+bytes of memory; but the application could try again later.
+.El
+.Sh USAGE
+Portable applications should avoid using
+.Fn valloc
+but should instead use
+.Fn malloc
+or
+.Xr mmap 2 .
+On systems with a large page size, the number of successful
+.Fn valloc
+operations might be 0.
+.Pp
These default memory allocation routines are safe for use in multithreaded
-applications but are not scalable. Concurrent accesses by multiple threads are
-single-threaded through the use of a single lock. Multithreaded applications
-that make heavy use of dynamic memory allocation should be linked with
-allocation libraries designed for concurrent access, such as
-\fBlibumem\fR(3LIB) or \fBlibmtmalloc\fR(3LIB). Applications that want to avoid
-using heap allocations (with \fBbrk\fR(2)) can do so by using either
-\fBlibumem\fR or \fBlibmapmalloc\fR(3LIB). The allocation libraries
-\fBlibmalloc\fR(3LIB) and \fBlibbsdmalloc\fR(3LIB) are available for special
-needs.
-.sp
-.LP
+applications but are not scalable.
+Concurrent accesses by multiple threads are single-threaded through the use of a
+single lock.
+Multithreaded applications that make heavy use of dynamic memory allocation
+should be linked with allocation libraries designed for concurrent access, such
+as
+.Xr libumem 3LIB
+or
+.Xr libmtmalloc 3LIB .
+Applications that want to avoid using heap allocations
+.Pq with Xr brk 2
+can do so by using either
+.Xr libumem 3LIB
+or
+.Xr libmapmalloc 3LIB .
+The allocation libraries
+.Xr libmalloc 3LIB
+and
+.Xr libbsdmalloc 3LIB
+are available for special needs.
+.Pp
Comparative features of the various allocation libraries can be found in the
-\fBumem_alloc\fR(3MALLOC) manual page.
-.SH ATTRIBUTES
-.sp
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability See below.
-_
-MT-Level Safe
-.TE
-
-.sp
-.LP
-The \fBmalloc()\fR, \fBcalloc()\fR, \fBfree()\fR, \fBrealloc()\fR,
-\fBvalloc()\fR functions are Standard. The \fBmemalign()\fR and \fBalloca()\fR
-functions are Stable.
-.SH SEE ALSO
-.sp
-.LP
-\fBbrk\fR(2), \fBgetrlimit\fR(2), \fBlibbsdmalloc\fR(3LIB),
-\fBlibmalloc\fR(3LIB), \fBlibmapmalloc\fR(3LIB), \fBlibmtmalloc\fR(3LIB),
-\fBlibumem\fR(3LIB), \fBumem_alloc\fR(3MALLOC), \fBwatchmalloc\fR(3MALLOC),
-\fBattributes\fR(5)
-.SH WARNINGS
-.sp
-.LP
+.Xr umem_alloc 3MALLOC
+manual page.
+.Sh INTERFACE STABILITY
+The
+.Fn malloc ,
+.Fn calloc ,
+.Fn free ,
+.Fn realloc ,
+.Fn valloc
+functions are
+.Sy Standard.
+.Pp
+The
+.Fn reallocarray
+function is
+.Sy Committed .
+.Pp
+The
+.Fn memalign
+and
+.Fn alloca
+functions are
+.Sy Stable .
+.Sh MT-LEVEL
+.Sy Safe.
+.Sh SEE ALSO
+.Xr brk 2 ,
+.Xr getrlimit 2 ,
+.Xr libbsdmalloc 3LIB ,
+.Xr libmalloc 3LIB ,
+.Xr libmapmalloc 3LIB ,
+.Xr libmtmalloc 3LIB ,
+.Xr libumem 3LIB ,
+.Xr umem_alloc 3MALLOC ,
+.Xr watchmalloc 3MALLOC ,
+.Xr attributes 5
+.Sh WARNINGS
Undefined results will occur if the size requested for a block of memory
exceeds the maximum size of a process's heap, which can be obtained with
-\fBgetrlimit\fR(2)
-.sp
-.LP
-The \fBalloca()\fR function is machine-, compiler-, and most of all,
-system-dependent. Its use is strongly discouraged.
+.Xr getrlimit 2 .
+.Pp
+The
+.Fn alloca
+function is machine-, compiler-, and most of all, system-dependent.
+Its use is strongly discouraged.
diff --git a/usr/src/man/man3c/strtonum.3c b/usr/src/man/man3c/strtonum.3c
new file mode 100644
index 0000000000..a0e6412d66
--- /dev/null
+++ b/usr/src/man/man3c/strtonum.3c
@@ -0,0 +1,151 @@
+.\"
+.\" Copyright (c) 2004 Ted Unangst
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: February 7 2016 $
+.Dt STRTONUM 3C
+.Os
+.Sh NAME
+.Nm strtonum
+.Nd reliably convert string value to an integer
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In stdlib.h
+.Ft long long
+.Fo strtonum
+.Fa "const char *nptr"
+.Fa "long long minval"
+.Fa "long long maxval"
+.Fa "const char **errstr"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn strtonum
+function converts the string in
+.Fa nptr
+to a
+.Li long long
+value.
+The
+.Fn strtonum
+function was designed to facilitate safe, robust programming
+and overcome the shortcomings of the
+.Xr atoi 3C
+and
+.Xr strtol 3C
+family of interfaces.
+.Pp
+The string may begin with an arbitrary amount of whitespace
+.Pq as determined by Xr isspace 3C
+followed by a single optional
+.Ql +
+or
+.Ql -
+sign.
+.Pp
+The remainder of the string is converted to a
+.Li long long
+value according to base 10.
+.Pp
+The value obtained is then checked against the provided
+.Fa minval
+and
+.Fa maxval
+bounds.
+If
+.Fa errstr
+is non-null,
+.Fn strtonum
+stores an error string in
+.Fa errstr
+indicating the failure.
+.Sh RETURN VALUES
+The
+.Fn strtonum
+function returns the result of the conversion,
+unless the value would exceed the provided bounds or is invalid.
+On error, 0 is returned,
+.Va errno
+is set, and
+.Fa errstr
+will point to an error message.
+.Fa errstr
+will be set to
+.Dv NULL
+on success; this fact can be used to differentiate a successful return of 0 from
+an error.
+.Sh EXAMPLES
+Using
+.Fn strtonum
+correctly is meant to be simpler than the alternative functions.
+.Bd -literal -offset indent
+int iterations;
+const char *errstr;
+
+iterations = strtonum(optarg, 1, 64, &errstr);
+if (errstr != NULL)
+ errx(1, "number of iterations is %s: %s", errstr, optarg);
+.Ed
+.Pp
+The above example will guarantee that the value of iterations is between
+1 and 64
+.Pq inclusive .
+.Sh ERRORS
+.Bl -tag -width Er
+.It Er ERANGE
+The given string was out of range.
+.It Er EINVAL
+The given string did not consist solely of digit characters.
+.It Er EINVAL
+.Ar minval
+was larger than
+.Ar maxval .
+.El
+.Pp
+If an error occurs,
+.Fa errstr
+will be set to one of the following strings:
+.Pp
+.Bl -tag -width "too largeXX" -compact
+.It Qq too large
+The result was larger than the provided maximum value.
+.It Qq too small
+The result was smaller than the provided minimum value.
+.It Qq invalid
+The string did not consist solely of digit characters.
+.El
+.Sh INTERFACE STABILITY
+.Sy Committed .
+.Sh MT-LEVEL
+.Sy Safe .
+.Sh SEE ALSO
+.Xr atof 3C ,
+.Xr atoi 3C ,
+.Xr atol 3C ,
+.Xr atoll 3C ,
+.Xr sscanf 3C ,
+.Xr strtod 3C ,
+.Xr strtol 3C ,
+.Xr strtoul 3C
+.Sh STANDARDS
+.Fn strtonum
+is an
+.Ox
+extension.
+The existing alternatives, such as
+.Xr atoi 3C
+and
+.Xr strtol 3C ,
+are either impossible or difficult to use safely.
diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf
index 9082061fd1..71d3683ffb 100644
--- a/usr/src/pkg/manifests/system-header.mf
+++ b/usr/src/pkg/manifests/system-header.mf
@@ -24,7 +24,7 @@
# Copyright (c) 2012 by Delphix. All rights reserved.
# Copyright 2013 Saso Kiselkov. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
-# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2017 Nexenta Systems, Inc.
# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
#
@@ -379,6 +379,7 @@ file path=usr/include/float.h
file path=usr/include/fmtmsg.h
file path=usr/include/fnmatch.h
file path=usr/include/form.h
+file path=usr/include/fts.h
file path=usr/include/ftw.h
file path=usr/include/gelf.h
file path=usr/include/getopt.h
diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc
index f913eecea4..0a07bd5222 100644
--- a/usr/src/pkg/manifests/system-library.man3c.inc
+++ b/usr/src/pkg/manifests/system-library.man3c.inc
@@ -11,7 +11,7 @@
#
# Copyright 2011, Richard Lowe
-# Copyright 2013 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2017 Nexenta Systems, Inc.
# Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
#
@@ -147,6 +147,7 @@ file path=usr/share/man/man3c/fsync.3c
file path=usr/share/man/man3c/ftell.3c
file path=usr/share/man/man3c/ftime.3c
file path=usr/share/man/man3c/ftok.3c
+file path=usr/share/man/man3c/fts.3c
file path=usr/share/man/man3c/ftw.3c
file path=usr/share/man/man3c/fwide.3c
file path=usr/share/man/man3c/fwprintf.3c
@@ -440,6 +441,7 @@ file path=usr/share/man/man3c/strsignal.3c
file path=usr/share/man/man3c/strtod.3c
file path=usr/share/man/man3c/strtoimax.3c
file path=usr/share/man/man3c/strtol.3c
+file path=usr/share/man/man3c/strtonum.3c
file path=usr/share/man/man3c/strtoul.3c
file path=usr/share/man/man3c/strtows.3c
file path=usr/share/man/man3c/strxfrm.3c
@@ -818,6 +820,11 @@ link path=usr/share/man/man3c/fsetattr.3c target=fgetattr.3c
link path=usr/share/man/man3c/ftello.3c target=ftell.3c
link path=usr/share/man/man3c/ftruncate.3c target=truncate.3c
link path=usr/share/man/man3c/ftrylockfile.3c target=flockfile.3c
+link path=usr/share/man/man3c/fts_children.3c target=fts.3c
+link path=usr/share/man/man3c/fts_close.3c target=fts.3c
+link path=usr/share/man/man3c/fts_open.3c target=fts.3c
+link path=usr/share/man/man3c/fts_read.3c target=fts.3c
+link path=usr/share/man/man3c/fts_set.3c target=fts.3c
link path=usr/share/man/man3c/func_to_decimal.3c target=string_to_decimal.3c
link path=usr/share/man/man3c/funlockfile.3c target=flockfile.3c
link path=usr/share/man/man3c/gconvert.3c target=econvert.3c
@@ -1197,6 +1204,7 @@ link path=usr/share/man/man3c/rctlblk_size.3c target=rctlblk_set_value.3c
link path=usr/share/man/man3c/re_exec.3c target=re_comp.3c
link path=usr/share/man/man3c/readdir_r.3c target=readdir.3c
link path=usr/share/man/man3c/realloc.3c target=malloc.3c
+link path=usr/share/man/man3c/reallocarray.3c target=malloc.3c
link path=usr/share/man/man3c/regerror.3c target=regcomp.3c
link path=usr/share/man/man3c/regex.3c target=regcmp.3c
link path=usr/share/man/man3c/regexec.3c target=regcomp.3c
diff --git a/usr/src/tools/mandoc/Makefile b/usr/src/tools/mandoc/Makefile
index 6e254601a2..7f8b3b8f2a 100644
--- a/usr/src/tools/mandoc/Makefile
+++ b/usr/src/tools/mandoc/Makefile
@@ -10,14 +10,18 @@
#
#
-# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+# Copyright 2017 Nexenta Systems, Inc.
#
CMDDIR= $(SRC)/cmd/mandoc
+LCDIR= $(SRC)/lib/libc/port
include $(SRC)/tools/Makefile.tools
include $(CMDDIR)/Makefile.common
+OBJS += reallocarray.o \
+ strtonum.o
+
.KEEP_STATE:
all: $(PROG)
@@ -34,4 +38,7 @@ $(PROG): $(OBJS)
%.o: $(CMDDIR)/%.c
$(COMPILE.c) -o $@ $<
+%.o: $(LCDIR)/gen/%.c
+ $(COMPILE.c) -o $@ $<
+
include $(SRC)/tools/Makefile.targ
diff --git a/usr/src/uts/common/fs/zfs/dsl_deadlist.c b/usr/src/uts/common/fs/zfs/dsl_deadlist.c
index 203815a750..ff06c9e93c 100644
--- a/usr/src/uts/common/fs/zfs/dsl_deadlist.c
+++ b/usr/src/uts/common/fs/zfs/dsl_deadlist.c
@@ -85,7 +85,7 @@ dsl_deadlist_load_tree(dsl_deadlist_t *dl)
zap_cursor_retrieve(&zc, &za) == 0;
zap_cursor_advance(&zc)) {
dsl_deadlist_entry_t *dle = kmem_alloc(sizeof (*dle), KM_SLEEP);
- dle->dle_mintxg = strtonum(za.za_name, NULL);
+ dle->dle_mintxg = zfs_strtonum(za.za_name, NULL);
VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os,
za.za_first_integer));
avl_add(&dl->dl_tree, dle);
@@ -490,7 +490,7 @@ dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, dmu_tx_t *tx)
for (zap_cursor_init(&zc, dl->dl_os, obj);
zap_cursor_retrieve(&zc, &za) == 0;
zap_cursor_advance(&zc)) {
- uint64_t mintxg = strtonum(za.za_name, NULL);
+ uint64_t mintxg = zfs_strtonum(za.za_name, NULL);
dsl_deadlist_insert_bpobj(dl, za.za_first_integer, mintxg, tx);
VERIFY3U(0, ==, zap_remove_int(dl->dl_os, obj, mintxg, tx));
}
diff --git a/usr/src/uts/common/fs/zfs/dsl_scan.c b/usr/src/uts/common/fs/zfs/dsl_scan.c
index e476689e40..ccd9eb4c39 100644
--- a/usr/src/uts/common/fs/zfs/dsl_scan.c
+++ b/usr/src/uts/common/fs/zfs/dsl_scan.c
@@ -1365,7 +1365,7 @@ dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx)
dsl_dataset_t *ds;
uint64_t dsobj;
- dsobj = strtonum(za.za_name, NULL);
+ dsobj = zfs_strtonum(za.za_name, NULL);
VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset,
scn->scn_phys.scn_queue_obj, dsobj, tx));
diff --git a/usr/src/uts/common/fs/zfs/dsl_userhold.c b/usr/src/uts/common/fs/zfs/dsl_userhold.c
index 54a15e1669..a0484a0cd9 100644
--- a/usr/src/uts/common/fs/zfs/dsl_userhold.c
+++ b/usr/src/uts/common/fs/zfs/dsl_userhold.c
@@ -340,7 +340,7 @@ static int
dsl_dataset_hold_obj_string(dsl_pool_t *dp, const char *dsobj, void *tag,
dsl_dataset_t **dsp)
{
- return (dsl_dataset_hold_obj(dp, strtonum(dsobj, NULL), tag, dsp));
+ return (dsl_dataset_hold_obj(dp, zfs_strtonum(dsobj, NULL), tag, dsp));
}
static int
diff --git a/usr/src/uts/common/fs/zfs/spa_errlog.c b/usr/src/uts/common/fs/zfs/spa_errlog.c
index 168f3acc2e..8ce780537a 100644
--- a/usr/src/uts/common/fs/zfs/spa_errlog.c
+++ b/usr/src/uts/common/fs/zfs/spa_errlog.c
@@ -73,13 +73,13 @@ bookmark_to_name(zbookmark_phys_t *zb, char *buf, size_t len)
static void
name_to_bookmark(char *buf, zbookmark_phys_t *zb)
{
- zb->zb_objset = strtonum(buf, &buf);
+ zb->zb_objset = zfs_strtonum(buf, &buf);
ASSERT(*buf == ':');
- zb->zb_object = strtonum(buf + 1, &buf);
+ zb->zb_object = zfs_strtonum(buf + 1, &buf);
ASSERT(*buf == ':');
- zb->zb_level = (int)strtonum(buf + 1, &buf);
+ zb->zb_level = (int)zfs_strtonum(buf + 1, &buf);
ASSERT(*buf == ':');
- zb->zb_blkid = strtonum(buf + 1, &buf);
+ zb->zb_blkid = zfs_strtonum(buf + 1, &buf);
ASSERT(*buf == '\0');
}
#endif
diff --git a/usr/src/uts/common/fs/zfs/spa_misc.c b/usr/src/uts/common/fs/zfs/spa_misc.c
index 1aebbca741..6555d4eee5 100644
--- a/usr/src/uts/common/fs/zfs/spa_misc.c
+++ b/usr/src/uts/common/fs/zfs/spa_misc.c
@@ -1481,7 +1481,7 @@ zfs_panic_recover(const char *fmt, ...)
* lowercase hexadecimal numbers that don't overflow.
*/
uint64_t
-strtonum(const char *str, char **nptr)
+zfs_strtonum(const char *str, char **nptr)
{
uint64_t val = 0;
char c;
diff --git a/usr/src/uts/common/fs/zfs/sys/spa.h b/usr/src/uts/common/fs/zfs/sys/spa.h
index c96c001da5..0243c3effd 100644
--- a/usr/src/uts/common/fs/zfs/sys/spa.h
+++ b/usr/src/uts/common/fs/zfs/sys/spa.h
@@ -829,7 +829,7 @@ extern int spa_maxblocksize(spa_t *spa);
extern void zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp);
extern int spa_mode(spa_t *spa);
-extern uint64_t strtonum(const char *str, char **nptr);
+extern uint64_t zfs_strtonum(const char *str, char **nptr);
extern char *spa_his_ievent_table[];
diff --git a/usr/src/uts/common/fs/zfs/zfs_vfsops.c b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
index 213a30b6e6..5fefc541a6 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c
@@ -632,7 +632,7 @@ fuidstr_to_sid(zfsvfs_t *zfsvfs, const char *fuidstr,
uint64_t fuid;
const char *domain;
- fuid = strtonum(fuidstr, NULL);
+ fuid = zfs_strtonum(fuidstr, NULL);
domain = zfs_fuid_find_by_idx(zfsvfs, FUID_INDEX(fuid));
if (domain)