summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-09-05 18:36:23 +0000
committerdim <dim@FreeBSD.org>2015-09-05 18:36:23 +0000
commitfe74670889cf92661ccb26dc6bd31e8227b41594 (patch)
treec2636bec23985b92b33023a5ca2e324f89604bfa /lib/libc
parent3cb87c6fdcce3fa2b08afc959741598eb31a8a5c (diff)
parent127f7b062779965375aa7d373ab56614a5d13f16 (diff)
downloadFreeBSD-src-fe74670889cf92661ccb26dc6bd31e8227b41594.zip
FreeBSD-src-fe74670889cf92661ccb26dc6bd31e8227b41594.tar.gz
Merge ^/head r286858 through r287489.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/aarch64/Symbol.map2
-rw-r--r--lib/libc/aarch64/gen/Makefile.inc1
-rw-r--r--lib/libc/aarch64/gen/infinity.c14
-rw-r--r--lib/libc/amd64/gen/setjmp.S4
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S4
-rw-r--r--lib/libc/compat-43/sigcompat.c28
-rw-r--r--lib/libc/db/btree/bt_open.c5
-rw-r--r--lib/libc/db/hash/hash_page.c5
-rw-r--r--lib/libc/gen/daemon.c8
-rw-r--r--lib/libc/gen/devname.c1
-rw-r--r--lib/libc/gen/posix_spawn.c9
-rw-r--r--lib/libc/gen/readpassphrase.c37
-rw-r--r--lib/libc/gen/setmode.c5
-rw-r--r--lib/libc/gen/siginterrupt.c7
-rw-r--r--lib/libc/gen/signal.c6
-rw-r--r--lib/libc/gen/tls.c24
-rw-r--r--lib/libc/gen/wordexp.316
-rw-r--r--lib/libc/gen/wordexp.c50
-rw-r--r--lib/libc/i386/gen/setjmp.S22
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S22
-rw-r--r--lib/libc/include/libc_private.h5
-rw-r--r--lib/libc/locale/utf8.c6
-rw-r--r--lib/libc/net/getnameinfo.c22
-rw-r--r--lib/libc/net/rcmd.c11
-rw-r--r--lib/libc/net/rcmdsh.c15
-rw-r--r--lib/libc/posix1e/acl_add_flag_np.33
-rw-r--r--lib/libc/posix1e/acl_flag.c2
-rw-r--r--lib/libc/posix1e/acl_init.c4
-rw-r--r--lib/libc/posix1e/acl_strip.c20
-rw-r--r--lib/libc/posix1e/acl_support_nfs4.c1
-rw-r--r--lib/libc/rpc/auth_des.c6
-rw-r--r--lib/libc/rpc/auth_none.c8
-rw-r--r--lib/libc/rpc/auth_time.c45
-rw-r--r--lib/libc/rpc/clnt_bcast.c2
-rw-r--r--lib/libc/rpc/clnt_dg.c60
-rw-r--r--lib/libc/rpc/crypt_client.c5
-rw-r--r--lib/libc/rpc/des_crypt.c21
-rw-r--r--lib/libc/rpc/des_soft.c3
-rw-r--r--lib/libc/rpc/getpublickey.c12
-rw-r--r--lib/libc/rpc/key_call.c42
-rw-r--r--lib/libc/rpc/rpc_prot.c28
-rw-r--r--lib/libc/rpc/rpc_soc.c145
-rw-r--r--lib/libc/rpc/rpcb_clnt.c70
-rw-r--r--lib/libc/rpc/rpcdname.c5
-rw-r--r--lib/libc/rpc/rtime.c9
-rw-r--r--lib/libc/rpc/svc_auth.c15
-rw-r--r--lib/libc/rpc/svc_auth_des.c35
-rw-r--r--lib/libc/rpc/svc_dg.c51
-rw-r--r--lib/libc/rpc/svc_vc.c75
-rw-r--r--lib/libc/stdio/tmpfile.c7
-rw-r--r--lib/libc/stdlib/abort.c6
-rw-r--r--lib/libc/stdlib/jemalloc/Makefile.inc9
-rw-r--r--lib/libc/stdlib/jemalloc/Symbol.map5
-rw-r--r--lib/libc/stdlib/system.c22
-rw-r--r--lib/libc/string/bcopy.33
-rw-r--r--lib/libc/string/bzero.310
-rw-r--r--lib/libc/string/strndup.c55
-rw-r--r--lib/libc/sys/getrlimit.261
-rw-r--r--lib/libc/sys/procctl.254
-rw-r--r--lib/libc/sys/sigaction.c1
-rw-r--r--lib/libc/sys/sigprocmask.c1
-rw-r--r--lib/libc/sys/sigsuspend.c1
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile2
-rw-r--r--lib/libc/tests/sys/Makefile3
64 files changed, 535 insertions, 701 deletions
diff --git a/lib/libc/aarch64/Symbol.map b/lib/libc/aarch64/Symbol.map
index e47056a..84c38d8 100644
--- a/lib/libc/aarch64/Symbol.map
+++ b/lib/libc/aarch64/Symbol.map
@@ -17,6 +17,8 @@ FBSD_1.0 {
__flt_rounds;
fpgetmask;
fpsetmask;
+ __infinity;
+ __nan;
setjmp;
longjmp;
sigsetjmp;
diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc
index 2ccc834..f138008 100644
--- a/lib/libc/aarch64/gen/Makefile.inc
+++ b/lib/libc/aarch64/gen/Makefile.inc
@@ -5,6 +5,7 @@ SRCS+= _ctx_start.S \
flt_rounds.c \
fpgetmask.c \
fpsetmask.c \
+ infinity.c \
ldexp.c \
makecontext.c \
_setjmp.S \
diff --git a/lib/libc/aarch64/gen/infinity.c b/lib/libc/aarch64/gen/infinity.c
new file mode 100644
index 0000000..c96045e
--- /dev/null
+++ b/lib/libc/aarch64/gen/infinity.c
@@ -0,0 +1,14 @@
+/*
+ * infinity.c
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <math.h>
+
+/* bytes for +Infinity on aarch64 */
+const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
+
+/* bytes for NaN */
+const union __nan_un __nan = { { 0, 0, 0xc0, 0xff } };
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index c26f52f..826220e 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -55,7 +55,7 @@ ENTRY(setjmp)
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10; (sigset_t*)oset */
/* stack is 16-byte aligned */
- call PIC_PLT(CNAME(_sigprocmask))
+ call __libc_sigprocmask
popq %rdi
movq %rdi,%rcx
movq 0(%rsp),%rdx /* retval */
@@ -82,7 +82,7 @@ ENTRY(__longjmp)
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
subq $0x8,%rsp /* make the stack 16-byte aligned */
- call PIC_PLT(CNAME(_sigprocmask))
+ call __libc_sigprocmask
addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 9a20556..1e8e77c 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -63,7 +63,7 @@ ENTRY(sigsetjmp)
movq $0,%rsi /* (sigset_t*)set */
leaq 72(%rcx),%rdx /* 9,10 (sigset_t*)oset */
/* stack is 16-byte aligned */
- call PIC_PLT(CNAME(_sigprocmask))
+ call __libc_sigprocmask
popq %rdi
2: movq %rdi,%rcx
movq 0(%rsp),%rdx /* retval */
@@ -91,7 +91,7 @@ ENTRY(__siglongjmp)
leaq 72(%rdx),%rsi /* (sigset_t*)set */
movq $0,%rdx /* (sigset_t*)oset */
subq $0x8,%rsp /* make the stack 16-byte aligned */
- call PIC_PLT(CNAME(_sigprocmask))
+ call __libc_sigprocmask
addq $0x8,%rsp
popq %rsi
popq %rdi /* jmpbuf */
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c
index 199846f..a8cef1c 100644
--- a/lib/libc/compat-43/sigcompat.c
+++ b/lib/libc/compat-43/sigcompat.c
@@ -59,7 +59,7 @@ sigvec(signo, sv, osv)
} else
sap = NULL;
osap = osv != NULL ? &osa : NULL;
- ret = _sigaction(signo, sap, osap);
+ ret = __libc_sigaction(signo, sap, osap);
if (ret == 0 && osv != NULL) {
osv->sv_handler = osa.sa_handler;
osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT;
@@ -77,7 +77,7 @@ sigsetmask(mask)
sigemptyset(&set);
set.__bits[0] = mask;
- n = _sigprocmask(SIG_SETMASK, &set, &oset);
+ n = __libc_sigprocmask(SIG_SETMASK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -92,7 +92,7 @@ sigblock(mask)
sigemptyset(&set);
set.__bits[0] = mask;
- n = _sigprocmask(SIG_BLOCK, &set, &oset);
+ n = __libc_sigprocmask(SIG_BLOCK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -105,7 +105,7 @@ sigpause(int mask)
sigemptyset(&set);
set.__bits[0] = mask;
- return (_sigsuspend(&set));
+ return (__libc_sigsuspend(&set));
}
int
@@ -113,11 +113,11 @@ xsi_sigpause(int sig)
{
sigset_t set;
- if (_sigprocmask(SIG_BLOCK, NULL, &set) == -1)
+ if (__libc_sigprocmask(SIG_BLOCK, NULL, &set) == -1)
return (-1);
if (sigdelset(&set, sig) == -1)
return (-1);
- return (_sigsuspend(&set));
+ return (__libc_sigsuspend(&set));
}
int
@@ -128,7 +128,7 @@ sighold(int sig)
sigemptyset(&set);
if (sigaddset(&set, sig) == -1)
return (-1);
- return (_sigprocmask(SIG_BLOCK, &set, NULL));
+ return (__libc_sigprocmask(SIG_BLOCK, &set, NULL));
}
int
@@ -138,7 +138,7 @@ sigignore(int sig)
bzero(&sa, sizeof(sa));
sa.sa_handler = SIG_IGN;
- return (_sigaction(sig, &sa, NULL));
+ return (__libc_sigaction(sig, &sa, NULL));
}
int
@@ -149,7 +149,7 @@ sigrelse(int sig)
sigemptyset(&set);
if (sigaddset(&set, sig) == -1)
return (-1);
- return (_sigprocmask(SIG_UNBLOCK, &set, NULL));
+ return (__libc_sigprocmask(SIG_UNBLOCK, &set, NULL));
}
void
@@ -161,26 +161,26 @@ void
sigemptyset(&set);
if (sigaddset(&set, sig) == -1)
return (SIG_ERR);
- if (_sigprocmask(SIG_BLOCK, NULL, &pset) == -1)
+ if (__libc_sigprocmask(SIG_BLOCK, NULL, &pset) == -1)
return (SIG_ERR);
if ((__sighandler_t *)disp == SIG_HOLD) {
- if (_sigprocmask(SIG_BLOCK, &set, &pset) == -1)
+ if (__libc_sigprocmask(SIG_BLOCK, &set, &pset) == -1)
return (SIG_ERR);
if (sigismember(&pset, sig))
return (SIG_HOLD);
else {
- if (_sigaction(sig, NULL, &psa) == -1)
+ if (__libc_sigaction(sig, NULL, &psa) == -1)
return (SIG_ERR);
return (psa.sa_handler);
}
} else {
- if (_sigprocmask(SIG_UNBLOCK, &set, &pset) == -1)
+ if (__libc_sigprocmask(SIG_UNBLOCK, &set, &pset) == -1)
return (SIG_ERR);
}
bzero(&sa, sizeof(sa));
sa.sa_handler = disp;
- if (_sigaction(sig, &sa, &psa) == -1)
+ if (__libc_sigaction(sig, &sa, &psa) == -1)
return (SIG_ERR);
if (sigismember(&pset, sig))
return (SIG_HOLD);
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index 94ba014..051fc28 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
#include "un-namespace.h"
+#include "libc_private.h"
#include <db.h>
#include "btree.h"
@@ -401,10 +402,10 @@ tmp(void)
}
(void)sigfillset(&set);
- (void)_sigprocmask(SIG_BLOCK, &set, &oset);
+ (void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
if ((fd = mkostemp(path, O_CLOEXEC)) != -1)
(void)unlink(path);
- (void)_sigprocmask(SIG_SETMASK, &oset, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oset, NULL);
return(fd);
}
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
index d319d98..8040419 100644
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
#include <assert.h>
#endif
#include "un-namespace.h"
+#include "libc_private.h"
#include <db.h>
#include "hash.h"
@@ -861,10 +862,10 @@ open_temp(HTAB *hashp)
/* Block signals; make sure file goes away at process exit. */
(void)sigfillset(&set);
- (void)_sigprocmask(SIG_BLOCK, &set, &oset);
+ (void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
if ((hashp->fp = mkostemp(path, O_CLOEXEC)) != -1)
(void)unlink(path);
- (void)_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
return (hashp->fp != -1 ? 0 : -1);
}
diff --git a/lib/libc/gen/daemon.c b/lib/libc/gen/daemon.c
index b359a87..15c6f4a 100644
--- a/lib/libc/gen/daemon.c
+++ b/lib/libc/gen/daemon.c
@@ -41,10 +41,10 @@ __FBSDID("$FreeBSD$");
#include <signal.h>
#include <unistd.h>
#include "un-namespace.h"
+#include "libc_private.h"
int
-daemon(nochdir, noclose)
- int nochdir, noclose;
+daemon(int nochdir, int noclose)
{
struct sigaction osa, sa;
int fd;
@@ -56,7 +56,7 @@ daemon(nochdir, noclose)
sigemptyset(&sa.sa_mask);
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
- osa_ok = _sigaction(SIGHUP, &sa, &osa);
+ osa_ok = __libc_sigaction(SIGHUP, &sa, &osa);
switch (fork()) {
case -1:
@@ -74,7 +74,7 @@ daemon(nochdir, noclose)
newgrp = setsid();
oerrno = errno;
if (osa_ok != -1)
- _sigaction(SIGHUP, &osa, NULL);
+ __libc_sigaction(SIGHUP, &osa, NULL);
if (newgrp == -1) {
errno = oerrno;
diff --git a/lib/libc/gen/devname.c b/lib/libc/gen/devname.c
index da0b923..bf95645 100644
--- a/lib/libc/gen/devname.c
+++ b/lib/libc/gen/devname.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index e3124b2..c65a730 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -118,15 +118,18 @@ process_spawnattr(const posix_spawnattr_t sa)
return (errno);
}
- /* Set signal masks/defaults */
+ /*
+ * Set signal masks/defaults.
+ * Use unwrapped syscall, libthr is in undefined state after vfork().
+ */
if (sa->sa_flags & POSIX_SPAWN_SETSIGMASK) {
- _sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
+ __sys_sigprocmask(SIG_SETMASK, &sa->sa_sigmask, NULL);
}
if (sa->sa_flags & POSIX_SPAWN_SETSIGDEF) {
for (i = 1; i <= _SIG_MAXSIG; i++) {
if (sigismember(&sa->sa_sigdefault, i))
- if (_sigaction(i, &sigact, NULL) != 0)
+ if (__sys_sigaction(i, &sigact, NULL) != 0)
return (errno);
}
}
diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c
index 95ae725..60051a1 100644
--- a/lib/libc/gen/readpassphrase.c
+++ b/lib/libc/gen/readpassphrase.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include <readpassphrase.h>
#include "un-namespace.h"
+#include "libc_private.h"
static volatile sig_atomic_t signo[NSIG];
@@ -104,15 +105,15 @@ restart:
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; /* don't restart system calls */
sa.sa_handler = handler;
- (void)_sigaction(SIGALRM, &sa, &savealrm);
- (void)_sigaction(SIGHUP, &sa, &savehup);
- (void)_sigaction(SIGINT, &sa, &saveint);
- (void)_sigaction(SIGPIPE, &sa, &savepipe);
- (void)_sigaction(SIGQUIT, &sa, &savequit);
- (void)_sigaction(SIGTERM, &sa, &saveterm);
- (void)_sigaction(SIGTSTP, &sa, &savetstp);
- (void)_sigaction(SIGTTIN, &sa, &savettin);
- (void)_sigaction(SIGTTOU, &sa, &savettou);
+ (void)__libc_sigaction(SIGALRM, &sa, &savealrm);
+ (void)__libc_sigaction(SIGHUP, &sa, &savehup);
+ (void)__libc_sigaction(SIGINT, &sa, &saveint);
+ (void)__libc_sigaction(SIGPIPE, &sa, &savepipe);
+ (void)__libc_sigaction(SIGQUIT, &sa, &savequit);
+ (void)__libc_sigaction(SIGTERM, &sa, &saveterm);
+ (void)__libc_sigaction(SIGTSTP, &sa, &savetstp);
+ (void)__libc_sigaction(SIGTTIN, &sa, &savettin);
+ (void)__libc_sigaction(SIGTTOU, &sa, &savettou);
if (!(flags & RPP_STDIN))
(void)_write(output, prompt, strlen(prompt));
@@ -142,15 +143,15 @@ restart:
errno == EINTR && !signo[SIGTTOU])
continue;
}
- (void)_sigaction(SIGALRM, &savealrm, NULL);
- (void)_sigaction(SIGHUP, &savehup, NULL);
- (void)_sigaction(SIGINT, &saveint, NULL);
- (void)_sigaction(SIGQUIT, &savequit, NULL);
- (void)_sigaction(SIGPIPE, &savepipe, NULL);
- (void)_sigaction(SIGTERM, &saveterm, NULL);
- (void)_sigaction(SIGTSTP, &savetstp, NULL);
- (void)_sigaction(SIGTTIN, &savettin, NULL);
- (void)_sigaction(SIGTTOU, &savettou, NULL);
+ (void)__libc_sigaction(SIGALRM, &savealrm, NULL);
+ (void)__libc_sigaction(SIGHUP, &savehup, NULL);
+ (void)__libc_sigaction(SIGINT, &saveint, NULL);
+ (void)__libc_sigaction(SIGQUIT, &savequit, NULL);
+ (void)__libc_sigaction(SIGPIPE, &savepipe, NULL);
+ (void)__libc_sigaction(SIGTERM, &saveterm, NULL);
+ (void)__libc_sigaction(SIGTSTP, &savetstp, NULL);
+ (void)__libc_sigaction(SIGTTIN, &savettin, NULL);
+ (void)__libc_sigaction(SIGTTOU, &savettou, NULL);
if (input != STDIN_FILENO)
(void)_close(input);
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 815cf14..7525567 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#endif
#include "un-namespace.h"
+#include "libc_private.h"
#define SET_LEN 6 /* initial # of bitcmd struct to malloc */
#define SET_LEN_INCR 4 /* # of bitcmd structs to add as needed */
@@ -364,9 +365,9 @@ getumask(void)
* handler, protect them as best we can.
*/
sigfillset(&sigset);
- (void)_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
+ (void)__libc_sigprocmask(SIG_BLOCK, &sigset, &sigoset);
(void)umask(mask = umask(0));
- (void)_sigprocmask(SIG_SETMASK, &sigoset, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &sigoset, NULL);
return (mask);
}
diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c
index fde33ca..d99b772 100644
--- a/lib/libc/gen/siginterrupt.c
+++ b/lib/libc/gen/siginterrupt.c
@@ -43,14 +43,13 @@ __FBSDID("$FreeBSD$");
* after an instance of the indicated signal.
*/
int
-siginterrupt(sig, flag)
- int sig, flag;
+siginterrupt(int sig, int flag)
{
extern sigset_t _sigintr __hidden;
struct sigaction sa;
int ret;
- if ((ret = _sigaction(sig, (struct sigaction *)0, &sa)) < 0)
+ if ((ret = __libc_sigaction(sig, (struct sigaction *)0, &sa)) < 0)
return (ret);
if (flag) {
sigaddset(&_sigintr, sig);
@@ -59,5 +58,5 @@ siginterrupt(sig, flag)
sigdelset(&_sigintr, sig);
sa.sa_flags |= SA_RESTART;
}
- return (_sigaction(sig, &sa, (struct sigaction *)0));
+ return (__libc_sigaction(sig, &sa, (struct sigaction *)0));
}
diff --git a/lib/libc/gen/signal.c b/lib/libc/gen/signal.c
index ee96dcc..70e7f17 100644
--- a/lib/libc/gen/signal.c
+++ b/lib/libc/gen/signal.c
@@ -44,9 +44,7 @@ __FBSDID("$FreeBSD$");
sigset_t _sigintr __hidden; /* shared with siginterrupt */
sig_t
-signal(s, a)
- int s;
- sig_t a;
+signal(int s, sig_t a)
{
struct sigaction sa, osa;
@@ -55,7 +53,7 @@ signal(s, a)
sa.sa_flags = 0;
if (!sigismember(&_sigintr, s))
sa.sa_flags |= SA_RESTART;
- if (_sigaction(s, &sa, &osa) < 0)
+ if (__libc_sigaction(s, &sa, &osa) < 0)
return (SIG_ERR);
return (osa.sa_handler);
}
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 58ebb55..73eb9a2 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -40,9 +40,9 @@
#include "libc_private.h"
/* Provided by jemalloc to avoid bootstrapping issues. */
-void *__je_a0malloc(size_t size);
-void *__je_a0calloc(size_t num, size_t size);
-void __je_a0free(void *ptr);
+void *__je_bootstrap_malloc(size_t size);
+void *__je_bootstrap_calloc(size_t num, size_t size);
+void __je_bootstrap_free(void *ptr);
__weak_reference(__libc_allocate_tls, _rtld_allocate_tls);
__weak_reference(__libc_free_tls, _rtld_free_tls);
@@ -125,8 +125,8 @@ __libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused)
tls = (Elf_Addr **)((Elf_Addr)tcb + tcbsize - TLS_TCB_SIZE);
dtv = tls[0];
- __je_a0free(dtv);
- __je_a0free(tcb);
+ __je_bootstrap_free(dtv);
+ __je_bootstrap_free(tcb);
}
/*
@@ -142,18 +142,18 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign __unused)
if (oldtcb != NULL && tcbsize == TLS_TCB_SIZE)
return (oldtcb);
- tcb = __je_a0calloc(1, tls_static_space + tcbsize - TLS_TCB_SIZE);
+ tcb = __je_bootstrap_calloc(1, tls_static_space + tcbsize - TLS_TCB_SIZE);
tls = (Elf_Addr **)(tcb + tcbsize - TLS_TCB_SIZE);
if (oldtcb != NULL) {
memcpy(tls, oldtcb, tls_static_space);
- __je_a0free(oldtcb);
+ __je_bootstrap_free(oldtcb);
/* Adjust the DTV. */
dtv = tls[0];
dtv[2] = (Elf_Addr)tls + TLS_TCB_SIZE;
} else {
- dtv = __je_a0malloc(3 * sizeof(Elf_Addr));
+ dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr));
tls[0] = dtv;
dtv[0] = 1;
dtv[1] = 1;
@@ -194,8 +194,8 @@ __libc_free_tls(void *tcb, size_t tcbsize __unused, size_t tcbalign)
dtv = ((Elf_Addr**)tcb)[1];
tlsend = (Elf_Addr) tcb;
tlsstart = tlsend - size;
- __je_a0free((void*) tlsstart);
- __je_a0free(dtv);
+ __je_bootstrap_free((void*) tlsstart);
+ __je_bootstrap_free(dtv);
}
/*
@@ -213,8 +213,8 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign)
if (tcbsize < 2 * sizeof(Elf_Addr))
tcbsize = 2 * sizeof(Elf_Addr);
- tls = __je_a0calloc(1, size + tcbsize);
- dtv = __je_a0malloc(3 * sizeof(Elf_Addr));
+ tls = __je_bootstrap_calloc(1, size + tcbsize);
+ dtv = __je_bootstrap_malloc(3 * sizeof(Elf_Addr));
segbase = (Elf_Addr)(tls + size);
((Elf_Addr*)segbase)[0] = segbase;
diff --git a/lib/libc/gen/wordexp.3 b/lib/libc/gen/wordexp.3
index 41b0d0c..2fc20ef 100644
--- a/lib/libc/gen/wordexp.3
+++ b/lib/libc/gen/wordexp.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 07, 2015
+.Dd August 18, 2015
.Dt WORDEXP 3
.Os
.Sh NAME
@@ -108,9 +108,8 @@ function frees the memory allocated by
.Sh IMPLEMENTATION NOTES
The
.Fn wordexp
-function is implemented as a wrapper around the undocumented
-.Ic wordexp
-shell built-in command.
+function is implemented by executing
+.Xr sh 1 .
.Sh RETURN VALUES
The
.Fn wordexp
@@ -132,9 +131,10 @@ argument contains one of the following unquoted characters:
.Ql { ,
.Ql } .
.It Dv WRDE_BADVAL
-An attempt was made to expand an undefined shell variable and
+An error after successful parsing,
+such as an attempt to expand an undefined shell variable with
.Dv WRDE_UNDEF
-is set in
+set in
.Fa flags .
.It Dv WRDE_CMDSUB
An attempt was made to use command substitution and
@@ -142,7 +142,9 @@ An attempt was made to use command substitution and
is set in
.Fa flags .
.It Dv WRDE_NOSPACE
-Not enough memory to store the result.
+Not enough memory to store the result or
+an error during
+.Xr fork 2 .
.It Dv WRDE_SYNTAX
Shell syntax error in
.Fa words .
diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c
index d0ddcf0..859ca50 100644
--- a/lib/libc/gen/wordexp.c
+++ b/lib/libc/gen/wordexp.c
@@ -38,6 +38,7 @@
#include <unistd.h>
#include <wordexp.h>
#include "un-namespace.h"
+#include "libc_private.h"
__FBSDID("$FreeBSD$");
@@ -103,8 +104,7 @@ static int
we_askshell(const char *words, wordexp_t *we, int flags)
{
int pdes[2]; /* Pipe to child */
- char bbuf[9]; /* Buffer for byte count */
- char wbuf[9]; /* Buffer for word count */
+ char buf[18]; /* Buffer for byte and word count */
long nwords, nbytes; /* Number of words, bytes from child */
long i; /* Handy integer */
size_t sofs; /* Offset into we->we_strings */
@@ -119,6 +119,7 @@ we_askshell(const char *words, wordexp_t *we, int flags)
char **nwv; /* Temporary for realloc() */
sigset_t newsigblock, oldsigblock;
const char *ifs;
+ char save;
serrno = errno;
ifs = getenv("IFS");
@@ -127,12 +128,12 @@ we_askshell(const char *words, wordexp_t *we, int flags)
return (WRDE_NOSPACE); /* XXX */
(void)sigemptyset(&newsigblock);
(void)sigaddset(&newsigblock, SIGCHLD);
- (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ (void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
if ((pid = fork()) < 0) {
serrno = errno;
_close(pdes[0]);
_close(pdes[1]);
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
errno = serrno;
return (WRDE_NOSPACE); /* XXX */
}
@@ -140,14 +141,15 @@ we_askshell(const char *words, wordexp_t *we, int flags)
/*
* We are the child; make /bin/sh expand `words'.
*/
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
if ((pdes[1] != STDOUT_FILENO ?
_dup2(pdes[1], STDOUT_FILENO) :
_fcntl(pdes[1], F_SETFD, 0)) < 0)
_exit(1);
execl(_PATH_BSHELL, "sh", flags & WRDE_UNDEF ? "-u" : "+u",
- "-c", "IFS=$1;eval \"$2\";eval \"set -- $3\";IFS=;a=\"$*\";"
- "printf '%08x' \"$#\" \"${#a}\";printf '%s\\0' \"$@\"",
+ "-c", "IFS=$1;eval \"$2\";eval \"echo;set -- $3\";"
+ "IFS=;a=\"$*\";printf '%08x' \"$#\" \"${#a}\";"
+ "printf '%s\\0' \"$@\"",
"",
ifs != NULL ? ifs : " \t\n",
flags & WRDE_SHOWERR ? "" : "exec 2>/dev/null", words,
@@ -157,20 +159,30 @@ we_askshell(const char *words, wordexp_t *we, int flags)
/*
* We are the parent; read the output of the shell wordexp function,
- * which is a 32-bit hexadecimal word count, a 32-bit hexadecimal
- * byte count (not including terminating null bytes), followed by
- * the expanded words separated by nulls.
+ * which is a byte indicating that the words were parsed successfully,
+ * a 32-bit hexadecimal word count, a 32-bit hexadecimal byte count
+ * (not including terminating null bytes), followed by the expanded
+ * words separated by nulls.
*/
_close(pdes[1]);
- if (we_read_fully(pdes[0], wbuf, 8) != 8 ||
- we_read_fully(pdes[0], bbuf, 8) != 8) {
- error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX;
+ switch (we_read_fully(pdes[0], buf, 17)) {
+ case 1:
+ error = WRDE_BADVAL;
+ serrno = errno;
+ goto cleanup;
+ case 17:
+ break;
+ default:
+ error = WRDE_SYNTAX;
serrno = errno;
goto cleanup;
}
- wbuf[8] = bbuf[8] = '\0';
- nwords = strtol(wbuf, NULL, 16);
- nbytes = strtol(bbuf, NULL, 16) + nwords;
+ save = buf[9];
+ buf[9] = '\0';
+ nwords = strtol(buf + 1, NULL, 16);
+ buf[9] = save;
+ buf[17] = '\0';
+ nbytes = strtol(buf + 9, NULL, 16) + nwords;
/*
* Allocate or reallocate (when flags & WRDE_APPEND) the word vector
@@ -200,7 +212,7 @@ we_askshell(const char *words, wordexp_t *we, int flags)
we->we_strings = nstrings;
if (we_read_fully(pdes[0], we->we_strings + sofs, nbytes) != nbytes) {
- error = flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX;
+ error = WRDE_NOSPACE; /* abort for unknown reason */
serrno = errno;
goto cleanup;
}
@@ -211,13 +223,13 @@ cleanup:
do
wpid = _waitpid(pid, &status, 0);
while (wpid < 0 && errno == EINTR);
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
if (error != 0) {
errno = serrno;
return (error);
}
if (wpid < 0 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
- return (flags & WRDE_UNDEF ? WRDE_BADVAL : WRDE_SYNTAX);
+ return (WRDE_NOSPACE); /* abort for unknown reason */
/*
* Break the null-terminated expanded word strings out into
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index 6e15868..eb33e10 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -50,21 +50,12 @@ __FBSDID("$FreeBSD$");
ENTRY(setjmp)
movl 4(%esp),%ecx
- PIC_PROLOGUE
-#ifdef PIC
- subl $12,%esp /* make the stack 16-byte aligned */
-#endif
leal 28(%ecx), %eax
pushl %eax /* (sigset_t*)oset */
pushl $0 /* (sigset_t*)set */
pushl $1 /* SIG_BLOCK */
- call PIC_PLT(CNAME(_sigprocmask))
-#ifdef PIC
- addl $24,%esp
-#else
+ call __libc_sigprocmask
addl $12,%esp
-#endif
- PIC_EPILOGUE
movl 4(%esp),%ecx
movl 0(%esp),%edx
movl %edx, 0(%ecx)
@@ -81,21 +72,12 @@ END(setjmp)
WEAK_REFERENCE(__longjmp, longjmp)
ENTRY(__longjmp)
movl 4(%esp),%edx
- PIC_PROLOGUE
-#ifdef PIC
- subl $12,%esp /* make the stack 16-byte aligned */
-#endif
pushl $0 /* (sigset_t*)oset */
leal 28(%edx), %eax
pushl %eax /* (sigset_t*)set */
pushl $3 /* SIG_SETMASK */
- call PIC_PLT(CNAME(_sigprocmask))
-#ifdef PIC
- addl $24,%esp
-#else
+ call __libc_sigprocmask
addl $12,%esp
-#endif
- PIC_EPILOGUE
movl 4(%esp),%edx
movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index 1c63649..7566d72 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -59,21 +59,12 @@ ENTRY(sigsetjmp)
movl %eax,44(%ecx)
testl %eax,%eax
jz 2f
- PIC_PROLOGUE
-#ifdef PIC
- subl $12,%esp /* make the stack 16-byte aligned */
-#endif
leal 28(%ecx), %eax
pushl %eax /* (sigset_t*)oset */
pushl $0 /* (sigset_t*)set */
pushl $1 /* SIG_BLOCK */
- call PIC_PLT(CNAME(_sigprocmask))
-#ifdef PIC
- addl $24,%esp
-#else
+ call __libc_sigprocmask
addl $12,%esp
-#endif
- PIC_EPILOGUE
movl 4(%esp),%ecx
2: movl 0(%esp),%edx
movl %edx, 0(%ecx)
@@ -92,21 +83,12 @@ ENTRY(__siglongjmp)
movl 4(%esp),%edx
cmpl $0,44(%edx)
jz 2f
- PIC_PROLOGUE
-#ifdef PIC
- subl $12,%esp /* make the stack 16-byte aligned */
-#endif
pushl $0 /* (sigset_t*)oset */
leal 28(%edx), %eax
pushl %eax /* (sigset_t*)set */
pushl $3 /* SIG_SETMASK */
- call PIC_PLT(CNAME(_sigprocmask))
-#ifdef PIC
- addl $24,%esp
-#else
+ call __libc_sigprocmask
addl $12,%esp
-#endif
- PIC_EPILOGUE
movl 4(%esp),%edx
2: movl 8(%esp),%eax
movl 0(%edx),%ecx
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index a670d63..5caf9a3 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -359,6 +359,11 @@ __pid_t __sys_wait6(enum idtype, __id_t, int *, int,
__ssize_t __sys_write(int, const void *, __size_t);
__ssize_t __sys_writev(int, const struct iovec *, int);
+int __libc_sigaction(int, const struct sigaction *,
+ struct sigaction *) __hidden;
+int __libc_sigprocmask(int, const __sigset_t *, __sigset_t *)
+ __hidden;
+int __libc_sigsuspend(const __sigset_t *) __hidden;
int __libc_sigwait(const __sigset_t * __restrict,
int * restrict sig);
int __libc_system(const char *);
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 55e2931..8ccfdb1 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -191,7 +191,7 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n,
errno = EILSEQ;
return ((size_t)-1);
}
- if (wch >= 0xd800 && wch <= 0xdfff) {
+ if ((wch >= 0xd800 && wch <= 0xdfff) || wch > 0x10ffff) {
/*
* Malformed input; invalid code points.
*/
@@ -318,6 +318,10 @@ _UTF8_wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
lead = 0xc0;
len = 2;
} else if ((wc & ~0xffff) == 0) {
+ if (wc >= 0xd800 && wc <= 0xdfff) {
+ errno = EILSEQ;
+ return ((size_t)-1);
+ }
lead = 0xe0;
len = 3;
} else if (wc >= 0 && wc <= 0x10ffff) {
diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c
index 005b877..f83d0e2 100644
--- a/lib/libc/net/getnameinfo.c
+++ b/lib/libc/net/getnameinfo.c
@@ -394,11 +394,22 @@ getnameinfo_link(const struct sockaddr *sa, socklen_t salen,
if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) {
n = snprintf(host, hostlen, "link#%d", sdl->sdl_index);
- if (n > hostlen) {
+ if (n >= hostlen) {
*host = '\0';
- return EAI_MEMORY;
+ return (EAI_MEMORY);
+ }
+ return (0);
+ }
+
+ if (sdl->sdl_nlen > 0 && sdl->sdl_alen == 0) {
+ n = sdl->sdl_nlen;
+ if (n >= hostlen) {
+ *host = '\0';
+ return (EAI_MEMORY);
}
- return 0;
+ memcpy(host, sdl->sdl_data, sdl->sdl_nlen);
+ host[n] = '\0';
+ return (0);
}
switch (sdl->sdl_type) {
@@ -440,10 +451,7 @@ getnameinfo_link(const struct sockaddr *sa, socklen_t salen,
}
static int
-hexname(cp, len, host, hostlen)
- const u_int8_t *cp;
- char *host;
- size_t len, hostlen;
+hexname(const u_int8_t *cp, size_t len, char *host, size_t hostlen)
{
int i, n;
char *outp = host;
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 2885dc3..1ba9888 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#endif
#include <arpa/nameser.h>
#include "un-namespace.h"
+#include "libc_private.h"
extern int innetgr( const char *, const char *, const char *, const char * );
@@ -148,7 +149,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
refused = 0;
sigemptyset(&newmask);
sigaddset(&newmask, SIGURG);
- _sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask);
+ __libc_sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask);
for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
s = rresvport_af(&lport, ai->ai_family);
if (s < 0) {
@@ -163,7 +164,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
(void)fprintf(stderr, "rcmd: socket: %s\n",
strerror(errno));
freeaddrinfo(res);
- _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
NULL);
return (-1);
}
@@ -181,7 +182,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
(void)fprintf(stderr, "%s: %s\n",
*ahost, strerror(errno));
freeaddrinfo(res);
- _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
NULL);
return (-1);
}
@@ -306,7 +307,7 @@ again:
}
goto bad2;
}
- _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
+ __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
freeaddrinfo(res);
return (s);
bad2:
@@ -314,7 +315,7 @@ bad2:
(void)_close(*fd2p);
bad:
(void)_close(s);
- _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
+ __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
freeaddrinfo(res);
return (-1);
}
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c
index bc4e87a..f30ad14 100644
--- a/lib/libc/net/rcmdsh.c
+++ b/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcmdsh.c,v 1.5 1998/04/25 16:23:58 millert Exp $ */
+/* $OpenBSD: rcmdsh.c,v 1.7 2002/03/12 00:05:44 millert Exp $ */
/*
* Copyright (c) 2001, MagniComp
@@ -49,23 +49,18 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
-#ifndef _PATH_RSH
-#define _PATH_RSH "/usr/bin/rsh"
-#endif
-
/*
* This is a replacement rcmd() function that uses the rsh(1)
* program in place of a direct rcmd(3) function call so as to
* avoid having to be root. Note that rport is ignored.
*/
int
-rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog)
- char **ahost;
- int rport;
- const char *locuser, *remuser, *cmd, *rshprog;
+rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser,
+ const char *cmd, const char *rshprog)
{
struct addrinfo hints, *res;
- int cpid, sp[2], error;
+ int sp[2], error;
+ pid_t cpid;
char *p;
struct passwd *pw;
char num[8];
diff --git a/lib/libc/posix1e/acl_add_flag_np.3 b/lib/libc/posix1e/acl_add_flag_np.3
index db8e565..2204826 100644
--- a/lib/libc/posix1e/acl_add_flag_np.3
+++ b/lib/libc/posix1e/acl_add_flag_np.3
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 30, 2014
+.Dd September 4, 2015
.Dt ACL_ADD_FLAG_NP 3
.Os
.Sh NAME
@@ -56,6 +56,7 @@ Valid values are:
.It ACL_ENTRY_DIRECTORY_INHERIT Ta "Will be inherited by directories."
.It ACL_ENTRY_NO_PROPAGATE_INHERIT Ta "Will not propagate."
.It ACL_ENTRY_INHERIT_ONLY Ta "Inherit-only."
+.It ACL_ENTRY_INHERITED Ta "Inherited from parent"
.El
.Sh RETURN VALUES
.Rv -std acl_add_flag_np
diff --git a/lib/libc/posix1e/acl_flag.c b/lib/libc/posix1e/acl_flag.c
index 39e258d..8ad10c5 100644
--- a/lib/libc/posix1e/acl_flag.c
+++ b/lib/libc/posix1e/acl_flag.c
@@ -71,7 +71,7 @@ acl_clear_flags_np(acl_flagset_t flagset_d)
return (-1);
}
- *flagset_d |= 0;
+ *flagset_d = 0;
return (0);
}
diff --git a/lib/libc/posix1e/acl_init.c b/lib/libc/posix1e/acl_init.c
index 4fe4037..88a1fc5 100644
--- a/lib/libc/posix1e/acl_init.c
+++ b/lib/libc/posix1e/acl_init.c
@@ -67,8 +67,10 @@ acl_init(int count)
error = posix_memalign((void *)&acl, 1 << _ACL_T_ALIGNMENT_BITS,
sizeof(struct acl_t_struct));
- if (error)
+ if (error) {
+ errno = error;
return (NULL);
+ }
bzero(acl, sizeof(struct acl_t_struct));
acl->ats_brand = ACL_BRAND_UNKNOWN;
diff --git a/lib/libc/posix1e/acl_strip.c b/lib/libc/posix1e/acl_strip.c
index 85dfb47..24fda84 100644
--- a/lib/libc/posix1e/acl_strip.c
+++ b/lib/libc/posix1e/acl_strip.c
@@ -107,13 +107,13 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
if (acl_get_permset(entry, &perm) == -1)
goto fail;
if (acl_create_entry(&acl_new, &entry_new) == -1)
- return (NULL);
+ goto fail;
if (acl_set_tag_type(entry_new, tag) == -1)
- return (NULL);
+ goto fail;
if (acl_set_permset(entry_new, perm) == -1)
- return (NULL);
+ goto fail;
if (acl_copy_entry(entry_new, entry) == -1)
- return (NULL);
+ goto fail;
assert(_entry_brand(entry_new) == ACL_BRAND_POSIX);
break;
case ACL_MASK:
@@ -122,20 +122,22 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
default:
break;
}
-fail:
- acl_free(acl_new);
- acl_free(acl_old);
- return (NULL);
}
assert(_acl_brand(acl_new) == ACL_BRAND_POSIX);
if (have_mask_entry && recalculate_mask) {
if (acl_calc_mask(&acl_new) == -1)
- return (NULL);
+ goto fail;
}
return (acl_new);
+
+fail:
+ acl_free(acl_new);
+ acl_free(acl_old);
+
+ return (NULL);
}
acl_t
diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c
index 4878b43..1eece98 100644
--- a/lib/libc/posix1e/acl_support_nfs4.c
+++ b/lib/libc/posix1e/acl_support_nfs4.c
@@ -48,6 +48,7 @@ struct flagnames_struct a_flags[] =
{ ACL_ENTRY_NO_PROPAGATE_INHERIT, "no_propagate", 'n'},
{ ACL_ENTRY_SUCCESSFUL_ACCESS, "successfull_access", 'S'},
{ ACL_ENTRY_FAILED_ACCESS, "failed_access", 'F'},
+ { ACL_ENTRY_INHERITED, "inherited", 'I' },
/*
* There is no ACE_IDENTIFIER_GROUP here - SunOS does not show it
* in the "flags" field. There is no ACE_OWNER, ACE_GROUP or
diff --git a/lib/libc/rpc/auth_des.c b/lib/libc/rpc/auth_des.c
index 1bc2661..5435e77 100644
--- a/lib/libc/rpc/auth_des.c
+++ b/lib/libc/rpc/auth_des.c
@@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$");
extern bool_t xdr_authdes_cred( XDR *, struct authdes_cred *);
extern bool_t xdr_authdes_verf( XDR *, struct authdes_verf *);
-extern int key_encryptsession_pk();
+extern int key_encryptsession_pk(char *, netobj *, des_block *);
extern bool_t __rpc_get_time_offset(struct timeval *, nis_server *, char *,
char **, char **);
@@ -259,7 +259,7 @@ failed:
*/
/*ARGSUSED*/
static void
-authdes_nextverf(AUTH *auth)
+authdes_nextverf(AUTH *auth __unused)
{
/* what the heck am I supposed to do??? */
}
@@ -420,7 +420,7 @@ authdes_validate(AUTH *auth, struct opaque_auth *rverf)
*/
/*ARGSUSED*/
static bool_t
-authdes_refresh(AUTH *auth, void *dummy)
+authdes_refresh(AUTH *auth, void *dummy __unused)
{
/* LINTED pointer alignment */
struct ad_private *ad = AUTH_PRIVATE(auth);
diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c
index 311fa55..0b846eb 100644
--- a/lib/libc/rpc/auth_none.c
+++ b/lib/libc/rpc/auth_none.c
@@ -65,9 +65,9 @@ static bool_t authnone_validate (AUTH *, struct opaque_auth *);
static bool_t authnone_refresh (AUTH *, void *);
static void authnone_destroy (AUTH *);
-extern bool_t xdr_opaque_auth();
+extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);
-static struct auth_ops *authnone_ops();
+static struct auth_ops *authnone_ops(void);
static struct authnone_private {
AUTH no_client;
@@ -76,7 +76,7 @@ static struct authnone_private {
} *authnone_private;
AUTH *
-authnone_create()
+authnone_create(void)
{
struct authnone_private *ap = authnone_private;
XDR xdr_stream;
@@ -156,7 +156,7 @@ authnone_destroy(AUTH *client)
}
static struct auth_ops *
-authnone_ops()
+authnone_ops(void)
{
static struct auth_ops ops;
diff --git a/lib/libc/rpc/auth_time.c b/lib/libc/rpc/auth_time.c
index 7aea232..4b71446 100644
--- a/lib/libc/rpc/auth_time.c
+++ b/lib/libc/rpc/auth_time.c
@@ -61,8 +61,7 @@ extern int _rpc_dtablesize( void );
static int saw_alarm = 0;
static void
-alarm_hndler(s)
- int s;
+alarm_hndler(int s)
{
saw_alarm = 1;
return;
@@ -83,12 +82,7 @@ alarm_hndler(s)
* Turn a 'universal address' into a struct sockaddr_in.
* Bletch.
*/
-static int uaddr_to_sockaddr(uaddr, sin)
-#ifdef foo
- endpoint *endpt;
-#endif
- char *uaddr;
- struct sockaddr_in *sin;
+static int uaddr_to_sockaddr(char *uaddr, struct sockaddr_in *sin)
{
unsigned char p_bytes[2];
int i;
@@ -118,9 +112,7 @@ static int uaddr_to_sockaddr(uaddr, sin)
* Free the strings that were strduped into the eps structure.
*/
static void
-free_eps(eps, num)
- endpoint eps[];
- int num;
+free_eps(endpoint eps[], int num)
{
int i;
@@ -142,14 +134,15 @@ free_eps(eps, num)
* fact that gethostbyname() could do an NIS search. Ideally, the
* NIS+ server will call __rpc_get_time_offset() with the nis_server
* structure already populated.
+ *
+ * host - name of the time host
+ * srv - nis_server struct to use.
+ * eps[] - array of endpoints
+ * maxep - max array size
*/
static nis_server *
-get_server(sin, host, srv, eps, maxep)
- struct sockaddr_in *sin;
- char *host; /* name of the time host */
- nis_server *srv; /* nis_server struct to use. */
- endpoint eps[]; /* array of endpoints */
- int maxep; /* max array size */
+get_server(struct sockaddr_in *sin, char *host, nis_server *srv,
+ endpoint eps[], int maxep)
{
char hname[256];
int num_ep = 0, i;
@@ -236,14 +229,16 @@ get_server(sin, host, srv, eps, maxep)
* structure and to then contact the machine for the time.
*
* td = "server" - "client"
+ *
+ * td - Time difference
+ * srv - NIS Server description
+ * thost - if no server, this is the timehost
+ * uaddr - known universal address
+ * netid - known network identifier
*/
int
-__rpc_get_time_offset(td, srv, thost, uaddr, netid)
- struct timeval *td; /* Time difference */
- nis_server *srv; /* NIS Server description */
- char *thost; /* if no server, this is the timehost */
- char **uaddr; /* known universal address */
- struct sockaddr_in *netid; /* known network identifier */
+__rpc_get_time_offset(struct timeval *td, nis_server *srv, char *thost,
+ char **uaddr, struct sockaddr_in *netid)
{
CLIENT *clnt; /* Client handle */
endpoint *ep, /* useful endpoints */
@@ -260,7 +255,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
char ut[64], ipuaddr[64];
endpoint teps[32];
nis_server tsrv;
- void (*oldsig)() = NULL; /* old alarm handler */
+ void (*oldsig)(int) = NULL; /* old alarm handler */
struct sockaddr_in sin;
socklen_t len;
int s = RPC_ANYSOCK;
@@ -429,7 +424,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
} else {
int res;
- oldsig = (void (*)())signal(SIGALRM, alarm_hndler);
+ oldsig = (void (*)(int))signal(SIGALRM, alarm_hndler);
saw_alarm = 0; /* global tracking the alarm */
alarm(20); /* only wait 20 seconds */
res = _connect(s, (struct sockaddr *)&sin, sizeof(sin));
diff --git a/lib/libc/rpc/clnt_bcast.c b/lib/libc/rpc/clnt_bcast.c
index 6ee1f90..63d3bec 100644
--- a/lib/libc/rpc/clnt_bcast.c
+++ b/lib/libc/rpc/clnt_bcast.c
@@ -251,7 +251,7 @@ rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
int inlen;
u_int maxbufsize = 0;
AUTH *sys_auth = authunix_create_default();
- int i;
+ u_int i;
void *handle;
char uaddress[1024]; /* A self imposed limit */
char *uaddrp = uaddress;
diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c
index cebbaf9..274a255 100644
--- a/lib/libc/rpc/clnt_dg.c
+++ b/lib/libc/rpc/clnt_dg.c
@@ -153,15 +153,17 @@ struct cu_data {
* If they are 0, use the transport default.
*
* If svcaddr is NULL, returns NULL.
+ *
+ * fd - open file descriptor
+ * svcaddr - servers address
+ * program - program number
+ * version - version number
+ * sendsz - buffer recv size
+ * recvsz - buffer send size
*/
CLIENT *
-clnt_dg_create(fd, svcaddr, program, version, sendsz, recvsz)
- int fd; /* open file descriptor */
- const struct netbuf *svcaddr; /* servers address */
- rpcprog_t program; /* program number */
- rpcvers_t version; /* version number */
- u_int sendsz; /* buffer recv size */
- u_int recvsz; /* buffer send size */
+clnt_dg_create(int fd, const struct netbuf *svcaddr, rpcprog_t program,
+ rpcvers_t version, u_int sendsz, u_int recvsz)
{
CLIENT *cl = NULL; /* client handle */
struct cu_data *cu = NULL; /* private data */
@@ -301,15 +303,18 @@ err2:
return (NULL);
}
+/*
+ * cl - client handle
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * utimeout - seconds to wait before giving up
+ */
static enum clnt_stat
-clnt_dg_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout)
- CLIENT *cl; /* client handle */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- void *argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- void *resultsp; /* pointer to results */
- struct timeval utimeout; /* seconds to wait before giving up */
+clnt_dg_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs, void *argsp,
+ xdrproc_t xresults, void *resultsp, struct timeval utimeout)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
XDR *xdrs;
@@ -602,9 +607,7 @@ out:
}
static void
-clnt_dg_geterr(cl, errp)
- CLIENT *cl;
- struct rpc_err *errp;
+clnt_dg_geterr(CLIENT *cl, struct rpc_err *errp)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
@@ -612,10 +615,7 @@ clnt_dg_geterr(cl, errp)
}
static bool_t
-clnt_dg_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
XDR *xdrs = &(cu->cu_outxdrs);
@@ -638,16 +638,12 @@ clnt_dg_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_dg_abort(h)
- CLIENT *h;
+clnt_dg_abort(CLIENT *h)
{
}
static bool_t
-clnt_dg_control(cl, request, info)
- CLIENT *cl;
- u_int request;
- void *info;
+clnt_dg_control(CLIENT *cl, u_int request, void *info)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
struct netbuf *addr;
@@ -790,8 +786,7 @@ clnt_dg_control(cl, request, info)
}
static void
-clnt_dg_destroy(cl)
- CLIENT *cl;
+clnt_dg_destroy(CLIENT *cl)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
int cu_fd = cu->cu_fd;
@@ -820,7 +815,7 @@ clnt_dg_destroy(cl)
}
static struct clnt_ops *
-clnt_dg_ops()
+clnt_dg_ops(void)
{
static struct clnt_ops ops;
sigset_t mask;
@@ -848,8 +843,7 @@ clnt_dg_ops()
* Make sure that the time is not garbage. -1 value is allowed.
*/
static bool_t
-time_not_ok(t)
- struct timeval *t;
+time_not_ok(struct timeval *t)
{
return (t->tv_sec < -1 || t->tv_sec > 100000000 ||
t->tv_usec < -1 || t->tv_usec > 1000000);
diff --git a/lib/libc/rpc/crypt_client.c b/lib/libc/rpc/crypt_client.c
index 5290021..b7f0d1ff 100644
--- a/lib/libc/rpc/crypt_client.c
+++ b/lib/libc/rpc/crypt_client.c
@@ -43,10 +43,7 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
int
-_des_crypt_call(buf, len, dparms)
- char *buf;
- int len;
- struct desparams *dparms;
+_des_crypt_call(char *buf, int len, struct desparams *dparms)
{
CLIENT *clnt;
desresp *result_1;
diff --git a/lib/libc/rpc/des_crypt.c b/lib/libc/rpc/des_crypt.c
index ace8ed6..b54af4f 100644
--- a/lib/libc/rpc/des_crypt.c
+++ b/lib/libc/rpc/des_crypt.c
@@ -70,12 +70,7 @@ extern int _des_crypt_call(char *, int, struct desparams *);
* CBC mode encryption
*/
int
-cbc_crypt(key, buf, len, mode, ivec)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- char *ivec;
+cbc_crypt(char *key, char *buf, unsigned len, unsigned mode, char *ivec)
{
int err;
struct desparams dp;
@@ -97,11 +92,7 @@ cbc_crypt(key, buf, len, mode, ivec)
* ECB mode encryption
*/
int
-ecb_crypt(key, buf, len, mode)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
+ecb_crypt(char *key, char *buf, unsigned len, unsigned mode)
{
struct desparams dp;
@@ -120,12 +111,8 @@ ecb_crypt(key, buf, len, mode)
* Common code to cbc_crypt() & ecb_crypt()
*/
static int
-common_crypt(key, buf, len, mode, desp)
- char *key;
- char *buf;
- unsigned len;
- unsigned mode;
- struct desparams *desp;
+common_crypt(char *key, char *buf, unsigned len, unsigned mode,
+ struct desparams *desp)
{
int desdev;
diff --git a/lib/libc/rpc/des_soft.c b/lib/libc/rpc/des_soft.c
index 80d8c52..5eb9915 100644
--- a/lib/libc/rpc/des_soft.c
+++ b/lib/libc/rpc/des_soft.c
@@ -58,8 +58,7 @@ static char partab[128] = {
* Add odd parity to low bit of 8 byte key
*/
void
-des_setparity(p)
- char *p;
+des_setparity(char *p)
{
int i;
diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c
index 143c0fc..74ed983 100644
--- a/lib/libc/rpc/getpublickey.c
+++ b/lib/libc/rpc/getpublickey.c
@@ -62,9 +62,7 @@ int (*__getpublickey_LOCAL)() = 0;
* Get somebody's public key
*/
static int
-__getpublickey_real(netname, publickey)
- const char *netname;
- char *publickey;
+__getpublickey_real(const char *netname, char *publickey)
{
char lookup[3 * HEXKEYBYTES];
char *p;
@@ -89,9 +87,7 @@ __getpublickey_real(netname, publickey)
*/
int
-getpublicandprivatekey(key, ret)
- const char *key;
- char *ret;
+getpublicandprivatekey(const char *key, char *ret)
{
char buf[1024]; /* big enough */
char *res;
@@ -166,9 +162,7 @@ getpublicandprivatekey(key, ret)
}
}
-int getpublickey(netname, publickey)
- const char *netname;
- char *publickey;
+int getpublickey(const char *netname, char *publickey)
{
if (__getpublickey_LOCAL != NULL)
return(__getpublickey_LOCAL(netname, publickey));
diff --git a/lib/libc/rpc/key_call.c b/lib/libc/rpc/key_call.c
index 3864061..664ddfd 100644
--- a/lib/libc/rpc/key_call.c
+++ b/lib/libc/rpc/key_call.c
@@ -88,8 +88,7 @@ des_block *(*__key_gendes_LOCAL)() = 0;
static int key_call( u_long, xdrproc_t, void *, xdrproc_t, void *);
int
-key_setsecret(secretkey)
- const char *secretkey;
+key_setsecret(const char *secretkey)
{
keystatus status;
@@ -131,10 +130,7 @@ key_secretkey_is_set(void)
}
int
-key_encryptsession_pk(remotename, remotekey, deskey)
- char *remotename;
- netobj *remotekey;
- des_block *deskey;
+key_encryptsession_pk(char *remotename, netobj *remotekey, des_block *deskey)
{
cryptkeyarg2 arg;
cryptkeyres res;
@@ -155,10 +151,7 @@ key_encryptsession_pk(remotename, remotekey, deskey)
}
int
-key_decryptsession_pk(remotename, remotekey, deskey)
- char *remotename;
- netobj *remotekey;
- des_block *deskey;
+key_decryptsession_pk(char *remotename, netobj *remotekey, des_block *deskey)
{
cryptkeyarg2 arg;
cryptkeyres res;
@@ -179,9 +172,7 @@ key_decryptsession_pk(remotename, remotekey, deskey)
}
int
-key_encryptsession(remotename, deskey)
- const char *remotename;
- des_block *deskey;
+key_encryptsession(const char *remotename, des_block *deskey)
{
cryptkeyarg arg;
cryptkeyres res;
@@ -201,9 +192,7 @@ key_encryptsession(remotename, deskey)
}
int
-key_decryptsession(remotename, deskey)
- const char *remotename;
- des_block *deskey;
+key_decryptsession(const char *remotename, des_block *deskey)
{
cryptkeyarg arg;
cryptkeyres res;
@@ -223,8 +212,7 @@ key_decryptsession(remotename, deskey)
}
int
-key_gendes(key)
- des_block *key;
+key_gendes(des_block *key)
{
if (!key_call((u_long)KEY_GEN, (xdrproc_t)xdr_void, NULL,
(xdrproc_t)xdr_des_block, key)) {
@@ -234,8 +222,7 @@ key_gendes(key)
}
int
-key_setnet(arg)
-struct key_netstarg *arg;
+key_setnet(struct key_netstarg *arg)
{
keystatus status;
@@ -254,9 +241,7 @@ struct key_netstarg *arg;
int
-key_get_conv(pkey, deskey)
- char *pkey;
- des_block *deskey;
+key_get_conv(char *pkey, des_block *deskey)
{
cryptkeyres res;
@@ -305,8 +290,7 @@ key_call_init(void)
* Keep the handle cached. This call may be made quite often.
*/
static CLIENT *
-getkeyserv_handle(vers)
-int vers;
+getkeyserv_handle(int vers)
{
void *localhandle;
struct netconfig *nconf;
@@ -429,12 +413,8 @@ int vers;
/* returns 0 on failure, 1 on success */
static int
-key_call(proc, xdr_arg, arg, xdr_rslt, rslt)
- u_long proc;
- xdrproc_t xdr_arg;
- void *arg;
- xdrproc_t xdr_rslt;
- void *rslt;
+key_call(u_long proc, xdrproc_t xdr_arg, void *arg, xdrproc_t xdr_rslt,
+ void *rslt)
{
CLIENT *clnt;
struct timeval wait_time;
diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c
index 20dc8fa..d4fdd90 100644
--- a/lib/libc/rpc/rpc_prot.c
+++ b/lib/libc/rpc/rpc_prot.c
@@ -68,9 +68,7 @@ extern struct opaque_auth _null_auth;
* (see auth.h)
*/
bool_t
-xdr_opaque_auth(xdrs, ap)
- XDR *xdrs;
- struct opaque_auth *ap;
+xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
{
assert(xdrs != NULL);
@@ -86,9 +84,7 @@ xdr_opaque_auth(xdrs, ap)
* XDR a DES block
*/
bool_t
-xdr_des_block(xdrs, blkp)
- XDR *xdrs;
- des_block *blkp;
+xdr_des_block(XDR *xdrs, des_block *blkp)
{
assert(xdrs != NULL);
@@ -103,9 +99,7 @@ xdr_des_block(xdrs, blkp)
* XDR the MSG_ACCEPTED part of a reply message union
*/
bool_t
-xdr_accepted_reply(xdrs, ar)
- XDR *xdrs;
- struct accepted_reply *ar;
+xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar)
{
enum accept_stat *par_stat;
@@ -142,9 +136,7 @@ xdr_accepted_reply(xdrs, ar)
* XDR the MSG_DENIED part of a reply message union
*/
bool_t
-xdr_rejected_reply(xdrs, rr)
- XDR *xdrs;
- struct rejected_reply *rr;
+xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr)
{
enum reject_stat *prj_stat;
enum auth_stat *prj_why;
@@ -182,9 +174,7 @@ static const struct xdr_discrim reply_dscrm[3] = {
* XDR a reply message
*/
bool_t
-xdr_replymsg(xdrs, rmsg)
- XDR *xdrs;
- struct rpc_msg *rmsg;
+xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
{
enum msg_type *prm_direction;
enum reply_stat *prp_stat;
@@ -212,9 +202,7 @@ xdr_replymsg(xdrs, rmsg)
* The rm_xid is not really static, but the user can easily munge on the fly.
*/
bool_t
-xdr_callhdr(xdrs, cmsg)
- XDR *xdrs;
- struct rpc_msg *cmsg;
+xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
{
enum msg_type *prm_direction;
@@ -238,9 +226,7 @@ xdr_callhdr(xdrs, cmsg)
/* ************************** Client utility routine ************* */
static void
-accepted(acpt_stat, error)
- enum accept_stat acpt_stat;
- struct rpc_err *error;
+accepted(enum accept_stat acpt_stat, struct rpc_err *error)
{
assert(error != NULL);
diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
index febc597..b7f6651 100644
--- a/lib/libc/rpc/rpc_soc.c
+++ b/lib/libc/rpc/rpc_soc.c
@@ -88,14 +88,8 @@ static bool_t rpc_wrap_bcast(char *, struct netbuf *, struct netconfig *);
* A common clnt create routine
*/
static CLIENT *
-clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp)
- struct sockaddr_in *raddr;
- rpcprog_t prog;
- rpcvers_t vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
- char *tp;
+clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, int *sockp,
+ u_int sendsz, u_int recvsz, char *tp)
{
CLIENT *cl;
int madefd = FALSE;
@@ -164,14 +158,8 @@ err: if (madefd == TRUE)
}
CLIENT *
-clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long prog;
- u_long vers;
- struct timeval wait;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clntudp_bufcreate(struct sockaddr_in *raddr, u_long prog, u_long vers,
+ struct timeval wait, int *sockp, u_int sendsz, u_int recvsz)
{
CLIENT *cl;
@@ -185,12 +173,8 @@ clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
}
CLIENT *
-clntudp_create(raddr, program, version, wait, sockp)
- struct sockaddr_in *raddr;
- u_long program;
- u_long version;
- struct timeval wait;
- int *sockp;
+clntudp_create(struct sockaddr_in *raddr, u_long program, u_long version,
+ struct timeval wait, int *sockp)
{
return clntudp_bufcreate(raddr, program, version, wait, sockp,
@@ -198,13 +182,8 @@ clntudp_create(raddr, program, version, wait, sockp)
}
CLIENT *
-clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long prog;
- u_long vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp,
+ u_int sendsz, u_int recvsz)
{
return clnt_com_create(raddr, (rpcprog_t)prog, (rpcvers_t)vers, sockp,
@@ -212,9 +191,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
}
CLIENT *
-clntraw_create(prog, vers)
- u_long prog;
- u_long vers;
+clntraw_create(u_long prog, u_long vers)
{
return clnt_raw_create((rpcprog_t)prog, (rpcvers_t)vers);
@@ -224,11 +201,7 @@ clntraw_create(prog, vers)
* A common server create routine
*/
static SVCXPRT *
-svc_com_create(fd, sendsize, recvsize, netid)
- int fd;
- u_int sendsize;
- u_int recvsize;
- char *netid;
+svc_com_create(int fd, u_int sendsize, u_int recvsize, char *netid)
{
struct netconfig *nconf;
SVCXPRT *svc;
@@ -268,29 +241,21 @@ svc_com_create(fd, sendsize, recvsize, netid)
}
SVCXPRT *
-svctcp_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svctcp_create(int fd, u_int sendsize, u_int recvsize)
{
return svc_com_create(fd, sendsize, recvsize, "tcp");
}
SVCXPRT *
-svcudp_bufcreate(fd, sendsz, recvsz)
- int fd;
- u_int sendsz, recvsz;
+svcudp_bufcreate(int fd, u_int sendsz, u_int recvsz)
{
return svc_com_create(fd, sendsz, recvsz, "udp");
}
SVCXPRT *
-svcfd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svcfd_create(int fd, u_int sendsize, u_int recvsize)
{
return svc_fd_create(fd, sendsize, recvsize);
@@ -298,8 +263,7 @@ svcfd_create(fd, sendsize, recvsize)
SVCXPRT *
-svcudp_create(fd)
- int fd;
+svcudp_create(int fd)
{
return svc_com_create(fd, UDPMSGSIZE, UDPMSGSIZE, "udp");
@@ -313,8 +277,7 @@ svcraw_create()
}
int
-get_myaddress(addr)
- struct sockaddr_in *addr;
+get_myaddress(struct sockaddr_in *addr)
{
memset((void *) addr, 0, sizeof(*addr));
@@ -328,11 +291,8 @@ get_myaddress(addr)
* For connectionless "udp" transport. Obsoleted by rpc_call().
*/
int
-callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
- const char *host;
- int prognum, versnum, procnum;
- xdrproc_t inproc, outproc;
- void *in, *out;
+callrpc(const char *host, int prognum, int versnum, int procnum,
+ xdrproc_t inproc, void *in, xdrproc_t outproc, void *out)
{
return (int)rpc_call(host, (rpcprog_t)prognum, (rpcvers_t)versnum,
@@ -343,10 +303,9 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
* For connectionless kind of transport. Obsoleted by rpc_reg()
*/
int
-registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
- int prognum, versnum, procnum;
- char *(*progname)(char [UDPMSGSIZE]);
- xdrproc_t inproc, outproc;
+registerrpc(int prognum, int versnum, int procnum,
+ char *(*progname)(char [UDPMSGSIZE]),
+ xdrproc_t inproc, xdrproc_t outproc)
{
return rpc_reg((rpcprog_t)prognum, (rpcvers_t)versnum,
@@ -374,10 +333,12 @@ clnt_broadcast_key_init(void)
*/
/* ARGSUSED */
static bool_t
-rpc_wrap_bcast(resultp, addr, nconf)
- char *resultp; /* results of the call */
- struct netbuf *addr; /* address of the guy who responded */
- struct netconfig *nconf; /* Netconf of the transport */
+rpc_wrap_bcast(char *resultp, struct netbuf *addr, struct netconfig *nconf)
+/*
+ * char *resultp; // results of the call
+ * struct netbuf *addr; // address of the guy who responded
+ * struct netconfig *nconf; // Netconf of the transport
+ */
{
resultproc_t clnt_broadcast_result;
@@ -395,15 +356,18 @@ rpc_wrap_bcast(resultp, addr, nconf)
* Broadcasts on UDP transport. Obsoleted by rpc_broadcast().
*/
enum clnt_stat
-clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
- u_long prog; /* program number */
- u_long vers; /* version number */
- u_long proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- void *argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- void *resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
+clnt_broadcast(u_long prog, u_long vers, u_long proc, xdrproc_t xargs,
+ void *argsp, xdrproc_t xresults, void *resultsp, resultproc_t eachresult)
+/*
+ * u_long prog; // program number
+ * u_long vers; // version number
+ * u_long proc; // procedure number
+ * xdrproc_t xargs; // xdr routine for args
+ * void *argsp; // pointer to args
+ * xdrproc_t xresults; // xdr routine for results
+ * void *resultsp; // pointer to results
+ * resultproc_t eachresult; // call with each result obtained
+ */
{
if (thr_main())
@@ -422,11 +386,14 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
* authdes_seccreate().
*/
AUTH *
-authdes_create(servername, window, syncaddr, ckey)
- char *servername; /* network name of server */
- u_int window; /* time to live */
- struct sockaddr *syncaddr; /* optional hostaddr to sync with */
- des_block *ckey; /* optional conversation key to use */
+authdes_create(char *servername, u_int window, struct sockaddr *syncaddr,
+ des_block *ckey)
+/*
+ * char *servername; // network name of server
+ * u_int window; // time to live
+ * struct sockaddr *syncaddr; // optional hostaddr to sync with
+ * des_block *ckey; // optional conversation key to use
+ */
{
AUTH *dummy;
AUTH *nauth;
@@ -453,13 +420,8 @@ fallback:
* Create a client handle for a unix connection. Obsoleted by clnt_vc_create()
*/
CLIENT *
-clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
- struct sockaddr_un *raddr;
- u_long prog;
- u_long vers;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clntunix_create(struct sockaddr_un *raddr, u_long prog, u_long vers, int *sockp,
+ u_int sendsz, u_int recvsz)
{
struct netbuf *svcaddr;
CLIENT *cl;
@@ -504,11 +466,7 @@ done:
* Obsoleted by svc_vc_create().
*/
SVCXPRT *
-svcunix_create(sock, sendsize, recvsize, path)
- int sock;
- u_int sendsize;
- u_int recvsize;
- char *path;
+svcunix_create(int sock, u_int sendsize, u_int recvsize, char *path)
{
struct netconfig *nconf;
void *localhandle;
@@ -568,10 +526,7 @@ done:
* descriptor as its first input. Obsoleted by svc_fd_create();
*/
SVCXPRT *
-svcunixfd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svcunixfd_create(int fd, u_int sendsize, u_int recvsize)
{
return (svc_fd_create(fd, sendsize, recvsize));
}
diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c
index a0d840e..c0c8c03 100644
--- a/lib/libc/rpc/rpcb_clnt.c
+++ b/lib/libc/rpc/rpcb_clnt.c
@@ -109,9 +109,7 @@ static struct netbuf *got_entry(rpcb_entry_list_ptr, const struct netconfig *);
* These are private routines that may not be provided in future releases.
*/
bool_t
-__rpc_control(request, info)
- int request;
- void *info;
+__rpc_control(int request, void *info)
{
switch (request) {
case CLCR_GET_RPCB_TIMEOUT:
@@ -150,8 +148,7 @@ __rpc_control(request, info)
*/
static struct address_cache *
-check_cache(host, netid)
- const char *host, *netid;
+check_cache(const char *host, const char *netid)
{
struct address_cache *cptr;
@@ -171,8 +168,7 @@ check_cache(host, netid)
}
static void
-delete_cache(addr)
- struct netbuf *addr;
+delete_cache(struct netbuf *addr)
{
struct address_cache *cptr, *prevptr = NULL;
@@ -286,10 +282,7 @@ out:
* On error, returns NULL and free's everything.
*/
static CLIENT *
-getclnthandle(host, nconf, targaddr)
- const char *host;
- const struct netconfig *nconf;
- char **targaddr;
+getclnthandle(const char *host, const struct netconfig *nconf, char **targaddr)
{
CLIENT *client;
struct netbuf *addr, taddr;
@@ -531,13 +524,13 @@ try_nconf:
/*
* Set a mapping between program, version and address.
* Calls the rpcbind service to do the mapping.
+ *
+ * nconf - Network structure of transport
+ * address - Services netconfig address
*/
bool_t
-rpcb_set(program, version, nconf, address)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf; /* Network structure of transport */
- const struct netbuf *address; /* Services netconfig address */
+rpcb_set(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
+ const struct netbuf *address)
{
CLIENT *client;
bool_t rslt = FALSE;
@@ -594,10 +587,7 @@ rpcb_set(program, version, nconf, address)
* only for the given transport.
*/
bool_t
-rpcb_unset(program, version, nconf)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
+rpcb_unset(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf)
{
CLIENT *client;
bool_t rslt = FALSE;
@@ -634,9 +624,7 @@ rpcb_unset(program, version, nconf)
* From the merged list, find the appropriate entry
*/
static struct netbuf *
-got_entry(relp, nconf)
- rpcb_entry_list_ptr relp;
- const struct netconfig *nconf;
+got_entry(rpcb_entry_list_ptr relp, const struct netconfig *nconf)
{
struct netbuf *na = NULL;
rpcb_entry_list_ptr sp;
@@ -667,7 +655,7 @@ got_entry(relp, nconf)
* local transport.
*/
static bool_t
-__rpcbind_is_up()
+__rpcbind_is_up(void)
{
struct netconfig *nconf;
struct sockaddr_un sun;
@@ -722,13 +710,9 @@ __rpcbind_is_up()
* starts working properly. Also look under clnt_vc.c.
*/
struct netbuf *
-__rpcb_findaddr_timed(program, version, nconf, host, clpp, tp)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
- const char *host;
- CLIENT **clpp;
- struct timeval *tp;
+__rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
+ const struct netconfig *nconf, const char *host,
+ CLIENT **clpp, struct timeval *tp)
{
static bool_t check_rpcbind = TRUE;
CLIENT *client = NULL;
@@ -1037,12 +1021,8 @@ done:
* Assuming that the address is all properly allocated
*/
int
-rpcb_getaddr(program, version, nconf, address, host)
- rpcprog_t program;
- rpcvers_t version;
- const struct netconfig *nconf;
- struct netbuf *address;
- const char *host;
+rpcb_getaddr(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
+ struct netbuf *address, const char *host)
{
struct netbuf *na;
@@ -1073,9 +1053,7 @@ rpcb_getaddr(program, version, nconf, address, host)
* It returns NULL on failure.
*/
rpcblist *
-rpcb_getmaps(nconf, host)
- const struct netconfig *nconf;
- const char *host;
+rpcb_getmaps(const struct netconfig *nconf, const char *host)
{
rpcblist_ptr head = NULL;
CLIENT *client;
@@ -1206,9 +1184,7 @@ error:
* Returns 1 if succeeds else 0.
*/
bool_t
-rpcb_gettime(host, timep)
- const char *host;
- time_t *timep;
+rpcb_gettime(const char *host, time_t *timep)
{
CLIENT *client = NULL;
void *handle;
@@ -1267,9 +1243,7 @@ rpcb_gettime(host, timep)
* really be called because local n2a libraries are always provided.
*/
char *
-rpcb_taddr2uaddr(nconf, taddr)
- struct netconfig *nconf;
- struct netbuf *taddr;
+rpcb_taddr2uaddr(struct netconfig *nconf, struct netbuf *taddr)
{
CLIENT *client;
char *uaddr = NULL;
@@ -1301,9 +1275,7 @@ rpcb_taddr2uaddr(nconf, taddr)
* really be called because local n2a libraries are always provided.
*/
struct netbuf *
-rpcb_uaddr2taddr(nconf, uaddr)
- struct netconfig *nconf;
- char *uaddr;
+rpcb_uaddr2taddr(struct netconfig *nconf, char *uaddr)
{
CLIENT *client;
struct netbuf *taddr;
diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c
index d6a21c9..f214b21 100644
--- a/lib/libc/rpc/rpcdname.c
+++ b/lib/libc/rpc/rpcdname.c
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
static char *default_domain = 0;
static char *
-get_default_domain()
+get_default_domain(void)
{
char temp[256];
@@ -71,8 +71,7 @@ get_default_domain()
* get rejected elsewhere in the NIS client package.
*/
int
-__rpc_get_default_domain(domain)
- char **domain;
+__rpc_get_default_domain(char **domain)
{
if ((*domain = get_default_domain()) != 0)
return (0);
diff --git a/lib/libc/rpc/rtime.c b/lib/libc/rpc/rtime.c
index 807b14c..37bc9a3 100644
--- a/lib/libc/rpc/rtime.c
+++ b/lib/libc/rpc/rtime.c
@@ -67,10 +67,8 @@ extern int _rpc_dtablesize( void );
static void do_close( int );
int
-rtime(addrp, timep, timeout)
- struct sockaddr_in *addrp;
- struct timeval *timep;
- struct timeval *timeout;
+rtime(struct sockaddr_in *addrp, struct timeval *timep,
+ struct timeval *timeout)
{
int s;
fd_set readfds;
@@ -148,8 +146,7 @@ rtime(addrp, timep, timeout)
}
static void
-do_close(s)
- int s;
+do_close(int s)
{
int save;
diff --git a/lib/libc/rpc/svc_auth.c b/lib/libc/rpc/svc_auth.c
index 2068529..6fe5bec 100644
--- a/lib/libc/rpc/svc_auth.c
+++ b/lib/libc/rpc/svc_auth.c
@@ -151,11 +151,7 @@ _authenticate(rqst, msg)
* that don't need to inspect or modify the message body.
*/
static bool_t
-svcauth_null_wrap(auth, xdrs, xdr_func, xdr_ptr)
- SVCAUTH *auth;
- XDR *xdrs;
- xdrproc_t xdr_func;
- caddr_t xdr_ptr;
+svcauth_null_wrap(SVCAUTH *auth, XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr)
{
return (xdr_func(xdrs, xdr_ptr));
@@ -168,9 +164,7 @@ struct svc_auth_ops svc_auth_null_ops = {
/*ARGSUSED*/
enum auth_stat
-_svcauth_null(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_null(struct svc_req *rqst, struct rpc_msg *msg)
{
return (AUTH_OK);
}
@@ -190,9 +184,8 @@ _svcauth_null(rqst, msg)
*/
int
-svc_auth_reg(cred_flavor, handler)
- int cred_flavor;
- enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *);
+svc_auth_reg(int cred_flavor,
+ enum auth_stat (*handler)(struct svc_req *, struct rpc_msg *))
{
struct authsvc *asp;
diff --git a/lib/libc/rpc/svc_auth_des.c b/lib/libc/rpc/svc_auth_des.c
index d6fb6af..7a24c06 100644
--- a/lib/libc/rpc/svc_auth_des.c
+++ b/lib/libc/rpc/svc_auth_des.c
@@ -90,11 +90,11 @@ struct cache_entry {
static struct cache_entry *authdes_cache/* [AUTHDES_CACHESZ] */;
static short *authdes_lru/* [AUTHDES_CACHESZ] */;
-static void cache_init(); /* initialize the cache */
-static short cache_spot(); /* find an entry in the cache */
-static void cache_ref(/*short sid*/); /* note that sid was ref'd */
+static void cache_init(void); /* initialize the cache */
+static short cache_spot(des_block *, char *, struct timeval *); /* find an entry in the cache */
+static void cache_ref(short sid); /* note that sid was ref'd */
-static void invalidate(); /* invalidate entry in cache */
+static void invalidate(char *); /* invalidate entry in cache */
/*
* cache statistics
@@ -109,9 +109,7 @@ static struct {
* Service side authenticator for AUTH_DES
*/
enum auth_stat
-_svcauth_des(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_des(struct svc_req *rqst, struct rpc_msg *msg)
{
long *ixdr;
@@ -355,7 +353,7 @@ _svcauth_des(rqst, msg)
* Initialize the cache
*/
static void
-cache_init()
+cache_init(void)
{
int i;
@@ -378,7 +376,7 @@ cache_init()
* Find the lru victim
*/
static short
-cache_victim()
+cache_victim(void)
{
return (authdes_lru[AUTHDES_CACHESZ-1]);
}
@@ -387,8 +385,7 @@ cache_victim()
* Note that sid was referenced
*/
static void
-cache_ref(sid)
- short sid;
+cache_ref(short sid)
{
int i;
short curr;
@@ -410,10 +407,7 @@ cache_ref(sid)
* return the spot in the cache.
*/
static short
-cache_spot(key, name, timestamp)
- des_block *key;
- char *name;
- struct timeval *timestamp;
+cache_spot(des_block *key, char *name, struct timeval *timestamp)
{
struct cache_entry *cp;
int i;
@@ -461,12 +455,8 @@ struct bsdcred {
* the credential.
*/
int
-authdes_getucred(adc, uid, gid, grouplen, groups)
- struct authdes_cred *adc;
- uid_t *uid;
- gid_t *gid;
- int *grouplen;
- gid_t *groups;
+authdes_getucred(struct authdes_cred *adc, uid_t *uid, gid_t *gid,
+ int *grouplen, gid_t *groups)
{
unsigned sid;
int i;
@@ -525,8 +515,7 @@ authdes_getucred(adc, uid, gid, grouplen, groups)
}
static void
-invalidate(cred)
- char *cred;
+invalidate(char *cred)
{
if (cred == NULL) {
return;
diff --git a/lib/libc/rpc/svc_dg.c b/lib/libc/rpc/svc_dg.c
index 980e39f..1957d64 100644
--- a/lib/libc/rpc/svc_dg.c
+++ b/lib/libc/rpc/svc_dg.c
@@ -102,10 +102,7 @@ static const char svc_dg_err4[] = "cannot set IP_RECVDSTADDR";
static const char __no_mem_str[] = "out of memory";
SVCXPRT *
-svc_dg_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_dg_create(int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt;
struct svc_dg_data *su = NULL;
@@ -188,8 +185,7 @@ freedata_nowarn:
/*ARGSUSED*/
static enum xprt_stat
-svc_dg_stat(xprt)
- SVCXPRT *xprt;
+svc_dg_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
@@ -250,9 +246,7 @@ svc_dg_recvfrom(int fd, char *buf, int buflen,
}
static bool_t
-svc_dg_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_dg_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_dg_data *su = su_data(xprt);
XDR *xdrs = &(su->su_xdrs);
@@ -335,9 +329,7 @@ svc_dg_sendto(int fd, char *buf, int buflen,
}
static bool_t
-svc_dg_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_dg_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_dg_data *su = su_data(xprt);
XDR *xdrs = &(su->su_xdrs);
@@ -378,10 +370,7 @@ svc_dg_reply(xprt, msg)
}
static bool_t
-svc_dg_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_dg_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_dg_data *su;
@@ -392,10 +381,7 @@ svc_dg_getargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_dg_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_dg_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
XDR *xdrs = &(su_data(xprt)->su_xdrs);
@@ -404,8 +390,7 @@ svc_dg_freeargs(xprt, xdr_args, args_ptr)
}
static void
-svc_dg_destroy(xprt)
- SVCXPRT *xprt;
+svc_dg_destroy(SVCXPRT *xprt)
{
struct svc_dg_data *su = su_data(xprt);
@@ -428,17 +413,13 @@ svc_dg_destroy(xprt)
static bool_t
/*ARGSUSED*/
-svc_dg_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_dg_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static void
-svc_dg_ops(xprt)
- SVCXPRT *xprt;
+svc_dg_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -536,9 +517,7 @@ static const char alloc_err[] = "could not allocate cache ";
static const char enable_err[] = "cache already enabled";
int
-svc_dg_enablecache(transp, size)
- SVCXPRT *transp;
- u_int size;
+svc_dg_enablecache(SVCXPRT *transp, u_int size)
{
struct svc_dg_data *su = su_data(transp);
struct cl_cache *uc;
@@ -593,9 +572,7 @@ static const char cache_set_err2[] = "victim alloc failed";
static const char cache_set_err3[] = "could not allocate new rpc buffer";
static void
-cache_set(xprt, replylen)
- SVCXPRT *xprt;
- size_t replylen;
+cache_set(SVCXPRT *xprt, size_t replylen)
{
cache_ptr victim;
cache_ptr *vicp;
@@ -683,11 +660,7 @@ cache_set(xprt, replylen)
* return 1 if found, 0 if not found and set the stage for cache_set()
*/
static int
-cache_get(xprt, msg, replyp, replylenp)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
- char **replyp;
- size_t *replylenp;
+cache_get(SVCXPRT *xprt, struct rpc_msg *msg, char **replyp, size_t *replylenp)
{
u_int loc;
cache_ptr ent;
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c
index aa45396..ca4b93e 100644
--- a/lib/libc/rpc/svc_vc.c
+++ b/lib/libc/rpc/svc_vc.c
@@ -123,10 +123,7 @@ struct cf_conn { /* kept in xprt->xp_p1 for actual connection */
* 0 => use the system default.
*/
SVCXPRT *
-svc_vc_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_vc_create(int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt = NULL;
struct cf_rendezvous *r = NULL;
@@ -186,10 +183,7 @@ cleanup_svc_vc_create:
* descriptor as its first input.
*/
SVCXPRT *
-svc_fd_create(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+svc_fd_create(int fd, u_int sendsize, u_int recvsize)
{
struct sockaddr_storage ss;
socklen_t slen;
@@ -243,10 +237,7 @@ freedata:
}
static SVCXPRT *
-makefd_xprt(fd, sendsize, recvsize)
- int fd;
- u_int sendsize;
- u_int recvsize;
+makefd_xprt(int fd, u_int sendsize, u_int recvsize)
{
SVCXPRT *xprt;
struct cf_conn *cd;
@@ -285,9 +276,7 @@ done:
/*ARGSUSED*/
static bool_t
-rendezvous_request(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+rendezvous_request(SVCXPRT *xprt, struct rpc_msg *msg)
{
int sock, flags;
struct cf_rendezvous *r;
@@ -366,16 +355,14 @@ again:
/*ARGSUSED*/
static enum xprt_stat
-rendezvous_stat(xprt)
- SVCXPRT *xprt;
+rendezvous_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
static void
-svc_vc_destroy(xprt)
- SVCXPRT *xprt;
+svc_vc_destroy(SVCXPRT *xprt)
{
assert(xprt != NULL);
@@ -384,8 +371,7 @@ svc_vc_destroy(xprt)
}
static void
-__svc_vc_dodestroy(xprt)
- SVCXPRT *xprt;
+__svc_vc_dodestroy(SVCXPRT *xprt)
{
struct cf_conn *cd;
struct cf_rendezvous *r;
@@ -417,19 +403,13 @@ __svc_vc_dodestroy(xprt)
/*ARGSUSED*/
static bool_t
-svc_vc_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static bool_t
-svc_vc_rendezvous_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_vc_rendezvous_control(SVCXPRT *xprt, const u_int rq, void *in)
{
struct cf_rendezvous *cfp;
@@ -457,10 +437,7 @@ svc_vc_rendezvous_control(xprt, rq, in)
* fatal for the connection.
*/
static int
-read_vc(xprtp, buf, len)
- void *xprtp;
- void *buf;
- int len;
+read_vc(void *xprtp, void *buf, int len)
{
SVCXPRT *xprt;
int sock;
@@ -520,10 +497,7 @@ fatal_err:
* Any error is fatal and the connection is closed.
*/
static int
-write_vc(xprtp, buf, len)
- void *xprtp;
- void *buf;
- int len;
+write_vc(void *xprtp, void *buf, int len)
{
SVCXPRT *xprt;
int i, cnt;
@@ -567,8 +541,7 @@ write_vc(xprtp, buf, len)
}
static enum xprt_stat
-svc_vc_stat(xprt)
- SVCXPRT *xprt;
+svc_vc_stat(SVCXPRT *xprt)
{
struct cf_conn *cd;
@@ -584,9 +557,7 @@ svc_vc_stat(xprt)
}
static bool_t
-svc_vc_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_vc_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct cf_conn *cd;
XDR *xdrs;
@@ -614,10 +585,7 @@ svc_vc_recv(xprt, msg)
}
static bool_t
-svc_vc_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_vc_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct cf_conn *cd;
@@ -628,10 +596,7 @@ svc_vc_getargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_vc_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_vc_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
XDR *xdrs;
@@ -645,9 +610,7 @@ svc_vc_freeargs(xprt, xdr_args, args_ptr)
}
static bool_t
-svc_vc_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_vc_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct cf_conn *cd;
XDR *xdrs;
@@ -689,8 +652,7 @@ svc_vc_reply(xprt, msg)
}
static void
-svc_vc_ops(xprt)
- SVCXPRT *xprt;
+svc_vc_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
@@ -713,8 +675,7 @@ svc_vc_ops(xprt)
}
static void
-svc_vc_rendezvous_ops(xprt)
- SVCXPRT *xprt;
+svc_vc_rendezvous_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
diff --git a/lib/libc/stdio/tmpfile.c b/lib/libc/stdio/tmpfile.c
index c67d1e4..e5a2be1 100644
--- a/lib/libc/stdio/tmpfile.c
+++ b/lib/libc/stdio/tmpfile.c
@@ -46,9 +46,10 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <paths.h>
#include "un-namespace.h"
+#include "libc_private.h"
FILE *
-tmpfile()
+tmpfile(void)
{
sigset_t set, oset;
FILE *fp;
@@ -69,7 +70,7 @@ tmpfile()
return (NULL);
sigfillset(&set);
- (void)_sigprocmask(SIG_BLOCK, &set, &oset);
+ (void)__libc_sigprocmask(SIG_BLOCK, &set, &oset);
fd = mkstemp(buf);
if (fd != -1)
@@ -77,7 +78,7 @@ tmpfile()
free(buf);
- (void)_sigprocmask(SIG_SETMASK, &oset, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oset, NULL);
if (fd == -1)
return (NULL);
diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c
index b137e49..022c6aa 100644
--- a/lib/libc/stdlib/abort.c
+++ b/lib/libc/stdlib/abort.c
@@ -61,7 +61,7 @@ abort()
* any errors -- ISO C doesn't allow abort to return anyway.
*/
sigdelset(&act.sa_mask, SIGABRT);
- (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
(void)raise(SIGABRT);
/*
@@ -71,9 +71,9 @@ abort()
act.sa_handler = SIG_DFL;
act.sa_flags = 0;
sigfillset(&act.sa_mask);
- (void)_sigaction(SIGABRT, &act, NULL);
+ (void)__libc_sigaction(SIGABRT, &act, NULL);
sigdelset(&act.sa_mask, SIGABRT);
- (void)_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &act.sa_mask, NULL);
(void)raise(SIGABRT);
exit(1);
}
diff --git a/lib/libc/stdlib/jemalloc/Makefile.inc b/lib/libc/stdlib/jemalloc/Makefile.inc
index 4f5fa58..46006ee 100644
--- a/lib/libc/stdlib/jemalloc/Makefile.inc
+++ b/lib/libc/stdlib/jemalloc/Makefile.inc
@@ -4,7 +4,8 @@
JEMALLOCSRCS:= jemalloc.c arena.c atomic.c base.c bitmap.c chunk.c \
chunk_dss.c chunk_mmap.c ckh.c ctl.c extent.c hash.c huge.c mb.c \
- mutex.c prof.c quarantine.c rtree.c stats.c tcache.c tsd.c util.c
+ mutex.c pages.c prof.c quarantine.c rtree.c stats.c tcache.c tsd.c \
+ util.c
SYM_MAPS+=${LIBC_SRCTOP}/stdlib/jemalloc/Symbol.map
@@ -39,12 +40,8 @@ MLINKS+= \
jemalloc.3 xallocx.3 \
jemalloc.3 sallocx.3 \
jemalloc.3 dallocx.3 \
+ jemalloc.3 sdallocx.3 \
jemalloc.3 nallocx.3 \
- jemalloc.3 allocm.3 \
- jemalloc.3 rallocm.3 \
- jemalloc.3 sallocm.3 \
- jemalloc.3 dallocm.3 \
- jemalloc.3 nallocm.3 \
jemalloc.3 malloc.conf.5
.if defined(MALLOC_PRODUCTION)
diff --git a/lib/libc/stdlib/jemalloc/Symbol.map b/lib/libc/stdlib/jemalloc/Symbol.map
index 132664a..c073068 100644
--- a/lib/libc/stdlib/jemalloc/Symbol.map
+++ b/lib/libc/stdlib/jemalloc/Symbol.map
@@ -51,6 +51,11 @@ FBSD_1.3 {
__nallocm;
};
+FBSD_1.4 {
+ sdallocx;
+ __sdallocx;
+};
+
FBSDprivate_1.0 {
_malloc_thread_cleanup;
_malloc_prefork;
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index bd9ea5a..2b298e4 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -70,16 +70,20 @@ __libc_system(const char *command)
(void)sigaddset(&newsigblock, SIGCHLD);
(void)sigaddset(&newsigblock, SIGINT);
(void)sigaddset(&newsigblock, SIGQUIT);
- (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
+ (void)__libc_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);
switch(pid = vfork()) {
+ /*
+ * In the child, use unwrapped syscalls. libthr is in
+ * undefined state after vfork().
+ */
case -1: /* error */
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
return (-1);
case 0: /* child */
/*
* Restore original signal dispositions and exec the command.
*/
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ (void)__sys_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);
_exit(127);
}
@@ -92,16 +96,16 @@ __libc_system(const char *command)
memset(&ign, 0, sizeof(ign));
ign.sa_handler = SIG_IGN;
(void)sigemptyset(&ign.sa_mask);
- (void)_sigaction(SIGINT, &ign, &intact);
- (void)_sigaction(SIGQUIT, &ign, &quitact);
+ (void)__libc_sigaction(SIGINT, &ign, &intact);
+ (void)__libc_sigaction(SIGQUIT, &ign, &quitact);
savedpid = pid;
do {
pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
} while (pid == -1 && errno == EINTR);
- (void)_sigaction(SIGINT, &intact, NULL);
- (void)_sigaction(SIGQUIT, &quitact, NULL);
- (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
- return(pid == -1 ? -1 : pstat);
+ (void)__libc_sigaction(SIGINT, &intact, NULL);
+ (void)__libc_sigaction(SIGQUIT, &quitact, NULL);
+ (void)__libc_sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
+ return (pid == -1 ? -1 : pstat);
}
__weak_reference(__libc_system, __system);
diff --git a/lib/libc/string/bcopy.3 b/lib/libc/string/bcopy.3
index c1bb807..ac480f8 100644
--- a/lib/libc/string/bcopy.3
+++ b/lib/libc/string/bcopy.3
@@ -31,7 +31,7 @@
.\" @(#)bcopy.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd August 14, 2015
+.Dd August 24, 2015
.Dt BCOPY 3
.Os
.Sh NAME
@@ -76,7 +76,6 @@ for
.St -p1003.1-2001
compliance.
.Pp
-The
.St -p1003.1-2008
removes the specification of
.Fn bcopy
diff --git a/lib/libc/string/bzero.3 b/lib/libc/string/bzero.3
index 5af1bcf..130a652 100644
--- a/lib/libc/string/bzero.3
+++ b/lib/libc/string/bzero.3
@@ -31,7 +31,7 @@
.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd October 6, 2014
+.Dd August 24, 2015
.Dt BZERO 3
.Os
.Sh NAME
@@ -88,3 +88,11 @@ function first appeared in
.Ox 5.5
and
.Fx 11.0 .
+.Pp
+.St -p1003.1-2008
+removes the specification of
+.Fn bzero
+and it is marked as LEGACY in
+.St -p1003.1-2004 .
+For portability with other systems new programs should use
+.Xr memset 3 .
diff --git a/lib/libc/string/strndup.c b/lib/libc/string/strndup.c
index 2897e93..bee944d 100644
--- a/lib/libc/string/strndup.c
+++ b/lib/libc/string/strndup.c
@@ -1,32 +1,19 @@
-/* $NetBSD: strndup.c,v 1.3 2007/01/14 23:41:24 cbiere Exp $ */
+/* $OpenBSD: strndup.c,v 1.1 2010/05/18 22:24:55 tedu Exp $ */
/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
*
- * 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.
+ * 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.
*
- * 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.
+ * 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 <sys/cdefs.h>
@@ -37,15 +24,17 @@ __FBSDID("$FreeBSD$");
#include <string.h>
char *
-strndup(const char *str, size_t n)
+strndup(const char *str, size_t maxlen)
{
- size_t len;
char *copy;
+ size_t len;
+
+ len = strnlen(str, maxlen);
+ copy = malloc(len + 1);
+ if (copy != NULL) {
+ (void)memcpy(copy, str, len);
+ copy[len] = '\0';
+ }
- len = strnlen(str, n);
- if ((copy = malloc(len + 1)) == NULL)
- return (NULL);
- memcpy(copy, str, len);
- copy[len] = '\0';
- return (copy);
+ return copy;
}
diff --git a/lib/libc/sys/getrlimit.2 b/lib/libc/sys/getrlimit.2
index 5fdd58b..1fc3656 100644
--- a/lib/libc/sys/getrlimit.2
+++ b/lib/libc/sys/getrlimit.2
@@ -28,7 +28,7 @@
.\" @(#)getrlimit.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd August 20, 2008
+.Dd August 19, 2015
.Dt GETRLIMIT 2
.Os
.Sh NAME
@@ -74,6 +74,8 @@ this defines how far a program may extend its break with the
function.
.It Dv RLIMIT_FSIZE
The largest size (in bytes) file that may be created.
+.It Dv RLIMIT_KQUEUES
+The maximum number of kqueues this user id is allowed to create.
.It Dv RLIMIT_MEMLOCK
The maximum size (in bytes) which a process may lock into memory
using the
@@ -83,12 +85,25 @@ system call.
The maximum number of open files for this process.
.It Dv RLIMIT_NPROC
The maximum number of simultaneous processes for this user id.
+.It Dv RLIMIT_NPTS
+The maximum number of pseudo-terminals this user id is allowed to create.
.It Dv RLIMIT_RSS
-The maximum size (in bytes) to which a process's resident set size may
-grow.
-This imposes a limit on the amount of physical memory to be given to
-a process; if memory is tight, the system will prefer to take memory
-from processes that are exceeding their declared resident set size.
+When there is memory pressure and swap is available, prioritize eviction of
+a process' resident pages beyond this amount (in bytes).
+When memory is not under pressure, this rlimit is effectively ignored.
+Even when there is memory pressure, the amount of available swap space and some
+sysctl settings like
+.Xr vm.swap_enabled
+and
+.Xr vm.swap_idle_enabled
+can affect what happens to processes that have exceeded this size.
+.Pp
+Processes that exceed their set
+.Dv RLIMIT_RSS
+are not signalled or halted.
+The limit is merely a hint to the VM daemon to prefer to deactivate pages from
+processes that have exceeded their set
+.Dv RLIMIT_RSS .
.It Dv RLIMIT_SBSIZE
The maximum size (in bytes) of socket buffer usage for this user.
This limits the amount of network memory, and hence the amount of
@@ -106,18 +121,20 @@ sysctl is set.
Please see
.Xr tuning 7
for a complete description of this sysctl.
-.It Dv RLIMIT_NPTS
-The maximum number of pseudo-terminals created by this user id.
-.It Dv RLIMIT_KQUEUES
-The maximum number of kqueues created by this user id.
+.It Dv RLIMIT_VMEM
+An alias for
+.Dv RLIMIT_AS .
.El
.Pp
A resource limit is specified as a soft limit and a hard limit.
-When a
-soft limit is exceeded a process may receive a signal (for example, if
-the cpu time or file size is exceeded), but it will be allowed to
-continue execution until it reaches the hard limit (or modifies
-its resource limit).
+When a soft limit is exceeded, a process might or might not receive a signal.
+For example, signals are generated when the cpu time or file size is exceeded,
+but not if the address space or RSS limit is exceeded.
+A program that exceeds the soft limit is allowed to continue execution until it
+reaches the hard limit, or modifies its own resource limit.
+Even reaching the hard limit does not necessarily halt a process.
+For example, if the RSS hard limit is exceeded, nothing happens.
+.Pp
The
.Vt rlimit
structure is used to specify the hard and soft limits on a resource,
@@ -170,6 +187,20 @@ the soft cpu time limit is exceeded, a signal
.Dv SIGXCPU
is sent to the
offending process.
+.Pp
+When most operations would allocate more virtual memory than allowed by the
+soft limit of
+.Dv RLIMIT_AS ,
+the operation fails with
+.Dv ENOMEM
+and no signal is raised.
+A notable exception is stack extension, described above.
+If stack extension would allocate more virtual memory than allowed by the soft
+limit of
+.Dv RLIMIT_AS ,
+the signal SIGSEGV will be delivered.
+The caller is free to raise the soft address space limit up to the hard limit
+and retry the allocation.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2
index 76a3cef..88dcfd3 100644
--- a/lib/libc/sys/procctl.2
+++ b/lib/libc/sys/procctl.2
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 29, 2014
+.Dd August 21, 2015
.Dt PROCCTL 2
.Os
.Sh NAME
@@ -71,11 +71,11 @@ The control request to perform is specified by the
.Fa cmd
argument.
The following commands are supported:
-.Bl -tag -width "Dv PROC_REAP_GETPIDS"
+.Bl -tag -width "PROC_REAP_GETPIDS"
.It Dv PROC_SPROTECT
Set process protection state.
This is used to mark a process as protected from being killed if the system
-exhausts available memory and swap.
+exhausts the available memory and swap.
The
.Fa arg
parameter must point to an integer containing an operation and zero or more
@@ -89,7 +89,7 @@ Clear the protected state of selected processes.
.El
.Pp
The following optional flags are supported:
-.Bl -tag -width "Dv PPROT_DESCE"
+.Bl -tag -width "Dv PPROT_DESCEND"
.It Dv PPROT_DESCEND
Apply the requested operation to all child processes of each selected process
in addition to each selected process.
@@ -101,18 +101,18 @@ Future child processes will also mark all of their future child processes.
.El
.It Dv PROC_REAP_ACQUIRE
Acquires the reaper status for the current process.
-The status means that children orphaned by the reaper's descendants
-that were forked after the acquisition of the status are reparented to the
-reaper.
-After the system initialization,
+Reaper status means that children orphaned by the reaper's descendants
+that were forked after the acquisition of reaper status are reparented to the
+reaper process.
+After system initialization,
.Xr init 8
is the default reaper.
.It Dv PROC_REAP_RELEASE
-Releases the reaper state for the current process.
+Release the reaper state for the current process.
The reaper of the current process becomes the new reaper of the
current process's descendants.
.It Dv PROC_REAP_STATUS
-Provides the information about the reaper of the specified process,
+Provides information about the reaper of the specified process,
or the process itself when it is a reaper.
The
.Fa data
@@ -133,7 +133,7 @@ The
may have the following flags returned:
.Bl -tag -width "Dv REAPER_STATUS_REALINIT"
.It Dv REAPER_STATUS_OWNED
-The specified process has acquired the reaper status and has not
+The specified process has acquired reaper status and has not
released it.
When the flag is returned, the specified process
.Fa id ,
@@ -142,13 +142,17 @@ pid, identifies the reaper, otherwise the
field of the structure is set to the pid of the reaper
for the specified process id.
.It Dv REAPER_STATUS_REALINIT
-The specified process is the root of the reaper tree, i.e.
+The specified process is the root of the reaper tree, i.e.,
.Xr init 8 .
.El
.Pp
The
.Fa rs_children
-field returns the number of children of the reaper.
+field returns the number of children of the reaper among the descendants.
+It is possible to have a child whose reaper is not the specified process,
+since the reaper for any existing children is not reset on the
+.Dv PROC_REAP_ACQUIRE
+operation.
The
.Fa rs_descendants
field returns the total number of descendants of the reaper(s),
@@ -242,7 +246,7 @@ struct procctl_reaper_kill {
The
.Fa rk_sig
field specifies the signal to be delivered.
-Zero is not a valid signal number, unlike
+Zero is not a valid signal number, unlike for
.Xr kill 2 .
The
.Fa rk_flags
@@ -271,20 +275,20 @@ field identifies the number of processes signalled.
The
.Fa rk_fpid
field is set to the pid of the first process for which signal
-delivery failed, e.g. due to the permission problems.
-If no such process exist, the
+delivery failed, e.g., due to permission problems.
+If no such process exists, the
.Fa rk_fpid
field is set to -1.
.It Dv PROC_TRACE_CTL
Enable or disable tracing of the specified process(es), according to the
value of the integer argument.
-Tracing includes attachment to the process using
+Tracing includes attachment to the process using the
.Xr ptrace 2
and
.Xr ktrace 2 ,
debugging sysctls,
.Xr hwpmc 4 ,
-.Xr dtrace 1
+.Xr dtrace 1 ,
and core dumping.
Possible values for the
.Fa data
@@ -297,7 +301,7 @@ Only allowed for self.
.It Dv PROC_TRACE_CTL_DISABLE
Disable tracing for the specified process.
Tracing is re-enabled when the process changes the executing
-program with
+program with the
.Xr execve 2
syscall.
A child inherits the trace settings from the parent on
@@ -305,7 +309,7 @@ A child inherits the trace settings from the parent on
.It Dv PROC_TRACE_CTL_DISABLE_EXEC
Same as
.Dv PROC_TRACE_CTL_DISABLE ,
-but the setting persist for the process even after
+but the setting persists for the process even after
.Xr execve 2 .
.El
.It Dv PROC_TRACE_STATUS
@@ -315,7 +319,7 @@ the integer variable pointed to by
If tracing is disabled,
.Fa data
is set to -1.
-If tracing is enabled, but no debugger is attached by
+If tracing is enabled, but no debugger is attached by the
.Xr ptrace 2
syscall,
.Fa data
@@ -328,7 +332,7 @@ is set to the pid of the debugger process.
Disabling tracing on a process should not be considered a security
feature, as it is bypassable both by the kernel and privileged processes,
and via other system mechanisms.
-As such, it should not be relied on to reliably protect cryptographic
+As such, it should not be utilized to reliably protect cryptographic
keying material or other confidential data.
.Sh RETURN VALUES
If an error occurs, a value of -1 is returned and
@@ -404,9 +408,9 @@ request was issued for a process already being traced.
.It Bq Er EPERM
The
.Dv PROC_TRACE_CTL
-request to re-enable tracing of the process (
-.Dv PROC_TRACE_CTL_ENABLE ) ,
-or to disable persistence of the
+request to re-enable tracing of the process
+.Po Dv PROC_TRACE_CTL_ENABLE Pc ,
+or to disable persistence of
.Dv PROC_TRACE_CTL_DISABLE
on
.Xr execve 2
diff --git a/lib/libc/sys/sigaction.c b/lib/libc/sys/sigaction.c
index 7645538..b4d6563 100644
--- a/lib/libc/sys/sigaction.c
+++ b/lib/libc/sys/sigaction.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
__weak_reference(__sys_sigaction, __sigaction);
+__weak_reference(sigaction, __libc_sigaction);
#pragma weak sigaction
int
diff --git a/lib/libc/sys/sigprocmask.c b/lib/libc/sys/sigprocmask.c
index 40dba95..d24bb89 100644
--- a/lib/libc/sys/sigprocmask.c
+++ b/lib/libc/sys/sigprocmask.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
__weak_reference(__sys_sigprocmask, __sigprocmask);
+__weak_reference(sigprocmask, __libc_sigprocmask);
#pragma weak sigprocmask
int
diff --git a/lib/libc/sys/sigsuspend.c b/lib/libc/sys/sigsuspend.c
index 6e47368..1f980a1 100644
--- a/lib/libc/sys/sigsuspend.c
+++ b/lib/libc/sys/sigsuspend.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
__weak_reference(__sys_sigsuspend, __sigsuspend);
+__weak_reference(sigsuspend, __libc_sigsuspend);
#pragma weak sigsuspend
int
diff --git a/lib/libc/tests/gen/posix_spawn/Makefile b/lib/libc/tests/gen/posix_spawn/Makefile
index a1c9b9e..d2dfa54 100644
--- a/lib/libc/tests/gen/posix_spawn/Makefile
+++ b/lib/libc/tests/gen/posix_spawn/Makefile
@@ -10,9 +10,9 @@ TESTSDIR= ${TESTSBASE}/lib/libc/gen/posix_spawn
BINDIR= ${TESTSDIR}
-# TODO: t_spawnattr (fix from pho@ needs additional review)
NETBSD_ATF_TESTS_C= fileactions_test
NETBSD_ATF_TESTS_C+= spawn_test
+NETBSD_ATF_TESTS_C+= spawnattr_test
PROGS= h_fileactions
PROGS+= h_spawn
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
index 89431bc..7ecf1d6 100644
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -25,7 +25,10 @@ NETBSD_ATF_TESTS_C+= kevent_test
NETBSD_ATF_TESTS_C+= kill_test
NETBSD_ATF_TESTS_C+= link_test
NETBSD_ATF_TESTS_C+= listen_test
+# On arm64 triggers panic ARM64TODO: pmap_mincore (PR202307).
+.if ${MACHINE_CPUARCH} != "aarch64"
NETBSD_ATF_TESTS_C+= mincore_test
+.endif
NETBSD_ATF_TESTS_C+= mkdir_test
NETBSD_ATF_TESTS_C+= mkfifo_test
NETBSD_ATF_TESTS_C+= mknod_test
OpenPOWER on IntegriCloud