diff options
author | dim <dim@FreeBSD.org> | 2015-06-01 06:54:21 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-06-01 06:54:21 +0000 |
commit | 8c2b6d93700b452fac3cadba57de1b18a783ec92 (patch) | |
tree | 6e8da4ceef4a7a36d46426497125611b2907ee1f | |
parent | b237d0308e74533064fa98d3f529f1b7eebd9e96 (diff) | |
parent | 2474a7a0d8a20e46cb41b5752822e3856e1f3bfb (diff) | |
download | FreeBSD-src-8c2b6d93700b452fac3cadba57de1b18a783ec92.zip FreeBSD-src-8c2b6d93700b452fac3cadba57de1b18a783ec92.tar.gz |
Merge ^/head r283771 through r283870.
63 files changed, 698 insertions, 606 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index aaf181c..1679404 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1276,8 +1276,8 @@ _sed= usr.bin/sed .endif .if ${BOOTSTRAPPING} < 1000002 -_m4= lib/libohash \ - usr.bin/m4 +_libohash= lib/libohash +_m4= usr.bin/m4 ${_bt}-usr.bin/m4: ${_bt}-lib/libohash .endif @@ -1363,6 +1363,15 @@ _kerberos5_bootstrap_tools= \ .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .endif +.if ${MK_MANDOCDB} != "no" +_libohash?= lib/libohash +_makewhatis= lib/libsqlite3 \ + usr.bin/mandoc +${_bt}-usr.bin/mandoc: ${_bt}-lib/libohash ${_bt}-lib/libsqlite3 +.else +_makewhatis=usr.bin/makewhatis +.endif + # Rebuild up-to-date libmd for xinstall ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd @@ -1383,7 +1392,8 @@ bootstrap-tools: .PHONY ${_awk} \ ${_cat} \ usr.bin/lorder \ - usr.bin/makewhatis \ + ${_libohash} \ + ${_makewhatis} \ usr.bin/rpcgen \ ${_sed} \ ${_yacc} \ @@ -1806,9 +1816,10 @@ kerberos5/lib/libroken__L: lib/libcrypt__L kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L kerberos5/lib/libheimbase__L: lib/libthr__L kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L -lib/libsqlite3__L: lib/libthr__L .endif +lib/libsqlite3__L: lib/libthr__L + .if ${MK_GSSAPI} != "no" _lib_libgssapi= lib/libgssapi .endif diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 0e5dd56..e86cfa8 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -180,7 +180,7 @@ main(int argc, char *argv[]) KINFO_STR *ks; struct varent *vent; struct winsize ws = { .ws_row = 0 }; - const char *nlistf, *memf, *fmtstr, *str; + const char *nlistf, *memf, *str; char *cols; int all, ch, elem, flag, _fmt, i, lineno, linelen, left; int descendancy, nentries, nkept, nselectors; @@ -649,11 +649,6 @@ main(int argc, char *argv[]) linelen = 0; xo_open_instance("process"); STAILQ_FOREACH(vent, &varlist, next_ve) { - if (vent->var->flag & LJUST) - fmtstr = "%-*s"; - else - fmtstr = "%*s"; - ks = STAILQ_FIRST(&kinfo[i].ki_ks); STAILQ_REMOVE_HEAD(&kinfo[i].ki_ks, ks_next); /* Truncate rightmost column if necessary. */ diff --git a/contrib/diff/src/context.c b/contrib/diff/src/context.c index 4937ce2..73bde69 100644 --- a/contrib/diff/src/context.c +++ b/contrib/diff/src/context.c @@ -62,7 +62,7 @@ print_context_label (char const *mark, { time_t sec = inf->stat.st_mtime; verify (info_preserved, sizeof inf->stat.st_mtime <= sizeof sec); - sprintf (buf, "%jd.%.9d", (intmax_t)sec, nsec); + sprintf (buf, "%jd.%.9ld", (intmax_t)sec, nsec); } fprintf (outfile, "%s %s\t%s\n", mark, inf->name, buf); } diff --git a/contrib/gcc/config/arm/lib1funcs.asm b/contrib/gcc/config/arm/lib1funcs.asm index c29f894..73c453d 100644 --- a/contrib/gcc/config/arm/lib1funcs.asm +++ b/contrib/gcc/config/arm/lib1funcs.asm @@ -252,7 +252,7 @@ SYM (\name): #ifdef __thumb__ #define THUMB_FUNC .thumb_func -#define THUMB_CODE .force_thumb +#define THUMB_CODE .thumb #else #define THUMB_FUNC #define THUMB_CODE diff --git a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c index 5afdee9..99235ea 100644 --- a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c +++ b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $"); #include <string.h> #include <unistd.h> #include <sys/param.h> +#ifdef __FreeBSD__ +#include <sys/stat.h> +#endif #define DIR "dir" #define FILE "dir/faccessat" diff --git a/contrib/netbsd-tests/lib/libc/c063/t_openat.c b/contrib/netbsd-tests/lib/libc/c063/t_openat.c index 79b5f38..5112efc 100644 --- a/contrib/netbsd-tests/lib/libc/c063/t_openat.c +++ b/contrib/netbsd-tests/lib/libc/c063/t_openat.c @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $"); #include <string.h> #include <unistd.h> #include <sys/param.h> +#ifdef __FreeBSD__ +#include <sys/stat.h> +#endif #define DIR "dir" #define FILE "dir/openat" diff --git a/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c b/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c index d354ff5..c9bc267 100644 --- a/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c +++ b/contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $"); #include <string.h> #include <unistd.h> #include <sys/param.h> +#ifdef __FreeBSD__ +#include <sys/stat.h> +#endif #define DIR "dir" #define FILE "dir/readlinkat" diff --git a/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c b/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c index 79aa7aa..220c4b2 100644 --- a/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c +++ b/contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c @@ -40,6 +40,9 @@ __RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $"); #include <string.h> #include <unistd.h> #include <sys/param.h> +#ifdef __FreeBSD__ +#include <sys/stat.h> +#endif #define DIR "dir" #define FILE "dir/unlinkat" diff --git a/contrib/traceroute/traceroute.8 b/contrib/traceroute/traceroute.8 index 654b538..ebfcc36 100644 --- a/contrib/traceroute/traceroute.8 +++ b/contrib/traceroute/traceroute.8 @@ -16,7 +16,7 @@ .\" $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $ .\" $FreeBSD$ .\" -.Dd June 19, 2012 +.Dd May 31, 2015 .Dt TRACEROUTE 8 .Os .Sh NAME @@ -65,7 +65,7 @@ Turn on AS# lookups and use the given server instead of the default. .It Fl e Firewall evasion mode. -Use fixed destination ports for UDP and TCP probes. +Use fixed destination ports for UDP, UDP-Lite, TCP and SCTP probes. The destination port does NOT increment with each packet sent. .It Fl f Ar first_ttl Set the initial time-to-live used in the first outgoing probe packet. @@ -110,21 +110,24 @@ Print hop addresses numerically rather than symbolically and numerically path). .It Fl P Ar proto Send packets of specified IP protocol. The currently supported protocols -are: UDP, TCP, GRE and ICMP. Other protocols may also be specified (either by -name or by number), though +are: UDP, UDP-Lite, TCP, SCTP, GRE and ICMP. Other protocols may also be +specified (either by name or by number), though .Nm does not implement any special knowledge of their packet formats. This option is useful for determining which router along a path may be blocking packets based on IP protocol number. But see BUGS below. .It Fl p Ar port -Protocol specific. For UDP and TCP, sets +Protocol specific. For UDP, UDP-Lite, TCP and SCTP, sets the base .Ar port number used in probes (default is 33434). -Traceroute hopes that nothing is listening on UDP ports -.Em base +Traceroute hopes that nothing is listening on UDP ports (or UDP-Lite ports +if used by +.Nm +and supported by the peer) +.Em base + 1 to -.Em base + nhops * nprobes - 1 +.Em base + nhops * nprobes at the destination host (so an ICMP PORT_UNREACHABLE message will be returned to terminate the route tracing). If something is listening on a port in the default range, this option can be used diff --git a/contrib/traceroute/traceroute.c b/contrib/traceroute/traceroute.c index 63cefa1..28ba67b 100644 --- a/contrib/traceroute/traceroute.c +++ b/contrib/traceroute/traceroute.c @@ -219,6 +219,7 @@ static const char rcsid[] = #include <netinet/ip.h> #include <netinet/ip_var.h> #include <netinet/ip_icmp.h> +#include <netinet/sctp.h> #include <netinet/udp.h> #include <netinet/tcp.h> #include <netinet/tcpip.h> @@ -367,9 +368,10 @@ void freehostinfo(struct hostinfo *); void getaddr(u_int32_t *, char *); struct hostinfo *gethostinfo(char *); u_short in_cksum(u_short *, int); +u_int32_t sctp_crc32c(const void *, u_int32_t); char *inetname(struct in_addr); int main(int, char **); -u_short p_cksum(struct ip *, u_short *, int); +u_short p_cksum(struct ip *, u_short *, int, int); int packet_ok(u_char *, int, struct sockaddr_in *, int); char *pr_type(u_char); void print(u_char *, int, struct sockaddr_in *); @@ -389,8 +391,12 @@ int usleep(u_int); void udp_prep(struct outdata *); int udp_check(const u_char *, int); +void udplite_prep(struct outdata *); +int udplite_check(const u_char *, int); void tcp_prep(struct outdata *); int tcp_check(const u_char *, int); +void sctp_prep(struct outdata *); +int sctp_check(const u_char *, int); void gre_prep(struct outdata *); int gre_check(const u_char *, int); void gen_prep(struct outdata *); @@ -424,6 +430,15 @@ struct outproto protos[] = { udp_check }, { + "udplite", + "spt dpt cov sum", + IPPROTO_UDPLITE, + sizeof(struct udphdr), + 32768 + 666, + udplite_prep, + udplite_check + }, + { "tcp", "spt dpt seq ack xxflwin sum urp", IPPROTO_TCP, @@ -433,6 +448,15 @@ struct outproto protos[] = { tcp_check }, { + "sctp", + "spt dpt vtag crc tyfllen tyfllen ", + IPPROTO_SCTP, + sizeof(struct sctphdr), + 32768 + 666, + sctp_prep, + sctp_check + }, + { "gre", "flg pro len clid", IPPROTO_GRE, @@ -452,7 +476,7 @@ struct outproto protos[] = { }, { NULL, - NULL, + "", 0, 2 * sizeof(u_short), 0, @@ -541,12 +565,12 @@ main(int argc, char **argv) case 'a': as_path = 1; break; - + case 'A': as_path = 1; as_server = optarg; break; - + case 'd': options |= SO_DEBUG; break; @@ -669,8 +693,11 @@ main(int argc, char **argv) if (lsrr > 0) optlen = (lsrr + 1) * sizeof(gwlist[0]); - minpacket = sizeof(*outip) + proto->hdrlen + sizeof(struct outdata) + optlen; - packlen = minpacket; /* minimum sized packet */ + minpacket = sizeof(*outip) + proto->hdrlen + optlen; + if (minpacket > 40) + packlen = minpacket; + else + packlen = 40; /* Process destination and optional packet size */ switch (argc - optind) { @@ -704,6 +731,11 @@ main(int argc, char **argv) #endif protlen = packlen - sizeof(*outip) - optlen; + if ((proto->num == IPPROTO_SCTP) && (packlen & 3)) { + Fprintf(stderr, "%s: packet length must be a multiple of 4\n", + prog); + exit(1); + } outip = (struct ip *)malloc((unsigned)packlen); if (outip == NULL) { @@ -931,7 +963,7 @@ main(int argc, char **argv) as_path = 0; } } - + #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) if (setpolicy(sndsock, "in bypass") < 0) errx(1, "%s", ipsec_strerror()); @@ -1330,7 +1362,7 @@ packet_ok(register u_char *buf, int cc, register struct sockaddr_in *from, hiplen = ((u_char *)icp + cc) - (u_char *)hip; hlen = hip->ip_hl << 2; inner = (u_char *)((u_char *)hip + hlen); - if (hlen + 12 <= cc + if (hlen + 16 <= cc && hip->ip_p == proto->num && (*proto->check)(inner, (u_char)seq)) return (type == ICMP_TIMXCEED ? -1 : code + 1); @@ -1343,8 +1375,8 @@ packet_ok(register u_char *buf, int cc, register struct sockaddr_in *from, Printf("\n%d bytes from %s to ", cc, inet_ntoa(from->sin_addr)); Printf("%s: icmp type %d (%s) code %d\n", inet_ntoa(ip->ip_dst), type, pr_type(type), icp->icmp_code); - for (i = 4; i < cc ; i += sizeof(*lp)) - Printf("%2d: x%8.8x\n", i, *lp++); + for (i = 4; i <= cc - ICMP_MINLEN; i += sizeof(*lp)) + Printf("%2d: %8.8x\n", i, ntohl(*lp++)); } #endif return(0); @@ -1383,7 +1415,7 @@ udp_prep(struct outdata *outdata) outudp->uh_ulen = htons((u_short)protlen); outudp->uh_sum = 0; if (doipcksum) { - u_short sum = p_cksum(outip, (u_short*)outudp, protlen); + u_short sum = p_cksum(outip, (u_short*)outudp, protlen, protlen); outudp->uh_sum = (sum) ? sum : 0xffff; } @@ -1400,6 +1432,32 @@ udp_check(const u_char *data, int seq) } void +udplite_prep(struct outdata *outdata) +{ + struct udphdr *const outudp = (struct udphdr *) outp; + + outudp->uh_sport = htons(ident + (fixedPort ? outdata->seq : 0)); + outudp->uh_dport = htons(port + (fixedPort ? 0 : outdata->seq)); + outudp->uh_ulen = htons(8); + outudp->uh_sum = 0; + if (doipcksum) { + u_short sum = p_cksum(outip, (u_short*)outudp, protlen, 8); + outudp->uh_sum = (sum) ? sum : 0xffff; + } + + return; +} + +int +udplite_check(const u_char *data, int seq) +{ + struct udphdr *const udp = (struct udphdr *) data; + + return (ntohs(udp->uh_sport) == ident + (fixedPort ? seq : 0) && + ntohs(udp->uh_dport) == port + (fixedPort ? 0 : seq)); +} + +void tcp_prep(struct outdata *outdata) { struct tcphdr *const tcp = (struct tcphdr *) outp; @@ -1412,10 +1470,8 @@ tcp_prep(struct outdata *outdata) tcp->th_flags = TH_SYN; tcp->th_sum = 0; - if (doipcksum) { - u_short sum = p_cksum(outip, (u_short*)tcp, protlen); - tcp->th_sum = (sum) ? sum : 0xffff; - } + if (doipcksum) + tcp->th_sum = p_cksum(outip, (u_short*)tcp, protlen, protlen); } int @@ -1429,6 +1485,47 @@ tcp_check(const u_char *data, int seq) } void +sctp_prep(struct outdata *outdata) +{ + struct sctphdr *const sctp = (struct sctphdr *) outp; + struct sctp_chunkhdr *chk; + + sctp->src_port = htons(ident); + sctp->dest_port = htons(port + (fixedPort ? 0 : outdata->seq)); + sctp->v_tag = (sctp->src_port << 16) | sctp->dest_port; + sctp->checksum = htonl(0); + if (protlen >= + (int)(sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))) { + chk = (struct sctp_chunkhdr *)(sctp + 1); + chk->chunk_type = SCTP_SHUTDOWN_ACK; + chk->chunk_flags = 0; + chk->chunk_length = htons(4); + } + if (protlen >= + (int)(sizeof(struct sctphdr) + 2 * sizeof(struct sctp_chunkhdr))) { + chk = chk + 1; + chk->chunk_type = SCTP_PAD_CHUNK; + chk->chunk_flags = 0; + chk->chunk_length = htons(protlen - + (sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr))); + } + if (doipcksum) { + sctp->checksum = sctp_crc32c(sctp, protlen); + } +} + +int +sctp_check(const u_char *data, int seq) +{ + struct sctphdr *const sctp = (struct sctphdr *) data; + + return (ntohs(sctp->src_port) == ident + && ntohs(sctp->dest_port) == port + (fixedPort ? 0 : seq) + && sctp->v_tag == + (u_int32_t)((sctp->src_port << 16) | sctp->dest_port)); +} + +void gre_prep(struct outdata *outdata) { struct grehdr *const gre = (struct grehdr *) outp; @@ -1494,8 +1591,8 @@ print(register u_char *buf, register int cc, register struct sockaddr_in *from) /* * Checksum routine for UDP and TCP headers. */ -u_short -p_cksum(struct ip *ip, u_short *data, int len) +u_short +p_cksum(struct ip *ip, u_short *data, int len, int cov) { static struct ipovly ipo; u_short sum[2]; @@ -1506,7 +1603,7 @@ p_cksum(struct ip *ip, u_short *data, int len) ipo.ih_dst = ip->ip_dst; sum[1] = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */ - sum[0] = in_cksum(data, len); /* payload data cksum */ + sum[0] = in_cksum(data, cov); /* payload data cksum */ return ~in_cksum(sum, sizeof(sum)); } @@ -1547,6 +1644,98 @@ in_cksum(register u_short *addr, register int len) } /* + * CRC32C routine for the Stream Control Transmission Protocol + */ + +#define CRC32C(c, d) (c = (c>>8) ^ crc_c[(c^(d))&0xFF]) + +static u_int32_t crc_c[256] = { + 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, + 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB, + 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, + 0x4D43CFD0, 0xBF284CD3, 0xAC78BF27, 0x5E133C24, + 0x105EC76F, 0xE235446C, 0xF165B798, 0x030E349B, + 0xD7C45070, 0x25AFD373, 0x36FF2087, 0xC494A384, + 0x9A879FA0, 0x68EC1CA3, 0x7BBCEF57, 0x89D76C54, + 0x5D1D08BF, 0xAF768BBC, 0xBC267848, 0x4E4DFB4B, + 0x20BD8EDE, 0xD2D60DDD, 0xC186FE29, 0x33ED7D2A, + 0xE72719C1, 0x154C9AC2, 0x061C6936, 0xF477EA35, + 0xAA64D611, 0x580F5512, 0x4B5FA6E6, 0xB93425E5, + 0x6DFE410E, 0x9F95C20D, 0x8CC531F9, 0x7EAEB2FA, + 0x30E349B1, 0xC288CAB2, 0xD1D83946, 0x23B3BA45, + 0xF779DEAE, 0x05125DAD, 0x1642AE59, 0xE4292D5A, + 0xBA3A117E, 0x4851927D, 0x5B016189, 0xA96AE28A, + 0x7DA08661, 0x8FCB0562, 0x9C9BF696, 0x6EF07595, + 0x417B1DBC, 0xB3109EBF, 0xA0406D4B, 0x522BEE48, + 0x86E18AA3, 0x748A09A0, 0x67DAFA54, 0x95B17957, + 0xCBA24573, 0x39C9C670, 0x2A993584, 0xD8F2B687, + 0x0C38D26C, 0xFE53516F, 0xED03A29B, 0x1F682198, + 0x5125DAD3, 0xA34E59D0, 0xB01EAA24, 0x42752927, + 0x96BF4DCC, 0x64D4CECF, 0x77843D3B, 0x85EFBE38, + 0xDBFC821C, 0x2997011F, 0x3AC7F2EB, 0xC8AC71E8, + 0x1C661503, 0xEE0D9600, 0xFD5D65F4, 0x0F36E6F7, + 0x61C69362, 0x93AD1061, 0x80FDE395, 0x72966096, + 0xA65C047D, 0x5437877E, 0x4767748A, 0xB50CF789, + 0xEB1FCBAD, 0x197448AE, 0x0A24BB5A, 0xF84F3859, + 0x2C855CB2, 0xDEEEDFB1, 0xCDBE2C45, 0x3FD5AF46, + 0x7198540D, 0x83F3D70E, 0x90A324FA, 0x62C8A7F9, + 0xB602C312, 0x44694011, 0x5739B3E5, 0xA55230E6, + 0xFB410CC2, 0x092A8FC1, 0x1A7A7C35, 0xE811FF36, + 0x3CDB9BDD, 0xCEB018DE, 0xDDE0EB2A, 0x2F8B6829, + 0x82F63B78, 0x709DB87B, 0x63CD4B8F, 0x91A6C88C, + 0x456CAC67, 0xB7072F64, 0xA457DC90, 0x563C5F93, + 0x082F63B7, 0xFA44E0B4, 0xE9141340, 0x1B7F9043, + 0xCFB5F4A8, 0x3DDE77AB, 0x2E8E845F, 0xDCE5075C, + 0x92A8FC17, 0x60C37F14, 0x73938CE0, 0x81F80FE3, + 0x55326B08, 0xA759E80B, 0xB4091BFF, 0x466298FC, + 0x1871A4D8, 0xEA1A27DB, 0xF94AD42F, 0x0B21572C, + 0xDFEB33C7, 0x2D80B0C4, 0x3ED04330, 0xCCBBC033, + 0xA24BB5A6, 0x502036A5, 0x4370C551, 0xB11B4652, + 0x65D122B9, 0x97BAA1BA, 0x84EA524E, 0x7681D14D, + 0x2892ED69, 0xDAF96E6A, 0xC9A99D9E, 0x3BC21E9D, + 0xEF087A76, 0x1D63F975, 0x0E330A81, 0xFC588982, + 0xB21572C9, 0x407EF1CA, 0x532E023E, 0xA145813D, + 0x758FE5D6, 0x87E466D5, 0x94B49521, 0x66DF1622, + 0x38CC2A06, 0xCAA7A905, 0xD9F75AF1, 0x2B9CD9F2, + 0xFF56BD19, 0x0D3D3E1A, 0x1E6DCDEE, 0xEC064EED, + 0xC38D26C4, 0x31E6A5C7, 0x22B65633, 0xD0DDD530, + 0x0417B1DB, 0xF67C32D8, 0xE52CC12C, 0x1747422F, + 0x49547E0B, 0xBB3FFD08, 0xA86F0EFC, 0x5A048DFF, + 0x8ECEE914, 0x7CA56A17, 0x6FF599E3, 0x9D9E1AE0, + 0xD3D3E1AB, 0x21B862A8, 0x32E8915C, 0xC083125F, + 0x144976B4, 0xE622F5B7, 0xF5720643, 0x07198540, + 0x590AB964, 0xAB613A67, 0xB831C993, 0x4A5A4A90, + 0x9E902E7B, 0x6CFBAD78, 0x7FAB5E8C, 0x8DC0DD8F, + 0xE330A81A, 0x115B2B19, 0x020BD8ED, 0xF0605BEE, + 0x24AA3F05, 0xD6C1BC06, 0xC5914FF2, 0x37FACCF1, + 0x69E9F0D5, 0x9B8273D6, 0x88D28022, 0x7AB90321, + 0xAE7367CA, 0x5C18E4C9, 0x4F48173D, 0xBD23943E, + 0xF36E6F75, 0x0105EC76, 0x12551F82, 0xE03E9C81, + 0x34F4F86A, 0xC69F7B69, 0xD5CF889D, 0x27A40B9E, + 0x79B737BA, 0x8BDCB4B9, 0x988C474D, 0x6AE7C44E, + 0xBE2DA0A5, 0x4C4623A6, 0x5F16D052, 0xAD7D5351 +}; + +u_int32_t +sctp_crc32c(const void *packet, u_int32_t len) +{ + u_int32_t i, crc32c; + u_int8_t byte0, byte1, byte2, byte3; + const u_int8_t *buf = (const u_int8_t *)packet; + + crc32c = ~0; + for (i = 0; i < len; i++) + CRC32C(crc32c, buf[i]); + crc32c = ~crc32c; + byte0 = crc32c & 0xff; + byte1 = (crc32c>>8) & 0xff; + byte2 = (crc32c>>16) & 0xff; + byte3 = (crc32c>>24) & 0xff; + crc32c = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); + return htonl(crc32c); +} + +/* * Subtract 2 timeval structs: out = out - in. * Out is assumed to be within about LONG_MAX seconds of in. */ diff --git a/lib/libc/arm/SYS.h b/lib/libc/arm/SYS.h index 3254c45..1173087 100644 --- a/lib/libc/arm/SYS.h +++ b/lib/libc/arm/SYS.h @@ -39,15 +39,11 @@ #include <sys/syscall.h> #include <machine/swi.h> -#ifdef __ARM_EABI__ #define SYSTRAP(x) \ mov ip, r7; \ ldr r7, =SYS_ ## x; \ swi 0; \ mov r7, ip -#else -#define SYSTRAP(x) swi 0 | SYS_ ## x -#endif #define CERROR _C_LABEL(cerror) #define CURBRK _C_LABEL(curbrk) diff --git a/lib/libc/arm/aeabi/aeabi_asm_double.S b/lib/libc/arm/aeabi/aeabi_asm_double.S index ab44362..7a5af82 100644 --- a/lib/libc/arm/aeabi/aeabi_asm_double.S +++ b/lib/libc/arm/aeabi/aeabi_asm_double.S @@ -56,7 +56,7 @@ ENTRY(__aeabi_cdcmple) cmp r0, #1 bne 1f /* Yes, clear Z and C */ - msr cpsr_c, #(0) + mov ip, #(0) b 99f 1: @@ -70,14 +70,15 @@ ENTRY(__aeabi_cdcmple) cmp r0, #1 bne 2f /* Yes, set Z and C */ - msr cpsr_c, #(PCR_Z | PCR_C) + mov ip, #(PCR_Z | PCR_C) b 99f 2: /* Not less than or equal, set C and clear Z */ - msr cpsr_c, #(PCR_C) + mov ip, #(PCR_C) 99: + msr cpsr_c, ip pop {r4, r5, r6, r7, ip, pc} END(__aeabi_cdcmple) @@ -112,6 +113,7 @@ ENTRY(__aeabi_cdcmpeq) RET 1: - msr cpsr_c, #(PCR_C) + mov ip, #(PCR_C) + msr cpsr_c, ip RET END(__aeabi_cdcmpeq) diff --git a/lib/libc/arm/aeabi/aeabi_asm_float.S b/lib/libc/arm/aeabi/aeabi_asm_float.S index bf32af7..e05daa5 100644 --- a/lib/libc/arm/aeabi/aeabi_asm_float.S +++ b/lib/libc/arm/aeabi/aeabi_asm_float.S @@ -54,7 +54,7 @@ ENTRY(__aeabi_cfcmple) cmp r0, #1 bne 1f /* Yes, clear Z and C */ - msr cpsr_c, #(0) + mov ip, #(0) b 99f 1: @@ -66,14 +66,15 @@ ENTRY(__aeabi_cfcmple) cmp r0, #1 bne 2f /* Yes, set Z and C */ - msr cpsr_c, #(PCR_Z | PCR_C) + mov ip, #(PCR_Z | PCR_C) b 99f 2: /* Not less than or equal, set C and clear Z */ - msr cpsr_c, #(PCR_C) + mov ip, #(PCR_C) 99: + msr cpsr_c, ip pop {r4, r5, ip, pc} END(__aeabi_cfcmple) @@ -103,6 +104,7 @@ ENTRY(__aeabi_cfcmpeq) RET 1: - msreq cpsr_c, #(PCR_C) + mov ip, #(PCR_C) + msr cpsr_c, ip RET END(__aeabi_cfcmpeq) diff --git a/lib/libc/arm/gen/_setjmp.S b/lib/libc/arm/gen/_setjmp.S index 3de9d99..853f61c 100644 --- a/lib/libc/arm/gen/_setjmp.S +++ b/lib/libc/arm/gen/_setjmp.S @@ -36,7 +36,7 @@ #error FPA is not supported anymore #endif -#if defined(__ARM_EABI__) && !defined(_STANDALONE) +#if !defined(_STANDALONE) .fpu vfp #endif @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_setjmp) ldr r1, .L_setjmp_magic -#if defined(__ARM_EABI__) && !defined(_STANDALONE) +#if !defined(_STANDALONE) ldr r2, .Lfpu_present #ifdef PIC GOT_INIT(r3, .L_setjmp_got, .L_setjmp_gotinit) @@ -79,7 +79,7 @@ ENTRY(_setjmp) vmrs r2, fpscr str r2, [r0, #(_JB_REG_FPSCR * 4)] 1: -#endif /* __ARM_EABI__ */ +#endif /* !_STANDALONE */ str r1, [r0] @@ -99,11 +99,11 @@ END(_setjmp) .L_setjmp_magic: .word _JB_MAGIC__SETJMP -#if defined(__ARM_EABI__) && !defined(_STANDALONE) +#if !defined(_STANDALONE) GOT_INITSYM(.L_setjmp_got, .L_setjmp_gotinit) .Lfpu_present: .word PIC_SYM(_libc_arm_fpu_present, GOTOFF) -#endif /* __ARM_EABI__ */ +#endif /* !_STANDALONE */ WEAK_ALIAS(___longjmp, _longjmp) ENTRY(_longjmp) @@ -114,7 +114,7 @@ ENTRY(_longjmp) teq ip, r3 /* magic correct? */ bne botch /* no, botch */ -#if defined(__ARM_EABI__) && !defined(_STANDALONE) +#if !defined(_STANDALONE) teq r3, r2 /* did magic change? */ beq 1f /* no, don't restore VFP */ add ip, r0, #(_JB_REG_D8 * 4) @@ -122,7 +122,7 @@ ENTRY(_longjmp) ldr ip, [r0, #(_JB_REG_FPSCR * 4)] vmsr fpscr, ip 1: -#endif /* __ARM_EABI__ */ +#endif /* !_STANDALONE */ add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ diff --git a/lib/libc/arm/gen/setjmp.S b/lib/libc/arm/gen/setjmp.S index 6269563..c9ae329 100644 --- a/lib/libc/arm/gen/setjmp.S +++ b/lib/libc/arm/gen/setjmp.S @@ -36,9 +36,7 @@ #error FPA is not supported anymore #endif -#ifdef __ARM_EABI__ .fpu vfp -#endif #include <machine/asm.h> #include <machine/setjmp.h> @@ -66,7 +64,6 @@ ENTRY(setjmp) ldr r1, .Lsetjmp_magic -#ifdef __ARM_EABI__ ldr r2, .Lfpu_present #ifdef PIC GOT_INIT(r3, .Lsetjmp_got, .Lsetjmp_gotinit) @@ -84,7 +81,6 @@ ENTRY(setjmp) vmrs r2, fpscr str r2, [r0, #(_JB_REG_FPSCR * 4)] 1: -#endif /* __ARM_EABI__ */ str r1, [r0] /* store magic */ @@ -102,11 +98,9 @@ ENTRY(setjmp) .Lsetjmp_magic: .word _JB_MAGIC_SETJMP -#ifdef __ARM_EABI__ GOT_INITSYM(.Lsetjmp_got, .Lsetjmp_gotinit) .Lfpu_present: .word PIC_SYM(_libc_arm_fpu_present, GOTOFF) -#endif /* __ARM_EABI__ */ END(setjmp) .weak _C_LABEL(longjmp) @@ -126,7 +120,6 @@ ENTRY(__longjmp) bl PIC_SYM(_C_LABEL(sigprocmask), PLT) ldmfd sp!, {r0-r2, r14} -#ifdef __ARM_EABI__ tst r2, #(_JB_MAGIC_SETJMP ^ _JB_MAGIC_SETJMP_VFP) /* is this a VFP magic? */ beq 1f /* no, don't restore VFP */ @@ -135,7 +128,6 @@ ENTRY(__longjmp) ldr ip, [r0, #(_JB_REG_FPSCR * 4)] vmsr fpscr, ip 1: -#endif /* __ARM_EABI__ */ add r0, r0, #(_JB_REG_R4 * 4) /* Restore integer registers */ diff --git a/lib/libc/arm/string/ffs.S b/lib/libc/arm/string/ffs.S index 4567f6c..cc7f396 100644 --- a/lib/libc/arm/string/ffs.S +++ b/lib/libc/arm/string/ffs.S @@ -78,6 +78,7 @@ ENTRY(ffs) .byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */ .byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */ #else + itt ne clzne r0, r0 rsbne r0, r0, #32 RET diff --git a/lib/libc/arm/string/memmove.S b/lib/libc/arm/string/memmove.S index 94e5474..2cd5a5e 100644 --- a/lib/libc/arm/string/memmove.S +++ b/lib/libc/arm/string/memmove.S @@ -48,7 +48,9 @@ ENTRY(bcopy) #endif /* Do the buffers overlap? */ cmp r0, r1 + it eq RETeq /* Bail now if src/dst are the same */ + ite cc subcc r3, r0, r1 /* if (dst > src) r3 = dst - src */ subcs r3, r1, r0 /* if (src > dsr) r3 = src - dst */ cmp r3, r2 /* if (r3 < len) we have an overlap */ @@ -56,8 +58,10 @@ ENTRY(bcopy) /* Determine copy direction */ cmp r1, r0 + it cc bcc .Lmemmove_backwards + itt eq moveq r0, #0 /* Quick abort for len=0 */ RETeq @@ -88,6 +92,7 @@ ENTRY(bcopy) bge .Lmemmove_floop32 cmn r2, #0x10 + ittt ge ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ stmiage r0!, {r3, r4, r12, lr} subge r2, r2, #0x10 @@ -98,6 +103,7 @@ ENTRY(bcopy) /* blat 12 bytes at a time */ .Lmemmove_floop12: + ittt ge ldmiage r1!, {r3, r12, lr} stmiage r0!, {r3, r12, lr} subsge r2, r2, #0x0c @@ -108,8 +114,10 @@ ENTRY(bcopy) blt .Lmemmove_fl4 subs r2, r2, #4 + itt lt ldrlt r3, [r1], #4 strlt r3, [r0], #4 + ittt ge ldmiage r1!, {r3, r12} stmiage r0!, {r3, r12} subge r2, r2, #4 @@ -117,14 +125,17 @@ ENTRY(bcopy) .Lmemmove_fl4: /* less than 4 bytes to go */ adds r2, r2, #4 + it eq ldmiaeq sp!, {r0, pc} /* done */ /* copy the crud byte at a time */ cmp r2, #2 ldrb r3, [r1], #1 strb r3, [r0], #1 + itt ge ldrbge r3, [r1], #1 strbge r3, [r0], #1 + itt gt ldrbgt r3, [r1], #1 strbgt r3, [r0], #1 ldmia sp!, {r0, pc} @@ -137,8 +148,10 @@ ENTRY(bcopy) /* align destination with byte copies */ ldrb r3, [r1], #1 strb r3, [r0], #1 + itt ge ldrbge r3, [r1], #1 strbge r3, [r0], #1 + itt gt ldrbgt r3, [r1], #1 strbgt r3, [r0], #1 subs r2, r2, r12 @@ -355,10 +368,12 @@ ENTRY(bcopy) .Lmemmove_bl32: cmn r2, #0x10 + ittt ge ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ stmdbge r0!, {r3, r4, r12, lr} subge r2, r2, #0x10 adds r2, r2, #0x14 + ittt ge ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */ stmdbge r0!, {r3, r12, lr} subge r2, r2, #0x0c @@ -368,8 +383,10 @@ ENTRY(bcopy) adds r2, r2, #8 blt .Lmemmove_bl4 subs r2, r2, #4 + itt lt ldrlt r3, [r1, #-4]! strlt r3, [r0, #-4]! + ittt ge ldmdbge r1!, {r3, r12} stmdbge r0!, {r3, r12} subge r2, r2, #4 @@ -377,14 +394,17 @@ ENTRY(bcopy) .Lmemmove_bl4: /* less than 4 bytes to go */ adds r2, r2, #4 + it eq RETeq /* done */ /* copy the crud byte at a time */ cmp r2, #2 ldrb r3, [r1, #-1]! strb r3, [r0, #-1]! + itt ge ldrbge r3, [r1, #-1]! strbge r3, [r0, #-1]! + itt gt ldrbgt r3, [r1, #-1]! strbgt r3, [r0, #-1]! RET @@ -396,8 +416,10 @@ ENTRY(bcopy) /* align destination with byte copies */ ldrb r3, [r1, #-1]! strb r3, [r0, #-1]! + itt ge ldrbge r3, [r1, #-1]! strbge r3, [r0, #-1]! + itt gt ldrbgt r3, [r1, #-1]! strbgt r3, [r0, #-1]! subs r2, r2, r12 diff --git a/lib/libc/arm/string/memset.S b/lib/libc/arm/string/memset.S index 66af33e..6d76901 100644 --- a/lib/libc/arm/string/memset.S +++ b/lib/libc/arm/string/memset.S @@ -114,6 +114,7 @@ ENTRY(memset) orr r3, r3, r3, lsl #16 /* Extend value to 32-bits */ #endif #ifdef _ARM_ARCH_5E + itt ne subne r1, r1, #0x04 /* Quad-align if necessary */ strne r3, [ip], #0x04 cmp r1, #0x10 @@ -127,18 +128,22 @@ ENTRY(memset) .Lmemset_loop128: subs r1, r1, #0x80 #ifdef _ARM_ARCH_5E + itttt ge strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 + itttt ge strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 + itttt ge strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 + itttt ge strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 @@ -162,6 +167,7 @@ ENTRY(memset) stmiage ip!, {r2-r3} #endif bgt .Lmemset_loop128 + it eq RETeq /* Zero length so just exit */ add r1, r1, #0x80 /* Adjust for extra sub */ @@ -169,6 +175,7 @@ ENTRY(memset) /* Do 32 bytes at a time */ .Lmemset_loop32: subs r1, r1, #0x20 + itttt ge #ifdef _ARM_ARCH_5E strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 @@ -181,11 +188,13 @@ ENTRY(memset) stmiage ip!, {r2-r3} #endif bgt .Lmemset_loop32 + it eq RETeq /* Zero length so just exit */ adds r1, r1, #0x10 /* Partially adjust for extra sub */ /* Deal with 16 bytes or more */ + itt ge #ifdef _ARM_ARCH_5E strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 @@ -193,20 +202,25 @@ ENTRY(memset) stmiage ip!, {r2-r3} stmiage ip!, {r2-r3} #endif + it eq RETeq /* Zero length so just exit */ + it lt addlt r1, r1, #0x10 /* Possibly adjust for extra sub */ /* We have at least 4 bytes so copy as words */ .Lmemset_loop4: subs r1, r1, #0x04 + it ge strge r3, [ip], #0x04 bgt .Lmemset_loop4 + it eq RETeq /* Zero length so just exit */ #ifdef _ARM_ARCH_5E /* Compensate for 64-bit alignment check */ adds r1, r1, #0x04 + it eq RETeq cmp r1, #2 #else @@ -214,7 +228,9 @@ ENTRY(memset) #endif strb r3, [ip], #0x01 /* Set 1 byte */ + it ge strbge r3, [ip], #0x01 /* Set another byte */ + it gt strbgt r3, [ip] /* and a third */ RET /* Exit */ @@ -222,18 +238,24 @@ ENTRY(memset) rsb r2, r2, #0x004 strb r3, [ip], #0x01 /* Set 1 byte */ cmp r2, #0x02 + it ge strbge r3, [ip], #0x01 /* Set another byte */ sub r1, r1, r2 + it gt strbgt r3, [ip], #0x01 /* and a third */ cmp r1, #0x04 /* More than 4 bytes left? */ + it ge bge .Lmemset_wordaligned /* Yup */ .Lmemset_lessthanfour: cmp r1, #0x00 + it eq RETeq /* Zero length so exit */ strb r3, [ip], #0x01 /* Set 1 byte */ cmp r1, #0x02 + it ge strbge r3, [ip], #0x01 /* Set another byte */ + it gt strbgt r3, [ip] /* and a third */ RET /* Exit */ #ifdef _BZERO diff --git a/lib/libc/arm/string/strcmp.S b/lib/libc/arm/string/strcmp.S index 3dd7453..d610fea 100644 --- a/lib/libc/arm/string/strcmp.S +++ b/lib/libc/arm/string/strcmp.S @@ -37,6 +37,7 @@ ENTRY(strcmp) ldrb r2, [r0], #1 ldrb r3, [r1], #1 cmp r2, #1 + it cs cmpcs r2, r3 beq 1b sub r0, r2, r3 diff --git a/lib/libc/arm/string/strlen.S b/lib/libc/arm/string/strlen.S index 7447710..c9334f9 100644 --- a/lib/libc/arm/string/strlen.S +++ b/lib/libc/arm/string/strlen.S @@ -52,8 +52,10 @@ ENTRY(strlen) #else ands r3, r2, #0xff000000 #endif + it ne addne r1, r1, #1 .Ldo_3: + itt ne #ifndef __ARMEB__ andsne r3, r2, #0x0000ff00 #else @@ -61,6 +63,7 @@ ENTRY(strlen) #endif addne r1, r1, #1 .Ldo_2: + itt ne #ifndef __ARMEB__ andsne r3, r2, #0x00ff0000 #else @@ -68,6 +71,7 @@ ENTRY(strlen) #endif addne r1, r1, #1 .Ldo_1: + ittt ne #ifndef __ARMEB__ andsne r3, r2, #0xff000000 #else diff --git a/lib/libc/arm/string/strncmp.S b/lib/libc/arm/string/strncmp.S index ac59deb..a5c0320 100644 --- a/lib/libc/arm/string/strncmp.S +++ b/lib/libc/arm/string/strncmp.S @@ -35,18 +35,21 @@ __FBSDID("$FreeBSD$"); ENTRY(strncmp) /* if (len == 0) return 0 */ cmp r2, #0 + itt eq moveq r0, #0 moveq pc, lr /* ip == last src address to compare */ adds ip, r0, r2 /* Use last possible address on overflow. */ + it cs movcs ip, #0 sub ip, ip, #1 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1 cmp ip, r0 + itt cs cmpcs r2, #1 cmpcs r2, r3 beq 1b diff --git a/lib/libc/xdr/xdr.c b/lib/libc/xdr/xdr.c index 4435119..4138171 100644 --- a/lib/libc/xdr/xdr.c +++ b/lib/libc/xdr/xdr.c @@ -76,9 +76,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; * Not a filter, but a convenient utility nonetheless */ void -xdr_free(proc, objp) - xdrproc_t proc; - void *objp; +xdr_free(xdrproc_t proc, void *objp) { XDR x; @@ -101,9 +99,7 @@ xdr_void(void) * XDR integers */ bool_t -xdr_int(xdrs, ip) - XDR *xdrs; - int *ip; +xdr_int(XDR *xdrs, int *ip) { long l; @@ -131,9 +127,7 @@ xdr_int(xdrs, ip) * XDR unsigned integers */ bool_t -xdr_u_int(xdrs, up) - XDR *xdrs; - u_int *up; +xdr_u_int(XDR *xdrs, u_int *up) { u_long l; @@ -163,9 +157,7 @@ xdr_u_int(xdrs, up) * same as xdr_u_long - open coded to save a proc call! */ bool_t -xdr_long(xdrs, lp) - XDR *xdrs; - long *lp; +xdr_long(XDR *xdrs, long *lp) { switch (xdrs->x_op) { case XDR_ENCODE: @@ -184,9 +176,7 @@ xdr_long(xdrs, lp) * same as xdr_long - open coded to save a proc call! */ bool_t -xdr_u_long(xdrs, ulp) - XDR *xdrs; - u_long *ulp; +xdr_u_long(XDR *xdrs, u_long *ulp) { switch (xdrs->x_op) { case XDR_ENCODE: @@ -206,9 +196,7 @@ xdr_u_long(xdrs, ulp) * same as xdr_u_int32_t - open coded to save a proc call! */ bool_t -xdr_int32_t(xdrs, int32_p) - XDR *xdrs; - int32_t *int32_p; +xdr_int32_t(XDR *xdrs, int32_t *int32_p) { long l; @@ -237,9 +225,7 @@ xdr_int32_t(xdrs, int32_p) * same as xdr_int32_t - open coded to save a proc call! */ bool_t -xdr_u_int32_t(xdrs, u_int32_p) - XDR *xdrs; - u_int32_t *u_int32_p; +xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p) { u_long l; @@ -268,9 +254,7 @@ xdr_u_int32_t(xdrs, u_int32_p) * same as xdr_int32_t - open coded to save a proc call! */ bool_t -xdr_uint32_t(xdrs, u_int32_p) - XDR *xdrs; - uint32_t *u_int32_p; +xdr_uint32_t(XDR *xdrs, uint32_t *u_int32_p) { u_long l; @@ -298,9 +282,7 @@ xdr_uint32_t(xdrs, u_int32_p) * XDR short integers */ bool_t -xdr_short(xdrs, sp) - XDR *xdrs; - short *sp; +xdr_short(XDR *xdrs, short *sp) { long l; @@ -328,9 +310,7 @@ xdr_short(xdrs, sp) * XDR unsigned short integers */ bool_t -xdr_u_short(xdrs, usp) - XDR *xdrs; - u_short *usp; +xdr_u_short(XDR *xdrs, u_short *usp) { u_long l; @@ -359,9 +339,7 @@ xdr_u_short(xdrs, usp) * XDR 16-bit integers */ bool_t -xdr_int16_t(xdrs, int16_p) - XDR *xdrs; - int16_t *int16_p; +xdr_int16_t(XDR *xdrs, int16_t *int16_p) { long l; @@ -389,9 +367,7 @@ xdr_int16_t(xdrs, int16_p) * XDR unsigned 16-bit integers */ bool_t -xdr_u_int16_t(xdrs, u_int16_p) - XDR *xdrs; - u_int16_t *u_int16_p; +xdr_u_int16_t(XDR *xdrs, u_int16_t *u_int16_p) { u_long l; @@ -419,9 +395,7 @@ xdr_u_int16_t(xdrs, u_int16_p) * XDR unsigned 16-bit integers */ bool_t -xdr_uint16_t(xdrs, u_int16_p) - XDR *xdrs; - uint16_t *u_int16_p; +xdr_uint16_t(XDR *xdrs, uint16_t *u_int16_p) { u_long l; @@ -450,9 +424,7 @@ xdr_uint16_t(xdrs, u_int16_p) * XDR a char */ bool_t -xdr_char(xdrs, cp) - XDR *xdrs; - char *cp; +xdr_char(XDR *xdrs, char *cp) { int i; @@ -468,9 +440,7 @@ xdr_char(xdrs, cp) * XDR an unsigned char */ bool_t -xdr_u_char(xdrs, cp) - XDR *xdrs; - u_char *cp; +xdr_u_char(XDR *xdrs, u_char *cp) { u_int u; @@ -486,9 +456,7 @@ xdr_u_char(xdrs, cp) * XDR booleans */ bool_t -xdr_bool(xdrs, bp) - XDR *xdrs; - bool_t *bp; +xdr_bool(XDR *xdrs, bool_t *bp) { long lb; @@ -516,9 +484,7 @@ xdr_bool(xdrs, bp) * XDR enumerations */ bool_t -xdr_enum(xdrs, ep) - XDR *xdrs; - enum_t *ep; +xdr_enum(XDR *xdrs, enum_t *ep) { enum sizecheck { SIZEVAL }; /* used to find the size of an enum */ @@ -542,10 +508,7 @@ xdr_enum(xdrs, ep) * cp points to the opaque object and cnt gives the byte length. */ bool_t -xdr_opaque(xdrs, cp, cnt) - XDR *xdrs; - caddr_t cp; - u_int cnt; +xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt) { u_int rndup; static int crud[BYTES_PER_XDR_UNIT]; @@ -594,11 +557,7 @@ xdr_opaque(xdrs, cp, cnt) * If *cpp is NULL maxsize bytes are allocated */ bool_t -xdr_bytes(xdrs, cpp, sizep, maxsize) - XDR *xdrs; - char **cpp; - u_int *sizep; - u_int maxsize; +xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int nodesize; @@ -650,9 +609,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) * Implemented here due to commonality of the object. */ bool_t -xdr_netobj(xdrs, np) - XDR *xdrs; - struct netobj *np; +xdr_netobj(XDR *xdrs, struct netobj *np) { return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); @@ -670,12 +627,14 @@ xdr_netobj(xdrs, np) * If there is no specific or default routine an error is returned. */ bool_t -xdr_union(xdrs, dscmp, unp, choices, dfault) - XDR *xdrs; - enum_t *dscmp; /* enum to decide which arm to work on */ - char *unp; /* the union itself */ - const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */ - xdrproc_t dfault; /* default xdr routine */ +xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault) +/* + * XDR *xdrs; + * enum_t *dscmp; // enum to decide which arm to work on + * char *unp; // the union itself + * const struct xdr_discrim *choices; // [value, xdr proc] for each arm + * xdrproc_t dfault; // default xdr routine + */ { enum_t dscm; @@ -719,10 +678,7 @@ xdr_union(xdrs, dscmp, unp, choices, dfault) * of the string as specified by a protocol. */ bool_t -xdr_string(xdrs, cpp, maxsize) - XDR *xdrs; - char **cpp; - u_int maxsize; +xdr_string(XDR *xdrs, char **cpp, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ u_int size; @@ -786,9 +742,7 @@ xdr_string(xdrs, cpp, maxsize) * routines like clnt_call */ bool_t -xdr_wrapstring(xdrs, cpp) - XDR *xdrs; - char **cpp; +xdr_wrapstring(XDR *xdrs, char **cpp) { return xdr_string(xdrs, cpp, LASTUNSIGNED); } @@ -805,9 +759,7 @@ xdr_wrapstring(xdrs, cpp) * XDR 64-bit integers */ bool_t -xdr_int64_t(xdrs, llp) - XDR *xdrs; - int64_t *llp; +xdr_int64_t(XDR *xdrs, int64_t *llp) { u_long ul[2]; @@ -838,9 +790,7 @@ xdr_int64_t(xdrs, llp) * XDR unsigned 64-bit integers */ bool_t -xdr_u_int64_t(xdrs, ullp) - XDR *xdrs; - u_int64_t *ullp; +xdr_u_int64_t(XDR *xdrs, u_int64_t *ullp) { u_long ul[2]; @@ -870,9 +820,7 @@ xdr_u_int64_t(xdrs, ullp) * XDR unsigned 64-bit integers */ bool_t -xdr_uint64_t(xdrs, ullp) - XDR *xdrs; - uint64_t *ullp; +xdr_uint64_t(XDR *xdrs, uint64_t *ullp) { u_long ul[2]; @@ -903,9 +851,7 @@ xdr_uint64_t(xdrs, ullp) * XDR hypers */ bool_t -xdr_hyper(xdrs, llp) - XDR *xdrs; - longlong_t *llp; +xdr_hyper(XDR *xdrs, longlong_t *llp) { /* @@ -920,9 +866,7 @@ xdr_hyper(xdrs, llp) * XDR unsigned hypers */ bool_t -xdr_u_hyper(xdrs, ullp) - XDR *xdrs; - u_longlong_t *ullp; +xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp) { /* @@ -937,9 +881,7 @@ xdr_u_hyper(xdrs, ullp) * XDR longlong_t's */ bool_t -xdr_longlong_t(xdrs, llp) - XDR *xdrs; - longlong_t *llp; +xdr_longlong_t(XDR *xdrs, longlong_t *llp) { /* @@ -954,9 +896,7 @@ xdr_longlong_t(xdrs, llp) * XDR u_longlong_t's */ bool_t -xdr_u_longlong_t(xdrs, ullp) - XDR *xdrs; - u_longlong_t *ullp; +xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp) { /* diff --git a/lib/libc/xdr/xdr_array.c b/lib/libc/xdr/xdr_array.c index 620155c..a11c7a1 100644 --- a/lib/libc/xdr/xdr_array.c +++ b/lib/libc/xdr/xdr_array.c @@ -64,13 +64,15 @@ __FBSDID("$FreeBSD$"); * xdr procedure to call to handle each element of the array. */ bool_t -xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) - XDR *xdrs; - caddr_t *addrp; /* array pointer */ - u_int *sizep; /* number of elements */ - u_int maxsize; /* max numberof elements */ - u_int elsize; /* size in bytes of each element */ - xdrproc_t elproc; /* xdr routine to handle each element */ +xdr_array(XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc) +/* + * XDR *xdrs; + * caddr_t *addrp; // array pointer + * u_int *sizep; // number of elements + * u_int maxsize; // max numberof elements + * u_int elsize; // size in bytes of each element + * xdrproc_t elproc; // xdr routine to handle each element + */ { u_int i; caddr_t target = *addrp; @@ -142,12 +144,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) * > xdr_elem: routine to XDR each element */ bool_t -xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem) - XDR *xdrs; - char *basep; - u_int nelem; - u_int elemsize; - xdrproc_t xdr_elem; +xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize, xdrproc_t xdr_elem) { u_int i; char *elptr; diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c index 1d3bb61..fc024fc 100644 --- a/lib/libc/xdr/xdr_float.c +++ b/lib/libc/xdr/xdr_float.c @@ -204,9 +204,7 @@ static struct dbl_limits { bool_t -xdr_double(xdrs, dp) - XDR *xdrs; - double *dp; +xdr_double(XDR *xdrs, double *dp) { #ifdef IEEEFP int32_t *i32p; diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c index 70f79c6..0455a5a 100644 --- a/lib/libc/xdr/xdr_mem.c +++ b/lib/libc/xdr/xdr_mem.c @@ -98,11 +98,7 @@ static const struct xdr_ops xdrmem_ops_unaligned = { * memory buffer. */ void -xdrmem_create(xdrs, addr, size, op) - XDR *xdrs; - char *addr; - u_int size; - enum xdr_op op; +xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op) { xdrs->x_op = op; @@ -114,16 +110,13 @@ xdrmem_create(xdrs, addr, size, op) /*ARGSUSED*/ static void -xdrmem_destroy(xdrs) - XDR *xdrs; +xdrmem_destroy(XDR *xdrs) { } static bool_t -xdrmem_getlong_aligned(xdrs, lp) - XDR *xdrs; - long *lp; +xdrmem_getlong_aligned(XDR *xdrs, long *lp) { if (xdrs->x_handy < sizeof(int32_t)) @@ -135,9 +128,7 @@ xdrmem_getlong_aligned(xdrs, lp) } static bool_t -xdrmem_putlong_aligned(xdrs, lp) - XDR *xdrs; - const long *lp; +xdrmem_putlong_aligned(XDR *xdrs, const long *lp) { if (xdrs->x_handy < sizeof(int32_t)) @@ -149,9 +140,7 @@ xdrmem_putlong_aligned(xdrs, lp) } static bool_t -xdrmem_getlong_unaligned(xdrs, lp) - XDR *xdrs; - long *lp; +xdrmem_getlong_unaligned(XDR *xdrs, long *lp) { u_int32_t l; @@ -165,9 +154,7 @@ xdrmem_getlong_unaligned(xdrs, lp) } static bool_t -xdrmem_putlong_unaligned(xdrs, lp) - XDR *xdrs; - const long *lp; +xdrmem_putlong_unaligned(XDR *xdrs, const long *lp) { u_int32_t l; @@ -181,10 +168,7 @@ xdrmem_putlong_unaligned(xdrs, lp) } static bool_t -xdrmem_getbytes(xdrs, addr, len) - XDR *xdrs; - char *addr; - u_int len; +xdrmem_getbytes(XDR *xdrs, char *addr, u_int len) { if (xdrs->x_handy < len) @@ -196,10 +180,7 @@ xdrmem_getbytes(xdrs, addr, len) } static bool_t -xdrmem_putbytes(xdrs, addr, len) - XDR *xdrs; - const char *addr; - u_int len; +xdrmem_putbytes(XDR *xdrs, const char *addr, u_int len) { if (xdrs->x_handy < len) @@ -211,8 +192,7 @@ xdrmem_putbytes(xdrs, addr, len) } static u_int -xdrmem_getpos(xdrs) - XDR *xdrs; +xdrmem_getpos(XDR *xdrs) { /* XXX w/64-bit pointers, u_int not enough! */ @@ -220,9 +200,7 @@ xdrmem_getpos(xdrs) } static bool_t -xdrmem_setpos(xdrs, pos) - XDR *xdrs; - u_int pos; +xdrmem_setpos(XDR *xdrs, u_int pos) { char *newaddr = xdrs->x_base + pos; char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy; @@ -235,9 +213,7 @@ xdrmem_setpos(xdrs, pos) } static int32_t * -xdrmem_inline_aligned(xdrs, len) - XDR *xdrs; - u_int len; +xdrmem_inline_aligned(XDR *xdrs, u_int len) { int32_t *buf = 0; @@ -251,9 +227,7 @@ xdrmem_inline_aligned(xdrs, len) /* ARGSUSED */ static int32_t * -xdrmem_inline_unaligned(xdrs, len) - XDR *xdrs; - u_int len; +xdrmem_inline_unaligned(XDR *xdrs, u_int len) { return (0); diff --git a/lib/libc/xdr/xdr_rec.c b/lib/libc/xdr/xdr_rec.c index 3f63498..f818ed94 100644 --- a/lib/libc/xdr/xdr_rec.c +++ b/lib/libc/xdr/xdr_rec.c @@ -161,15 +161,18 @@ static bool_t realloc_stream(RECSTREAM *, int); * calls expect that they take an opaque handle rather than an fd. */ void -xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) - XDR *xdrs; - u_int sendsize; - u_int recvsize; - void *tcp_handle; - /* like read, but pass it a tcp_handle, not sock */ - int (*readit)(void *, void *, int); - /* like write, but pass it a tcp_handle, not sock */ - int (*writeit)(void *, void *, int); +xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, void *tcp_handle, + int (*readit)(void *, void *, int), int (*writeit)(void *, void *, int)) +/* + * XDR *xdrs; + * u_int sendsize; + * u_int recvsize; + * void *tcp_handle; + * // like read, but pass it a tcp_handle, not sock + * int (*readit)(void *, void *, int); + * // like write, but pass it a tcp_handle, not sock + * int (*writeit)(void *, void *, int); + */ { RECSTREAM *rstrm = mem_alloc(sizeof(RECSTREAM)); @@ -229,9 +232,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) */ static bool_t -xdrrec_getlong(xdrs, lp) - XDR *xdrs; - long *lp; +xdrrec_getlong(XDR *xdrs, long *lp) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int32_t *buflp = (int32_t *)(void *)(rstrm->in_finger); @@ -253,9 +254,7 @@ xdrrec_getlong(xdrs, lp) } static bool_t -xdrrec_putlong(xdrs, lp) - XDR *xdrs; - const long *lp; +xdrrec_putlong(XDR *xdrs, const long *lp) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int32_t *dest_lp = ((int32_t *)(void *)(rstrm->out_finger)); @@ -277,10 +276,7 @@ xdrrec_putlong(xdrs, lp) } static bool_t /* must manage buffers, fragments, and records */ -xdrrec_getbytes(xdrs, addr, len) - XDR *xdrs; - char *addr; - u_int len; +xdrrec_getbytes(XDR *xdrs, char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); int current; @@ -305,10 +301,7 @@ xdrrec_getbytes(xdrs, addr, len) } static bool_t -xdrrec_putbytes(xdrs, addr, len) - XDR *xdrs; - const char *addr; - u_int len; +xdrrec_putbytes(XDR *xdrs, const char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); size_t current; @@ -331,8 +324,7 @@ xdrrec_putbytes(xdrs, addr, len) } static u_int -xdrrec_getpos(xdrs) - XDR *xdrs; +xdrrec_getpos(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; off_t pos; @@ -358,9 +350,7 @@ xdrrec_getpos(xdrs) } static bool_t -xdrrec_setpos(xdrs, pos) - XDR *xdrs; - u_int pos; +xdrrec_setpos(XDR *xdrs, u_int pos) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; u_int currpos = xdrrec_getpos(xdrs); @@ -397,9 +387,7 @@ xdrrec_setpos(xdrs, pos) } static int32_t * -xdrrec_inline(xdrs, len) - XDR *xdrs; - u_int len; +xdrrec_inline(XDR *xdrs, u_int len) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; int32_t *buf = NULL; @@ -429,8 +417,7 @@ xdrrec_inline(xdrs, len) } static void -xdrrec_destroy(xdrs) - XDR *xdrs; +xdrrec_destroy(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; @@ -449,8 +436,7 @@ xdrrec_destroy(xdrs) * this procedure to guarantee proper record alignment. */ bool_t -xdrrec_skiprecord(xdrs) - XDR *xdrs; +xdrrec_skiprecord(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); enum xprt_stat xstat; @@ -485,8 +471,7 @@ xdrrec_skiprecord(xdrs) * after consuming the rest of the current record. */ bool_t -xdrrec_eof(xdrs) - XDR *xdrs; +xdrrec_eof(XDR *xdrs) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); @@ -509,9 +494,7 @@ xdrrec_eof(xdrs) * pipelined procedure calls.) TRUE => immmediate flush to tcp connection. */ bool_t -xdrrec_endofrecord(xdrs, sendnow) - XDR *xdrs; - bool_t sendnow; +xdrrec_endofrecord(XDR *xdrs, bool_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); u_long len; /* fragment length */ @@ -535,10 +518,7 @@ xdrrec_endofrecord(xdrs, sendnow) * Return true if a record is available in the buffer, false if not. */ bool_t -__xdrrec_getrec(xdrs, statp, expectdata) - XDR *xdrs; - enum xprt_stat *statp; - bool_t expectdata; +__xdrrec_getrec(XDR *xdrs, enum xprt_stat *statp, bool_t expectdata) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); ssize_t n; @@ -618,9 +598,7 @@ __xdrrec_getrec(xdrs, statp, expectdata) } bool_t -__xdrrec_setnonblock(xdrs, maxrec) - XDR *xdrs; - int maxrec; +__xdrrec_setnonblock(XDR *xdrs, int maxrec) { RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); @@ -635,9 +613,7 @@ __xdrrec_setnonblock(xdrs, maxrec) * Internal useful routines */ static bool_t -flush_out(rstrm, eor) - RECSTREAM *rstrm; - bool_t eor; +flush_out(RECSTREAM *rstrm, bool_t eor) { u_int32_t eormask = (eor == TRUE) ? LAST_FRAG : 0; u_int32_t len = (u_int32_t)((u_long)(rstrm->out_finger) - @@ -655,8 +631,7 @@ flush_out(rstrm, eor) } static bool_t /* knows nothing about records! Only about input buffers */ -fill_input_buf(rstrm) - RECSTREAM *rstrm; +fill_input_buf(RECSTREAM *rstrm) { char *where; u_int32_t i; @@ -678,10 +653,7 @@ fill_input_buf(rstrm) } static bool_t /* knows nothing about records! Only about input buffers */ -get_input_bytes(rstrm, addr, len) - RECSTREAM *rstrm; - char *addr; - int len; +get_input_bytes(RECSTREAM *rstrm, char *addr, int len) { size_t current; @@ -711,8 +683,7 @@ get_input_bytes(rstrm, addr, len) } static bool_t /* next two bytes of the input stream are treated as a header */ -set_input_fragment(rstrm) - RECSTREAM *rstrm; +set_input_fragment(RECSTREAM *rstrm) { u_int32_t header; @@ -737,9 +708,7 @@ set_input_fragment(rstrm) } static bool_t /* consumes input bytes; knows nothing about records! */ -skip_input_bytes(rstrm, cnt) - RECSTREAM *rstrm; - long cnt; +skip_input_bytes(RECSTREAM *rstrm, long cnt) { u_int32_t current; @@ -759,8 +728,7 @@ skip_input_bytes(rstrm, cnt) } static u_int -fix_buf_size(s) - u_int s; +fix_buf_size(u_int s) { if (s < 100) @@ -772,9 +740,7 @@ fix_buf_size(s) * Reallocate the input buffer for a non-block stream. */ static bool_t -realloc_stream(rstrm, size) - RECSTREAM *rstrm; - int size; +realloc_stream(RECSTREAM *rstrm, int size) { ptrdiff_t diff; char *buf; diff --git a/lib/libc/xdr/xdr_reference.c b/lib/libc/xdr/xdr_reference.c index 146dcf2..9acdd96 100644 --- a/lib/libc/xdr/xdr_reference.c +++ b/lib/libc/xdr/xdr_reference.c @@ -65,11 +65,13 @@ __FBSDID("$FreeBSD$"); * proc is the routine to handle the referenced structure. */ bool_t -xdr_reference(xdrs, pp, size, proc) - XDR *xdrs; - caddr_t *pp; /* the pointer to work on */ - u_int size; /* size of the object pointed to */ - xdrproc_t proc; /* xdr routine to handle the object */ +xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc) +/* + * XDR *xdrs; + * caddr_t *pp; // the pointer to work on + * u_int size; // size of the object pointed to + * xdrproc_t proc; // xdr routine to handle the object + */ { caddr_t loc = *pp; bool_t stat; @@ -122,11 +124,7 @@ xdr_reference(xdrs, pp, size, proc) * */ bool_t -xdr_pointer(xdrs,objpp,obj_size,xdr_obj) - XDR *xdrs; - char **objpp; - u_int obj_size; - xdrproc_t xdr_obj; +xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj) { bool_t more_data; diff --git a/lib/libc/xdr/xdr_sizeof.c b/lib/libc/xdr/xdr_sizeof.c index 3daaa0c..f4b2874 100644 --- a/lib/libc/xdr/xdr_sizeof.c +++ b/lib/libc/xdr/xdr_sizeof.c @@ -47,9 +47,7 @@ __FBSDID("$FreeBSD$"); /* ARGSUSED */ static bool_t -x_putlong(xdrs, longp) - XDR *xdrs; - long *longp; +x_putlong(XDR *xdrs, const long *longp) { xdrs->x_handy += BYTES_PER_XDR_UNIT; return (TRUE); @@ -57,36 +55,28 @@ x_putlong(xdrs, longp) /* ARGSUSED */ static bool_t -x_putbytes(xdrs, bp, len) - XDR *xdrs; - char *bp; - u_int len; +x_putbytes(XDR *xdrs, const char *bp, u_int len) { xdrs->x_handy += len; return (TRUE); } static u_int -x_getpostn(xdrs) - XDR *xdrs; +x_getpostn(XDR *xdrs) { return (xdrs->x_handy); } /* ARGSUSED */ static bool_t -x_setpostn(xdrs, pos) - XDR *xdrs; - u_int pos; +x_setpostn(XDR *xdrs, u_int pos) { /* This is not allowed */ return (FALSE); } static int32_t * -x_inline(xdrs, len) - XDR *xdrs; - u_int len; +x_inline(XDR *xdrs, u_int len) { if (len == 0) { return (NULL); @@ -113,15 +103,14 @@ x_inline(xdrs, len) } static int -harmless() +harmless(void) { /* Always return FALSE/NULL, as the case may be */ return (0); } static void -x_destroy(xdrs) - XDR *xdrs; +x_destroy(XDR *xdrs) { xdrs->x_handy = 0; xdrs->x_base = 0; @@ -133,9 +122,7 @@ x_destroy(xdrs) } unsigned long -xdr_sizeof(func, data) - xdrproc_t func; - void *data; +xdr_sizeof(xdrproc_t func, void *data) { XDR x; struct xdr_ops ops; diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c index 832b308..0065154 100644 --- a/lib/libc/xdr/xdr_stdio.c +++ b/lib/libc/xdr/xdr_stdio.c @@ -83,10 +83,7 @@ static const struct xdr_ops xdrstdio_ops = { * Operation flag is set to op. */ void -xdrstdio_create(xdrs, file, op) - XDR *xdrs; - FILE *file; - enum xdr_op op; +xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op) { xdrs->x_op = op; @@ -101,17 +98,14 @@ xdrstdio_create(xdrs, file, op) * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create. */ static void -xdrstdio_destroy(xdrs) - XDR *xdrs; +xdrstdio_destroy(XDR *xdrs) { (void)fflush((FILE *)xdrs->x_private); /* XXX: should we close the file ?? */ } static bool_t -xdrstdio_getlong(xdrs, lp) - XDR *xdrs; - long *lp; +xdrstdio_getlong(XDR *xdrs, long *lp) { u_int32_t temp; @@ -122,9 +116,7 @@ xdrstdio_getlong(xdrs, lp) } static bool_t -xdrstdio_putlong(xdrs, lp) - XDR *xdrs; - const long *lp; +xdrstdio_putlong(XDR *xdrs, const long *lp) { int32_t mycopy = htonl((u_int32_t)*lp); @@ -134,10 +126,7 @@ xdrstdio_putlong(xdrs, lp) } static bool_t -xdrstdio_getbytes(xdrs, addr, len) - XDR *xdrs; - char *addr; - u_int len; +xdrstdio_getbytes(XDR *xdrs, char *addr, u_int len) { if ((len != 0) && (fread(addr, (size_t)len, 1, (FILE *)xdrs->x_private) != 1)) @@ -146,10 +135,7 @@ xdrstdio_getbytes(xdrs, addr, len) } static bool_t -xdrstdio_putbytes(xdrs, addr, len) - XDR *xdrs; - const char *addr; - u_int len; +xdrstdio_putbytes(XDR *xdrs, const char *addr, u_int len) { if ((len != 0) && (fwrite(addr, (size_t)len, 1, @@ -159,17 +145,14 @@ xdrstdio_putbytes(xdrs, addr, len) } static u_int -xdrstdio_getpos(xdrs) - XDR *xdrs; +xdrstdio_getpos(XDR *xdrs) { return ((u_int) ftell((FILE *)xdrs->x_private)); } static bool_t -xdrstdio_setpos(xdrs, pos) - XDR *xdrs; - u_int pos; +xdrstdio_setpos(XDR *xdrs, u_int pos) { return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ? @@ -178,9 +161,7 @@ xdrstdio_setpos(xdrs, pos) /* ARGSUSED */ static int32_t * -xdrstdio_inline(xdrs, len) - XDR *xdrs; - u_int len; +xdrstdio_inline(XDR *xdrs, u_int len) { /* diff --git a/lib/libdpv/dpv.c b/lib/libdpv/dpv.c index fd44360..6a03922 100644 --- a/lib/libdpv/dpv.c +++ b/lib/libdpv/dpv.c @@ -692,7 +692,7 @@ dpv(struct dpv_config *config, struct dpv_file_node *file_list) if (!dpv_interrupt) printf("\n"); } else - warnx("%s: %lli lines read", __func__, dpv_overall_read); + warnx("%s: %lli overall read", __func__, dpv_overall_read); if (dpv_interrupt || dpv_abort) return (-1); diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 727419b..c292d5d 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -1235,7 +1235,7 @@ procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat *fst, struct vnode vnode; char tagstr[12]; void *vp; - int error, found; + int error; unsigned int i; assert(kd); @@ -1264,7 +1264,7 @@ procstat_get_vnode_info_kvm(kvm_t *kd, struct filestat *fst, /* * Find appropriate handler. */ - for (i = 0, found = 0; i < NTYPES; i++) + for (i = 0; i < NTYPES; i++) if (!strcmp(fstypes[i].tag, tagstr)) { if (fstypes[i].handler(kd, &vnode, vn) != 0) { goto fail; diff --git a/libexec/ypxfr/ypxfr_main.c b/libexec/ypxfr/ypxfr_main.c index 70fd1f5..03a30f6 100644 --- a/libexec/ypxfr/ypxfr_main.c +++ b/libexec/ypxfr/ypxfr_main.c @@ -357,7 +357,7 @@ the local domain name isn't set"); ypxfr_mapname, ypxfr_master, 0)) == 0) { yp_error("failed to get order number of %s: %s", - ypxfr_mapname, yp_errno == YPXFR_SUCC ? + ypxfr_mapname, yp_errno == YP_TRUE ? "map has order 0" : ypxfrerr_string((ypxfrstat)yp_errno)); ypxfr_exit(YPXFR_YPERR,NULL); @@ -533,7 +533,7 @@ leave: ypxfr_mapname, ypxfr_master, 0)) == 0) { yp_error("failed to get order number of %s: %s", - ypxfr_mapname, yp_errno == YPXFR_SUCC ? + ypxfr_mapname, yp_errno == YP_TRUE ? "map has order 0" : ypxfrerr_string((ypxfrstat)yp_errno)); ypxfr_exit(YPXFR_YPERR,ypxfr_temp_map); diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 13e8655..8e8e786 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd April 19, 2015 +.Dd May 30, 2015 .Dt SRC.CONF 5 .Os .Sh NAME @@ -834,6 +834,13 @@ is set explicitly) .\" from FreeBSD: head/tools/build/options/WITHOUT_MANCOMPRESS 266752 2014-05-27 15:52:27Z gjb Set to not to install compressed man pages. Only the uncompressed versions will be installed. +.It Va WITHOUT_MANDOCDB +.\" from FreeBSD: head/tools/build/options/WITHOUT_MANDOCDB 283777 2015-05-30 17:41:37Z bapt +Use the +.Xr mandoc 1 +version of +.Xr makewhatis 8 +database and utilities. .It Va WITHOUT_MAN_UTILS .\" from FreeBSD: head/tools/build/options/WITHOUT_MAN_UTILS 208322 2010-05-20 00:07:21Z jkim Set to not build utilities for manual pages, diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 6e18874..ed03a78 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -126,6 +126,7 @@ __DEFAULT_YES_OPTIONS = \ MAIL \ MAILWRAPPER \ MAKE \ + MANDOCDB \ NDIS \ NETCAT \ NETGRAPH \ diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 193d207..0836375 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -840,14 +840,8 @@ trap_fatal(frame, eva) if (frame->tf_rflags & PSL_RF) printf("resume, "); printf("IOPL = %ld\n", (frame->tf_rflags & PSL_IOPL) >> 12); - printf("current process = "); - if (curproc) { - printf("%lu (%s)\n", - (u_long)curproc->p_pid, curthread->td_name ? - curthread->td_name : ""); - } else { - printf("Idle\n"); - } + printf("current process = %d (%s)\n", + curproc->p_pid, curthread->td_name); #ifdef KDB if (debugger_on_panic || kdb_active) diff --git a/sys/arm/arm/copystr.S b/sys/arm/arm/copystr.S index 3ce8499..d41525a 100644 --- a/sys/arm/arm/copystr.S +++ b/sys/arm/arm/copystr.S @@ -194,6 +194,7 @@ END(copyoutstr) /* A fault occurred during the copy */ .Lcopystrfault: + mov r0, #EFAULT mov r1, #0x00000000 str r1, [r4, #PCB_ONFAULT] RESTORE_REGS diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h index e36699c..b627963 100644 --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -105,15 +105,9 @@ typedef __uint32_t __vm_paddr_t; typedef __uint64_t __vm_pindex_t; typedef __uint32_t __vm_size_t; -#ifdef __ARM_EABI__ typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ #define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ -#else -typedef int ___wchar_t; -#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ -#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -#endif /* * Unusual type definitions. diff --git a/sys/arm/include/asm.h b/sys/arm/include/asm.h index 0c25d7b..2f64c37 100644 --- a/sys/arm/include/asm.h +++ b/sys/arm/include/asm.h @@ -49,7 +49,7 @@ # define _ALIGN_TEXT .align 2 #endif -#if defined(__ARM_EABI__) && !defined(_STANDALONE) +#ifndef _STANDALONE #define STOP_UNWINDING .cantunwind #define _FNSTART .fnstart #define _FNEND .fnend diff --git a/sys/arm/include/proc.h b/sys/arm/include/proc.h index a86df35..25f4480 100644 --- a/sys/arm/include/proc.h +++ b/sys/arm/include/proc.h @@ -61,11 +61,7 @@ struct mdproc { void *md_sigtramp; }; -#ifdef __ARM_EABI__ #define KINFO_PROC_SIZE 816 -#else -#define KINFO_PROC_SIZE 792 -#endif #define MAXARGS 8 /* diff --git a/sys/boot/fdt/dts/arm/sun4i-a10.dtsi b/sys/boot/fdt/dts/arm/sun4i-a10.dtsi index 087e314..0d554f2 100644 --- a/sys/boot/fdt/dts/arm/sun4i-a10.dtsi +++ b/sys/boot/fdt/dts/arm/sun4i-a10.dtsi @@ -127,7 +127,6 @@ current-speed = <115200>; clock-frequency = < 24000000 >; busy-detect = <1>; - broken-txfifo = <1>; }; emac@01c0b000 { diff --git a/sys/boot/fdt/dts/arm/sun7i-a20.dtsi b/sys/boot/fdt/dts/arm/sun7i-a20.dtsi index 7dd8947..fa60c38 100644 --- a/sys/boot/fdt/dts/arm/sun7i-a20.dtsi +++ b/sys/boot/fdt/dts/arm/sun7i-a20.dtsi @@ -133,7 +133,6 @@ current-speed = <115200>; clock-frequency = < 24000000 >; busy-detect = <1>; - broken-txfifo = <1>; }; emac@01c0b000 { diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index f5b2644..b164cce 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -582,7 +582,6 @@ t4_attach(device_t dev) #ifdef DEV_NETMAP int nm_rqidx, nm_tqidx; #endif - const char *pcie_ts; sc = device_get_softc(dev); sc->dev = dev; @@ -905,25 +904,10 @@ t4_attach(device_t dev) goto done; } - switch (sc->params.pci.speed) { - case 0x1: - pcie_ts = "2.5"; - break; - case 0x2: - pcie_ts = "5.0"; - break; - case 0x3: - pcie_ts = "8.0"; - break; - default: - pcie_ts = "??"; - break; - } device_printf(dev, - "PCIe x%d (%s GTS/s) (%d), %d ports, %d %s interrupt%s, %d eq, %d iq\n", - sc->params.pci.width, pcie_ts, sc->params.pci.speed, - sc->params.nports, sc->intr_count, - sc->intr_type == INTR_MSIX ? "MSI-X" : + "PCIe gen%d x%d, %d ports, %d %s interrupt%s, %d eq, %d iq\n", + sc->params.pci.speed, sc->params.pci.width, sc->params.nports, + sc->intr_count, sc->intr_type == INTR_MSIX ? "MSI-X" : (sc->intr_type == INTR_MSI ? "MSI" : "INTx"), sc->intr_count > 1 ? "s" : "", sc->sge.neq, sc->sge.niq); diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 9416252..27e1ccf 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -2665,7 +2665,7 @@ alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl, F_FW_IQ_CMD_FL0CONGEN); } c.fl0dcaen_to_fl0cidxfthresh = - htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) | + htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_128B) | V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B)); c.fl0size = htobe16(fl->qsize); c.fl0addr = htobe64(fl->ba); diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 9ff295a..b2810a0 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -416,10 +416,10 @@ ns8250_bus_attach(struct uart_softc *sc) * has broken txfifo. */ node = ofw_bus_get_node(sc->sc_dev); - if ((OF_getprop(node, "busy-detect", &cell, sizeof(cell))) > 0) - ns8250->busy_detect = 1; - if ((OF_getprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0) - broken_txfifo = 1; + if ((OF_getencprop(node, "busy-detect", &cell, sizeof(cell))) > 0) + ns8250->busy_detect = cell ? 1 : 0; + if ((OF_getencprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0) + broken_txfifo = cell ? 1 : 0; #endif bas = &sc->sc_bas; diff --git a/sys/libkern/arm/memcpy.S b/sys/libkern/arm/memcpy.S index 9fca8f6..3703195 100644 --- a/sys/libkern/arm/memcpy.S +++ b/sys/libkern/arm/memcpy.S @@ -31,7 +31,11 @@ __FBSDID("$FreeBSD$"); #ifdef __ARM_EABI__ ENTRY_NP(__aeabi_memcpy) +EENTRY_NP(__aeabi_memcpy4) +EENTRY_NP(__aeabi_memcpy8) b memcpy +EEND(__aeabi_memcpy8) +EEND(__aeabi_memcpy4) END(__aeabi_memcpy) #endif diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 515857d..4fee265 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -7208,7 +7208,6 @@ deallocate_dependencies(bp, freeblks, off) { struct indirdep *indirdep; struct pagedep *pagedep; - struct allocdirect *adp; struct worklist *wk, *wkn; struct ufsmount *ump; @@ -7255,7 +7254,6 @@ deallocate_dependencies(bp, freeblks, off) break; case D_ALLOCDIRECT: - adp = WK_ALLOCDIRECT(wk); if (off != 0) continue; /* FALLTHROUGH */ diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index b3b36d6..81995a1 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1827,6 +1827,7 @@ vm_page_alloc_contig_vdrop(struct spglist *lst) * * optional allocation flags: * VM_ALLOC_NOBUSY do not exclusive busy the page + * VM_ALLOC_NODUMP do not include the page in a kernel core dump * VM_ALLOC_NOOBJ page is not associated with an object and * should not be exclusive busy * VM_ALLOC_SBUSY shared busy the allocated page diff --git a/tests/Makefile b/tests/Makefile index 12c1509..7fdc5d7 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -2,8 +2,8 @@ .include <bsd.own.mk> -SUBDIR= etc -SUBDIR= sys +SUBDIR+= etc +SUBDIR+= sys TESTSDIR= ${TESTSBASE} KYUAFILE= yes diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 321dc82..b8d4fa2 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -304,7 +304,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) ATF_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); /* Wait for parent's failed wait. */ - ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0); + ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == sizeof(c)); wpid = waitpid(child, &status, 0); ATF_REQUIRE(wpid == child); @@ -313,6 +313,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) exit(0); } + close(dpipe[1]); /* Parent process. */ @@ -365,10 +366,11 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) ATF_REQUIRE(wpid == 0); /* Signal the debugger to wait for the child. */ - close(dpipe[0]); + ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c)); /* Wait for the debugger. */ - ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0); + ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0); + close(dpipe[0]); /* The child process should now be ready. */ wpid = waitpid(child, &status, WNOHANG); diff --git a/tools/build/options/WITHOUT_MANDOCDB b/tools/build/options/WITHOUT_MANDOCDB new file mode 100644 index 0000000..7d7ec21 --- /dev/null +++ b/tools/build/options/WITHOUT_MANDOCDB @@ -0,0 +1,6 @@ +.\" $FreeBSD$ +Use the +.Xr mandoc 1 +version of +.Xr makewhatis 8 +database and utilities. diff --git a/usr.bin/Makefile b/usr.bin/Makefile index af9b471..c77f89a 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -317,7 +317,9 @@ SUBDIR+= bmake .if ${MK_MAN_UTILS} != "no" SUBDIR+= catman +.if ${MK_MANDOCDB} == "no" _makewhatis= makewhatis +.endif _man= man .endif diff --git a/usr.bin/man/Makefile b/usr.bin/man/Makefile index 3e37b59..7057b2e 100644 --- a/usr.bin/man/Makefile +++ b/usr.bin/man/Makefile @@ -1,11 +1,17 @@ # $FreeBSD$ +.include <src.opts.mk> + SCRIPTS= man.sh -LINKS= ${BINDIR}/man ${BINDIR}/apropos \ - ${BINDIR}/man ${BINDIR}/manpath \ - ${BINDIR}/man ${BINDIR}/whatis +LINKS= ${BINDIR}/man ${BINDIR}/manpath -MAN= man.1 manpath.1 apropos.1 man.conf.5 +MAN= man.1 manpath.1 man.conf.5 + +.if ${MK_MANDOCDB} == no +LINKS+= ${BINDIR}/man ${BINDIR}/apropos \ + ${BINDIR}/man ${BINDIR}/whatis +MAN+= apropos.1 MLINKS= apropos.1 whatis.1 +.endif .include <bsd.prog.mk> diff --git a/usr.bin/mandoc/Makefile b/usr.bin/mandoc/Makefile index cdb512b..e2c59cf 100644 --- a/usr.bin/mandoc/Makefile +++ b/usr.bin/mandoc/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <src.opts.mk> + MDOCMLDIR= ${.CURDIR}/../../contrib/mdocml .PATH: ${MDOCMLDIR} @@ -7,7 +9,14 @@ PROG= mandoc FILES= example.style.css style.css FILESDIR= ${SHAREDIR}/mdocml MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 # roff.7 -MLINKS= mandoc.1 mdocml.1 +MLINKS= mandoc.1 mdocml.1 +.if ${MK_MANDOCDB} != no +MAN+= apropos.1 makewhatis.8 +MLINKS+= apropos.1 whatis.1 +LINKS= ${BINDIR}/mandoc ${BINDIR}/whatis \ + ${BINDIR}/mandoc ${BINDIR}/makewhatis \ + ${BINDIR}/mandoc ${BINDIR}/apropos +.endif LIBMAN_SRCS= man.c \ man_hash.c \ diff --git a/usr.sbin/pw/Makefile b/usr.sbin/pw/Makefile index 69953da..4bcf691 100644 --- a/usr.sbin/pw/Makefile +++ b/usr.sbin/pw/Makefile @@ -6,7 +6,7 @@ SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \ grupd.c pwupd.c fileupd.c psdate.c \ bitmap.c cpdir.c rm_r.c -WARNS?= 2 +WARNS?= 3 LIBADD= crypt util sbuf diff --git a/usr.sbin/pw/grupd.c b/usr.sbin/pw/grupd.c index 74cc390..8735831 100644 --- a/usr.sbin/pw/grupd.c +++ b/usr.sbin/pw/grupd.c @@ -116,9 +116,6 @@ chggrent(char const * login, struct group * grp) int delgrent(struct group * grp) { - char group[MAXLOGNAME]; - strlcpy(group, grp->gr_name, MAXLOGNAME); - - return gr_update(NULL, group); + return (gr_update(NULL, grp->gr_name)); } diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index ff48db7..0c41f03 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -221,8 +221,9 @@ main(int argc, char *argv[]) char * etcpath = getarg(&arglist, 'V')->val; if (*etcpath) { if (config == NULL) { /* Only override config location if -C not specified */ - config = malloc(MAXPATHLEN); - snprintf(config, MAXPATHLEN, "%s/pw.conf", etcpath); + asprintf(&config, "%s/pw.conf", etcpath); + if (config == NULL) + errx(EX_OSERR, "out of memory"); } memcpy(&PWF, &VPWF, sizeof PWF); setpwdir(etcpath); diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c index 99d3e8f..24c0650 100644 --- a/usr.sbin/pw/pw_conf.c +++ b/usr.sbin/pw/pw_conf.c @@ -241,126 +241,127 @@ read_userconfig(char const * file) if (file == NULL) file = _PATH_PW_CONF; - if ((fp = fopen(file, "r")) != NULL) { - while ((linelen = getline(&buf, &linecap, fp)) > 0) { - if (*buf && (p = strtok(buf, " \t\r\n=")) != NULL && *p != '#') { - static char const toks[] = " \t\r\n,="; - char *q = strtok(NULL, toks); - int i = 0; - mode_t *modeset; - - while (i < _UC_FIELDS && strcmp(p, kwds[i]) != 0) - ++i; + if ((fp = fopen(file, "r")) == NULL) + return (&config); + + while ((linelen = getline(&buf, &linecap, fp)) > 0) { + if (*buf && (p = strtok(buf, " \t\r\n=")) != NULL && *p != '#') { + static char const toks[] = " \t\r\n,="; + char *q = strtok(NULL, toks); + int i = 0; + mode_t *modeset; + + while (i < _UC_FIELDS && strcmp(p, kwds[i]) != 0) + ++i; #if debugging - if (i == _UC_FIELDS) - printf("Got unknown kwd `%s' val=`%s'\n", p, q ? q : ""); - else - printf("Got kwd[%s]=%s\n", p, q); + if (i == _UC_FIELDS) + printf("Got unknown kwd `%s' val=`%s'\n", p, q ? q : ""); + else + printf("Got kwd[%s]=%s\n", p, q); #endif - switch (i) { - case _UC_DEFAULTPWD: - config.default_password = boolean_val(q, 1); - break; - case _UC_REUSEUID: - config.reuse_uids = boolean_val(q, 0); - break; - case _UC_REUSEGID: - config.reuse_gids = boolean_val(q, 0); - break; - case _UC_NISPASSWD: - config.nispasswd = (q == NULL || !boolean_val(q, 1)) - ? NULL : newstr(q); - break; - case _UC_DOTDIR: - config.dotdir = (q == NULL || !boolean_val(q, 1)) - ? NULL : newstr(q); - break; + switch (i) { + case _UC_DEFAULTPWD: + config.default_password = boolean_val(q, 1); + break; + case _UC_REUSEUID: + config.reuse_uids = boolean_val(q, 0); + break; + case _UC_REUSEGID: + config.reuse_gids = boolean_val(q, 0); + break; + case _UC_NISPASSWD: + config.nispasswd = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; + case _UC_DOTDIR: + config.dotdir = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; case _UC_NEWMAIL: - config.newmail = (q == NULL || !boolean_val(q, 1)) - ? NULL : newstr(q); - break; - case _UC_LOGFILE: - config.logfile = (q == NULL || !boolean_val(q, 1)) - ? NULL : newstr(q); - break; - case _UC_HOMEROOT: - config.home = (q == NULL || !boolean_val(q, 1)) - ? "/home" : newstr(q); - break; - case _UC_HOMEMODE: - modeset = setmode(q); - config.homemode = (q == NULL || !boolean_val(q, 1)) - ? _DEF_DIRMODE : getmode(modeset, _DEF_DIRMODE); - free(modeset); - break; - case _UC_SHELLPATH: - config.shelldir = (q == NULL || !boolean_val(q, 1)) - ? "/bin" : newstr(q); - break; - case _UC_SHELLS: - for (i = 0; i < _UC_MAXSHELLS && q != NULL; i++, q = strtok(NULL, toks)) - system_shells[i] = newstr(q); - if (i > 0) - while (i < _UC_MAXSHELLS) - system_shells[i++] = NULL; - break; - case _UC_DEFAULTSHELL: - config.shell_default = (q == NULL || !boolean_val(q, 1)) - ? (char *) bourne_shell : newstr(q); - break; - case _UC_DEFAULTGROUP: - q = unquote(q); - config.default_group = (q == NULL || !boolean_val(q, 1) || GETGRNAM(q) == NULL) - ? NULL : newstr(q); - break; - case _UC_EXTRAGROUPS: - for (i = 0; q != NULL; q = strtok(NULL, toks)) { - if (extendarray(&config.groups, &config.numgroups, i + 2) != -1) - config.groups[i++] = newstr(q); - } - if (i > 0) - while (i < config.numgroups) - config.groups[i++] = NULL; - break; - case _UC_DEFAULTCLASS: - config.default_class = (q == NULL || !boolean_val(q, 1)) - ? NULL : newstr(q); - break; - case _UC_MINUID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.min_uid = (uid_t) atol(q); - break; - case _UC_MAXUID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.max_uid = (uid_t) atol(q); - break; - case _UC_MINGID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.min_gid = (gid_t) atol(q); - break; - case _UC_MAXGID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.max_gid = (gid_t) atol(q); - break; - case _UC_EXPIRE: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.expire_days = atoi(q); - break; - case _UC_PASSWORD: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.password_days = atoi(q); - break; - case _UC_FIELDS: - case _UC_NONE: - break; + config.newmail = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; + case _UC_LOGFILE: + config.logfile = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; + case _UC_HOMEROOT: + config.home = (q == NULL || !boolean_val(q, 1)) + ? "/home" : newstr(q); + break; + case _UC_HOMEMODE: + modeset = setmode(q); + config.homemode = (q == NULL || !boolean_val(q, 1)) + ? _DEF_DIRMODE : getmode(modeset, _DEF_DIRMODE); + free(modeset); + break; + case _UC_SHELLPATH: + config.shelldir = (q == NULL || !boolean_val(q, 1)) + ? "/bin" : newstr(q); + break; + case _UC_SHELLS: + for (i = 0; i < _UC_MAXSHELLS && q != NULL; i++, q = strtok(NULL, toks)) + system_shells[i] = newstr(q); + if (i > 0) + while (i < _UC_MAXSHELLS) + system_shells[i++] = NULL; + break; + case _UC_DEFAULTSHELL: + config.shell_default = (q == NULL || !boolean_val(q, 1)) + ? (char *) bourne_shell : newstr(q); + break; + case _UC_DEFAULTGROUP: + q = unquote(q); + config.default_group = (q == NULL || !boolean_val(q, 1) || GETGRNAM(q) == NULL) + ? NULL : newstr(q); + break; + case _UC_EXTRAGROUPS: + for (i = 0; q != NULL; q = strtok(NULL, toks)) { + if (extendarray(&config.groups, &config.numgroups, i + 2) != -1) + config.groups[i++] = newstr(q); } + if (i > 0) + while (i < config.numgroups) + config.groups[i++] = NULL; + break; + case _UC_DEFAULTCLASS: + config.default_class = (q == NULL || !boolean_val(q, 1)) + ? NULL : newstr(q); + break; + case _UC_MINUID: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.min_uid = (uid_t) atol(q); + break; + case _UC_MAXUID: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.max_uid = (uid_t) atol(q); + break; + case _UC_MINGID: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.min_gid = (gid_t) atol(q); + break; + case _UC_MAXGID: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.max_gid = (gid_t) atol(q); + break; + case _UC_EXPIRE: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.expire_days = atoi(q); + break; + case _UC_PASSWORD: + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.password_days = atoi(q); + break; + case _UC_FIELDS: + case _UC_NONE: + break; } } - if (linecap > 0) - free(buf); - fclose(fp); } - return &config; + free(buf); + fclose(fp); + + return (&config); } @@ -452,19 +453,19 @@ write_userconfig(char const * file) config.default_class : ""); break; case _UC_MINUID: - sbuf_printf(buf, "%lu", (unsigned long) config.min_uid); + sbuf_printf(buf, "%u", config.min_uid); quote = 0; break; case _UC_MAXUID: - sbuf_printf(buf, "%lu", (unsigned long) config.max_uid); + sbuf_printf(buf, "%u", config.max_uid); quote = 0; break; case _UC_MINGID: - sbuf_printf(buf, "%lu", (unsigned long) config.min_gid); + sbuf_printf(buf, "%u", config.min_gid); quote = 0; break; case _UC_MAXGID: - sbuf_printf(buf, "%lu", (unsigned long) config.max_gid); + sbuf_printf(buf, "%u", config.max_gid); quote = 0; break; case _UC_EXPIRE: diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c index b20ce88..c001160 100644 --- a/usr.sbin/pw/pw_group.c +++ b/usr.sbin/pw/pw_group.c @@ -83,7 +83,7 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) gid_t next = gr_gidpolicy(cnf, args); if (getarg(args, 'q')) return next; - printf("%ld\n", (long)next); + printf("%u\n", next); return EXIT_SUCCESS; } @@ -116,7 +116,7 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) char *fmems[1]; fmems[0] = NULL; fakegroup.gr_name = a_name ? a_name->val : "nogroup"; - fakegroup.gr_gid = a_gid ? (gid_t) atol(a_gid->val) : -1; + fakegroup.gr_gid = a_gid ? (gid_t) atol(a_gid->val) : (gid_t)-1; fakegroup.gr_mem = fmems; return print_group(&fakegroup, getarg(args, 'P') != NULL); } @@ -135,10 +135,9 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) if (rc == -1) err(EX_IOERR, "group '%s' not available (NIS?)", grp->gr_name); else if (rc != 0) { - warn("group update"); - return EX_IOERR; + err(EX_IOERR, "group update"); } - pw_log(cnf, mode, W_GROUP, "%s(%ld) removed", a_name->val, (long) gid); + pw_log(cnf, mode, W_GROUP, "%s(%u) removed", a_name->val, gid); return EXIT_SUCCESS; } else if (mode == M_PRINT) return print_group(grp, getarg(args, 'P') != NULL); @@ -201,10 +200,8 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) fputc('\n', stdout); fflush(stdout); } - if (b < 0) { - warn("-h file descriptor"); - return EX_OSERR; - } + if (b < 0) + err(EX_OSERR, "-h file descriptor"); line[b] = '\0'; if ((p = strpbrk(line, " \t\r\n")) != NULL) *p = '\0'; @@ -265,16 +262,16 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) if (mode == M_ADD && (rc = addgrent(grp)) != 0) { if (rc == -1) - warnx("group '%s' already exists", grp->gr_name); + errx(EX_IOERR, "group '%s' already exists", + grp->gr_name); else - warn("group update"); - return EX_IOERR; + err(EX_IOERR, "group update"); } else if (mode == M_UPDATE && (rc = chggrent(a_name->val, grp)) != 0) { if (rc == -1) - warnx("group '%s' not available (NIS?)", grp->gr_name); + errx(EX_IOERR, "group '%s' not available (NIS?)", + grp->gr_name); else - warn("group update"); - return EX_IOERR; + err(EX_IOERR, "group update"); } arg = a_newname != NULL ? a_newname : a_name; @@ -282,7 +279,7 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) if ((grp = GETGRNAM(arg->val)) == NULL) errx(EX_SOFTWARE, "group disappeared during update"); - pw_log(cnf, mode, W_GROUP, "%s(%ld)", grp->gr_name, (long) grp->gr_gid); + pw_log(cnf, mode, W_GROUP, "%s(%u)", grp->gr_name, grp->gr_gid); free(members); @@ -364,7 +361,7 @@ gr_gidpolicy(struct userconf * cnf, struct cargs * args) gid = (gid_t) atol(a_gid->val); if ((grp = GETGRGID(gid)) != NULL && getarg(args, 'o') == NULL) - errx(EX_DATAERR, "gid `%ld' has already been allocated", (long) grp->gr_gid); + errx(EX_DATAERR, "gid `%u' has already been allocated", grp->gr_gid); } else { struct bitmap bm; diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index b058aab..48eb934 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -139,7 +139,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) uid_t next = pw_uidpolicy(cnf, args); if (getarg(args, 'q')) return next; - printf("%ld:", (long)next); + printf("%u:", next); pw_group(cnf, mode, args); return EXIT_SUCCESS; } @@ -286,8 +286,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) arg = getarg(args, 'C'); if (write_userconfig(arg ? arg->val : NULL)) return EXIT_SUCCESS; - warn("config update"); - return EX_IOERR; + err(EX_IOERR, "config udpate"); } if (mode == M_PRINT && getarg(args, 'a')) { @@ -336,7 +335,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) if (pwd == NULL) { if (mode == M_PRINT && getarg(args, 'F')) { fakeuser.pw_name = a_name ? a_name->val : "nouser"; - fakeuser.pw_uid = a_uid ? (uid_t) atol(a_uid->val) : -1; + fakeuser.pw_uid = a_uid ? (uid_t) atol(a_uid->val) : (uid_t) -1; return print_user(&fakeuser, getarg(args, 'P') != NULL, getarg(args, '7') != NULL); @@ -416,10 +415,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) rc = delpwent(pwd); if (rc == -1) err(EX_IOERR, "user '%s' does not exist", pwd->pw_name); - else if (rc != 0) { - warn("passwd update"); - return EX_IOERR; - } + else if (rc != 0) + err(EX_IOERR, "passwd update"); if (cnf->nispasswd && *cnf->nispasswd=='/') { rc = delnispwent(cnf->nispasswd, a_name->val); @@ -452,7 +449,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) } ENDGRENT(); - pw_log(cnf, mode, W_USER, "%s(%ld) account removed", a_name->val, (long) uid); + pw_log(cnf, mode, W_USER, "%s(%u) account removed", a_name->val, uid); if (!PWALTDIR()) { /* @@ -472,8 +469,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) if (getarg(args, 'r') != NULL && *home == '/' && getpwuid(uid) == NULL) { if (stat(home, &st) != -1) { rm_r(home, uid); - pw_log(cnf, mode, W_USER, "%s(%ld) home '%s' %sremoved", - a_name->val, (long) uid, home, + pw_log(cnf, mode, W_USER, "%s(%u) home '%s' %sremoved", + a_name->val, uid, home, stat(home, &st) == -1 ? "" : "not completely "); } } @@ -672,11 +669,9 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) fputc('\n', stdout); fflush(stdout); } - if (b < 0) { - warn("-%c file descriptor", precrypt ? 'H' : - 'h'); - return EX_IOERR; - } + if (b < 0) + err(EX_IOERR, "-%c file descriptor", + precrypt ? 'H' : 'h'); line[b] = '\0'; if ((p = strpbrk(line, "\r\n")) != NULL) *p = '\0'; @@ -709,13 +704,11 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) if (mode == M_ADD) { edited = 1; /* Always */ rc = addpwent(pwd); - if (rc == -1) { - warnx("user '%s' already exists", pwd->pw_name); - return EX_IOERR; - } else if (rc != 0) { - warn("passwd file update"); - return EX_IOERR; - } + if (rc == -1) + errx(EX_IOERR, "user '%s' already exists", + pwd->pw_name); + else if (rc != 0) + err(EX_IOERR, "passwd file update"); if (cnf->nispasswd && *cnf->nispasswd=='/') { rc = addnispwent(cnf->nispasswd, pwd); if (rc == -1) @@ -727,13 +720,10 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) } else if (mode == M_UPDATE || mode == M_LOCK || mode == M_UNLOCK) { if (edited) { /* Only updated this if required */ rc = chgpwent(a_name->val, pwd); - if (rc == -1) { - warnx("user '%s' does not exist (NIS?)", pwd->pw_name); - return EX_IOERR; - } else if (rc != 0) { - warn("passwd file update"); - return EX_IOERR; - } + if (rc == -1) + errx(EX_IOERR, "user '%s' does not exist (NIS?)", pwd->pw_name); + else if (rc != 0) + err(EX_IOERR, "passwd file update"); if ( cnf->nispasswd && *cnf->nispasswd=='/') { rc = chgnispwent(cnf->nispasswd, a_name->val, pwd); if (rc == -1) @@ -799,9 +789,9 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) errx(EX_NOUSER, "user '%s' disappeared during update", a_name->val); grp = GETGRGID(pwd->pw_gid); - pw_log(cnf, mode, W_USER, "%s(%ld):%s(%ld):%s:%s:%s", - pwd->pw_name, (long) pwd->pw_uid, - grp ? grp->gr_name : "unknown", (long) (grp ? grp->gr_gid : -1), + pw_log(cnf, mode, W_USER, "%s(%u):%s(%u):%s:%s:%s", + pwd->pw_name, pwd->pw_uid, + grp ? grp->gr_name : "unknown", (grp ? grp->gr_gid : (uid_t)-1), pwd->pw_gecos, pwd->pw_dir, pwd->pw_shell); /* @@ -825,8 +815,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) */ if (!PWALTDIR() && getarg(args, 'm') != NULL && pwd->pw_dir && *pwd->pw_dir == '/' && pwd->pw_dir[1]) { copymkdir(pwd->pw_dir, cnf->dotdir, cnf->homemode, pwd->pw_uid, pwd->pw_gid); - pw_log(cnf, mode, W_USER, "%s(%ld) home %s made", - pwd->pw_name, (long) pwd->pw_uid, pwd->pw_dir); + pw_log(cnf, mode, W_USER, "%s(%u) home %s made", + pwd->pw_name, pwd->pw_uid, pwd->pw_dir); } @@ -845,8 +835,8 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) fputs(line, pfp); } pclose(pfp); - pw_log(cnf, mode, W_USER, "%s(%ld) new user mail sent", - pwd->pw_name, (long) pwd->pw_uid); + pw_log(cnf, mode, W_USER, "%s(%u) new user mail sent", + pwd->pw_name, pwd->pw_uid); } fclose(fp); } @@ -869,7 +859,7 @@ pw_uidpolicy(struct userconf * cnf, struct cargs * args) uid = (uid_t) atol(a_uid->val); if ((pwd = GETPWUID(uid)) != NULL && getarg(args, 'o') == NULL) - errx(EX_DATAERR, "uid `%ld' has already been allocated", (long) pwd->pw_uid); + errx(EX_DATAERR, "uid `%u' has already been allocated", pwd->pw_uid); } else { struct bitmap bm; @@ -1193,14 +1183,14 @@ print_user(struct passwd * pwd, int pretty, int v7) strftime(acexpire, sizeof acexpire, "%c", tptr); if (pwd->pw_change > (time_t)0 && (tptr = localtime(&pwd->pw_change)) != NULL) strftime(pwexpire, sizeof pwexpire, "%c", tptr); - printf("Login Name: %-15s #%-12ld Group: %-15s #%ld\n" + printf("Login Name: %-15s #%-12u Group: %-15s #%u\n" " Full Name: %s\n" " Home: %-26.26s Class: %s\n" " Shell: %-26.26s Office: %s\n" "Work Phone: %-26.26s Home Phone: %s\n" "Acc Expire: %-26.26s Pwd Expire: %s\n", - pwd->pw_name, (long) pwd->pw_uid, - grp ? grp->gr_name : "(invalid)", (long) pwd->pw_gid, + pwd->pw_name, pwd->pw_uid, + grp ? grp->gr_name : "(invalid)", pwd->pw_gid, uname, pwd->pw_dir, pwd->pw_class, pwd->pw_shell, office, wphone, hphone, acexpire, pwexpire); diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c index 710e901..89d0856 100644 --- a/usr.sbin/pw/pwupd.c +++ b/usr.sbin/pw/pwupd.c @@ -162,9 +162,6 @@ chgpwent(char const * login, struct passwd * pwd) int delpwent(struct passwd * pwd) { - char login[MAXLOGNAME]; - - strlcpy(login, pwd->pw_name, MAXLOGNAME); - return (pw_update(NULL, login)); + return (pw_update(NULL, pwd->pw_name)); } diff --git a/usr.sbin/yppoll/yppoll.8 b/usr.sbin/yppoll/yppoll.8 index d466fd3..c08a4e5 100644 --- a/usr.sbin/yppoll/yppoll.8 +++ b/usr.sbin/yppoll/yppoll.8 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 25, 1994 +.Dd May 31, 2015 .Dt YPPOLL 8 .Os .Sh NAME @@ -35,7 +35,7 @@ .Nd ask version of YP map from YP server .Sh SYNOPSIS .Nm -.Op Fl h Ar host +.\".Op Fl h Ar host .Op Fl d Ar domain .Ar mapname .Sh DESCRIPTION @@ -48,15 +48,15 @@ server for .Pp The options are as follows: .Bl -tag -width indent -.It Fl h Ar host -Ask the YP server process running on -.Ar host -for information about -.Ar mapname . -If -.Ar host -is not specified, the server polled is the default server returned by -.Xr ypwhich 1 . +.\".It Fl h Ar host +.\"Ask the YP server process running on +.\".Ar host +.\"for information about +.\".Ar mapname . +.\"If +.\".Ar host +.\"is not specified, the server polled is the default server returned by +.\".Xr ypwhich 1 . .It Fl d Ar domain Use the YP domain .Ar domain diff --git a/usr.sbin/yppoll/yppoll.c b/usr.sbin/yppoll/yppoll.c index e35087c..34ba18b 100644 --- a/usr.sbin/yppoll/yppoll.c +++ b/usr.sbin/yppoll/yppoll.c @@ -49,7 +49,11 @@ __FBSDID("$FreeBSD$"); static void usage(void) { +#if 0 fprintf(stderr, "usage: yppoll [-h host] [-d domainname] mapname\n"); +#else + fprintf(stderr, "usage: yppoll [-d domainname] mapname\n"); +#endif exit(1); } @@ -57,7 +61,9 @@ int main(int argc, char *argv[]) { char *domainname; +#if 0 char *hostname = "localhost"; +#endif char *inmap, *master; int order; int c, r; @@ -71,7 +77,11 @@ main(int argc, char *argv[]) domainname = optarg; break; case 'h': +#if 0 hostname = optarg; +#else + /* does nothing */ +#endif break; case '?': usage(); diff --git a/usr.sbin/yppush/yppush_main.c b/usr.sbin/yppush/yppush_main.c index df1dbe4..6c66515 100644 --- a/usr.sbin/yppush/yppush_main.c +++ b/usr.sbin/yppush/yppush_main.c @@ -137,11 +137,11 @@ yppush_show_status(ypxfrstat status, unsigned long tid) job->tid); } - if (status != YPPUSH_SUCC || verbose) { + if (status != YPXFR_SUCC || verbose) { yp_error("transfer of map %s to server %s %s", - job->map, job->server, status == YPPUSH_SUCC ? + job->map, job->server, status == YPXFR_SUCC ? "succeeded" : "failed"); - yp_error("status returned by ypxfr: %s", status > YPPUSH_AGE ? + yp_error("status returned by ypxfr: %s", status > YPXFR_AGE ? yppusherr_string(status) : ypxfrerr_string(status)); } @@ -365,7 +365,7 @@ create udp handle to NIS server")); * request to the internal list, send the YPPROC_XFR request to ypserv * do other magic things. */ -int +static int yp_push(char *server, char *map, unsigned long tid) { unsigned long prognum; @@ -433,7 +433,7 @@ yp_push(char *server, char *map, unsigned long tid) * Called for each entry in the ypservers map from yp_get_map(), which * is our private yp_all() routine. */ -int +static int yppush_foreach(int status, char *key, int keylen, char *val, int vallen, char *data) { |