Date: Wed, 29 Oct 2014 09:06:06 +0000 (UTC) From: Mark Murray <markm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r273812 - in projects/random_number_generator: bin/sh bin/sh/tests/parameters contrib/mtree contrib/ofed/libcxgb4 contrib/ofed/librdmacm/examples contrib/ofed/usr.lib contrib/ofed/usr.l... Message-ID: <201410290906.s9T966UJ013479@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markm Date: Wed Oct 29 09:06:05 2014 New Revision: 273812 URL: https://svnweb.freebsd.org/changeset/base/273812 Log: MFC - tracking commit. Merging r273783 through r273811. Added: projects/random_number_generator/bin/sh/tests/parameters/positional6.0 - copied unchanged from r273811, head/bin/sh/tests/parameters/positional6.0 projects/random_number_generator/bin/sh/tests/parameters/positional7.0 - copied unchanged from r273811, head/bin/sh/tests/parameters/positional7.0 projects/random_number_generator/contrib/ofed/libcxgb4/ - copied from r273811, head/contrib/ofed/libcxgb4/ projects/random_number_generator/contrib/ofed/usr.lib/libcxgb4/ - copied from r273811, head/contrib/ofed/usr.lib/libcxgb4/ projects/random_number_generator/share/man/man9/casuword.9 - copied unchanged from r273811, head/share/man/man9/casuword.9 projects/random_number_generator/sys/x86/include/vmware.h - copied unchanged from r273811, head/sys/x86/include/vmware.h Modified: projects/random_number_generator/bin/sh/expand.c projects/random_number_generator/bin/sh/tests/parameters/Makefile projects/random_number_generator/contrib/mtree/create.c projects/random_number_generator/contrib/mtree/extern.h projects/random_number_generator/contrib/mtree/getid.c projects/random_number_generator/contrib/mtree/mtree.c projects/random_number_generator/contrib/mtree/spec.c projects/random_number_generator/contrib/ofed/librdmacm/examples/rping.c projects/random_number_generator/contrib/ofed/usr.lib/Makefile projects/random_number_generator/lib/libutil/gr_util.c projects/random_number_generator/share/man/man9/Makefile projects/random_number_generator/share/man/man9/fetch.9 projects/random_number_generator/share/mk/bsd.test.mk projects/random_number_generator/sys/amd64/amd64/support.S projects/random_number_generator/sys/amd64/ia32/ia32_syscall.c projects/random_number_generator/sys/amd64/include/md_var.h projects/random_number_generator/sys/arm/allwinner/a10_gpio.c projects/random_number_generator/sys/arm/broadcom/bcm2835/bcm2835_gpio.c projects/random_number_generator/sys/arm/freescale/imx/imx_gpio.c projects/random_number_generator/sys/arm/freescale/vybrid/vf_gpio.c projects/random_number_generator/sys/arm/include/param.h projects/random_number_generator/sys/arm/lpc/lpc_gpio.c projects/random_number_generator/sys/arm/rockchip/rk30xx_gpio.c projects/random_number_generator/sys/arm/samsung/exynos/exynos5_pad.c projects/random_number_generator/sys/arm/ti/ti_gpio.c projects/random_number_generator/sys/arm/xilinx/zy7_gpio.c projects/random_number_generator/sys/arm/xscale/ixp425/avila_gpio.c projects/random_number_generator/sys/arm/xscale/ixp425/cambria_gpio.c projects/random_number_generator/sys/cam/ctl/ctl_backend_block.c projects/random_number_generator/sys/cam/ctl/ctl_error.c projects/random_number_generator/sys/cam/ctl/ctl_error.h projects/random_number_generator/sys/cam/scsi/scsi_all.c projects/random_number_generator/sys/compat/freebsd32/freebsd32_misc.c projects/random_number_generator/sys/dev/cxgbe/tom/t4_cpl_io.c projects/random_number_generator/sys/dev/safe/safe.c projects/random_number_generator/sys/i386/i386/support.s projects/random_number_generator/sys/i386/i386/trap.c projects/random_number_generator/sys/i386/include/md_var.h projects/random_number_generator/sys/kern/kern_exec.c projects/random_number_generator/sys/kern/kern_umtx.c projects/random_number_generator/sys/kern/subr_param.c projects/random_number_generator/sys/kern/subr_uio.c projects/random_number_generator/sys/kern/vfs_acl.c projects/random_number_generator/sys/mips/atheros/ar71xx_gpio.c projects/random_number_generator/sys/mips/cavium/octeon_gpio.c projects/random_number_generator/sys/mips/include/param.h projects/random_number_generator/sys/mips/rt305x/rt305x_gpio.c projects/random_number_generator/sys/net/if_spppsubr.c projects/random_number_generator/sys/powerpc/powerpc/copyinout.c projects/random_number_generator/sys/powerpc/wii/wii_gpio.c projects/random_number_generator/sys/sparc64/include/param.h projects/random_number_generator/sys/sys/systm.h projects/random_number_generator/sys/x86/x86/identcpu.c projects/random_number_generator/sys/x86/x86/tsc.c projects/random_number_generator/usr.sbin/ctld/ctl.conf.5 projects/random_number_generator/usr.sbin/pw/pw_user.c projects/random_number_generator/usr.sbin/pw/tests/pw_delete.sh projects/random_number_generator/usr.sbin/pw/tests/pw_modify.sh Directory Properties: projects/random_number_generator/ (props changed) projects/random_number_generator/contrib/mtree/ (props changed) projects/random_number_generator/lib/libutil/ (props changed) projects/random_number_generator/share/ (props changed) projects/random_number_generator/sys/ (props changed) Modified: projects/random_number_generator/bin/sh/expand.c ============================================================================== --- projects/random_number_generator/bin/sh/expand.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/bin/sh/expand.c Wed Oct 29 09:06:05 2014 (r273812) @@ -878,7 +878,7 @@ varvalue(const char *name, int quoted, i int num; char *p; int i; - char sep; + char sep[2]; char **ap; switch (*name) { @@ -912,15 +912,18 @@ varvalue(const char *name, int quoted, i /* FALLTHROUGH */ case '*': if (ifsset()) - sep = ifsval()[0]; + sep[0] = ifsval()[0]; else - sep = ' '; + sep[0] = ' '; + sep[1] = '\0'; for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { strtodest(p, flag, subtype, quoted); if (!*ap) break; - if (sep || (flag & EXP_FULL && !quoted && **ap != '\0')) - STPUTC(sep, expdest); + if (sep[0]) + strtodest(sep, flag, subtype, quoted); + else if (flag & EXP_FULL && !quoted && **ap != '\0') + STPUTC('\0', expdest); } return; default: Modified: projects/random_number_generator/bin/sh/tests/parameters/Makefile ============================================================================== --- projects/random_number_generator/bin/sh/tests/parameters/Makefile Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/bin/sh/tests/parameters/Makefile Wed Oct 29 09:06:05 2014 (r273812) @@ -18,6 +18,8 @@ FILES+= positional2.0 FILES+= positional3.0 FILES+= positional4.0 FILES+= positional5.0 +FILES+= positional6.0 +FILES+= positional7.0 FILES+= pwd1.0 FILES+= pwd2.0 Copied: projects/random_number_generator/bin/sh/tests/parameters/positional6.0 (from r273811, head/bin/sh/tests/parameters/positional6.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/bin/sh/tests/parameters/positional6.0 Wed Oct 29 09:06:05 2014 (r273812, copy of r273811, head/bin/sh/tests/parameters/positional6.0) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +IFS=? +set p r +v=pqrs +r=${v#"$*"} +[ "$r" = pqrs ] Copied: projects/random_number_generator/bin/sh/tests/parameters/positional7.0 (from r273811, head/bin/sh/tests/parameters/positional7.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/bin/sh/tests/parameters/positional7.0 Wed Oct 29 09:06:05 2014 (r273812, copy of r273811, head/bin/sh/tests/parameters/positional7.0) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +set -- / '' +IFS=* +set -- "$*" +IFS=: +args="$*" +[ "$#:$args" = "1:/*" ] Modified: projects/random_number_generator/contrib/mtree/create.c ============================================================================== --- projects/random_number_generator/contrib/mtree/create.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/mtree/create.c Wed Oct 29 09:06:05 2014 (r273812) @@ -1,4 +1,4 @@ -/* $NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $ */ +/* $NetBSD: create.c,v 1.73 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $"); +__RCSID("$NetBSD: create.c,v 1.73 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -91,13 +91,14 @@ static u_long flags; #endif static int dcmp(const FTSENT *FTS_CONST *, const FTSENT *FTS_CONST *); -static void output(int, int *, const char *, ...) - __attribute__((__format__(__printf__, 3, 4))); -static int statd(FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, u_long *); -static void statf(int, FTSENT *); +static void output(FILE *, int, int *, const char *, ...) + __printflike(4, 5); +static int statd(FILE *, FTS *, FTSENT *, uid_t *, gid_t *, mode_t *, + u_long *); +static void statf(FILE *, int, FTSENT *); void -cwalk(void) +cwalk(FILE *fp) { FTS *t; FTSENT *p; @@ -121,7 +122,7 @@ cwalk(void) } if (!nflag) - printf( + fprintf(fp, "#\t user: %s\n#\tmachine: %s\n#\t tree: %s\n" "#\t date: %s", user, host, fullpath, ctime(&clocktime)); @@ -142,21 +143,21 @@ cwalk(void) switch(p->fts_info) { case FTS_D: if (!bflag) - printf("\n"); + fprintf(fp, "\n"); if (!nflag) - printf("# %s\n", p->fts_path); - statd(t, p, &uid, &gid, &mode, &flags); - statf(indent, p); + fprintf(fp, "# %s\n", p->fts_path); + statd(fp, t, p, &uid, &gid, &mode, &flags); + statf(fp, indent, p); break; case FTS_DP: if (p->fts_level > 0) if (!nflag) - printf("%*s# %s\n", indent, "", + fprintf(fp, "%*s# %s\n", indent, "", p->fts_path); if (p->fts_level > 0 || flavor == F_FREEBSD9) { - printf("%*s..\n", indent, ""); + fprintf(fp, "%*s..\n", indent, ""); if (!bflag) - printf("\n"); + fprintf(fp, "\n"); } break; case FTS_DNR: @@ -167,7 +168,7 @@ cwalk(void) break; default: if (!dflag) - statf(indent, p); + statf(fp, indent, p); break; } @@ -178,7 +179,7 @@ cwalk(void) } static void -statf(int indent, FTSENT *p) +statf(FILE *fp, int indent, FTSENT *p) { u_int32_t len, val; int fd, offset; @@ -187,51 +188,54 @@ statf(int indent, FTSENT *p) char *digestbuf; #endif - offset = printf("%*s%s%s", indent, "", + offset = fprintf(fp, "%*s%s%s", indent, "", S_ISDIR(p->fts_statp->st_mode) ? "" : " ", vispath(p->fts_name)); if (offset > (INDENTNAMELEN + indent)) offset = MAXLINELEN; else - offset += printf("%*s", (INDENTNAMELEN + indent) - offset, ""); + offset += fprintf(fp, "%*s", + (INDENTNAMELEN + indent) - offset, ""); if (!S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag)) - output(indent, &offset, "type=%s", + output(fp, indent, &offset, "type=%s", inotype(p->fts_statp->st_mode)); if (keys & (F_UID | F_UNAME) && p->fts_statp->st_uid != uid) { if (keys & F_UNAME && (name = user_from_uid(p->fts_statp->st_uid, 1)) != NULL) - output(indent, &offset, "uname=%s", name); + output(fp, indent, &offset, "uname=%s", name); if (keys & F_UID || (keys & F_UNAME && name == NULL)) - output(indent, &offset, "uid=%u", p->fts_statp->st_uid); + output(fp, indent, &offset, "uid=%u", + p->fts_statp->st_uid); } if (keys & (F_GID | F_GNAME) && p->fts_statp->st_gid != gid) { if (keys & F_GNAME && (name = group_from_gid(p->fts_statp->st_gid, 1)) != NULL) - output(indent, &offset, "gname=%s", name); + output(fp, indent, &offset, "gname=%s", name); if (keys & F_GID || (keys & F_GNAME && name == NULL)) - output(indent, &offset, "gid=%u", p->fts_statp->st_gid); + output(fp, indent, &offset, "gid=%u", + p->fts_statp->st_gid); } if (keys & F_MODE && (p->fts_statp->st_mode & MBITS) != mode) - output(indent, &offset, "mode=%#o", + output(fp, indent, &offset, "mode=%#o", p->fts_statp->st_mode & MBITS); if (keys & F_DEV && (S_ISBLK(p->fts_statp->st_mode) || S_ISCHR(p->fts_statp->st_mode))) - output(indent, &offset, "device=%#jx", + output(fp, indent, &offset, "device=%#jx", (uintmax_t)p->fts_statp->st_rdev); if (keys & F_NLINK && p->fts_statp->st_nlink != 1) - output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink); + output(fp, indent, &offset, "nlink=%u", p->fts_statp->st_nlink); if (keys & F_SIZE && (flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode))) - output(indent, &offset, "size=%ju", + output(fp, indent, &offset, "size=%ju", (uintmax_t)p->fts_statp->st_size); if (keys & F_TIME) #if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H) - output(indent, &offset, "time=%jd.%09ld", + output(fp, indent, &offset, "time=%jd.%09ld", (intmax_t)p->fts_statp->st_mtimespec.tv_sec, p->fts_statp->st_mtimespec.tv_nsec); #else - output(indent, &offset, "time=%jd.%09ld", + output(fp, indent, &offset, "time=%jd.%09ld", (intmax_t)p->fts_statp->st_mtime, (long)0); #endif if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) { @@ -239,14 +243,14 @@ statf(int indent, FTSENT *p) crc(fd, &val, &len)) mtree_err("%s: %s", p->fts_accpath, strerror(errno)); close(fd); - output(indent, &offset, "cksum=%lu", (long)val); + output(fp, indent, &offset, "cksum=%lu", (long)val); } #ifndef NO_MD5 if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { if ((digestbuf = MD5File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: MD5File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", MD5KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", MD5KEY, digestbuf); free(digestbuf); } #endif /* ! NO_MD5 */ @@ -255,7 +259,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = RMD160File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: RMD160File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", RMD160KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", RMD160KEY, digestbuf); free(digestbuf); } #endif /* ! NO_RMD160 */ @@ -264,7 +268,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA1File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA1File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA1KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA1KEY, digestbuf); free(digestbuf); } #endif /* ! NO_SHA1 */ @@ -273,7 +277,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA256_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA256_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA256KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA256KEY, digestbuf); free(digestbuf); } #ifdef SHA384_BLOCK_LENGTH @@ -281,7 +285,7 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA384_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA384_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA384KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA384KEY, digestbuf); free(digestbuf); } #endif @@ -289,18 +293,18 @@ statf(int indent, FTSENT *p) if ((digestbuf = SHA512_File(p->fts_accpath, NULL)) == NULL) mtree_err("%s: SHA512_File failed: %s", p->fts_accpath, strerror(errno)); - output(indent, &offset, "%s=%s", SHA512KEY, digestbuf); + output(fp, indent, &offset, "%s=%s", SHA512KEY, digestbuf); free(digestbuf); } #endif /* ! NO_SHA2 */ if (keys & F_SLINK && (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) - output(indent, &offset, "link=%s", + output(fp, indent, &offset, "link=%s", vispath(rlink(p->fts_accpath))); #if HAVE_STRUCT_STAT_ST_FLAGS if (keys & F_FLAGS && p->fts_statp->st_flags != flags) { char *str = flags_to_string(p->fts_statp->st_flags, "none"); - output(indent, &offset, "flags=%s", str); + output(fp, indent, &offset, "flags=%s", str); free(str); } #endif @@ -324,8 +328,8 @@ statf(int indent, FTSENT *p) #define MTREE_MAXS 16 static int -statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode, - u_long *pflags) +statd(FILE *fp, FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode, + u_long *pflags) { FTSENT *p; gid_t sgid; @@ -398,33 +402,33 @@ statd(FTS *t, FTSENT *parent, uid_t *pui first) { first = 0; if (flavor != F_NETBSD6 && dflag) - printf("/set type=dir"); + fprintf(fp, "/set type=dir"); else - printf("/set type=file"); + fprintf(fp, "/set type=file"); if (keys & (F_UID | F_UNAME)) { if (keys & F_UNAME && (name = user_from_uid(saveuid, 1)) != NULL) - printf(" uname=%s", name); + fprintf(fp, " uname=%s", name); if (keys & F_UID || (keys & F_UNAME && name == NULL)) - printf(" uid=%lu", (u_long)saveuid); + fprintf(fp, " uid=%lu", (u_long)saveuid); } if (keys & (F_GID | F_GNAME)) { if (keys & F_GNAME && (name = group_from_gid(savegid, 1)) != NULL) - printf(" gname=%s", name); + fprintf(fp, " gname=%s", name); if (keys & F_GID || (keys & F_GNAME && name == NULL)) - printf(" gid=%lu", (u_long)savegid); + fprintf(fp, " gid=%lu", (u_long)savegid); } if (keys & F_MODE) - printf(" mode=%#lo", (u_long)savemode); + fprintf(fp, " mode=%#lo", (u_long)savemode); if (keys & F_NLINK) - printf(" nlink=1"); + fprintf(fp, " nlink=1"); if (keys & F_FLAGS) { char *str = flags_to_string(saveflags, "none"); - printf(" flags=%s", str); + fprintf(fp, " flags=%s", str); free(str); } - printf("\n"); + fprintf(fp, "\n"); *puid = saveuid; *pgid = savegid; *pmode = savemode; @@ -455,7 +459,7 @@ dcmp(const FTSENT *FTS_CONST *a, const F } void -output(int indent, int *offset, const char *fmt, ...) +output(FILE *fp, int indent, int *offset, const char *fmt, ...) { va_list ap; char buf[1024]; @@ -465,8 +469,8 @@ output(int indent, int *offset, const ch va_end(ap); if (*offset + strlen(buf) > MAXLINELEN - 3) { - printf(" \\\n%*s", INDENTNAMELEN + indent, ""); + fprintf(fp, " \\\n%*s", INDENTNAMELEN + indent, ""); *offset = INDENTNAMELEN + indent; } - *offset += printf(" %s", buf) + 1; + *offset += fprintf(fp, " %s", buf) + 1; } Modified: projects/random_number_generator/contrib/mtree/extern.h ============================================================================== --- projects/random_number_generator/contrib/mtree/extern.h Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/mtree/extern.h Wed Oct 29 09:06:05 2014 (r273812) @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.38 2013/02/03 19:15:17 christos Exp $ */ +/* $NetBSD: extern.h,v 1.39 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -63,8 +63,8 @@ void addtag(slist_t *, char *); int check_excludes(const char *, const char *); int compare(NODE *, FTSENT *); int crc(int, u_int32_t *, u_int32_t *); -void cwalk(void); -void dump_nodes(const char *, NODE *, int); +void cwalk(FILE *); +void dump_nodes(FILE *, const char *, NODE *, int); void init_excludes(void); int matchtags(NODE *); __dead __printflike(1,2) void mtree_err(const char *, ...); Modified: projects/random_number_generator/contrib/mtree/getid.c ============================================================================== --- projects/random_number_generator/contrib/mtree/getid.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/mtree/getid.c Wed Oct 29 09:06:05 2014 (r273812) @@ -1,4 +1,4 @@ -/* $NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $ */ +/* $NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $ */ /* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */ /* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */ @@ -65,7 +65,7 @@ #endif #include <sys/cdefs.h> -__RCSID("$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $"); +__RCSID("$NetBSD: getid.c,v 1.10 2014/10/27 21:46:45 christos Exp $"); #include <sys/param.h> @@ -206,7 +206,12 @@ grstart(void) } if (grfile[0] == '\0') /* sanity check */ return 0; - return (_gr_fp = fopen(grfile, "r")) ? 1 : 0; + + _gr_fp = fopen(grfile, "r"); + if (_gr_fp != NULL) + return 1; + warn("Can't open `%s'", grfile); + return 0; } @@ -231,7 +236,7 @@ grscan(int search, gid_t gid, const char continue; } /* skip comments */ - if (pwline[0] == '#') + if (grline[0] == '#') continue; if (grmatchline(search, gid, name)) return 1; @@ -350,7 +355,11 @@ pwstart(void) } if (pwfile[0] == '\0') /* sanity check */ return 0; - return (_pw_fp = fopen(pwfile, "r")) ? 1 : 0; + _pw_fp = fopen(pwfile, "r"); + if (_pw_fp != NULL) + return 1; + warn("Can't open `%s'", pwfile); + return 0; } Modified: projects/random_number_generator/contrib/mtree/mtree.c ============================================================================== --- projects/random_number_generator/contrib/mtree/mtree.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/mtree/mtree.c Wed Oct 29 09:06:05 2014 (r273812) @@ -1,4 +1,4 @@ -/* $NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $ */ +/* $NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1990, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19 #if 0 static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93"; #else -__RCSID("$NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $"); +__RCSID("$NetBSD: mtree.c,v 1.49 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -296,11 +296,11 @@ main(int argc, char **argv) mtree_err("-l and -u flags are mutually exclusive"); if (cflag) { - cwalk(); + cwalk(stdout); exit(0); } if (Cflag || Dflag) { - dump_nodes("", spec(spec1), Dflag); + dump_nodes(stdout, "", spec(spec1), Dflag); exit(0); } if (spec2 != NULL) Modified: projects/random_number_generator/contrib/mtree/spec.c ============================================================================== --- projects/random_number_generator/contrib/mtree/spec.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/mtree/spec.c Wed Oct 29 09:06:05 2014 (r273812) @@ -1,4 +1,4 @@ -/* $NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $ */ +/* $NetBSD: spec.c,v 1.89 2014/04/24 17:22:41 christos Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $"); +__RCSID("$NetBSD: spec.c,v 1.89 2014/04/24 17:22:41 christos Exp $"); #endif #endif /* not lint */ @@ -102,7 +102,7 @@ static void set(char *, NODE *); static void unset(char *, NODE *); static void addchild(NODE *, NODE *); static int nodecmp(const NODE *, const NODE *); -static int appendfield(int, const char *, ...) __printflike(2, 3); +static int appendfield(FILE *, int, const char *, ...) __printflike(3, 4); #define REPLACEPTR(x,v) do { if ((x)) free((x)); (x) = (v); } while (0) @@ -290,21 +290,21 @@ free_nodes(NODE *root) /* * appendfield -- - * Like printf(), but output a space either before or after + * Like fprintf(), but output a space either before or after * the regular output, according to the pathlast flag. */ static int -appendfield(int pathlast, const char *fmt, ...) +appendfield(FILE *fp, int pathlast, const char *fmt, ...) { va_list ap; int result; va_start(ap, fmt); if (!pathlast) - printf(" "); + fprintf(fp, " "); result = vprintf(fmt, ap); if (pathlast) - printf(" "); + fprintf(fp, " "); va_end(ap); return result; } @@ -316,7 +316,7 @@ appendfield(int pathlast, const char *fm * it first. */ void -dump_nodes(const char *dir, NODE *root, int pathlast) +dump_nodes(FILE *fp, const char *dir, NODE *root, int pathlast) { NODE *cur; char path[MAXPATHLEN]; @@ -334,70 +334,75 @@ dump_nodes(const char *dir, NODE *root, mtree_err("Pathname too long."); if (!pathlast) - printf("%s", vispath(path)); + fprintf(fp, "%s", vispath(path)); #define MATCHFLAG(f) ((keys & (f)) && (cur->flags & (f))) if (MATCHFLAG(F_TYPE)) - appendfield(pathlast, "type=%s", nodetype(cur->type)); + appendfield(fp, pathlast, "type=%s", + nodetype(cur->type)); if (MATCHFLAG(F_UID | F_UNAME)) { if (keys & F_UNAME && (name = user_from_uid(cur->st_uid, 1)) != NULL) - appendfield(pathlast, "uname=%s", name); + appendfield(fp, pathlast, "uname=%s", name); else - appendfield(pathlast, "uid=%u", cur->st_uid); + appendfield(fp, pathlast, "uid=%u", + cur->st_uid); } if (MATCHFLAG(F_GID | F_GNAME)) { if (keys & F_GNAME && (name = group_from_gid(cur->st_gid, 1)) != NULL) - appendfield(pathlast, "gname=%s", name); + appendfield(fp, pathlast, "gname=%s", name); else - appendfield(pathlast, "gid=%u", cur->st_gid); + appendfield(fp, pathlast, "gid=%u", + cur->st_gid); } if (MATCHFLAG(F_MODE)) - appendfield(pathlast, "mode=%#o", cur->st_mode); + appendfield(fp, pathlast, "mode=%#o", cur->st_mode); if (MATCHFLAG(F_DEV) && (cur->type == F_BLOCK || cur->type == F_CHAR)) - appendfield(pathlast, "device=%#jx", + appendfield(fp, pathlast, "device=%#jx", (uintmax_t)cur->st_rdev); if (MATCHFLAG(F_NLINK)) - appendfield(pathlast, "nlink=%d", cur->st_nlink); + appendfield(fp, pathlast, "nlink=%d", cur->st_nlink); if (MATCHFLAG(F_SLINK)) - appendfield(pathlast, "link=%s", vispath(cur->slink)); + appendfield(fp, pathlast, "link=%s", + vispath(cur->slink)); if (MATCHFLAG(F_SIZE)) - appendfield(pathlast, "size=%ju", + appendfield(fp, pathlast, "size=%ju", (uintmax_t)cur->st_size); if (MATCHFLAG(F_TIME)) - appendfield(pathlast, "time=%jd.%09ld", + appendfield(fp, pathlast, "time=%jd.%09ld", (intmax_t)cur->st_mtimespec.tv_sec, cur->st_mtimespec.tv_nsec); if (MATCHFLAG(F_CKSUM)) - appendfield(pathlast, "cksum=%lu", cur->cksum); + appendfield(fp, pathlast, "cksum=%lu", cur->cksum); if (MATCHFLAG(F_MD5)) - appendfield(pathlast, "%s=%s", MD5KEY, cur->md5digest); + appendfield(fp, pathlast, "%s=%s", MD5KEY, + cur->md5digest); if (MATCHFLAG(F_RMD160)) - appendfield(pathlast, "%s=%s", RMD160KEY, + appendfield(fp, pathlast, "%s=%s", RMD160KEY, cur->rmd160digest); if (MATCHFLAG(F_SHA1)) - appendfield(pathlast, "%s=%s", SHA1KEY, + appendfield(fp, pathlast, "%s=%s", SHA1KEY, cur->sha1digest); if (MATCHFLAG(F_SHA256)) - appendfield(pathlast, "%s=%s", SHA256KEY, + appendfield(fp, pathlast, "%s=%s", SHA256KEY, cur->sha256digest); if (MATCHFLAG(F_SHA384)) - appendfield(pathlast, "%s=%s", SHA384KEY, + appendfield(fp, pathlast, "%s=%s", SHA384KEY, cur->sha384digest); if (MATCHFLAG(F_SHA512)) - appendfield(pathlast, "%s=%s", SHA512KEY, + appendfield(fp, pathlast, "%s=%s", SHA512KEY, cur->sha512digest); if (MATCHFLAG(F_FLAGS)) { str = flags_to_string(cur->st_flags, "none"); - appendfield(pathlast, "flags=%s", str); + appendfield(fp, pathlast, "flags=%s", str); free(str); } if (MATCHFLAG(F_IGN)) - appendfield(pathlast, "ignore"); + appendfield(fp, pathlast, "ignore"); if (MATCHFLAG(F_OPT)) - appendfield(pathlast, "optional"); + appendfield(fp, pathlast, "optional"); if (MATCHFLAG(F_TAGS)) { /* don't output leading or trailing commas */ p = cur->tags; @@ -406,12 +411,12 @@ dump_nodes(const char *dir, NODE *root, q = p + strlen(p); while(q > p && q[-1] == ',') q--; - appendfield(pathlast, "tags=%.*s", (int)(q - p), p); + appendfield(fp, pathlast, "tags=%.*s", (int)(q - p), p); } puts(pathlast ? vispath(path) : ""); if (cur->child) - dump_nodes(path, cur->child, pathlast); + dump_nodes(fp, path, cur->child, pathlast); } } Modified: projects/random_number_generator/contrib/ofed/librdmacm/examples/rping.c ============================================================================== --- projects/random_number_generator/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/ofed/librdmacm/examples/rping.c Wed Oct 29 09:06:05 2014 (r273812) @@ -40,7 +40,6 @@ #include <netinet/in.h> #include <sys/socket.h> #include <netdb.h> -#include <byteswap.h> #include <semaphore.h> #include <arpa/inet.h> #include <pthread.h> @@ -280,10 +279,10 @@ static int rping_cq_event_handler(struct ret = 0; if (wc.status) { - fprintf(stderr, "cq completion failed status %d\n", - wc.status); if (wc.status != IBV_WC_WR_FLUSH_ERR) - ret = -1; + fprintf(stderr, "cq completion failed status %d\n", + wc.status); + ret = -1; goto error; } @@ -800,10 +799,9 @@ static void *rping_persistent_server_thr rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); rping_free_qp(cb); - pthread_cancel(cb->cqthread); - pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); free_cb(cb); return NULL; @@ -888,6 +886,7 @@ static int rping_run_server(struct rping rping_test_server(cb); rdma_disconnect(cb->child_cm_id); + pthread_join(cb->cqthread, NULL); rdma_destroy_id(cb->child_cm_id); err2: rping_free_buffers(cb); @@ -1053,9 +1052,16 @@ static int rping_run_client(struct rping goto err2; } - rping_test_client(cb); + ret = rping_test_client(cb); + if (ret) { + fprintf(stderr, "rping client failed: %d\n", ret); + goto err3; + } + ret = 0; +err3: rdma_disconnect(cb->cm_id); err2: + pthread_join(cb->cqthread, NULL); rping_free_buffers(cb); err1: rping_free_qp(cb); Modified: projects/random_number_generator/contrib/ofed/usr.lib/Makefile ============================================================================== --- projects/random_number_generator/contrib/ofed/usr.lib/Makefile Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/contrib/ofed/usr.lib/Makefile Wed Oct 29 09:06:05 2014 (r273812) @@ -1,6 +1,6 @@ .include <bsd.own.mk> SUBDIR = libibcommon libibmad libibumad libibverbs libmlx4 libmthca -SUBDIR += libopensm libosmcomp libosmvendor libibcm librdmacm libsdp +SUBDIR += libopensm libosmcomp libosmvendor libibcm librdmacm libsdp libcxgb4 .include <bsd.subdir.mk> Modified: projects/random_number_generator/lib/libutil/gr_util.c ============================================================================== --- projects/random_number_generator/lib/libutil/gr_util.c Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/lib/libutil/gr_util.c Wed Oct 29 09:06:05 2014 (r273812) @@ -170,14 +170,21 @@ gr_copy(int ffd, int tfd, const struct g size_t len; int eof, readlen; - sgr = gr; + if (old_gr == NULL && gr == NULL) + return(-1); + + sgr = old_gr; + /* deleting a group */ if (gr == NULL) { line = NULL; - if (old_gr == NULL) + } else { + if ((line = gr_make(gr)) == NULL) return (-1); - sgr = old_gr; - } else if ((line = gr_make(gr)) == NULL) - return (-1); + } + + /* adding a group */ + if (sgr == NULL) + sgr = gr; eof = 0; len = 0; Modified: projects/random_number_generator/share/man/man9/Makefile ============================================================================== --- projects/random_number_generator/share/man/man9/Makefile Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/share/man/man9/Makefile Wed Oct 29 09:06:05 2014 (r273812) @@ -46,6 +46,7 @@ MAN= accept_filter.9 \ BUS_SETUP_INTR.9 \ bus_space.9 \ byteorder.9 \ + casuword.9 \ cd.9 \ condvar.9 \ config_intrhook.9 \ @@ -581,6 +582,9 @@ MLINKS+=condvar.9 cv_broadcast.9 \ MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ config_intrhook.9 config_intrhook_establish.9 MLINKS+=contigmalloc.9 contigfree.9 +MLINKS+=casuword.9 casueword.9 \ + casuword.9 casueword32.9 \ + casuword.9 casuword32.9 MLINKS+=copy.9 copyin.9 \ copy.9 copyin_nofault.9 \ copy.9 copyinstr.9 \ @@ -688,7 +692,10 @@ MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuword.9 \ fetch.9 fuword16.9 \ fetch.9 fuword32.9 \ - fetch.9 fuword64.9 + fetch.9 fuword64.9 \ + fetch.9 fueword.9 \ + fetch.9 fueword32.9 \ + fetch.9 fueword64.9 MLINKS+=firmware.9 firmware_get.9 \ firmware.9 firmware_put.9 \ firmware.9 firmware_register.9 \ Copied: projects/random_number_generator/share/man/man9/casuword.9 (from r273811, head/share/man/man9/casuword.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/random_number_generator/share/man/man9/casuword.9 Wed Oct 29 09:06:05 2014 (r273812, copy of r273811, head/share/man/man9/casuword.9) @@ -0,0 +1,95 @@ +.\" Copyright (c) 2014 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Part of this documentation was written by +.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" 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 AUTHORS 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 AUTHORS 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. +.\" +.\" $FreeBSD$ +.\" +.Dd October 21, 2014 +.Dt CASU 9 +.Os +.Sh NAME +.Nm casueword , +.Nm casueword32 , +.Nm casuword , +.Nm casuword32 +.Nd fetch, compare and store data from user-space +.Sh SYNOPSIS +.In sys/types.h +.In sys/systm.h +.Ft int +.Fn casueword "volatile u_long *base" "u_long oldval" "u_long *oldvalp" "u_long newval" +.Ft int +.Fn casueword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t *oldvalp" "uint32_t newval" +.Ft u_long +.Fn casuword "volatile u_long *base" "u_long oldval" "u_long newval" +.Ft uint32_t +.Fn casuword32 "volatile uint32_t *base" "uint32_t oldval" "uint32_t newval" +.Sh DESCRIPTION +The +.Nm +functions are designed to perform atomic compare-and-swap operation on +the value in the usermode memory of the current process. +.Pp +The +.Nm +routines reads the value from user memory with address +.Pa base , +and compare the value read with +.Pa oldval . +If the values are equal, +.Pa newval +is written to the +.Pa *base . +In case of +.Fn casueword32 +and +.Fn casueword , +old value is stored into the (kernel-mode) variable pointed by +.Pa *oldvalp . +The userspace value must be naturally aligned. +.Pp +The callers of +.Fn casuword +and +.Fn casuword32 +functions cannot distinguish between -1 read from +userspace and function failure. +.Sh RETURN VALUES +The +.Fn casuword +and +.Fn casuword32 +functions return the data fetched or -1 on failure. +The +.Fn casueword +and +.Fn casueword32 +functions return 0 on success and -1 on failure. +.Sh SEE ALSO +.Xr atomic 9 , +.Xr fetch 9 , +.Xr store 9 Modified: projects/random_number_generator/share/man/man9/fetch.9 ============================================================================== --- projects/random_number_generator/share/man/man9/fetch.9 Wed Oct 29 06:24:12 2014 (r273811) +++ projects/random_number_generator/share/man/man9/fetch.9 Wed Oct 29 09:06:05 2014 (r273812) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2009 +.Dd October 21, 2014 .Dt FETCH 9 .Os .Sh NAME @@ -44,11 +44,13 @@ .Nm fuword , .Nm fuword16 , .Nm fuword32 , -.Nm fuword64 +.Nm fuword64 , +.Nm fueword , +.Nm fueword32 , +.Nm fueword64 .Nd fetch data from user-space .Sh SYNOPSIS .In sys/types.h -.In sys/time.h .In sys/systm.h .Ft int .Fn fubyte "const void *base" @@ -60,27 +62,38 @@ .Fn fuword32 "const void *base" .Ft int64_t .Fn fuword64 "const void *base" +.Ft long +.Fn fueword "const void *base" "long *val" +.Ft int32_t +.Fn fueword32 "const void *base" "int32_t *val" +.Ft int64_t +.Fn fueword64 "const void *base" "int64_t *val" .In sys/resourcevar.h .Ft int .Fn fuswintr "void *base" .Sh DESCRIPTION The .Nm -functions are designed to copy small amounts of data from user-space. +functions are designed to copy small amounts of data from user-space +of the current process. +If read is successful, it is performed atomically. +The data read must be naturally aligned. .Pp The .Nm routines provide the following functionality: -.Bl -tag -width "fuswintr()" +.Bl -tag -width "fueword32()" .It Fn fubyte Fetches a byte of data from the user-space address .Pa base . +The byte read is zero-extended into the results variable. .It Fn fuword -Fetches a word of data from the user-space address +Fetches a word of data (long) from the user-space address .Pa base . .It Fn fuword16 Fetches 16 bits of data from the user-space address .Pa base . +The half-word read is zero-extended into the results variable. .It Fn fuword32 Fetches 32 bits of data from the user-space address .Pa base . @@ -91,11 +104,46 @@ Fetches 64 bits of data from the user-sp Fetches a short word of data from the user-space address .Pa base . This function is safe to call during an interrupt context. +.It Fn fueword +Fetches a word of data (long) from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . +.It Fn fueword32 +Fetches 32 bits of data from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . +.It Fn fueword64 +Fetches 64 bits of data from the user-space address +.Pa base +and stores the result in the variable pointed by +.Pa val . .El +.Pp +The callers of +.Fn fuword , +.Fn fuword32 +and +.Fn fuword64 +functions cannot distinguish between -1 read from +userspace and function failure. .Sh RETURN VALUES The -.Nm +.Fn fubyte , +.Fn fuword , +.Fn fuword16 , +.Fn fuword32 , +.Fn fuword64 , +and +.Fn fuswintr functions return the data fetched or -1 on failure. +The +.Fn fueword , +.Fn fueword32 +and +.Fn fueword64 +functions return 0 on success and -1 on failure. .Sh SEE ALSO *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410290906.s9T966UJ013479>