summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/db/hash/hash.c2
-rw-r--r--lib/libc/db/hash/hash_buf.c4
-rw-r--r--lib/libc/gen/err.c8
-rw-r--r--lib/libc/gen/getmntinfo.c2
-rw-r--r--lib/libc/gen/opendir.c2
-rw-r--r--lib/libc/gen/sysctl.3246
-rw-r--r--lib/libc/gen/tls.c4
-rw-r--r--lib/libc/iconv/bsd_iconv.c10
-rw-r--r--lib/libc/locale/wcstod.c13
-rw-r--r--lib/libc/locale/wcstof.c20
-rw-r--r--lib/libc/locale/wcstold.c13
-rw-r--r--lib/libc/locale/xlocale_private.h11
-rw-r--r--lib/libc/net/base64.c2
-rw-r--r--lib/libc/net/getifaddrs.c3
-rw-r--r--lib/libc/net/getservent.c4
-rw-r--r--lib/libc/net/rcmd.c2
-rw-r--r--lib/libc/posix1e/acl_support_nfs4.c2
-rw-r--r--lib/libc/resolv/mtctxres.c11
-rw-r--r--lib/libc/resolv/res_init.c4
-rw-r--r--lib/libc/resolv/res_mkupdate.c4
-rw-r--r--lib/libc/rpc/auth_des.c6
-rw-r--r--lib/libc/rpc/auth_none.c14
-rw-r--r--lib/libc/rpc/auth_time.c45
-rw-r--r--lib/libc/rpc/auth_unix.c28
-rw-r--r--lib/libc/rpc/authdes_prot.c8
-rw-r--r--lib/libc/rpc/authunix_prot.c4
-rw-r--r--lib/libc/rpc/bindresvport.c8
-rw-r--r--lib/libc/rpc/clnt_bcast.c63
-rw-r--r--lib/libc/rpc/clnt_dg.c60
-rw-r--r--lib/libc/rpc/clnt_perror.c33
-rw-r--r--lib/libc/rpc/clnt_raw.c36
-rw-r--r--lib/libc/rpc/clnt_simple.c20
-rw-r--r--lib/libc/rpc/clnt_vc.c107
-rw-r--r--lib/libc/rpc/crypt_client.c6
-rw-r--r--lib/libc/rpc/des_crypt.c23
-rw-r--r--lib/libc/rpc/des_soft.c3
-rw-r--r--lib/libc/rpc/getnetconfig.c31
-rw-r--r--lib/libc/rpc/getnetpath.c16
-rw-r--r--lib/libc/rpc/getpublickey.c14
-rw-r--r--lib/libc/rpc/getrpcent.34
-rw-r--r--lib/libc/rpc/getrpcent.c6
-rw-r--r--lib/libc/rpc/getrpcport.c4
-rw-r--r--lib/libc/rpc/key_call.c48
-rw-r--r--lib/libc/rpc/mt_misc.c4
-rw-r--r--lib/libc/rpc/netname.c13
-rw-r--r--lib/libc/rpc/netnamer.c20
-rw-r--r--lib/libc/rpc/pmap_getmaps.c3
-rw-r--r--lib/libc/rpc/pmap_getport.c7
-rw-r--r--lib/libc/rpc/pmap_prot.c4
-rw-r--r--lib/libc/rpc/pmap_prot2.c8
-rw-r--r--lib/libc/rpc/pmap_rmt.c19
-rw-r--r--lib/libc/rpc/rpc_callmsg.c12
-rw-r--r--lib/libc/rpc/rpc_com.h4
-rw-r--r--lib/libc/rpc/rpc_generic.c35
-rw-r--r--lib/libc/rpc/rpc_prot.c48
-rw-r--r--lib/libc/rpc/rpc_soc.c147
-rw-r--r--lib/libc/rpc/rpcb_clnt.c105
-rw-r--r--lib/libc/rpc/rpcb_prot.c42
-rw-r--r--lib/libc/rpc/rpcb_st_xdr.c50
-rw-r--r--lib/libc/rpc/rpcdname.c15
-rw-r--r--lib/libc/rpc/rtime.c25
-rw-r--r--lib/libc/rpc/svc.c103
-rw-r--r--lib/libc/rpc/svc_auth.c19
-rw-r--r--lib/libc/rpc/svc_auth_des.c35
-rw-r--r--lib/libc/rpc/svc_auth_unix.c8
-rw-r--r--lib/libc/rpc/svc_dg.c51
-rw-r--r--lib/libc/rpc/svc_generic.c36
-rw-r--r--lib/libc/rpc/svc_raw.c34
-rw-r--r--lib/libc/rpc/svc_run.c4
-rw-r--r--lib/libc/rpc/svc_simple.c22
-rw-r--r--lib/libc/rpc/svc_vc.c77
-rw-r--r--lib/libc/softfloat/timesoftfloat.c6
-rw-r--r--lib/libc/sys/open.218
-rw-r--r--lib/libc/tests/Makefile5
-rw-r--r--lib/libc/tests/iconv/Makefile9
-rw-r--r--lib/libc/tests/iconv/iconvctl_test.c69
-rw-r--r--lib/libc/uuid/uuid_to_string.c2
-rw-r--r--lib/libc/xdr/xdr_mem.c2
78 files changed, 846 insertions, 1169 deletions
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index 12220a9..c4bf0c6 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -771,7 +771,7 @@ next_bucket:
if (__big_keydata(hashp, bufp, key, data, 1))
return (ERROR);
} else {
- if (hashp->cpage == 0)
+ if (hashp->cpage == NULL)
return (ERROR);
key->data = (u_char *)hashp->cpage->page + bp[ndx];
key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c
index 4445fc5..7dcd328 100644
--- a/lib/libc/db/hash/hash_buf.c
+++ b/lib/libc/db/hash/hash_buf.c
@@ -245,7 +245,7 @@ newbuf(HTAB *hashp, u_int32_t addr, BUFHEAD *prev_bp)
*/
for (xbp = bp; xbp->ovfl;) {
next_xbp = xbp->ovfl;
- xbp->ovfl = 0;
+ xbp->ovfl = NULL;
xbp = next_xbp;
/* Check that ovfl pointer is up date. */
@@ -350,7 +350,7 @@ __buf_free(HTAB *hashp, int do_free, int to_disk)
void
__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
{
- bp->ovfl = 0;
+ bp->ovfl = NULL;
bp->addr = 0;
bp->flags = 0;
BUF_REMOVE(bp);
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index 0ba584c..6db66d3 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -99,7 +99,7 @@ errc(int eval, int code, const char *fmt, ...)
void
verrc(int eval, int code, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
@@ -124,7 +124,7 @@ errx(int eval, const char *fmt, ...)
void
verrx(int eval, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
@@ -164,7 +164,7 @@ warnc(int code, const char *fmt, ...)
void
vwarnc(int code, const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL) {
@@ -186,7 +186,7 @@ warnx(const char *fmt, ...)
void
vwarnx(const char *fmt, va_list ap)
{
- if (err_file == 0)
+ if (err_file == NULL)
err_set_file((FILE *)0);
fprintf(err_file, "%s: ", _getprogname());
if (fmt != NULL)
diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c
index 2b532f6..2a81205 100644
--- a/lib/libc/gen/getmntinfo.c
+++ b/lib/libc/gen/getmntinfo.c
@@ -58,7 +58,7 @@ getmntinfo(mntbufp, flags)
if (mntbuf)
free(mntbuf);
bufsize = (mntsize + 1) * sizeof(struct statfs);
- if ((mntbuf = (struct statfs *)malloc(bufsize)) == 0)
+ if ((mntbuf = malloc(bufsize)) == NULL)
return (0);
if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
return (0);
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 54928e7..bf4dea3 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -209,7 +209,7 @@ _filldir(DIR *dirp, bool use_current_pos)
* On the second pass, save pointers to each one.
* Then sort the pointers and remove duplicate names.
*/
- for (dpv = 0;;) {
+ for (dpv = NULL;;) {
n = 0;
ddptr = buf;
while (ddptr < ddeptr) {
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 7d7b90a..7032d26 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -183,16 +183,16 @@ The top level names are defined with a CTL_ prefix in
and are as follows.
The next and subsequent levels down are found in the include files
listed here, and described in separate sections below.
-.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
-.It Sy "Name Next level names Description"
-.It "CTL_DEBUG sys/sysctl.h Debugging"
-.It "CTL_VFS sys/mount.h File system"
-.It "CTL_HW sys/sysctl.h Generic CPU, I/O"
-.It "CTL_KERN sys/sysctl.h High kernel limits"
-.It "CTL_MACHDEP sys/sysctl.h Machine dependent"
-.It "CTL_NET sys/socket.h Networking"
-.It "CTL_USER sys/sysctl.h User-level"
-.It "CTL_VM vm/vm_param.h Virtual memory"
+.Bl -column CTLXMACHDEPXXX "Next Level NamesXXXXXX" -offset indent
+.It Sy Name Ta Sy Next Level Names Ta Sy Description
+.It Dv CTL_DEBUG Ta In sys/sysctl.h Ta Debugging
+.It Dv CTL_VFS Ta In sys/mount.h Ta File system
+.It Dv CTL_HW Ta In sys/sysctl.h Ta Generic CPU, I/O
+.It Dv CTL_KERN Ta In sys/sysctl.h Ta High kernel limits
+.It Dv CTL_MACHDEP Ta In sys/sysctl.h Ta Machine dependent
+.It Dv CTL_NET Ta In sys/socket.h Ta Networking
+.It Dv CTL_USER Ta In sys/sysctl.h Ta User-level
+.It Dv CTL_VM Ta In vm/vm_param.h Ta Virtual memory
.El
.Pp
For example, the following retrieves the maximum number of processes allowed
@@ -270,20 +270,20 @@ The string and integer information available for the CTL_HW level
is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
-.Bl -column "Second level nameXXXXXX" integerXXX -offset indent
-.It Sy "Second level name Type Changeable"
-.It "HW_MACHINE string no"
-.It "HW_MODEL string no"
-.It "HW_NCPU integer no"
-.It "HW_BYTEORDER integer no"
-.It "HW_PHYSMEM integer no"
-.It "HW_USERMEM integer no"
-.It "HW_PAGESIZE integer no"
-.\".It "HW_DISKNAMES integer no"
-.\".It "HW_DISKSTATS integer no"
-.It "HW_FLOATINGPT integer no"
-.It "HW_MACHINE_ARCH string no"
-.It "HW_REALMEM integer no"
+.Bl -column "Second Level Name" integerXXX Changeable -offset indent
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv HW_MACHINE Ta string Ta no
+.It Dv HW_MODEL Ta string Ta no
+.It Dv HW_NCPU Ta integer Ta no
+.It Dv HW_BYTEORDER Ta integer Ta no
+.It Dv HW_PHYSMEM Ta integer Ta no
+.It Dv HW_USERMEM Ta integer Ta no
+.It Dv HW_PAGESIZE Ta integer Ta no
+.\".It Dv HW_DISKNAMES Ta integer Ta no
+.\".It Dv HW_DISKSTATS Ta integer Ta no
+.It Dv HW_FLOATINGPT Ta integer Ta no
+.It Dv HW_MACHINE_ARCH Ta string Ta no
+.It Dv HW_REALMEM Ta integer Ta no
.El
.Bl -tag -width 6n
.It Li HW_MACHINE
@@ -293,7 +293,7 @@ The machine model
.It Li HW_NCPU
The number of cpus.
.It Li HW_BYTEORDER
-The byteorder (4,321, or 1,234).
+The byteorder (4321 or 1234).
.It Li HW_PHYSMEM
The bytes of physical memory.
.It Li HW_USERMEM
@@ -319,36 +319,36 @@ system vnodes, the open file entries, routing table entries,
virtual memory statistics, load average history, and clock rate
information.
.Bl -column "KERNXMAXFILESPERPROCXXX" "struct clockrateXXX" -offset indent
-.It Sy "Second level name Type Changeable"
-.It "KERN_ARGMAX integer no"
-.It "KERN_BOOTFILE string yes"
-.It "KERN_BOOTTIME struct timeval no"
-.It "KERN_CLOCKRATE struct clockinfo no"
-.It "KERN_FILE struct xfile no"
-.It "KERN_HOSTID integer yes"
-.It "KERN_HOSTUUID string yes"
-.It "KERN_HOSTNAME string yes"
-.It "KERN_JOB_CONTROL integer no"
-.It "KERN_MAXFILES integer yes"
-.It "KERN_MAXFILESPERPROC integer yes"
-.It "KERN_MAXPROC integer no"
-.It "KERN_MAXPROCPERUID integer yes"
-.It "KERN_MAXVNODES integer yes"
-.It "KERN_NGROUPS integer no"
-.It "KERN_NISDOMAINNAME string yes"
-.It "KERN_OSRELDATE integer no"
-.It "KERN_OSRELEASE string no"
-.It "KERN_OSREV integer no"
-.It "KERN_OSTYPE string no"
-.It "KERN_POSIX1 integer no"
-.It "KERN_PROC node not applicable"
-.It "KERN_PROF node not applicable"
-.It "KERN_QUANTUM integer yes"
-.It "KERN_SAVED_IDS integer no"
-.It "KERN_SECURELVL integer raise only"
-.It "KERN_UPDATEINTERVAL integer no"
-.It "KERN_VERSION string no"
-.It "KERN_VNODE struct xvnode no"
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv KERN_ARGMAX Ta integer Ta no
+.It Dv KERN_BOOTFILE Ta string Ta yes
+.It Dv KERN_BOOTTIME Ta struct timeval Ta no
+.It Dv KERN_CLOCKRATE Ta struct clockinfo Ta no
+.It Dv KERN_FILE Ta struct xfile Ta no
+.It Dv KERN_HOSTID Ta integer Ta yes
+.It Dv KERN_HOSTUUID Ta string Ta yes
+.It Dv KERN_HOSTNAME Ta string Ta yes
+.It Dv KERN_JOB_CONTROL Ta integer Ta no
+.It Dv KERN_MAXFILES Ta integer Ta yes
+.It Dv KERN_MAXFILESPERPROC Ta integer Ta yes
+.It Dv KERN_MAXPROC Ta integer Ta no
+.It Dv KERN_MAXPROCPERUID Ta integer Ta yes
+.It Dv KERN_MAXVNODES Ta integer Ta yes
+.It Dv KERN_NGROUPS Ta integer Ta no
+.It Dv KERN_NISDOMAINNAME Ta string Ta yes
+.It Dv KERN_OSRELDATE Ta integer Ta no
+.It Dv KERN_OSRELEASE Ta string Ta no
+.It Dv KERN_OSREV Ta integer Ta no
+.It Dv KERN_OSTYPE Ta string Ta no
+.It Dv KERN_POSIX1 Ta integer Ta no
+.It Dv KERN_PROC Ta node Ta not applicable
+.It Dv KERN_PROF Ta node Ta not applicable
+.It Dv KERN_QUANTUM Ta integer Ta yes
+.It Dv KERN_SAVED_IDS Ta integer Ta no
+.It Dv KERN_SECURELVL Ta integer Ta raise only
+.It Dv KERN_UPDATEINTERVAL Ta integer Ta no
+.It Dv KERN_VERSION Ta string Ta no
+.It Dv KERN_VNODE Ta struct xvnode Ta no
.El
.Bl -tag -width 6n
.It Li KERN_ARGMAX
@@ -439,14 +439,14 @@ For the following names, an array of
.Va struct kinfo_proc
structures is returned,
whose size depends on the current number of such objects in the system.
-.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
-.It "Third level name Fourth level is:"
-.It "KERN_PROC_ALL None"
-.It "KERN_PROC_PID A process ID"
-.It "KERN_PROC_PGRP A process group"
-.It "KERN_PROC_TTY A tty device"
-.It "KERN_PROC_UID A user ID"
-.It "KERN_PROC_RUID A real user ID"
+.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent
+.It Sy Third Level Name Ta Sy Fourth Level
+.It Dv KERN_PROC_ALL Ta None
+.It Dv KERN_PROC_PID Ta A process ID
+.It Dv KERN_PROC_PGRP Ta A process group
+.It Dv KERN_PROC_TTY Ta A tty device
+.It Dv KERN_PROC_UID Ta A user ID
+.It Dv KERN_PROC_RUID Ta A real user ID
.El
.Pp
If the third level name is
@@ -465,8 +465,8 @@ For
a process ID of
.Li \-1
implies the current process.
-.Bl -column "Third level nameXXXXXX" "Fourth level is:XXXXXX" -offset indent
-.It Sy "Third level name Fourth level is:"
+.Bl -column "Third Level NameXXXXXX" "Fourth LevelXXXXXX" -offset indent
+.It Sy Third Level Name Ta Sy Fourth Level
.It Dv KERN_PROC_ARGS Ta "A process ID"
.It Dv KERN_PROC_PATHNAME Ta "A process ID"
.El
@@ -481,12 +481,12 @@ is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
-.It Sy "Third level name Type Changeable"
-.It "GPROF_STATE integer yes"
-.It "GPROF_COUNT u_short[\|] yes"
-.It "GPROF_FROMS u_short[\|] yes"
-.It "GPROF_TOS struct tostruct yes"
-.It "GPROF_GMONPARAM struct gmonparam no"
+.It Sy Third Level Name Ta Sy Type Ta Sy Changeable
+.It Dv GPROF_STATE Ta integer Ta yes
+.It Dv GPROF_COUNT Ta u_short[\|] Ta yes
+.It Dv GPROF_FROMS Ta u_short[\|] Ta yes
+.It Dv GPROF_TOS Ta struct tostruct Ta yes
+.It Dv GPROF_GMONPARAM Ta struct gmonparam Ta no
.El
.Pp
The variables are as follows:
@@ -530,11 +530,11 @@ The string and integer information available for the CTL_NET level
is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
-.Bl -column "Second level nameXXXXXX" "routing messagesXXX" -offset indent
-.It Sy "Second level name Type Changeable"
-.It "PF_ROUTE routing messages no"
-.It "PF_INET IPv4 values yes"
-.It "PF_INET6 IPv6 values yes"
+.Bl -column "Second Level NameXXXXXX" "routing messagesXXX" -offset indent
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv PF_ROUTE Ta routing messages Ta no
+.It Dv PF_INET Ta IPv4 values Ta yes
+.It Dv PF_INET6 Ta IPv6 values Ta yes
.El
.Bl -tag -width 6n
.It Li PF_ROUTE
@@ -548,13 +548,13 @@ The third level name is a protocol number, which is currently always 0.
The fourth level name is an address family, which may be set to 0 to
select all address families.
The fifth, sixth, and seventh level names are as follows:
-.Bl -column -offset indent "Fifth level Sixth level" "Seventh level"
-.It Sy "Fifth level Sixth level" Ta Sy "Seventh level"
-.It "NET_RT_FLAGS rtflags" Ta "None"
-.It "NET_RT_DUMP None" Ta "None or fib number"
-.It "NET_RT_IFLIST 0 or if_index" Ta None
-.It "NET_RT_IFMALIST 0 or if_index" Ta None
-.It "NET_RT_IFLISTL 0 or if_index" Ta None
+.Bl -column -offset indent "Fifth Level" "Sixth Level" "Seventh Level"
+.It Sy Fifth level Ta Sy Sixth Level Ta Sy Seventh Level
+.It Dv NET_RT_FLAGS Ta rtflags Ta None
+.It Dv NET_RT_DUMP Ta None Ta None or fib number
+.It Dv NET_RT_IFLIST Ta 0 or if_index Ta None
+.It Dv NET_RT_IFMALIST Ta 0 or if_index Ta None
+.It Dv NET_RT_IFLISTL Ta 0 or if_index Ta None
.El
.Pp
The
@@ -582,13 +582,13 @@ The third level name is the protocol.
The fourth level name is the variable name.
The currently defined protocols and names are:
.Bl -column ProtocolXX VariableXX TypeXX ChangeableXX
-.It Sy "Protocol Variable Type Changeable"
-.It "icmp bmcastecho integer yes"
-.It "icmp maskrepl integer yes"
-.It "ip forwarding integer yes"
-.It "ip redirect integer yes"
-.It "ip ttl integer yes"
-.It "udp checksum integer yes"
+.It Sy Protocol Ta Sy Variable Ta Sy Type Ta Sy Changeable
+.It icmp Ta bmcastecho Ta integer Ta yes
+.It icmp Ta maskrepl Ta integer Ta yes
+.It ip Ta forwarding Ta integer Ta yes
+.It ip Ta redirect Ta integer Ta yes
+.It ip Ta ttl Ta integer Ta yes
+.It udp Ta checksum Ta integer Ta yes
.El
.Pp
The variables are as follows:
@@ -633,27 +633,27 @@ is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
.Bl -column "USER_COLL_WEIGHTS_MAXXXX" "integerXXX" -offset indent
-.It Sy "Second level name Type Changeable"
-.It "USER_BC_BASE_MAX integer no"
-.It "USER_BC_DIM_MAX integer no"
-.It "USER_BC_SCALE_MAX integer no"
-.It "USER_BC_STRING_MAX integer no"
-.It "USER_COLL_WEIGHTS_MAX integer no"
-.It "USER_CS_PATH string no"
-.It "USER_EXPR_NEST_MAX integer no"
-.It "USER_LINE_MAX integer no"
-.It "USER_POSIX2_CHAR_TERM integer no"
-.It "USER_POSIX2_C_BIND integer no"
-.It "USER_POSIX2_C_DEV integer no"
-.It "USER_POSIX2_FORT_DEV integer no"
-.It "USER_POSIX2_FORT_RUN integer no"
-.It "USER_POSIX2_LOCALEDEF integer no"
-.It "USER_POSIX2_SW_DEV integer no"
-.It "USER_POSIX2_UPE integer no"
-.It "USER_POSIX2_VERSION integer no"
-.It "USER_RE_DUP_MAX integer no"
-.It "USER_STREAM_MAX integer no"
-.It "USER_TZNAME_MAX integer no"
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv USER_BC_BASE_MAX Ta integer Ta no
+.It Dv USER_BC_DIM_MAX Ta integer Ta no
+.It Dv USER_BC_SCALE_MAX Ta integer Ta no
+.It Dv USER_BC_STRING_MAX Ta integer Ta no
+.It Dv USER_COLL_WEIGHTS_MAX Ta integer Ta no
+.It Dv USER_CS_PATH Ta string Ta no
+.It Dv USER_EXPR_NEST_MAX Ta integer Ta no
+.It Dv USER_LINE_MAX Ta integer Ta no
+.It Dv USER_POSIX2_CHAR_TERM Ta integer Ta no
+.It Dv USER_POSIX2_C_BIND Ta integer Ta no
+.It Dv USER_POSIX2_C_DEV Ta integer Ta no
+.It Dv USER_POSIX2_FORT_DEV Ta integer Ta no
+.It Dv USER_POSIX2_FORT_RUN Ta integer Ta no
+.It Dv USER_POSIX2_LOCALEDEF Ta integer Ta no
+.It Dv USER_POSIX2_SW_DEV Ta integer Ta no
+.It Dv USER_POSIX2_UPE Ta integer Ta no
+.It Dv USER_POSIX2_VERSION Ta integer Ta no
+.It Dv USER_RE_DUP_MAX Ta integer Ta no
+.It Dv USER_STREAM_MAX Ta integer Ta no
+.It Dv USER_TZNAME_MAX Ta integer Ta no
.El
.Bl -tag -width 6n
.It Li USER_BC_BASE_MAX
@@ -731,18 +731,18 @@ The string and integer information available for the CTL_VM level
is detailed below.
The changeable column shows whether a process with appropriate
privilege may change the value.
-.Bl -column "Second level nameXXXXXX" "struct loadavgXXX" -offset indent
-.It Sy "Second level name Type Changeable"
-.It "VM_LOADAVG struct loadavg no"
-.It "VM_TOTAL struct vmtotal no"
-.It "VM_SWAPPING_ENABLED integer maybe"
-.It "VM_V_CACHE_MAX integer yes"
-.It "VM_V_CACHE_MIN integer yes"
-.It "VM_V_FREE_MIN integer yes"
-.It "VM_V_FREE_RESERVED integer yes"
-.It "VM_V_FREE_TARGET integer yes"
-.It "VM_V_INACTIVE_TARGET integer yes"
-.It "VM_V_PAGEOUT_FREE_MIN integer yes"
+.Bl -column "Second Level NameXXXXXX" "struct loadavgXXX" -offset indent
+.It Sy Second Level Name Ta Sy Type Ta Sy Changeable
+.It Dv VM_LOADAVG Ta struct loadavg Ta no
+.It Dv VM_TOTAL Ta struct vmtotal Ta no
+.It Dv VM_SWAPPING_ENABLED Ta integer Ta maybe
+.It Dv VM_V_CACHE_MAX Ta integer Ta yes
+.It Dv VM_V_CACHE_MIN Ta integer Ta yes
+.It Dv VM_V_FREE_MIN Ta integer Ta yes
+.It Dv VM_V_FREE_RESERVED Ta integer Ta yes
+.It Dv VM_V_FREE_TARGET Ta integer Ta yes
+.It Dv VM_V_INACTIVE_TARGET Ta integer Ta yes
+.It Dv VM_V_PAGEOUT_FREE_MIN Ta integer Ta yes
.El
.Bl -tag -width 6n
.It Li VM_LOADAVG
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index 466f957..8ac4040 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -284,7 +284,7 @@ _init_tls()
while (*sp++ != 0)
;
aux = (Elf_Auxinfo *) sp;
- phdr = 0;
+ phdr = NULL;
phent = phnum = 0;
for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
switch (auxp->a_type) {
@@ -301,7 +301,7 @@ _init_tls()
break;
}
}
- if (phdr == 0 || phent != sizeof(Elf_Phdr) || phnum == 0)
+ if (phdr == NULL || phent != sizeof(Elf_Phdr) || phnum == 0)
return;
for (i = 0; (unsigned) i < phnum; i++) {
diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c
index e032a5b..cc1ea3d 100644
--- a/lib/libc/iconv/bsd_iconv.c
+++ b/lib/libc/iconv/bsd_iconv.c
@@ -259,8 +259,9 @@ __bsd_iconvctl(iconv_t cd, int request, void *argument)
struct _citrus_iconv *cv;
struct iconv_hooks *hooks;
const char *convname;
- char src[PATH_MAX], *dst;
+ char *dst;
int *i;
+ size_t srclen;
cv = (struct _citrus_iconv *)(void *)cd;
hooks = (struct iconv_hooks *)argument;
@@ -275,12 +276,9 @@ __bsd_iconvctl(iconv_t cd, int request, void *argument)
case ICONV_TRIVIALP:
convname = cv->cv_shared->ci_convname;
dst = strchr(convname, '/');
-
- strlcpy(src, convname, dst - convname + 1);
+ srclen = dst - convname;
dst++;
- if ((convname == NULL) || (src == NULL) || (dst == NULL))
- return (-1);
- *i = strcmp(src, dst) == 0 ? 1 : 0;
+ *i = (srclen == strlen(dst)) && !memcmp(convname, dst, srclen);
return (0);
case ICONV_GET_TRANSLITERATE:
*i = 1;
diff --git a/lib/libc/locale/wcstod.c b/lib/libc/locale/wcstod.c
index 8bc46a7..c6ae141 100644
--- a/lib/libc/locale/wcstod.c
+++ b/lib/libc/locale/wcstod.c
@@ -54,11 +54,13 @@ wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
mbstate_t mbs;
double val;
char *buf, *end;
- const wchar_t *wcp = nptr;
+ const wchar_t *wcp;
size_t len;
- size_t spaces = 0;
+ size_t spaces;
FIX_LOCALE(locale);
+ wcp = nptr;
+ spaces = 0;
while (iswspace_l(*wcp, locale)) {
wcp++;
spaces++;
@@ -80,8 +82,11 @@ wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
*endptr = (wchar_t *)nptr;
return (0.0);
}
- if ((buf = malloc(len + 1)) == NULL)
+ if ((buf = malloc(len + 1)) == NULL) {
+ if (endptr != NULL)
+ *endptr = (wchar_t *)nptr;
return (0.0);
+ }
mbs = initial;
wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
@@ -95,13 +100,11 @@ wcstod_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
* corresponding position in the wide char string.
*/
if (endptr != NULL) {
- /* XXX Assume each wide char is one byte. */
*endptr = (wchar_t *)nptr + (end - buf);
if (buf != end)
*endptr += spaces;
}
-
free(buf);
return (val);
diff --git a/lib/libc/locale/wcstof.c b/lib/libc/locale/wcstof.c
index 93a5af8..99ce0fe 100644
--- a/lib/libc/locale/wcstof.c
+++ b/lib/libc/locale/wcstof.c
@@ -50,27 +50,37 @@ wcstof_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
char *buf, *end;
const wchar_t *wcp;
size_t len;
+ size_t spaces;
FIX_LOCALE(locale);
- while (iswspace_l(*nptr, locale))
- nptr++;
-
wcp = nptr;
+ spaces = 0;
+ while (iswspace_l(*wcp, locale)) {
+ wcp++;
+ spaces++;
+ }
+
mbs = initial;
if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) {
if (endptr != NULL)
*endptr = (wchar_t *)nptr;
return (0.0);
}
- if ((buf = malloc(len + 1)) == NULL)
+ if ((buf = malloc(len + 1)) == NULL) {
+ if (endptr != NULL)
+ *endptr = (wchar_t *)nptr;
return (0.0);
+ }
mbs = initial;
wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
val = strtof_l(buf, &end, locale);
- if (endptr != NULL)
+ if (endptr != NULL) {
*endptr = (wchar_t *)nptr + (end - buf);
+ if (buf != end)
+ *endptr += spaces;
+ }
free(buf);
diff --git a/lib/libc/locale/wcstold.c b/lib/libc/locale/wcstold.c
index fcfd48f..89c92d9 100644
--- a/lib/libc/locale/wcstold.c
+++ b/lib/libc/locale/wcstold.c
@@ -48,32 +48,35 @@ wcstold_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
mbstate_t mbs;
long double val;
char *buf, *end;
- const wchar_t *wcp = nptr;
+ const wchar_t *wcp;
size_t len;
- size_t spaces = 0;
+ size_t spaces;
FIX_LOCALE(locale);
+ wcp = nptr;
+ spaces = 0;
while (iswspace_l(*wcp, locale)) {
wcp++;
spaces++;
}
- wcp = nptr;
mbs = initial;
if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) {
if (endptr != NULL)
*endptr = (wchar_t *)nptr;
return (0.0);
}
- if ((buf = malloc(len + 1)) == NULL)
+ if ((buf = malloc(len + 1)) == NULL) {
+ if (endptr != NULL)
+ *endptr = (wchar_t *)nptr;
return (0.0);
+ }
mbs = initial;
wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale);
val = strtold_l(buf, &end, locale);
if (endptr != NULL) {
- /* XXX Assume each wide char is one byte. */
*endptr = (wchar_t *)nptr + (end - buf);
if (buf != end)
*endptr += spaces;
diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h
index 502b548..77b9ff4 100644
--- a/lib/libc/locale/xlocale_private.h
+++ b/lib/libc/locale/xlocale_private.h
@@ -155,12 +155,11 @@ __attribute__((unused)) static void
xlocale_release(void *val)
{
struct xlocale_refcounted *obj = val;
- long count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
- if (count < 0) {
- if (0 != obj->destructor) {
- obj->destructor(obj);
- }
- }
+ long count;
+
+ count = atomic_fetchadd_long(&(obj->retain_count), -1) - 1;
+ if (count < 0 && obj->destructor != NULL)
+ obj->destructor(obj);
}
/**
diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c
index 8a9c59e..2c4cfe3 100644
--- a/lib/libc/net/base64.c
+++ b/lib/libc/net/base64.c
@@ -210,7 +210,7 @@ b64_pton(const char *src, u_char *target, size_t targsize)
break;
pos = strchr(Base64, ch);
- if (pos == 0) /* A non-base64 character. */
+ if (pos == NULL) /* A non-base64 character. */
return (-1);
switch (state) {
diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c
index f8633d5..4c04e9e 100644
--- a/lib/libc/net/getifaddrs.c
+++ b/lib/libc/net/getifaddrs.c
@@ -85,7 +85,7 @@ getifaddrs(struct ifaddrs **pif)
size_t needed;
char *buf;
char *next;
- struct ifaddrs *cif = 0;
+ struct ifaddrs *cif;
char *p, *p0;
struct rt_msghdr *rtm;
struct if_msghdrl *ifm;
@@ -214,6 +214,7 @@ getifaddrs(struct ifaddrs **pif)
ift = ifa;
idx = 0;
+ cif = NULL;
for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)(void *)next;
if (rtm->rtm_version != RTM_VERSION)
diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c
index 005de98..a549ff8 100644
--- a/lib/libc/net/getservent.c
+++ b/lib/libc/net/getservent.c
@@ -406,14 +406,14 @@ files_servent(void *retval, void *mdata, va_list ap)
continue;
gotname:
- if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
+ if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
rv = NS_SUCCESS;
break;
case nss_lt_id:
if (port != serv->s_port)
continue;
- if (proto == 0 || strcmp(serv->s_proto, proto) == 0)
+ if (proto == NULL || strcmp(serv->s_proto, proto) == 0)
rv = NS_SUCCESS;
break;
case nss_lt_all:
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 1ba9888..a65c2a8 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -214,7 +214,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
}
}
lport--;
- if (fd2p == 0) {
+ if (fd2p == NULL) {
_write(s, "", 1);
lport = 0;
} else {
diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c
index 1eece98..7dd7f04 100644
--- a/lib/libc/posix1e/acl_support_nfs4.c
+++ b/lib/libc/posix1e/acl_support_nfs4.c
@@ -81,7 +81,7 @@ static const char *
format_flag(uint32_t *var, const struct flagnames_struct *flags)
{
- for (; flags->name != 0; flags++) {
+ for (; flags->name != NULL; flags++) {
if ((flags->flag & *var) == 0)
continue;
diff --git a/lib/libc/resolv/mtctxres.c b/lib/libc/resolv/mtctxres.c
index f02a7f5..c2aea38 100644
--- a/lib/libc/resolv/mtctxres.c
+++ b/lib/libc/resolv/mtctxres.c
@@ -75,7 +75,7 @@ __res_init_ctx(void) {
return (0);
}
- if ((mt = malloc(sizeof (mtctxres_t))) == 0) {
+ if ((mt = malloc(sizeof(mtctxres_t))) == NULL) {
errno = ENOMEM;
return (-1);
}
@@ -94,10 +94,7 @@ __res_init_ctx(void) {
static void
__res_destroy_ctx(void *value) {
- mtctxres_t *mt = (mtctxres_t *)value;
-
- if (mt != 0)
- free(mt);
+ free(value);
}
#endif
@@ -130,9 +127,9 @@ ___mtctxres(void) {
* that fails return a global context.
*/
if (mt_key_initialized) {
- if (((mt = pthread_getspecific(key)) != 0) ||
+ if (((mt = pthread_getspecific(key)) != NULL) ||
(__res_init_ctx() == 0 &&
- (mt = pthread_getspecific(key)) != 0)) {
+ (mt = pthread_getspecific(key)) != NULL)) {
return (mt);
}
}
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 715b654..76ad311 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -315,7 +315,7 @@ __res_vinit(res_state statp, int preinit) {
while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n')
cp++;
*cp = '\0';
- *pp++ = 0;
+ *pp++ = NULL;
}
#define MATCH(line, name) \
@@ -391,7 +391,7 @@ __res_vinit(res_state statp, int preinit) {
while (*cp != '\0' && *cp != ' ' && *cp != '\t')
cp++;
*cp = '\0';
- *pp++ = 0;
+ *pp++ = NULL;
havesearch = 1;
continue;
}
diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c
index 5c5858d..45667c4 100644
--- a/lib/libc/resolv/res_mkupdate.c
+++ b/lib/libc/resolv/res_mkupdate.c
@@ -1175,7 +1175,7 @@ res_protocolname(int num) {
if (protolist == (struct valuelist *)0)
res_buildprotolist();
pp = cgetprotobynumber(num);
- if (pp == 0) {
+ if (pp == NULL) {
(void) sprintf(number, "%d", num);
return (number);
}
@@ -1190,7 +1190,7 @@ res_servicename(u_int16_t port, const char *proto) { /*%< Host byte order. */
if (servicelist == (struct valuelist *)0)
res_buildservicelist();
ss = cgetservbyport(htons(port), proto);
- if (ss == 0) {
+ if (ss == NULL) {
(void) sprintf(number, "%d", port);
return (number);
}
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..32bebeb 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,16 +76,16 @@ static struct authnone_private {
} *authnone_private;
AUTH *
-authnone_create()
+authnone_create(void)
{
struct authnone_private *ap = authnone_private;
XDR xdr_stream;
XDR *xdrs;
mutex_lock(&authnone_lock);
- if (ap == 0) {
- ap = (struct authnone_private *)calloc(1, sizeof (*ap));
- if (ap == 0) {
+ if (ap == NULL) {
+ ap = calloc(1, sizeof (*ap));
+ if (ap == NULL) {
mutex_unlock(&authnone_lock);
return (0);
}
@@ -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/auth_unix.c b/lib/libc/rpc/auth_unix.c
index 1ec5430..1404335 100644
--- a/lib/libc/rpc/auth_unix.c
+++ b/lib/libc/rpc/auth_unix.c
@@ -91,12 +91,7 @@ struct audata {
* Returns an auth handle with the given stuff in it.
*/
AUTH *
-authunix_create(machname, uid, gid, len, aup_gids)
- char *machname;
- u_int uid;
- u_int gid;
- int len;
- u_int *aup_gids;
+authunix_create(char *machname, u_int uid, u_int gid, int len, u_int *aup_gids)
{
struct authunix_parms aup;
char mymem[MAX_AUTH_BYTES];
@@ -182,7 +177,7 @@ authunix_create(machname, uid, gid, len, aup_gids)
* syscalls.
*/
AUTH *
-authunix_create_default()
+authunix_create_default(void)
{
AUTH *auth;
int ngids;
@@ -218,16 +213,13 @@ authunix_create_default()
/* ARGSUSED */
static void
-authunix_nextverf(auth)
- AUTH *auth;
+authunix_nextverf(AUTH *auth)
{
/* no action necessary */
}
static bool_t
-authunix_marshal(auth, xdrs)
- AUTH *auth;
- XDR *xdrs;
+authunix_marshal(AUTH *auth, XDR *xdrs)
{
struct audata *au;
@@ -239,9 +231,7 @@ authunix_marshal(auth, xdrs)
}
static bool_t
-authunix_validate(auth, verf)
- AUTH *auth;
- struct opaque_auth *verf;
+authunix_validate(AUTH *auth, struct opaque_auth *verf)
{
struct audata *au;
XDR xdrs;
@@ -317,8 +307,7 @@ done:
}
static void
-authunix_destroy(auth)
- AUTH *auth;
+authunix_destroy(AUTH *auth)
{
struct audata *au;
@@ -343,8 +332,7 @@ authunix_destroy(auth)
* sets private data, au_marshed and au_mpos
*/
static void
-marshal_new_auth(auth)
- AUTH *auth;
+marshal_new_auth(AUTH *auth)
{
XDR xdr_stream;
XDR *xdrs = &xdr_stream;
@@ -363,7 +351,7 @@ marshal_new_auth(auth)
}
static struct auth_ops *
-authunix_ops()
+authunix_ops(void)
{
static struct auth_ops ops;
diff --git a/lib/libc/rpc/authdes_prot.c b/lib/libc/rpc/authdes_prot.c
index ae12973..0d4bec0 100644
--- a/lib/libc/rpc/authdes_prot.c
+++ b/lib/libc/rpc/authdes_prot.c
@@ -49,9 +49,7 @@ __FBSDID("$FreeBSD$");
#define ATTEMPT(xdr_op) if (!(xdr_op)) return (FALSE)
bool_t
-xdr_authdes_cred(xdrs, cred)
- XDR *xdrs;
- struct authdes_cred *cred;
+xdr_authdes_cred(XDR *xdrs, struct authdes_cred *cred)
{
enum authdes_namekind *padc_namekind = &cred->adc_namekind;
/*
@@ -78,9 +76,7 @@ xdr_authdes_cred(xdrs, cred)
bool_t
-xdr_authdes_verf(xdrs, verf)
- XDR *xdrs;
- struct authdes_verf *verf;
+xdr_authdes_verf(XDR *xdrs, struct authdes_verf *verf)
{
/*
* Unrolled xdr
diff --git a/lib/libc/rpc/authunix_prot.c b/lib/libc/rpc/authunix_prot.c
index 42a5fad..cd6676b 100644
--- a/lib/libc/rpc/authunix_prot.c
+++ b/lib/libc/rpc/authunix_prot.c
@@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$");
* XDR for unix authentication parameters.
*/
bool_t
-xdr_authunix_parms(xdrs, p)
- XDR *xdrs;
- struct authunix_parms *p;
+xdr_authunix_parms(XDR *xdrs, struct authunix_parms *p)
{
u_int **paup_gids;
diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c
index c8b1646..8629cba 100644
--- a/lib/libc/rpc/bindresvport.c
+++ b/lib/libc/rpc/bindresvport.c
@@ -61,9 +61,7 @@ __FBSDID("$FreeBSD$");
* Bind a socket to a privileged IP port
*/
int
-bindresvport(sd, sin)
- int sd;
- struct sockaddr_in *sin;
+bindresvport(int sd, struct sockaddr_in *sin)
{
return bindresvport_sa(sd, (struct sockaddr *)sin);
}
@@ -72,9 +70,7 @@ bindresvport(sd, sin)
* Bind a socket to a privileged IP port
*/
int
-bindresvport_sa(sd, sa)
- int sd;
- struct sockaddr *sa;
+bindresvport_sa(int sd, struct sockaddr *sa)
{
int old, error, af;
struct sockaddr_storage myaddr;
diff --git a/lib/libc/rpc/clnt_bcast.c b/lib/libc/rpc/clnt_bcast.c
index 15b48dde..d98bd4e 100644
--- a/lib/libc/rpc/clnt_bcast.c
+++ b/lib/libc/rpc/clnt_bcast.c
@@ -225,21 +225,26 @@ __rpc_broadenable(int af, int s, struct broadif *bip)
return 0;
}
-
+/*
+ * rpc_broadcast_exp()
+ *
+ * prog - program number
+ * vers - version number
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * eachresult - call with each result obtained
+ * inittime - how long to wait initially
+ * waittime - maximum time to wait
+ * nettype - transport type
+ */
enum clnt_stat
-rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
- eachresult, inittime, waittime, nettype)
- rpcprog_t prog; /* program number */
- rpcvers_t vers; /* version number */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
- int inittime; /* how long to wait initially */
- int waittime; /* maximum time to wait */
- const char *nettype; /* transport type */
+rpc_broadcast_exp(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc,
+ xdrproc_t xargs, caddr_t argsp, xdrproc_t xresults, caddr_t resultsp,
+ resultproc_t eachresult, int inittime, int waittime,
+ const char *nettype)
{
enum clnt_stat stat = RPC_SUCCESS; /* Return status */
XDR xdr_stream; /* XDR stream */
@@ -251,7 +256,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;
@@ -647,19 +652,23 @@ done_broad:
return (stat);
}
-
+/*
+ * rpc_broadcast()
+ *
+ * prog - program number
+ * vers - version number
+ * proc - procedure number
+ * xargs - xdr routine for args
+ * argsp - pointer to args
+ * xresults - xdr routine for results
+ * resultsp - pointer to results
+ * eachresult - call with each result obtained
+ * nettype - transport type
+ */
enum clnt_stat
-rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
- eachresult, nettype)
- rpcprog_t prog; /* program number */
- rpcvers_t vers; /* version number */
- rpcproc_t proc; /* procedure number */
- xdrproc_t xargs; /* xdr routine for args */
- caddr_t argsp; /* pointer to args */
- xdrproc_t xresults; /* xdr routine for results */
- caddr_t resultsp; /* pointer to results */
- resultproc_t eachresult; /* call with each result obtained */
- const char *nettype; /* transport type */
+rpc_broadcast(rpcprog_t prog, rpcvers_t vers, rpcproc_t proc, xdrproc_t xargs,
+ caddr_t argsp, xdrproc_t xresults, caddr_t resultsp,
+ resultproc_t eachresult, const char *nettype)
{
enum clnt_stat dummy;
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/clnt_perror.c b/lib/libc/rpc/clnt_perror.c
index 5d87b0c..d674fbb 100644
--- a/lib/libc/rpc/clnt_perror.c
+++ b/lib/libc/rpc/clnt_perror.c
@@ -61,11 +61,11 @@ static char *auth_errmsg(enum auth_stat);
#define CLNT_PERROR_BUFLEN 256
static char *
-_buf()
+_buf(void)
{
- if (buf == 0)
- buf = (char *)malloc(CLNT_PERROR_BUFLEN);
+ if (buf == NULL)
+ buf = malloc(CLNT_PERROR_BUFLEN);
return (buf);
}
@@ -73,9 +73,7 @@ _buf()
* Print reply error info
*/
char *
-clnt_sperror(rpch, s)
- CLIENT *rpch;
- const char *s;
+clnt_sperror(CLIENT *rpch, const char *s)
{
struct rpc_err e;
char *err;
@@ -87,7 +85,7 @@ clnt_sperror(rpch, s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return (0);
len = CLNT_PERROR_BUFLEN;
strstart = str;
@@ -180,9 +178,7 @@ clnt_sperror(rpch, s)
}
void
-clnt_perror(rpch, s)
- CLIENT *rpch;
- const char *s;
+clnt_perror(CLIENT *rpch, const char *s)
{
assert(rpch != NULL);
@@ -217,8 +213,7 @@ static const char *const rpc_errlist[] = {
* This interface for use by clntrpc
*/
char *
-clnt_sperrno(stat)
- enum clnt_stat stat;
+clnt_sperrno(enum clnt_stat stat)
{
unsigned int errnum = stat;
@@ -230,16 +225,14 @@ clnt_sperrno(stat)
}
void
-clnt_perrno(num)
- enum clnt_stat num;
+clnt_perrno(enum clnt_stat num)
{
(void) fprintf(stderr, "%s\n", clnt_sperrno(num));
}
char *
-clnt_spcreateerror(s)
- const char *s;
+clnt_spcreateerror(const char *s)
{
char *str;
size_t len, i;
@@ -247,7 +240,7 @@ clnt_spcreateerror(s)
assert(s != NULL);
str = _buf(); /* side effect: sets CLNT_PERROR_BUFLEN */
- if (str == 0)
+ if (str == NULL)
return(0);
len = CLNT_PERROR_BUFLEN;
i = snprintf(str, len, "%s: ", s);
@@ -291,8 +284,7 @@ clnt_spcreateerror(s)
}
void
-clnt_pcreateerror(s)
- const char *s;
+clnt_pcreateerror(const char *s)
{
assert(s != NULL);
@@ -319,8 +311,7 @@ static const char *const auth_errlist[] = {
};
static char *
-auth_errmsg(stat)
- enum auth_stat stat;
+auth_errmsg(enum auth_stat stat)
{
unsigned int errnum = stat;
diff --git a/lib/libc/rpc/clnt_raw.c b/lib/libc/rpc/clnt_raw.c
index 26e2856..ad64112 100644
--- a/lib/libc/rpc/clnt_raw.c
+++ b/lib/libc/rpc/clnt_raw.c
@@ -87,9 +87,7 @@ static struct clnt_ops *clnt_raw_ops(void);
* Create a client handle for memory based rpc.
*/
CLIENT *
-clnt_raw_create(prog, vers)
- rpcprog_t prog;
- rpcvers_t vers;
+clnt_raw_create(rpcprog_t prog, rpcvers_t vers)
{
struct clntraw_private *clp;
struct rpc_msg call_msg;
@@ -142,14 +140,8 @@ clnt_raw_create(prog, vers)
/* ARGSUSED */
static enum clnt_stat
-clnt_raw_call(h, proc, xargs, argsp, xresults, resultsp, timeout)
- CLIENT *h;
- rpcproc_t proc;
- xdrproc_t xargs;
- void *argsp;
- xdrproc_t xresults;
- void *resultsp;
- struct timeval timeout;
+clnt_raw_call(CLIENT *h, rpcproc_t proc, xdrproc_t xargs, void *argsp,
+ xdrproc_t xresults, void *resultsp, struct timeval timeout)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -240,19 +232,14 @@ call_again:
/*ARGSUSED*/
static void
-clnt_raw_geterr(cl, err)
- CLIENT *cl;
- struct rpc_err *err;
+clnt_raw_geterr(CLIENT *cl, struct rpc_err *err)
{
}
/* ARGSUSED */
static bool_t
-clnt_raw_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_raw_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct clntraw_private *clp = clntraw_private;
XDR *xdrs = &clp->xdr_stream;
@@ -271,30 +258,25 @@ clnt_raw_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_raw_abort(cl)
- CLIENT *cl;
+clnt_raw_abort(CLIENT *cl)
{
}
/*ARGSUSED*/
static bool_t
-clnt_raw_control(cl, ui, str)
- CLIENT *cl;
- u_int ui;
- void *str;
+clnt_raw_control(CLIENT *cl, u_int ui, void *str)
{
return (FALSE);
}
/*ARGSUSED*/
static void
-clnt_raw_destroy(cl)
- CLIENT *cl;
+clnt_raw_destroy(CLIENT *cl)
{
}
static struct clnt_ops *
-clnt_raw_ops()
+clnt_raw_ops(void)
{
static struct clnt_ops ops;
diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c
index 3541205..4fc374a 100644
--- a/lib/libc/rpc/clnt_simple.c
+++ b/lib/libc/rpc/clnt_simple.c
@@ -107,17 +107,19 @@ rpc_call_key_init(void)
* the future calls to same prog, vers, host and nettype combination.
*
* The total time available is 25 seconds.
+ *
+ * host - host name
+ * prognum - program number
+ * versnum - version number
+ * procnum - procedure number
+ * inproc, outproc - in/out XDR procedures
+ * in, out - recv/send data
+ * nettype - nettype
*/
enum clnt_stat
-rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
- const char *host; /* host name */
- rpcprog_t prognum; /* program number */
- rpcvers_t versnum; /* version number */
- rpcproc_t procnum; /* procedure number */
- xdrproc_t inproc, outproc; /* in/out XDR procedures */
- const char *in;
- char *out; /* recv/send data */
- const char *nettype; /* nettype */
+rpc_call(const char *host, const rpcprog_t prognum, const rpcvers_t versnum,
+ const rpcproc_t procnum, const xdrproc_t inproc, const char *in,
+ const xdrproc_t outproc, char *out, const char *nettype)
{
struct rpc_call_private *rcp = (struct rpc_call_private *) 0;
enum clnt_stat clnt_stat;
diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c
index 2c18850..112b32e 100644
--- a/lib/libc/rpc/clnt_vc.c
+++ b/lib/libc/rpc/clnt_vc.c
@@ -154,15 +154,17 @@ static const char __no_mem_str[] = "out of memory";
* set this something more useful.
*
* fd should be an open socket
+ *
+ * fd - open file descriptor
+ * raddr - servers address
+ * prog - program number
+ * vers - version number
+ * sendsz - buffer send size
+ * recvsz - buffer recv size
*/
CLIENT *
-clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
- int fd; /* open file descriptor */
- const struct netbuf *raddr; /* servers address */
- const rpcprog_t prog; /* program number */
- const rpcvers_t vers; /* version number */
- u_int sendsz; /* buffer recv size */
- u_int recvsz; /* buffer send size */
+clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
+ const rpcvers_t vers, u_int sendsz, u_int recvsz)
{
CLIENT *cl; /* client handle */
struct ct_data *ct = NULL; /* client handle */
@@ -312,14 +314,8 @@ err:
}
static enum clnt_stat
-clnt_vc_call(cl, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
- CLIENT *cl;
- rpcproc_t proc;
- xdrproc_t xdr_args;
- void *args_ptr;
- xdrproc_t xdr_results;
- void *results_ptr;
- struct timeval timeout;
+clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr,
+ xdrproc_t xdr_results, void *results_ptr, struct timeval timeout)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
XDR *xdrs = &(ct->ct_xdrs);
@@ -462,9 +458,7 @@ call_again:
}
static void
-clnt_vc_geterr(cl, errp)
- CLIENT *cl;
- struct rpc_err *errp;
+clnt_vc_geterr(CLIENT *cl, struct rpc_err *errp)
{
struct ct_data *ct;
@@ -476,10 +470,7 @@ clnt_vc_geterr(cl, errp)
}
static bool_t
-clnt_vc_freeres(cl, xdr_res, res_ptr)
- CLIENT *cl;
- xdrproc_t xdr_res;
- void *res_ptr;
+clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct ct_data *ct;
XDR *xdrs;
@@ -508,16 +499,26 @@ clnt_vc_freeres(cl, xdr_res, res_ptr)
/*ARGSUSED*/
static void
-clnt_vc_abort(cl)
- CLIENT *cl;
+clnt_vc_abort(CLIENT *cl)
+{
+}
+
+static __inline void
+htonlp(void *dst, const void *src, uint32_t incr)
+{
+ /* We are aligned, so we think */
+ *(uint32_t *)dst = htonl(*(const uint32_t *)src + incr);
+}
+
+static __inline void
+ntohlp(void *dst, const void *src)
{
+ /* We are aligned, so we think */
+ *(uint32_t *)dst = htonl(*(const uint32_t *)src);
}
static bool_t
-clnt_vc_control(cl, request, info)
- CLIENT *cl;
- u_int request;
- void *info;
+clnt_vc_control(CLIENT *cl, u_int request, void *info)
{
struct ct_data *ct;
void *infop = info;
@@ -590,14 +591,12 @@ clnt_vc_control(cl, request, info)
* first element in the call structure
* This will get the xid of the PREVIOUS call
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
+ ntohlp(info, &ct->ct_u.ct_mcalli);
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
- *(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
- htonl(*((u_int32_t *)info) + 1);
/* increment by 1 as clnt_vc_call() decrements once */
+ htonlp(&ct->ct_u.ct_mcalli, info, 1);
break;
case CLGET_VERS:
/*
@@ -606,15 +605,11 @@ clnt_vc_control(cl, request, info)
* begining of the RPC header. MUST be changed if the
* call_struct is changed
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 4 * BYTES_PER_XDR_UNIT));
+ ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
break;
case CLSET_VERS:
- *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 4 * BYTES_PER_XDR_UNIT) =
- htonl(*(u_int32_t *)info);
+ htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
break;
case CLGET_PROG:
@@ -624,15 +619,11 @@ clnt_vc_control(cl, request, info)
* begining of the RPC header. MUST be changed if the
* call_struct is changed
*/
- *(u_int32_t *)info =
- ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 3 * BYTES_PER_XDR_UNIT));
+ ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
break;
case CLSET_PROG:
- *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
- 3 * BYTES_PER_XDR_UNIT) =
- htonl(*(u_int32_t *)info);
+ htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
break;
default:
@@ -645,8 +636,7 @@ clnt_vc_control(cl, request, info)
static void
-clnt_vc_destroy(cl)
- CLIENT *cl;
+clnt_vc_destroy(CLIENT *cl)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
int ct_fd = ct->ct_fd;
@@ -684,10 +674,7 @@ clnt_vc_destroy(cl)
* around for the rpc level.
*/
static int
-read_vc(ctp, buf, len)
- void *ctp;
- void *buf;
- int len;
+read_vc(void *ctp, void *buf, int len)
{
struct sockaddr sa;
socklen_t sal;
@@ -741,10 +728,7 @@ read_vc(ctp, buf, len)
}
static int
-write_vc(ctp, buf, len)
- void *ctp;
- void *buf;
- int len;
+write_vc(void *ctp, void *buf, int len)
{
struct sockaddr sa;
socklen_t sal;
@@ -775,7 +759,7 @@ write_vc(ctp, buf, len)
}
static struct clnt_ops *
-clnt_vc_ops()
+clnt_vc_ops(void)
{
static struct clnt_ops ops;
sigset_t mask, newmask;
@@ -803,18 +787,14 @@ clnt_vc_ops()
* Note this is different from time_not_ok in clnt_dg.c
*/
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);
}
static int
-__msgread(sock, buf, cnt)
- int sock;
- void *buf;
- size_t cnt;
+__msgread(int sock, void *buf, size_t cnt)
{
struct iovec iov[1];
struct msghdr msg;
@@ -839,10 +819,7 @@ __msgread(sock, buf, cnt)
}
static int
-__msgwrite(sock, buf, cnt)
- int sock;
- void *buf;
- size_t cnt;
+__msgwrite(int sock, void *buf, size_t cnt)
{
struct iovec iov[1];
struct msghdr msg;
diff --git a/lib/libc/rpc/crypt_client.c b/lib/libc/rpc/crypt_client.c
index 4e5c793..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;
@@ -64,6 +61,7 @@ _des_crypt_call(buf, len, dparms)
}
if (nconf == NULL) {
warnx("getnetconfig: %s", nc_sperror());
+ endnetconfig(localhandle);
return(DESERR_HWERROR);
}
clnt = clnt_tp_create(NULL, CRYPT_PROG, CRYPT_VERS, nconf);
diff --git a/lib/libc/rpc/des_crypt.c b/lib/libc/rpc/des_crypt.c
index ace8ed6..236e9ed 100644
--- a/lib/libc/rpc/des_crypt.c
+++ b/lib/libc/rpc/des_crypt.c
@@ -41,7 +41,7 @@ static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02
__FBSDID("$FreeBSD$");
static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * );
-int (*__des_crypt_LOCAL)() = 0;
+int (*__des_crypt_LOCAL)(char *, unsigned, struct desparams *) = 0;
extern int _des_crypt_call(char *, int, struct desparams *);
/*
* Copy 8 bytes
@@ -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/getnetconfig.c b/lib/libc/rpc/getnetconfig.c
index 9220b1c..38754bb 100644
--- a/lib/libc/rpc/getnetconfig.c
+++ b/lib/libc/rpc/getnetconfig.c
@@ -147,7 +147,7 @@ nc_key_init(void)
#define MAXNETCONFIGLINE 1000
static int *
-__nc_error()
+__nc_error(void)
{
static int nc_error = 0;
int *nc_addr;
@@ -193,7 +193,7 @@ __nc_error()
* the netconfig database is not present).
*/
void *
-setnetconfig()
+setnetconfig(void)
{
struct netconfig_vars *nc_vars;
@@ -239,8 +239,7 @@ setnetconfig()
*/
struct netconfig *
-getnetconfig(handlep)
-void *handlep;
+getnetconfig(void *handlep)
{
struct netconfig_vars *ncp = (struct netconfig_vars *)handlep;
char *stringp; /* tmp string pointer */
@@ -377,8 +376,7 @@ void *handlep;
* previously).
*/
int
-endnetconfig(handlep)
-void *handlep;
+endnetconfig(void *handlep)
{
struct netconfig_vars *nc_handlep = (struct netconfig_vars *)handlep;
@@ -443,8 +441,7 @@ void *handlep;
*/
struct netconfig *
-getnetconfigent(netid)
- const char *netid;
+getnetconfigent(const char *netid)
{
FILE *file; /* NETCONFIG db's file pointer */
char *linep; /* holds current netconfig line */
@@ -535,8 +532,7 @@ getnetconfigent(netid)
*/
void
-freenetconfigent(netconfigp)
- struct netconfig *netconfigp;
+freenetconfigent(struct netconfig *netconfigp)
{
if (netconfigp != NULL) {
free(netconfigp->nc_netid); /* holds all netconfigp's strings */
@@ -556,12 +552,13 @@ freenetconfigent(netconfigp)
* Note that we modify stringp (putting NULLs after tokens) and
* we set the ncp's string field pointers to point to these tokens within
* stringp.
+ *
+ * stringp - string to parse
+ * ncp - where to put results
*/
static int
-parse_ncp(stringp, ncp)
-char *stringp; /* string to parse */
-struct netconfig *ncp; /* where to put results */
+parse_ncp(char *stringp, struct netconfig *ncp)
{
char *tokenp; /* for processing tokens */
char *lasts;
@@ -652,7 +649,7 @@ struct netconfig *ncp; /* where to put results */
* Returns a string describing the reason for failure.
*/
char *
-nc_sperror()
+nc_sperror(void)
{
const char *message;
@@ -683,8 +680,7 @@ nc_sperror()
* Prints a message onto standard error describing the reason for failure.
*/
void
-nc_perror(s)
- const char *s;
+nc_perror(const char *s)
{
fprintf(stderr, "%s: %s\n", s, nc_sperror());
}
@@ -693,8 +689,7 @@ nc_perror(s)
* Duplicates the matched netconfig buffer.
*/
static struct netconfig *
-dup_ncp(ncp)
-struct netconfig *ncp;
+dup_ncp(struct netconfig *ncp)
{
struct netconfig *p;
char *tmp, *tmp2;
diff --git a/lib/libc/rpc/getnetpath.c b/lib/libc/rpc/getnetpath.c
index f68345c..8d31136 100644
--- a/lib/libc/rpc/getnetpath.c
+++ b/lib/libc/rpc/getnetpath.c
@@ -82,7 +82,7 @@ char *_get_next_token(char *, int);
*/
void *
-setnetpath()
+setnetpath(void)
{
struct netpath_vars *np_sessionp; /* this session's variables */
@@ -141,8 +141,7 @@ failed:
*/
struct netconfig *
-getnetpath(handlep)
- void *handlep;
+getnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netconfig *ncp = NULL; /* temp. holds a netconfig session */
@@ -197,8 +196,7 @@ getnetpath(handlep)
* (e.g. if setnetpath() was not called previously.
*/
int
-endnetpath(handlep)
- void *handlep;
+endnetpath(void *handlep)
{
struct netpath_vars *np_sessionp = (struct netpath_vars *)handlep;
struct netpath_chain *chainp, *lastp;
@@ -231,12 +229,12 @@ endnetpath(handlep)
* Returns pointer to the rest-of-the-string after the current token.
* The token itself starts at arg, and we null terminate it. We return NULL
* if either the arg is empty, or if this is the last token.
+ *
+ * npp - string
+ * token - char to parse string for
*/
-
char *
-_get_next_token(npp, token)
-char *npp; /* string */
-int token; /* char to parse string for */
+_get_next_token(char *npp, int token)
{
char *cp; /* char pointer */
char *np; /* netpath pointer */
diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c
index 143c0fc..4c80685 100644
--- a/lib/libc/rpc/getpublickey.c
+++ b/lib/libc/rpc/getpublickey.c
@@ -56,15 +56,13 @@ __FBSDID("$FreeBSD$");
/*
* Hack to let ypserv/rpc.nisd use AUTH_DES.
*/
-int (*__getpublickey_LOCAL)() = 0;
+int (*__getpublickey_LOCAL)(const char *, char *) = 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/getrpcent.3 b/lib/libc/rpc/getrpcent.3
index 1a999eb..e36d31c 100644
--- a/lib/libc/rpc/getrpcent.3
+++ b/lib/libc/rpc/getrpcent.3
@@ -2,7 +2,7 @@
.\" $NetBSD: getrpcent.3,v 1.6 1998/02/05 18:49:06 perry Exp $
.\" $FreeBSD$
.\"
-.Dd December 14, 1987
+.Dd February 26, 2016
.Dt GETRPCENT 3
.Os
.Sh NAME
@@ -19,7 +19,7 @@
.Ft struct rpcent *
.Fn getrpcent void
.Ft struct rpcent *
-.Fn getrpcbyname "char *name"
+.Fn getrpcbyname "const char *name"
.Ft struct rpcent *
.Fn getrpcbynumber "int number"
.Ft void
diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c
index 54c403e..8e74737 100644
--- a/lib/libc/rpc/getrpcent.c
+++ b/lib/libc/rpc/getrpcent.c
@@ -971,7 +971,7 @@ getrpc(int (*fn)(union key, struct rpcent *, char *, size_t, struct rpcent **),
}
struct rpcent *
-getrpcbyname(char *name)
+getrpcbyname(const char *name)
{
union key key;
@@ -991,7 +991,7 @@ getrpcbynumber(int number)
}
struct rpcent *
-getrpcent()
+getrpcent(void)
{
union key key;
@@ -1025,7 +1025,7 @@ setrpcent(int stayopen)
}
void
-endrpcent()
+endrpcent(void)
{
#ifdef NS_CACHING
static const nss_cache_info cache_info = NS_MP_CACHE_INFO_INITIALIZER(
diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c
index 1ceaa3f..b365678 100644
--- a/lib/libc/rpc/getrpcport.c
+++ b/lib/libc/rpc/getrpcport.c
@@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
int
-getrpcport(host, prognum, versnum, proto)
- char *host;
- int prognum, versnum, proto;
+getrpcport(char *host, int prognum, int versnum, int proto)
{
struct sockaddr_in addr;
struct hostent *hp;
diff --git a/lib/libc/rpc/key_call.c b/lib/libc/rpc/key_call.c
index 3864061..b9bc77a 100644
--- a/lib/libc/rpc/key_call.c
+++ b/lib/libc/rpc/key_call.c
@@ -81,15 +81,14 @@ __FBSDID("$FreeBSD$");
* implementations of these functions, and to call those in key_call().
*/
-cryptkeyres *(*__key_encryptsession_pk_LOCAL)() = 0;
-cryptkeyres *(*__key_decryptsession_pk_LOCAL)() = 0;
-des_block *(*__key_gendes_LOCAL)() = 0;
+cryptkeyres *(*__key_encryptsession_pk_LOCAL)(uid_t, void *arg) = 0;
+cryptkeyres *(*__key_decryptsession_pk_LOCAL)(uid_t, void *arg) = 0;
+des_block *(*__key_gendes_LOCAL)(uid_t, void *) = 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/mt_misc.c b/lib/libc/rpc/mt_misc.c
index 54712b0..a1b8057 100644
--- a/lib/libc/rpc/mt_misc.c
+++ b/lib/libc/rpc/mt_misc.c
@@ -93,9 +93,9 @@ rce_key_init(void)
}
struct rpc_createerr *
-__rpc_createerr()
+__rpc_createerr(void)
{
- struct rpc_createerr *rce_addr = 0;
+ struct rpc_createerr *rce_addr = NULL;
if (thr_main())
return (&rpc_createerr);
diff --git a/lib/libc/rpc/netname.c b/lib/libc/rpc/netname.c
index 7b1661e..77b522b 100644
--- a/lib/libc/rpc/netname.c
+++ b/lib/libc/rpc/netname.c
@@ -79,8 +79,7 @@ static char *OPSYS = "unix";
* Figure out my fully qualified network name
*/
int
-getnetname(name)
- char name[MAXNETNAMELEN+1];
+getnetname(char name[MAXNETNAMELEN+1])
{
uid_t uid;
@@ -97,10 +96,7 @@ getnetname(name)
* Convert unix cred to network-name
*/
int
-user2netname(netname, uid, domain)
- char netname[MAXNETNAMELEN + 1];
- const uid_t uid;
- const char *domain;
+user2netname(char netname[MAXNETNAMELEN + 1], const uid_t uid, const char *domain)
{
char *dfltdom;
@@ -122,10 +118,7 @@ user2netname(netname, uid, domain)
* Convert host to network-name
*/
int
-host2netname(netname, host, domain)
- char netname[MAXNETNAMELEN + 1];
- const char *host;
- const char *domain;
+host2netname(char netname[MAXNETNAMELEN + 1], const char *host, const char *domain)
{
char *dfltdom;
char hostname[MAXHOSTNAMELEN+1];
diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c
index 6359667..c29f271 100644
--- a/lib/libc/rpc/netnamer.c
+++ b/lib/libc/rpc/netnamer.c
@@ -68,12 +68,8 @@ static int _getgroups( char *, gid_t * );
* Convert network-name into unix credential
*/
int
-netname2user(netname, uidp, gidp, gidlenp, gidlist)
- char netname[MAXNETNAMELEN + 1];
- uid_t *uidp;
- gid_t *gidp;
- int *gidlenp;
- gid_t *gidlist;
+netname2user(char netname[MAXNETNAMELEN + 1], uid_t *uidp, gid_t *gidp,
+ int *gidlenp, gid_t *gidlist)
{
char *p;
int gidlen;
@@ -149,9 +145,7 @@ netname2user(netname, uidp, gidp, gidlenp, gidlist)
*/
static int
-_getgroups(uname, groups)
- char *uname;
- gid_t groups[NGRPS];
+_getgroups(char *uname, gid_t groups[NGRPS])
{
gid_t ngroups = 0;
struct group *grp;
@@ -190,10 +184,7 @@ toomany:
* Convert network-name to hostname
*/
int
-netname2host(netname, hostname, hostlen)
- char netname[MAXNETNAMELEN + 1];
- char *hostname;
- int hostlen;
+netname2host(char netname[MAXNETNAMELEN + 1], char *hostname, int hostlen)
{
int err;
char valbuf[1024];
@@ -239,8 +230,7 @@ netname2host(netname, hostname, hostlen)
* network information service.
*/
int
-getnetid(key, ret)
- char *key, *ret;
+getnetid(char *key, char *ret)
{
char buf[1024]; /* big enough */
char *res;
diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c
index 34e254a..1049005 100644
--- a/lib/libc/rpc/pmap_getmaps.c
+++ b/lib/libc/rpc/pmap_getmaps.c
@@ -70,8 +70,7 @@ __FBSDID("$FreeBSD$");
* Calls the pmap service remotely to do get the maps.
*/
struct pmaplist *
-pmap_getmaps(address)
- struct sockaddr_in *address;
+pmap_getmaps(struct sockaddr_in *address)
{
struct pmaplist *head = NULL;
int sock = -1;
diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c
index e06f958..c1e0c7a 100644
--- a/lib/libc/rpc/pmap_getport.c
+++ b/lib/libc/rpc/pmap_getport.c
@@ -66,11 +66,8 @@ static const struct timeval tottimeout = { 60, 0 };
* Returns 0 if no map exists.
*/
u_short
-pmap_getport(address, program, version, protocol)
- struct sockaddr_in *address;
- u_long program;
- u_long version;
- u_int protocol;
+pmap_getport(struct sockaddr_in *address, u_long program, u_long version,
+ u_int protocol)
{
u_short port = 0;
int sock = -1;
diff --git a/lib/libc/rpc/pmap_prot.c b/lib/libc/rpc/pmap_prot.c
index 1967467..bf01672 100644
--- a/lib/libc/rpc/pmap_prot.c
+++ b/lib/libc/rpc/pmap_prot.c
@@ -52,9 +52,7 @@ __FBSDID("$FreeBSD$");
bool_t
-xdr_pmap(xdrs, regs)
- XDR *xdrs;
- struct pmap *regs;
+xdr_pmap(XDR *xdrs, struct pmap *regs)
{
assert(xdrs != NULL);
diff --git a/lib/libc/rpc/pmap_prot2.c b/lib/libc/rpc/pmap_prot2.c
index 56a1198..f892afb 100644
--- a/lib/libc/rpc/pmap_prot2.c
+++ b/lib/libc/rpc/pmap_prot2.c
@@ -90,9 +90,7 @@ __FBSDID("$FreeBSD$");
* this sounds like a job for xdr_reference!
*/
bool_t
-xdr_pmaplist(xdrs, rp)
- XDR *xdrs;
- struct pmaplist **rp;
+xdr_pmaplist(XDR *xdrs, struct pmaplist **rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -134,9 +132,7 @@ xdr_pmaplist(xdrs, rp)
* functionality to xdr_pmaplist().
*/
bool_t
-xdr_pmaplist_ptr(xdrs, rp)
- XDR *xdrs;
- struct pmaplist *rp;
+xdr_pmaplist_ptr(XDR *xdrs, struct pmaplist *rp)
{
return xdr_pmaplist(xdrs, (struct pmaplist **)(void *)rp);
}
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index fe7b432..1241204 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -76,14 +76,9 @@ static const struct timeval timeout = { 3, 0 };
* programs to do a lookup and call in one step.
*/
enum clnt_stat
-pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
- port_ptr)
- struct sockaddr_in *addr;
- u_long prog, vers, proc;
- xdrproc_t xdrargs, xdrres;
- caddr_t argsp, resp;
- struct timeval tout;
- u_long *port_ptr;
+pmap_rmtcall(struct sockaddr_in *addr, u_long prog, u_long vers, u_long proc,
+ xdrproc_t xdrargs, caddr_t argsp, xdrproc_t xdrres, caddr_t resp,
+ struct timeval tout, u_long *port_ptr)
{
int sock = -1;
CLIENT *client;
@@ -122,9 +117,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
* written for XDR_ENCODE direction only
*/
bool_t
-xdr_rmtcall_args(xdrs, cap)
- XDR *xdrs;
- struct rmtcallargs *cap;
+xdr_rmtcall_args(XDR *xdrs, struct rmtcallargs *cap)
{
u_int lenposition, argposition, position;
@@ -156,9 +149,7 @@ xdr_rmtcall_args(xdrs, cap)
* written for XDR_DECODE direction only
*/
bool_t
-xdr_rmtcallres(xdrs, crp)
- XDR *xdrs;
- struct rmtcallres *crp;
+xdr_rmtcallres(XDR *xdrs, struct rmtcallres *crp)
{
caddr_t port_ptr;
diff --git a/lib/libc/rpc/rpc_callmsg.c b/lib/libc/rpc/rpc_callmsg.c
index 5b7ea49..4063e8b 100644
--- a/lib/libc/rpc/rpc_callmsg.c
+++ b/lib/libc/rpc/rpc_callmsg.c
@@ -54,9 +54,7 @@ __FBSDID("$FreeBSD$");
* XDR a call message
*/
bool_t
-xdr_callmsg(xdrs, cmsg)
- XDR *xdrs;
- struct rpc_msg *cmsg;
+xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsg)
{
enum msg_type *prm_direction;
int32_t *buf;
@@ -195,11 +193,11 @@ xdr_callmsg(xdrs, cmsg)
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *) prm_direction) &&
(cmsg->rm_direction == CALL) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
(cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
+ xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) &&
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_vers)) &&
+ xdr_rpcproc(xdrs, &(cmsg->rm_call.cb_proc)) &&
xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
return (FALSE);
diff --git a/lib/libc/rpc/rpc_com.h b/lib/libc/rpc/rpc_com.h
index 770faf9..bfa6a0b 100644
--- a/lib/libc/rpc/rpc_com.h
+++ b/lib/libc/rpc/rpc_com.h
@@ -86,8 +86,8 @@ bool_t __xdrrec_setnonblock(XDR *, int);
bool_t __xdrrec_getrec(XDR *, enum xprt_stat *, bool_t);
void __xprt_unregister_unlocked(SVCXPRT *);
-SVCXPRT **__svc_xports;
-int __svc_maxrec;
+extern SVCXPRT **__svc_xports;
+extern int __svc_maxrec;
__END_DECLS
diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c
index 57ef267..fe970e1 100644
--- a/lib/libc/rpc/rpc_generic.c
+++ b/lib/libc/rpc/rpc_generic.c
@@ -111,7 +111,7 @@ static int getnettype(const char *);
* expensive call every time.
*/
int
-__rpc_dtbsize()
+__rpc_dtbsize(void)
{
static int tbsize;
struct rlimit rl;
@@ -132,12 +132,12 @@ __rpc_dtbsize()
/*
* Find the appropriate buffer size
+ *
+ * size - Size requested
*/
u_int
/*ARGSUSED*/
-__rpc_get_t_size(af, proto, size)
- int af, proto;
- int size; /* Size requested */
+__rpc_get_t_size(int af, int proto, int size)
{
int maxsize, defsize;
@@ -164,8 +164,7 @@ __rpc_get_t_size(af, proto, size)
* Find the appropriate address buffer size
*/
u_int
-__rpc_get_a_size(af)
- int af;
+__rpc_get_a_size(int af)
{
switch (af) {
case AF_INET:
@@ -184,8 +183,7 @@ __rpc_get_a_size(af)
#if 0
static char *
-strlocase(p)
- char *p;
+strlocase(char *p)
{
char *t = p;
@@ -201,8 +199,7 @@ strlocase(p)
* If nettype is NULL, it defaults to NETPATH.
*/
static int
-getnettype(nettype)
- const char *nettype;
+getnettype(const char *nettype)
{
int i;
@@ -237,8 +234,7 @@ keys_init(void)
* This should be freed by calling freenetconfigent()
*/
struct netconfig *
-__rpc_getconfip(nettype)
- const char *nettype;
+__rpc_getconfip(const char *nettype)
{
char *netid;
char *netid_tcp = (char *) NULL;
@@ -309,8 +305,7 @@ __rpc_getconfip(nettype)
* __rpc_getconf().
*/
void *
-__rpc_setconf(nettype)
- const char *nettype;
+__rpc_setconf(const char *nettype)
{
struct handle *handle;
@@ -353,8 +348,7 @@ failed:
* __rpc_setconf() should have been called previously.
*/
struct netconfig *
-__rpc_getconf(vhandle)
- void *vhandle;
+__rpc_getconf(void *vhandle)
{
struct handle *handle;
struct netconfig *nconf;
@@ -430,8 +424,7 @@ __rpc_getconf(vhandle)
}
void
-__rpc_endconf(vhandle)
- void * vhandle;
+__rpc_endconf(void *vhandle)
{
struct handle *handle;
@@ -452,8 +445,7 @@ __rpc_endconf(vhandle)
* Returns NULL if fails, else a non-NULL pointer.
*/
void *
-rpc_nullproc(clnt)
- CLIENT *clnt;
+rpc_nullproc(CLIENT *clnt)
{
struct timeval TIMEOUT = {25, 0};
@@ -469,8 +461,7 @@ rpc_nullproc(clnt)
* one succeeds in finding the netconf for the given fd.
*/
struct netconfig *
-__rpcgettp(fd)
- int fd;
+__rpcgettp(int fd)
{
const char *netid;
struct __rpc_sockinfo si;
diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c
index 20dc8fa..50d11cc 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;
@@ -125,9 +119,9 @@ xdr_accepted_reply(xdrs, ar)
return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
case PROG_MISMATCH:
- if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
+ if (!xdr_rpcvers(xdrs, &(ar->ar_vers.low)))
return (FALSE);
- return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
+ return (xdr_rpcvers(xdrs, &(ar->ar_vers.high)));
case GARBAGE_ARGS:
case SYSTEM_ERR:
@@ -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;
@@ -160,9 +152,9 @@ xdr_rejected_reply(xdrs, rr)
switch (rr->rj_stat) {
case RPC_MISMATCH:
- if (! xdr_u_int32_t(xdrs, &(rr->rj_vers.low)))
+ if (! xdr_rpcvers(xdrs, &(rr->rj_vers.low)))
return (FALSE);
- return (xdr_u_int32_t(xdrs, &(rr->rj_vers.high)));
+ return (xdr_rpcvers(xdrs, &(rr->rj_vers.high)));
case AUTH_ERROR:
prj_why = &rr->rj_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;
@@ -229,8 +217,8 @@ xdr_callhdr(xdrs, cmsg)
(xdrs->x_op == XDR_ENCODE) &&
xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *) prm_direction) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
- xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) )
+ xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+ xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) )
return (xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)));
return (FALSE);
}
@@ -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);
@@ -279,9 +265,7 @@ accepted(acpt_stat, error)
}
static void
-rejected(rjct_stat, error)
- enum reject_stat rjct_stat;
- struct rpc_err *error;
+rejected(enum reject_stat rjct_stat, struct rpc_err *error)
{
assert(error != NULL);
@@ -306,9 +290,7 @@ rejected(rjct_stat, error)
* given a reply message, fills in the error
*/
void
-_seterr_reply(msg, error)
- struct rpc_msg *msg;
- struct rpc_err *error;
+_seterr_reply(struct rpc_msg *msg, struct rpc_err *error)
{
assert(msg != NULL);
diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
index ff7a289..64516a9 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,23 +263,21 @@ svcfd_create(fd, sendsize, recvsize)
SVCXPRT *
-svcudp_create(fd)
- int fd;
+svcudp_create(int fd)
{
return svc_com_create(fd, UDPMSGSIZE, UDPMSGSIZE, "udp");
}
SVCXPRT *
-svcraw_create()
+svcraw_create(void)
{
return svc_raw_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;
@@ -503,11 +465,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;
@@ -567,10 +525,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 da7f014..f9d89c1 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;
@@ -197,10 +193,8 @@ delete_cache(addr)
}
static void
-add_cache(host, netid, taddr, uaddr)
- const char *host, *netid;
- char *uaddr;
- struct netbuf *taddr;
+add_cache(const char *host, const char *netid, struct netbuf *taddr,
+ char *uaddr)
{
struct address_cache *ad_cache, *cptr, *prevptr;
@@ -280,10 +274,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;
@@ -429,7 +420,7 @@ getclnthandle(host, nconf, targaddr)
* rpcbind. Returns NULL on error and free's everything.
*/
static CLIENT *
-local_rpcb()
+local_rpcb(void)
{
CLIENT *client;
static struct netconfig *loopnconf;
@@ -525,13 +516,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;
@@ -588,10 +579,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;
@@ -628,9 +616,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;
@@ -661,7 +647,7 @@ got_entry(relp, nconf)
* local transport.
*/
static bool_t
-__rpcbind_is_up()
+__rpcbind_is_up(void)
{
struct netconfig *nconf;
struct sockaddr_un sun;
@@ -716,13 +702,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;
@@ -1028,13 +1010,9 @@ 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;
+bool_t
+rpcb_getaddr(rpcprog_t program, rpcvers_t version, const struct netconfig *nconf,
+ struct netbuf *address, const char *host)
{
struct netbuf *na;
@@ -1065,9 +1043,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;
@@ -1115,19 +1091,20 @@ done:
* which will look up a service program in the address maps, and then
* remotely call that routine with the given parameters. This allows
* programs to do a lookup and call in one step.
-*/
+ *
+ * nconf -Netconfig structure
+ * host - Remote host name
+ * proc - Remote proc identifiers
+ * xdrargs, xdrres; XDR routines
+ * argsp, resp - Argument and Result
+ * tout - Timeout value for this call
+ * addr_ptr - Preallocated netbuf address
+ */
enum clnt_stat
-rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
- xdrres, resp, tout, addr_ptr)
- const struct netconfig *nconf; /* Netconfig structure */
- const char *host; /* Remote host name */
- rpcprog_t prog;
- rpcvers_t vers;
- rpcproc_t proc; /* Remote proc identifiers */
- xdrproc_t xdrargs, xdrres; /* XDR routines */
- caddr_t argsp, resp; /* Argument and Result */
- struct timeval tout; /* Timeout value for this call */
- const struct netbuf *addr_ptr; /* Preallocated netbuf address */
+rpcb_rmtcall(const struct netconfig *nconf, const char *host, rpcprog_t prog,
+ rpcvers_t vers, rpcproc_t proc, xdrproc_t xdrargs, caddr_t argsp,
+ xdrproc_t xdrres, caddr_t resp, struct timeval tout,
+ const struct netbuf *addr_ptr)
{
CLIENT *client;
enum clnt_stat stat;
@@ -1198,9 +1175,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;
@@ -1259,9 +1234,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;
@@ -1293,9 +1266,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/rpcb_prot.c b/lib/libc/rpc/rpcb_prot.c
index 92463c0..c462e19 100644
--- a/lib/libc/rpc/rpcb_prot.c
+++ b/lib/libc/rpc/rpcb_prot.c
@@ -54,14 +54,12 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
bool_t
-xdr_rpcb(xdrs, objp)
- XDR *xdrs;
- RPCB *objp;
+xdr_rpcb(XDR *xdrs, RPCB *objp)
{
- if (!xdr_u_int32_t(xdrs, &objp->r_prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->r_prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->r_vers)) {
return (FALSE);
}
if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
@@ -100,9 +98,7 @@ xdr_rpcb(xdrs, objp)
*/
bool_t
-xdr_rpcblist_ptr(xdrs, rp)
- XDR *xdrs;
- rpcblist_ptr *rp;
+xdr_rpcblist_ptr(XDR *xdrs, rpcblist_ptr *rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -154,9 +150,7 @@ xdr_rpcblist_ptr(xdrs, rp)
* functionality to xdr_rpcblist_ptr().
*/
bool_t
-xdr_rpcblist(xdrs, rp)
- XDR *xdrs;
- RPCBLIST **rp;
+xdr_rpcblist(XDR *xdrs, RPCBLIST **rp)
{
bool_t dummy;
@@ -166,9 +160,7 @@ xdr_rpcblist(xdrs, rp)
bool_t
-xdr_rpcb_entry(xdrs, objp)
- XDR *xdrs;
- rpcb_entry *objp;
+xdr_rpcb_entry(XDR *xdrs, rpcb_entry *objp)
{
if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
return (FALSE);
@@ -189,9 +181,7 @@ xdr_rpcb_entry(xdrs, objp)
}
bool_t
-xdr_rpcb_entry_list_ptr(xdrs, rp)
- XDR *xdrs;
- rpcb_entry_list_ptr *rp;
+xdr_rpcb_entry_list_ptr(XDR *xdrs, rpcb_entry_list_ptr *rp)
{
/*
* more_elements is pre-computed in case the direction is
@@ -244,9 +234,7 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
* written for XDR_ENCODE direction only
*/
bool_t
-xdr_rpcb_rmtcallargs(xdrs, p)
- XDR *xdrs;
- struct rpcb_rmtcallargs *p;
+xdr_rpcb_rmtcallargs(XDR *xdrs, struct rpcb_rmtcallargs *p)
{
struct r_rpcb_rmtcallargs *objp =
(struct r_rpcb_rmtcallargs *)(void *)p;
@@ -255,13 +243,13 @@ xdr_rpcb_rmtcallargs(xdrs, p)
buf = XDR_INLINE(xdrs, 3 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
} else {
@@ -296,9 +284,7 @@ xdr_rpcb_rmtcallargs(xdrs, p)
* written for XDR_DECODE direction only
*/
bool_t
-xdr_rpcb_rmtcallres(xdrs, p)
- XDR *xdrs;
- struct rpcb_rmtcallres *p;
+xdr_rpcb_rmtcallres(XDR *xdrs, struct rpcb_rmtcallres *p)
{
bool_t dummy;
struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
@@ -314,9 +300,7 @@ xdr_rpcb_rmtcallres(xdrs, p)
}
bool_t
-xdr_netbuf(xdrs, objp)
- XDR *xdrs;
- struct netbuf *objp;
+xdr_netbuf(XDR *xdrs, struct netbuf *objp)
{
bool_t dummy;
void **pp;
diff --git a/lib/libc/rpc/rpcb_st_xdr.c b/lib/libc/rpc/rpcb_st_xdr.c
index 8ffc5b6..9abc028 100644
--- a/lib/libc/rpc/rpcb_st_xdr.c
+++ b/lib/libc/rpc/rpcb_st_xdr.c
@@ -47,16 +47,14 @@ __FBSDID("$FreeBSD$");
/* Link list of all the stats about getport and getaddr */
bool_t
-xdr_rpcbs_addrlist(xdrs, objp)
- XDR *xdrs;
- rpcbs_addrlist *objp;
+xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addrlist *objp)
{
struct rpcbs_addrlist **pnext;
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -83,9 +81,7 @@ xdr_rpcbs_addrlist(xdrs, objp)
/* Link list of all the stats about rmtcall */
bool_t
-xdr_rpcbs_rmtcalllist(xdrs, objp)
- XDR *xdrs;
- rpcbs_rmtcalllist *objp;
+xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_rmtcalllist *objp)
{
int32_t *buf;
struct rpcbs_rmtcalllist **pnext;
@@ -93,13 +89,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
if (xdrs->x_op == XDR_ENCODE) {
buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -132,13 +128,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
} else if (xdrs->x_op == XDR_DECODE) {
buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
if (buf == NULL) {
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -168,13 +164,13 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
}
return (TRUE);
}
- if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+ if (!xdr_rpcprog(xdrs, &objp->prog)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+ if (!xdr_rpcvers(xdrs, &objp->vers)) {
return (FALSE);
}
- if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+ if (!xdr_rpcproc(xdrs, &objp->proc)) {
return (FALSE);
}
if (!xdr_int(xdrs, &objp->success)) {
@@ -198,9 +194,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
}
bool_t
-xdr_rpcbs_proc(xdrs, objp)
- XDR *xdrs;
- rpcbs_proc objp;
+xdr_rpcbs_proc(XDR *xdrs, rpcbs_proc objp)
{
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
sizeof (int), (xdrproc_t)xdr_int)) {
@@ -210,9 +204,7 @@ xdr_rpcbs_proc(xdrs, objp)
}
bool_t
-xdr_rpcbs_addrlist_ptr(xdrs, objp)
- XDR *xdrs;
- rpcbs_addrlist_ptr *objp;
+xdr_rpcbs_addrlist_ptr(XDR *xdrs, rpcbs_addrlist_ptr *objp)
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_addrlist),
(xdrproc_t)xdr_rpcbs_addrlist)) {
@@ -222,9 +214,7 @@ xdr_rpcbs_addrlist_ptr(xdrs, objp)
}
bool_t
-xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
- XDR *xdrs;
- rpcbs_rmtcalllist_ptr *objp;
+xdr_rpcbs_rmtcalllist_ptr(XDR *xdrs, rpcbs_rmtcalllist_ptr *objp)
{
if (!xdr_pointer(xdrs, (char **)objp, sizeof (rpcbs_rmtcalllist),
(xdrproc_t)xdr_rpcbs_rmtcalllist)) {
@@ -234,9 +224,7 @@ xdr_rpcbs_rmtcalllist_ptr(xdrs, objp)
}
bool_t
-xdr_rpcb_stat(xdrs, objp)
- XDR *xdrs;
- rpcb_stat *objp;
+xdr_rpcb_stat(XDR *xdrs, rpcb_stat *objp)
{
if (!xdr_rpcbs_proc(xdrs, objp->info)) {
@@ -262,9 +250,7 @@ xdr_rpcb_stat(xdrs, objp)
* being monitored.
*/
bool_t
-xdr_rpcb_stat_byvers(xdrs, objp)
- XDR *xdrs;
- rpcb_stat_byvers objp;
+xdr_rpcb_stat_byvers(XDR *xdrs, rpcb_stat_byvers objp)
{
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c
index d6a21c9..08b5d7d 100644
--- a/lib/libc/rpc/rpcdname.c
+++ b/lib/libc/rpc/rpcdname.c
@@ -43,20 +43,20 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include "un-namespace.h"
-static char *default_domain = 0;
+static char *default_domain;
static char *
-get_default_domain()
+get_default_domain(void)
{
char temp[256];
- if (default_domain)
+ if (default_domain != NULL)
return (default_domain);
if (getdomainname(temp, sizeof(temp)) < 0)
return (0);
if ((int) strlen(temp) > 0) {
- default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
- if (default_domain == 0)
+ default_domain = malloc((strlen(temp) + (unsigned)1));
+ if (default_domain == NULL)
return (0);
(void) strcpy(default_domain, temp);
return (default_domain);
@@ -71,10 +71,9 @@ 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)
+ if ((*domain = get_default_domain()) != NULL)
return (0);
return (-1);
}
diff --git a/lib/libc/rpc/rtime.c b/lib/libc/rpc/rtime.c
index 807b14c..7c40c36 100644
--- a/lib/libc/rpc/rtime.c
+++ b/lib/libc/rpc/rtime.c
@@ -61,16 +61,14 @@ __FBSDID("$FreeBSD$");
extern int _rpc_dtablesize( void );
-#define NYEARS (unsigned long)(1970 - 1900)
-#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
+#define NYEARS (unsigned long)(1970 - 1900)
+#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
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;
@@ -100,11 +98,11 @@ rtime(addrp, timep, timeout)
addrp->sin_port = serv->s_port;
if (type == SOCK_DGRAM) {
- res = _sendto(s, (char *)&thetime, sizeof(thetime), 0,
+ res = _sendto(s, (char *)&thetime, sizeof(thetime), 0,
(struct sockaddr *)addrp, sizeof(*addrp));
if (res < 0) {
do_close(s);
- return(-1);
+ return(-1);
}
do {
FD_ZERO(&readfds);
@@ -117,14 +115,14 @@ rtime(addrp, timep, timeout)
errno = ETIMEDOUT;
}
do_close(s);
- return(-1);
+ return(-1);
}
fromlen = sizeof(from);
- res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
+ res = _recvfrom(s, (char *)&thetime, sizeof(thetime), 0,
(struct sockaddr *)&from, &fromlen);
do_close(s);
if (res < 0) {
- return(-1);
+ return(-1);
}
} else {
if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
@@ -139,7 +137,7 @@ rtime(addrp, timep, timeout)
}
if (res != sizeof(thetime)) {
errno = EIO;
- return(-1);
+ return(-1);
}
thetime = ntohl(thetime);
timep->tv_sec = thetime - TOFFSET;
@@ -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.c b/lib/libc/rpc/svc.c
index 49b14d3..d68fa9f 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -84,6 +84,9 @@ static struct svc_callout {
void (*sc_dispatch)(struct svc_req *, SVCXPRT *);
} *svc_head;
+SVCXPRT **__svc_xports;
+int __svc_maxrec;
+
static struct svc_callout *svc_find(rpcprog_t, rpcvers_t,
struct svc_callout **, char *);
static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
@@ -94,8 +97,7 @@ static void __xprt_do_unregister (SVCXPRT *xprt, bool_t dolock);
* Activate a transport handle.
*/
void
-xprt_register(xprt)
- SVCXPRT *xprt;
+xprt_register(SVCXPRT *xprt)
{
int sock;
@@ -137,9 +139,7 @@ __xprt_unregister_unlocked(SVCXPRT *xprt)
* De-activate a transport handle.
*/
static void
-__xprt_do_unregister(xprt, dolock)
- SVCXPRT *xprt;
- bool_t dolock;
+__xprt_do_unregister(SVCXPRT *xprt, bool_t dolock)
{
int sock;
@@ -168,12 +168,9 @@ __xprt_do_unregister(xprt, dolock)
* program number comes in.
*/
bool_t
-svc_reg(xprt, prog, vers, dispatch, nconf)
- SVCXPRT *xprt;
- const rpcprog_t prog;
- const rpcvers_t vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- const struct netconfig *nconf;
+svc_reg(SVCXPRT *xprt, const rpcprog_t prog, const rpcvers_t vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ const struct netconfig *nconf)
{
bool_t dummy;
struct svc_callout *prev;
@@ -240,9 +237,7 @@ rpcb_it:
* Remove a service program from the callout list.
*/
void
-svc_unreg(prog, vers)
- const rpcprog_t prog;
- const rpcvers_t vers;
+svc_unreg(const rpcprog_t prog, const rpcvers_t vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -273,12 +268,9 @@ svc_unreg(prog, vers)
* program number comes in.
*/
bool_t
-svc_register(xprt, prog, vers, dispatch, protocol)
- SVCXPRT *xprt;
- u_long prog;
- u_long vers;
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- int protocol;
+svc_register(SVCXPRT *xprt, u_long prog, u_long vers,
+ void (*dispatch)(struct svc_req *, SVCXPRT *),
+ int protocol)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -313,9 +305,7 @@ pmap_it:
* Remove a service program from the callout list.
*/
void
-svc_unregister(prog, vers)
- u_long prog;
- u_long vers;
+svc_unregister(u_long prog, u_long vers)
{
struct svc_callout *prev;
struct svc_callout *s;
@@ -340,11 +330,8 @@ svc_unregister(prog, vers)
* struct.
*/
static struct svc_callout *
-svc_find(prog, vers, prev, netid)
- rpcprog_t prog;
- rpcvers_t vers;
- struct svc_callout **prev;
- char *netid;
+svc_find(rpcprog_t prog, rpcvers_t vers, struct svc_callout **prev,
+ char *netid)
{
struct svc_callout *s, *p;
@@ -368,10 +355,8 @@ svc_find(prog, vers, prev, netid)
* Send a reply to an rpc request
*/
bool_t
-svc_sendreply(xprt, xdr_results, xdr_location)
- SVCXPRT *xprt;
- xdrproc_t xdr_results;
- void * xdr_location;
+svc_sendreply(SVCXPRT *xprt, xdrproc_t xdr_results,
+ void * xdr_location)
{
struct rpc_msg rply;
@@ -390,8 +375,7 @@ svc_sendreply(xprt, xdr_results, xdr_location)
* No procedure error reply
*/
void
-svcerr_noproc(xprt)
- SVCXPRT *xprt;
+svcerr_noproc(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -408,8 +392,7 @@ svcerr_noproc(xprt)
* Can't decode args error reply
*/
void
-svcerr_decode(xprt)
- SVCXPRT *xprt;
+svcerr_decode(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -426,8 +409,7 @@ svcerr_decode(xprt)
* Some system error
*/
void
-svcerr_systemerr(xprt)
- SVCXPRT *xprt;
+svcerr_systemerr(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -448,31 +430,27 @@ svcerr_systemerr(xprt)
* protocol: the portmapper (or rpc binder).
*/
void
-__svc_versquiet_on(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_on(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags |= SVC_VERSQUIET;
}
void
-__svc_versquiet_off(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_off(SVCXPRT *xprt)
{
SVC_EXT(xprt)->xp_flags &= ~SVC_VERSQUIET;
}
void
-svc_versquiet(xprt)
- SVCXPRT *xprt;
+svc_versquiet(SVCXPRT *xprt)
{
__svc_versquiet_on(xprt);
}
int
-__svc_versquiet_get(xprt)
- SVCXPRT *xprt;
+__svc_versquiet_get(SVCXPRT *xprt)
{
return (SVC_EXT(xprt)->xp_flags & SVC_VERSQUIET);
@@ -483,9 +461,7 @@ __svc_versquiet_get(xprt)
* Authentication error reply
*/
void
-svcerr_auth(xprt, why)
- SVCXPRT *xprt;
- enum auth_stat why;
+svcerr_auth(SVCXPRT *xprt, enum auth_stat why)
{
struct rpc_msg rply;
@@ -502,8 +478,7 @@ svcerr_auth(xprt, why)
* Auth too weak error reply
*/
void
-svcerr_weakauth(xprt)
- SVCXPRT *xprt;
+svcerr_weakauth(SVCXPRT *xprt)
{
assert(xprt != NULL);
@@ -515,8 +490,7 @@ svcerr_weakauth(xprt)
* Program unavailable error reply
*/
void
-svcerr_noprog(xprt)
- SVCXPRT *xprt;
+svcerr_noprog(SVCXPRT *xprt)
{
struct rpc_msg rply;
@@ -533,10 +507,7 @@ svcerr_noprog(xprt)
* Program version mismatch error reply
*/
void
-svcerr_progvers(xprt, low_vers, high_vers)
- SVCXPRT *xprt;
- rpcvers_t low_vers;
- rpcvers_t high_vers;
+svcerr_progvers(SVCXPRT *xprt, rpcvers_t low_vers, rpcvers_t high_vers)
{
struct rpc_msg rply;
@@ -558,7 +529,7 @@ svcerr_progvers(xprt, low_vers, high_vers)
* parameters.
*/
SVCXPRT *
-svc_xprt_alloc()
+svc_xprt_alloc(void)
{
SVCXPRT *xprt;
SVCXPRT_EXT *ext;
@@ -583,8 +554,7 @@ svc_xprt_alloc()
* Free a server transport structure.
*/
void
-svc_xprt_free(xprt)
- SVCXPRT *xprt;
+svc_xprt_free(SVCXPRT *xprt)
{
mem_free(xprt->xp_p3, sizeof(SVCXPRT_EXT));
@@ -610,8 +580,7 @@ svc_xprt_free(xprt)
*/
void
-svc_getreq(rdfds)
- int rdfds;
+svc_getreq(int rdfds)
{
fd_set readfds;
@@ -621,8 +590,7 @@ svc_getreq(rdfds)
}
void
-svc_getreqset(readfds)
- fd_set *readfds;
+svc_getreqset(fd_set *readfds)
{
int bit, fd;
fd_mask mask, *maskp;
@@ -642,8 +610,7 @@ svc_getreqset(readfds)
}
void
-svc_getreq_common(fd)
- int fd;
+svc_getreq_common(int fd)
{
SVCXPRT *xprt;
struct svc_req r;
@@ -738,9 +705,7 @@ call_done:
void
-svc_getreq_poll(pfdp, pollretval)
- struct pollfd *pfdp;
- int pollretval;
+svc_getreq_poll(struct pollfd *pfdp, int pollretval)
{
int i;
int fds_found;
diff --git a/lib/libc/rpc/svc_auth.c b/lib/libc/rpc/svc_auth.c
index 2068529..58435af 100644
--- a/lib/libc/rpc/svc_auth.c
+++ b/lib/libc/rpc/svc_auth.c
@@ -95,9 +95,7 @@ struct svc_auth_ops svc_auth_null_ops;
* invalid.
*/
enum auth_stat
-_authenticate(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_authenticate(struct svc_req *rqst, struct rpc_msg *msg)
{
int cred_flavor;
struct authsvc *asp;
@@ -151,11 +149,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 +162,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 +182,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_auth_unix.c b/lib/libc/rpc/svc_auth_unix.c
index 7e837d3..8e51183 100644
--- a/lib/libc/rpc/svc_auth_unix.c
+++ b/lib/libc/rpc/svc_auth_unix.c
@@ -56,9 +56,7 @@ __FBSDID("$FreeBSD$");
* Unix longhand authenticator
*/
enum auth_stat
-_svcauth_unix(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
{
enum auth_stat stat;
XDR xdrs;
@@ -147,9 +145,7 @@ done:
*/
/*ARGSUSED*/
enum auth_stat
-_svcauth_short(rqst, msg)
- struct svc_req *rqst;
- struct rpc_msg *msg;
+_svcauth_short(struct svc_req *rqst, struct rpc_msg *msg)
{
return (AUTH_REJECTEDCRED);
}
diff --git a/lib/libc/rpc/svc_dg.c b/lib/libc/rpc/svc_dg.c
index 1591872..5d9baaa 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);
@@ -427,17 +412,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;
@@ -535,9 +516,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;
@@ -592,9 +571,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;
@@ -682,11 +659,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_generic.c b/lib/libc/rpc/svc_generic.c
index dca79f5..00bbc5a 100644
--- a/lib/libc/rpc/svc_generic.c
+++ b/lib/libc/rpc/svc_generic.c
@@ -72,13 +72,14 @@ extern int __svc_vc_setflag(SVCXPRT *, int);
* It creates a link list of all the handles it could create.
* If svc_create() is called multiple times, it uses the handle
* created earlier instead of creating a new handle every time.
+ *
+ * prognum - Program number
+ * versnum - Version number
+ * nettype - Networktype token
*/
int
-svc_create(dispatch, prognum, versnum, nettype)
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- rpcprog_t prognum; /* Program number */
- rpcvers_t versnum; /* Version number */
- const char *nettype; /* Networktype token */
+svc_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
+ rpcprog_t prognum, rpcvers_t versnum, const char *nettype)
{
struct xlist {
SVCXPRT *xprt; /* Server handle */
@@ -145,13 +146,14 @@ done:
* The high level interface to svc_tli_create().
* It tries to create a server for "nconf" and registers the service
* with the rpcbind. It calls svc_tli_create();
+ *
+ * prognum - Program number
+ * versnum - Version number
+ * ncofn - Netconfig structure for the network
*/
SVCXPRT *
-svc_tp_create(dispatch, prognum, versnum, nconf)
- void (*dispatch)(struct svc_req *, SVCXPRT *);
- rpcprog_t prognum; /* Program number */
- rpcvers_t versnum; /* Version number */
- const struct netconfig *nconf; /* Netconfig structure for the network */
+svc_tp_create(void (*dispatch)(struct svc_req *, SVCXPRT *),
+ rpcprog_t prognum, rpcvers_t versnum, const struct netconfig *nconf)
{
SVCXPRT *xprt;
@@ -186,14 +188,16 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
* is set to 8.
*
* If sendsz or recvsz are zero, their default values are chosen.
+ *
+ * fd - Connection end point
+ * nconf - Netconfig struct for nettoken
+ * bindaddr - Local bind address
+ * sendsz - Max sendsize
+ * recvxz - Max recvsize
*/
SVCXPRT *
-svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
- int fd; /* Connection end point */
- const struct netconfig *nconf; /* Netconfig struct for nettoken */
- const struct t_bind *bindaddr; /* Local bind address */
- u_int sendsz; /* Max sendsize */
- u_int recvsz; /* Max recvsize */
+svc_tli_create(int fd, const struct netconfig *nconf,
+ const struct t_bind *bindaddr, u_int sendsz, u_int recvsz)
{
SVCXPRT *xprt = NULL; /* service handle */
bool_t madefd = FALSE; /* whether fd opened here */
diff --git a/lib/libc/rpc/svc_raw.c b/lib/libc/rpc/svc_raw.c
index ffa9122..9159335 100644
--- a/lib/libc/rpc/svc_raw.c
+++ b/lib/libc/rpc/svc_raw.c
@@ -82,7 +82,7 @@ static bool_t svc_raw_control(SVCXPRT *, const u_int, void *);
char *__rpc_rawcombuf = NULL;
SVCXPRT *
-svc_raw_create()
+svc_raw_create(void)
{
struct svc_raw_private *srp;
/* VARIABLES PROTECTED BY svcraw_lock: svc_raw_private, srp */
@@ -125,17 +125,14 @@ svc_raw_create()
/*ARGSUSED*/
static enum xprt_stat
-svc_raw_stat(xprt)
-SVCXPRT *xprt; /* args needed to satisfy ANSI-C typechecking */
+svc_raw_stat(SVCXPRT *xprt)
{
return (XPRT_IDLE);
}
/*ARGSUSED*/
static bool_t
-svc_raw_recv(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_raw_recv(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -159,9 +156,7 @@ svc_raw_recv(xprt, msg)
/*ARGSUSED*/
static bool_t
-svc_raw_reply(xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svc_raw_reply(SVCXPRT *xprt, struct rpc_msg *msg)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -201,10 +196,7 @@ svc_raw_reply(xprt, msg)
/*ARGSUSED*/
static bool_t
-svc_raw_getargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_raw_getargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_raw_private *srp;
@@ -222,10 +214,7 @@ svc_raw_getargs(xprt, xdr_args, args_ptr)
/*ARGSUSED*/
static bool_t
-svc_raw_freeargs(xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- void *args_ptr;
+svc_raw_freeargs(SVCXPRT *xprt, xdrproc_t xdr_args, void *args_ptr)
{
struct svc_raw_private *srp;
XDR *xdrs;
@@ -245,24 +234,19 @@ svc_raw_freeargs(xprt, xdr_args, args_ptr)
/*ARGSUSED*/
static void
-svc_raw_destroy(xprt)
-SVCXPRT *xprt;
+svc_raw_destroy(SVCXPRT *xprt)
{
}
/*ARGSUSED*/
static bool_t
-svc_raw_control(xprt, rq, in)
- SVCXPRT *xprt;
- const u_int rq;
- void *in;
+svc_raw_control(SVCXPRT *xprt, const u_int rq, void *in)
{
return (FALSE);
}
static void
-svc_raw_ops(xprt)
- SVCXPRT *xprt;
+svc_raw_ops(SVCXPRT *xprt)
{
static struct xp_ops ops;
static struct xp_ops2 ops2;
diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c
index 08c8a84..9b0089b 100644
--- a/lib/libc/rpc/svc_run.c
+++ b/lib/libc/rpc/svc_run.c
@@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$");
#include "mt_misc.h"
void
-svc_run()
+svc_run(void)
{
fd_set readfds, cleanfds;
struct timeval timeout;
@@ -89,7 +89,7 @@ svc_run()
* more work to do.
*/
void
-svc_exit()
+svc_exit(void)
{
rwlock_wrlock(&svc_fd_lock);
FD_ZERO(&svc_fdset);
diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c
index 2e98c6a..1c60950 100644
--- a/lib/libc/rpc/svc_simple.c
+++ b/lib/libc/rpc/svc_simple.c
@@ -92,16 +92,18 @@ static const char __no_mem_str[] = "out of memory";
* is also limited by the recvsize for that transport, even if it is
* a COTS transport. This may be wrong, but for cases like these, they
* should not use the simplified interfaces like this.
+ *
+ * prognum - program number
+ * versnum - version number
+ * procnum - procedure number
+ * progname - Server routine
+ * inproc, outproc - in/out XDR procedures
+ * nettype - nettype
*/
-
int
-rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
- rpcprog_t prognum; /* program number */
- rpcvers_t versnum; /* version number */
- rpcproc_t procnum; /* procedure number */
- char *(*progname)(char *); /* Server routine */
- xdrproc_t inproc, outproc; /* in/out XDR procedures */
- char *nettype; /* nettype */
+rpc_reg(rpcprog_t prognum, rpcvers_t versnum, rpcproc_t procnum,
+ char *(*progname)(char *), xdrproc_t inproc, xdrproc_t outproc,
+ char *nettype)
{
struct netconfig *nconf;
int done = FALSE;
@@ -240,9 +242,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
*/
static void
-universal(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
+universal(struct svc_req *rqstp, SVCXPRT *transp)
{
rpcprog_t prog;
rpcvers_t vers;
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c
index 6ce99d3..912383d 100644
--- a/lib/libc/rpc/svc_vc.c
+++ b/lib/libc/rpc/svc_vc.c
@@ -123,12 +123,9 @@ 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;
+ SVCXPRT *xprt = NULL;
struct cf_rendezvous *r = NULL;
struct __rpc_sockinfo si;
struct sockaddr_storage sslocal;
@@ -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;
@@ -380,16 +369,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);
@@ -398,8 +385,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;
@@ -429,19 +415,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;
@@ -469,10 +449,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;
@@ -532,10 +509,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;
@@ -579,8 +553,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;
@@ -596,9 +569,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;
@@ -626,10 +597,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;
@@ -640,10 +608,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;
@@ -657,9 +622,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;
@@ -701,8 +664,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;
@@ -725,8 +687,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/softfloat/timesoftfloat.c b/lib/libc/softfloat/timesoftfloat.c
index 98b6ba2..b97c8b0 100644
--- a/lib/libc/softfloat/timesoftfloat.c
+++ b/lib/libc/softfloat/timesoftfloat.c
@@ -2068,14 +2068,14 @@ static void
roundingPrecisionName = "80";
}
else {
- roundingPrecisionName = 0;
+ roundingPrecisionName = NULL;
}
#ifdef FLOATX80
floatx80_rounding_precision = roundingPrecision;
#endif
switch ( roundingMode ) {
case 0:
- roundingModeName = 0;
+ roundingModeName = NULL;
roundingCode = float_round_nearest_even;
break;
case ROUND_NEAREST_EVEN:
@@ -2098,7 +2098,7 @@ static void
float_rounding_mode = roundingCode;
switch ( tininessMode ) {
case 0:
- tininessModeName = 0;
+ tininessModeName = NULL;
tininessCode = float_tininess_after_rounding;
break;
case TININESS_BEFORE_ROUNDING:
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index a546666..1dbc493 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -28,7 +28,7 @@
.\" @(#)open.2 8.2 (Berkeley) 11/16/93
.\" $FreeBSD$
.\"
-.Dd April 2, 2015
+.Dd November 22, 2016
.Dt OPEN 2
.Os
.Sh NAME
@@ -471,6 +471,22 @@ The
.Fn openat
function was introduced in
.Fx 8.0 .
+.Sh STANDARDS
+These functions are specified by
+.St -p1003.1-2008 .
+.Fx
+sets
+.Va errno
+to
+.Er EMLINK instead of
+.Er ELOOP
+as specified by
+.Tn POSIX
+when
+.Dv O_NOFOLLOW
+is set in flags and the final component of pathname is a symbolic link
+to distinguish it from the case of too many symbolic link traversals
+in one of its non-final components.
.Sh BUGS
The Open Group Extended API Set 2 specification requires that the test
for whether
diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile
index 15db4fd..9b89152 100644
--- a/lib/libc/tests/Makefile
+++ b/lib/libc/tests/Makefile
@@ -10,6 +10,7 @@ TESTS_SUBDIRS= c063
TESTS_SUBDIRS+= db
TESTS_SUBDIRS+= gen
TESTS_SUBDIRS+= hash
+TESTS_SUBDIRS+= iconv
TESTS_SUBDIRS+= inet
TESTS_SUBDIRS+= net
TESTS_SUBDIRS+= nss
@@ -24,6 +25,10 @@ TESTS_SUBDIRS+= termios
TESTS_SUBDIRS+= tls
TESTS_SUBDIRS+= ttyio
+.if ${MK_ICONV} != "no"
+TESTS_SUBDIRS+= iconv
+.endif
+
.if ${MK_LOCALES} != "no"
TESTS_SUBDIRS+= locale
.endif
diff --git a/lib/libc/tests/iconv/Makefile b/lib/libc/tests/iconv/Makefile
new file mode 100644
index 0000000..e6ae03e
--- /dev/null
+++ b/lib/libc/tests/iconv/Makefile
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/lib/libc/iconv
+
+ATF_TESTS_C+= iconvctl_test
+
+.include <bsd.test.mk>
diff --git a/lib/libc/tests/iconv/iconvctl_test.c b/lib/libc/tests/iconv/iconvctl_test.c
new file mode 100644
index 0000000..04bf24b8
--- /dev/null
+++ b/lib/libc/tests/iconv/iconvctl_test.c
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2016 Eric van Gyzen
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <iconv.h>
+
+#include <atf-c.h>
+
+void
+test_trivialp(const char *src, const char *dst, int expected)
+{
+ iconv_t ic;
+ int actual, status;
+
+ ic = iconv_open(dst, src);
+ ATF_REQUIRE(ic != (iconv_t)-1);
+
+ status = iconvctl(ic, ICONV_TRIVIALP, &actual);
+ ATF_REQUIRE(status == 0);
+
+ ATF_REQUIRE(actual == expected);
+
+ status = iconv_close(ic);
+ ATF_REQUIRE(status == 0);
+}
+
+ATF_TC_WITHOUT_HEAD(iconvctl_trivialp_test);
+ATF_TC_BODY(iconvctl_trivialp_test, tc)
+{
+
+ test_trivialp("ISO-8859-1", "ISO-8859-1", 1);
+ test_trivialp("ISO-8859-1", "ISO-8859-15", 0);
+ test_trivialp("ISO-8859-15", "ISO-8859-1", 0);
+ test_trivialp("ISO-8859-15", "UTF-8", 0);
+ test_trivialp("UTF-8", "ASCII", 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, iconvctl_trivialp_test);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/uuid/uuid_to_string.c b/lib/libc/uuid/uuid_to_string.c
index f816391..35f8581 100644
--- a/lib/libc/uuid/uuid_to_string.c
+++ b/lib/libc/uuid/uuid_to_string.c
@@ -49,7 +49,7 @@ uuid_to_string(const uuid_t *u, char **s, uint32_t *status)
*status = uuid_s_ok;
/* Why allow a NULL-pointer here? */
- if (s == 0)
+ if (s == NULL)
return;
if (u == NULL) {
diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c
index 70f79c6..ec15bb8 100644
--- a/lib/libc/xdr/xdr_mem.c
+++ b/lib/libc/xdr/xdr_mem.c
@@ -239,7 +239,7 @@ xdrmem_inline_aligned(xdrs, len)
XDR *xdrs;
u_int len;
{
- int32_t *buf = 0;
+ int32_t *buf = NULL;
if (xdrs->x_handy >= len) {
xdrs->x_handy -= len;
OpenPOWER on IntegriCloud