svn commit: r265781 - stable/10/usr.sbin/daemon
Author: jh Date: Fri May 9 15:55:45 2014 New Revision: 265781 URL: http://svnweb.freebsd.org/changeset/base/265781 Log: MFC r264194: Fork a child process and wait until the process terminates when the -P option is specified. This behavior is documented on the manual page. PR: bin/187265 Modified: stable/10/usr.sbin/daemon/daemon.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/daemon/daemon.c == --- stable/10/usr.sbin/daemon/daemon.c Fri May 9 14:35:07 2014 (r265780) +++ stable/10/usr.sbin/daemon/daemon.c Fri May 9 15:55:45 2014 (r265781) @@ -139,7 +139,7 @@ main(int argc, char *argv[]) * get SIGCHLD eventually. */ pid = -1; - if (pidfile != NULL || restart) { + if (pidfile != NULL || ppidfile != NULL || restart) { /* * Restore default action for SIGTERM in case the * parent process decided to ignore it. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r264194 - head/usr.sbin/daemon
Author: jh Date: Sun Apr 6 16:35:49 2014 New Revision: 264194 URL: http://svnweb.freebsd.org/changeset/base/264194 Log: Fork a child process and wait until the process terminates when the -P option is specified. This behavior is documented on the manual page. PR: bin/187265 Submitted by: Kimo R MFC after:2 weeks Modified: head/usr.sbin/daemon/daemon.c Modified: head/usr.sbin/daemon/daemon.c == --- head/usr.sbin/daemon/daemon.c Sun Apr 6 16:31:28 2014 (r264193) +++ head/usr.sbin/daemon/daemon.c Sun Apr 6 16:35:49 2014 (r264194) @@ -139,7 +139,7 @@ main(int argc, char *argv[]) * get SIGCHLD eventually. */ pid = -1; - if (pidfile != NULL || restart) { + if (pidfile != NULL || ppidfile != NULL || restart) { /* * Restore default action for SIGTERM in case the * parent process decided to ignore it. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r264066 - head/bin/ls
Hi, On 2014-04-03, Greg Lehey wrote: Add information on standards compliance of many options. -n and -A are in POSIX.1-2008. Please see this PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/140435 -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r264047 - stable/9/usr.bin/tail
Author: jh Date: Wed Apr 2 17:10:17 2014 New Revision: 264047 URL: http://svnweb.freebsd.org/changeset/base/264047 Log: MFC r251565: Print file names without stdio buffering to avoid mixing buffered and unbuffered ouput. PR: bin/176886 Modified: stable/9/usr.bin/tail/extern.h stable/9/usr.bin/tail/forward.c stable/9/usr.bin/tail/misc.c stable/9/usr.bin/tail/tail.c Directory Properties: stable/9/usr.bin/tail/ (props changed) Modified: stable/9/usr.bin/tail/extern.h == --- stable/9/usr.bin/tail/extern.h Wed Apr 2 16:53:07 2014 (r264046) +++ stable/9/usr.bin/tail/extern.h Wed Apr 2 17:10:17 2014 (r264047) @@ -67,5 +67,6 @@ void ierr(const char *); void oerr(void); int mapprint(struct mapinfo *, off_t, off_t); int maparound(struct mapinfo *, off_t); +void printfn(const char *, int); extern int Fflag, fflag, qflag, rflag, rval, no_files; Modified: stable/9/usr.bin/tail/forward.c == --- stable/9/usr.bin/tail/forward.c Wed Apr 2 16:53:07 2014 (r264046) +++ stable/9/usr.bin/tail/forward.c Wed Apr 2 17:10:17 2014 (r264047) @@ -243,7 +243,7 @@ show(file_info_t *file) while ((ch = getc(file-fp)) != EOF) { if (last != file no_files 1) { if (!qflag) - (void)printf(\n== %s ==\n, file-file_name); + printfn(file-file_name, 1); last = file; } if (putchar(ch) == EOF) @@ -320,7 +320,7 @@ follow(file_info_t *files, enum STYLE st active = 1; n++; if (no_files 1 !qflag) - (void)printf(\n== %s ==\n, file-file_name); + printfn(file-file_name, 1); forward(file-fp, file-file_name, style, off, file-st); if (Fflag fileno(file-fp) != STDIN_FILENO) n++; Modified: stable/9/usr.bin/tail/misc.c == --- stable/9/usr.bin/tail/misc.cWed Apr 2 16:53:07 2014 (r264046) +++ stable/9/usr.bin/tail/misc.cWed Apr 2 17:10:17 2014 (r264047) @@ -113,3 +113,17 @@ maparound(struct mapinfo *mip, off_t off return (0); } + +/* + * Print the file name without stdio buffering. + */ +void +printfn(const char *fn, int print_nl) +{ + + if (print_nl) + WR(\n, 1); + WR(== , 4); + WR(fn, strlen(fn)); + WR( ==\n, 5); +} Modified: stable/9/usr.bin/tail/tail.c == --- stable/9/usr.bin/tail/tail.cWed Apr 2 16:53:07 2014 (r264046) +++ stable/9/usr.bin/tail/tail.cWed Apr 2 17:10:17 2014 (r264047) @@ -203,10 +203,8 @@ main(int argc, char *argv[]) continue; } if (argc 1 !qflag) { - (void)printf(%s== %s ==\n, - first ? : \n, fn); + printfn(fn, !first); first = 0; - (void)fflush(stdout); } if (rflag) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r263945 - stable/9/sbin/devfs
Author: jh Date: Sun Mar 30 17:59:32 2014 New Revision: 263945 URL: http://svnweb.freebsd.org/changeset/base/263945 Log: MFC r253252: Clarify how hide and unhide commands work on directories. Modified: stable/9/sbin/devfs/devfs.8 Directory Properties: stable/9/sbin/devfs/ (props changed) Modified: stable/9/sbin/devfs/devfs.8 == --- stable/9/sbin/devfs/devfs.8 Sun Mar 30 16:56:36 2014(r263944) +++ stable/9/sbin/devfs/devfs.8 Sun Mar 30 17:59:32 2014(r263945) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd February 21, 2010 +.Dd July 12, 2013 .Dt DEVFS 8 .Os .Sh NAME @@ -190,6 +190,7 @@ Nodes may later be revived manually with or with the .Cm unhide action. +Hiding a directory node effectively hides all of its child nodes. .It Cm include Ar ruleset Apply all the rules in ruleset number .Ar ruleset @@ -213,6 +214,8 @@ which may be a user name or number. .It Cm unhide Unhide the node. +If the node resides in a subdirectory, +all parent directory nodes must be visible to be able to access the node. .El .Sh IMPLEMENTATION NOTES Rulesets are created by the kernel at the first reference ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r255856 - stable/9/sys/kern
Author: jh Date: Tue Sep 24 17:09:28 2013 New Revision: 255856 URL: http://svnweb.freebsd.org/changeset/base/255856 Log: MFC r250706: A library function shall not set errno to 0. Modified: stable/9/sys/kern/subr_sbuf.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_sbuf.c == --- stable/9/sys/kern/subr_sbuf.c Tue Sep 24 17:01:29 2013 (r255855) +++ stable/9/sys/kern/subr_sbuf.c Tue Sep 24 17:09:28 2013 (r255856) @@ -706,9 +706,10 @@ sbuf_finish(struct sbuf *s) #ifdef _KERNEL return (s-s_error); #else - errno = s-s_error; - if (s-s_error) + if (s-s_error != 0) { + errno = s-s_error; return (-1); + } return (0); #endif } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r253252 - head/sbin/devfs
Author: jh Date: Fri Jul 12 06:03:25 2013 New Revision: 253252 URL: http://svnweb.freebsd.org/changeset/base/253252 Log: Clarify how hide and unhide commands work on directories. Modified: head/sbin/devfs/devfs.8 Modified: head/sbin/devfs/devfs.8 == --- head/sbin/devfs/devfs.8 Fri Jul 12 05:58:54 2013(r253251) +++ head/sbin/devfs/devfs.8 Fri Jul 12 06:03:25 2013(r253252) @@ -25,7 +25,7 @@ .\ .\ $FreeBSD$ .\ -.Dd April 21, 2013 +.Dd July 12, 2013 .Dt DEVFS 8 .Os .Sh NAME @@ -190,6 +190,7 @@ Nodes may later be revived manually with or with the .Cm unhide action. +Hiding a directory node effectively hides all of its child nodes. .It Cm include Ar ruleset Apply all the rules in ruleset number .Ar ruleset @@ -213,6 +214,8 @@ which may be a user name or number. .It Cm unhide Unhide the node. +If the node resides in a subdirectory, +all parent directory nodes must be visible to be able to access the node. .El .Sh IMPLEMENTATION NOTES Rulesets are created by the kernel at the first reference ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251998 - stable/9/sbin/mount
Author: jh Date: Wed Jun 19 18:00:00 2013 New Revision: 251998 URL: http://svnweb.freebsd.org/changeset/base/251998 Log: MFC r251485: Revert r238399. The failok option doesn't have any effect at all unless specified in fstab(5) and combined with the -a flag. The failok option is already documented in fstab(5). PR: 177630 Modified: stable/9/sbin/mount/mount.8 Directory Properties: stable/9/sbin/mount/ (props changed) Modified: stable/9/sbin/mount/mount.8 == --- stable/9/sbin/mount/mount.8 Wed Jun 19 17:14:59 2013(r251997) +++ stable/9/sbin/mount/mount.8 Wed Jun 19 18:00:00 2013(r251998) @@ -28,7 +28,7 @@ .\ @(#)mount.88.8 (Berkeley) 6/16/94 .\ $FreeBSD$ .\ -.Dd July 12, 2012 +.Dd June 6, 2011 .Dt MOUNT 8 .Os .Sh NAME @@ -145,11 +145,6 @@ When used with the .Fl u flag, this is the same as specifying the options currently in effect for the mounted file system. -.It Cm failok -If this option is specified, -.Nm -will return 0 even if an error occurs -during the mount of the filesystem. .It Cm force The same as .Fl f ; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251999 - stable/8/sbin/mount
Author: jh Date: Wed Jun 19 18:01:37 2013 New Revision: 251999 URL: http://svnweb.freebsd.org/changeset/base/251999 Log: MFC r251485: Revert r238399. The failok option doesn't have any effect at all unless specified in fstab(5) and combined with the -a flag. The failok option is already documented in fstab(5). PR: 177630 Modified: stable/8/sbin/mount/mount.8 Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount.8 == --- stable/8/sbin/mount/mount.8 Wed Jun 19 18:00:00 2013(r251998) +++ stable/8/sbin/mount/mount.8 Wed Jun 19 18:01:37 2013(r251999) @@ -28,7 +28,7 @@ .\ @(#)mount.88.8 (Berkeley) 6/16/94 .\ $FreeBSD$ .\ -.Dd July 12, 2012 +.Dd June 6, 2011 .Dt MOUNT 8 .Os .Sh NAME @@ -145,11 +145,6 @@ When used with the .Fl u flag, this is the same as specifying the options currently in effect for the mounted file system. -.It Cm failok -If this option is specified, -.Nm -will return 0 even if an error occurs -during the mount of the filesystem. .It Cm force The same as .Fl f ; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251565 - head/usr.bin/tail
Author: jh Date: Sun Jun 9 08:06:26 2013 New Revision: 251565 URL: http://svnweb.freebsd.org/changeset/base/251565 Log: Print file names without stdio buffering to avoid mixing buffered and unbuffered ouput. PR: bin/176886 Reviewed by: mjg Modified: head/usr.bin/tail/extern.h head/usr.bin/tail/forward.c head/usr.bin/tail/misc.c head/usr.bin/tail/tail.c Modified: head/usr.bin/tail/extern.h == --- head/usr.bin/tail/extern.h Sun Jun 9 07:15:43 2013(r251564) +++ head/usr.bin/tail/extern.h Sun Jun 9 08:06:26 2013(r251565) @@ -67,5 +67,6 @@ void ierr(const char *); void oerr(void); int mapprint(struct mapinfo *, off_t, off_t); int maparound(struct mapinfo *, off_t); +void printfn(const char *, int); extern int Fflag, fflag, qflag, rflag, rval, no_files; Modified: head/usr.bin/tail/forward.c == --- head/usr.bin/tail/forward.c Sun Jun 9 07:15:43 2013(r251564) +++ head/usr.bin/tail/forward.c Sun Jun 9 08:06:26 2013(r251565) @@ -243,7 +243,7 @@ show(file_info_t *file) while ((ch = getc(file-fp)) != EOF) { if (last != file no_files 1) { if (!qflag) - (void)printf(\n== %s ==\n, file-file_name); + printfn(file-file_name, 1); last = file; } if (putchar(ch) == EOF) @@ -320,7 +320,7 @@ follow(file_info_t *files, enum STYLE st active = 1; n++; if (no_files 1 !qflag) - (void)printf(\n== %s ==\n, file-file_name); + printfn(file-file_name, 1); forward(file-fp, file-file_name, style, off, file-st); if (Fflag fileno(file-fp) != STDIN_FILENO) n++; Modified: head/usr.bin/tail/misc.c == --- head/usr.bin/tail/misc.cSun Jun 9 07:15:43 2013(r251564) +++ head/usr.bin/tail/misc.cSun Jun 9 08:06:26 2013(r251565) @@ -113,3 +113,17 @@ maparound(struct mapinfo *mip, off_t off return (0); } + +/* + * Print the file name without stdio buffering. + */ +void +printfn(const char *fn, int print_nl) +{ + + if (print_nl) + WR(\n, 1); + WR(== , 4); + WR(fn, strlen(fn)); + WR( ==\n, 5); +} Modified: head/usr.bin/tail/tail.c == --- head/usr.bin/tail/tail.cSun Jun 9 07:15:43 2013(r251564) +++ head/usr.bin/tail/tail.cSun Jun 9 08:06:26 2013(r251565) @@ -203,10 +203,8 @@ main(int argc, char *argv[]) continue; } if (argc 1 !qflag) { - (void)printf(%s== %s ==\n, - first ? : \n, fn); + printfn(fn, !first); first = 0; - (void)fflush(stdout); } if (rflag) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251485 - head/sbin/mount
Author: jh Date: Fri Jun 7 07:17:46 2013 New Revision: 251485 URL: http://svnweb.freebsd.org/changeset/base/251485 Log: Revert r238399. The failok option doesn't have any effect at all unless specified in fstab(5) and combined with the -a flag. The failok option is already documented in fstab(5). PR: 177630 No objection: eadler MFC after:1 week Modified: head/sbin/mount/mount.8 Modified: head/sbin/mount/mount.8 == --- head/sbin/mount/mount.8 Fri Jun 7 05:18:07 2013(r251484) +++ head/sbin/mount/mount.8 Fri Jun 7 07:17:46 2013(r251485) @@ -28,7 +28,7 @@ .\ @(#)mount.88.8 (Berkeley) 6/16/94 .\ $FreeBSD$ .\ -.Dd July 12, 2012 +.Dd June 6, 2011 .Dt MOUNT 8 .Os .Sh NAME @@ -152,11 +152,6 @@ When used with the .Fl u flag, this is the same as specifying the options currently in effect for the mounted file system. -.It Cm failok -If this option is specified, -.Nm -will return 0 even if an error occurs -during the mount of the filesystem. .It Cm force The same as .Fl f ; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251304 - stable/8/sys/geom
Author: jh Date: Mon Jun 3 16:10:30 2013 New Revision: 251304 URL: http://svnweb.freebsd.org/changeset/base/251304 Log: MFC r250868: Remove an extra semicolon from the DOT language output. PR: kern/178540 Modified: stable/8/sys/geom/geom_dump.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/geom/ (props changed) Modified: stable/8/sys/geom/geom_dump.c == --- stable/8/sys/geom/geom_dump.c Mon Jun 3 16:09:23 2013 (r251303) +++ stable/8/sys/geom/geom_dump.c Mon Jun 3 16:10:30 2013 (r251304) @@ -104,7 +104,7 @@ g_confdot(void *p, int flag ) sbuf_printf(sb, digraph geom {\n); LIST_FOREACH(mp, g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, };\n); + sbuf_printf(sb, }\n); sbuf_finish(sb); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r251303 - stable/9/sys/geom
Author: jh Date: Mon Jun 3 16:09:23 2013 New Revision: 251303 URL: http://svnweb.freebsd.org/changeset/base/251303 Log: MFC r250868: Remove an extra semicolon from the DOT language output. PR: kern/178540 Modified: stable/9/sys/geom/geom_dump.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/geom_dump.c == --- stable/9/sys/geom/geom_dump.c Mon Jun 3 16:05:34 2013 (r251302) +++ stable/9/sys/geom/geom_dump.c Mon Jun 3 16:09:23 2013 (r251303) @@ -104,7 +104,7 @@ g_confdot(void *p, int flag ) sbuf_printf(sb, digraph geom {\n); LIST_FOREACH(mp, g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, };\n); + sbuf_printf(sb, }\n); sbuf_finish(sb); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250976 - stable/9/usr.sbin/ctladm
Author: jh Date: Sat May 25 09:47:33 2013 New Revision: 250976 URL: http://svnweb.freebsd.org/changeset/base/250976 Log: MFC r250443: Check the return value of sbuf_finish(). Modified: stable/9/usr.sbin/ctladm/ctladm.c Directory Properties: stable/9/usr.sbin/ctladm/ (props changed) Modified: stable/9/usr.sbin/ctladm/ctladm.c == --- stable/9/usr.sbin/ctladm/ctladm.c Sat May 25 07:17:16 2013 (r250975) +++ stable/9/usr.sbin/ctladm/ctladm.c Sat May 25 09:47:33 2013 (r250976) @@ -545,7 +545,8 @@ retry: } if (xml != 0) { sbuf_printf(sb, /ctlfelist\n); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) + err(1, %s: sbuf_finish, __func__); printf(%s, sbuf_data(sb)); sbuf_delete(sb); } @@ -3492,7 +3493,8 @@ cctl_end_element(void *user_data, const errx(1, %s: no valid sbuf at level %d (name %s), __func__, devlist-level, name); - sbuf_finish(devlist-cur_sb[devlist-level]); + if (sbuf_finish(devlist-cur_sb[devlist-level]) != 0) + err(1, %s: sbuf_finish, __func__); str = strdup(sbuf_data(devlist-cur_sb[devlist-level])); if (str == NULL) err(1, %s can't allocate %zd bytes for string, __func__, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250868 - head/sys/geom
Author: jh Date: Tue May 21 18:40:54 2013 New Revision: 250868 URL: http://svnweb.freebsd.org/changeset/base/250868 Log: Remove an extra semicolon from the DOT language output. PR: kern/178540 Submitted by: Trond Endrestol MFC after:1 week Modified: head/sys/geom/geom_dump.c Modified: head/sys/geom/geom_dump.c == --- head/sys/geom/geom_dump.c Tue May 21 18:38:09 2013(r250867) +++ head/sys/geom/geom_dump.c Tue May 21 18:40:54 2013(r250868) @@ -105,7 +105,7 @@ g_confdot(void *p, int flag ) sbuf_printf(sb, digraph geom {\n); LIST_FOREACH(mp, g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, };\n); + sbuf_printf(sb, }\n); sbuf_finish(sb); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250706 - head/sys/kern
Author: jh Date: Thu May 16 18:13:10 2013 New Revision: 250706 URL: http://svnweb.freebsd.org/changeset/base/250706 Log: A library function shall not set errno to 0. Reviewed by: mdf Modified: head/sys/kern/subr_sbuf.c Modified: head/sys/kern/subr_sbuf.c == --- head/sys/kern/subr_sbuf.c Thu May 16 17:53:12 2013(r250705) +++ head/sys/kern/subr_sbuf.c Thu May 16 18:13:10 2013(r250706) @@ -706,9 +706,10 @@ sbuf_finish(struct sbuf *s) #ifdef _KERNEL return (s-s_error); #else - errno = s-s_error; - if (s-s_error) + if (s-s_error != 0) { + errno = s-s_error; return (-1); + } return (0); #endif } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250667 - in head/contrib/nvi: common include
Author: jh Date: Wed May 15 18:41:49 2013 New Revision: 250667 URL: http://svnweb.freebsd.org/changeset/base/250667 Log: Rename O_DIRECTORY to O_TMP_DIRECTORY to avoid shadowing the fcntl.h O_DIRECTORY flag. PR: bin/173924 Obtained from:git://repo.or.cz/nvi.git Modified: head/contrib/nvi/common/exf.c head/contrib/nvi/common/options.c head/contrib/nvi/include/options_def.h Modified: head/contrib/nvi/common/exf.c == --- head/contrib/nvi/common/exf.c Wed May 15 18:38:28 2013 (r250666) +++ head/contrib/nvi/common/exf.c Wed May 15 18:41:49 2013 (r250667) @@ -187,10 +187,10 @@ file_init(sp, frp, rcv_name, flags) */ oname = frp-name; if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) { - if (opts_empty(sp, O_DIRECTORY, 0)) + if (opts_empty(sp, O_TMP_DIRECTORY, 0)) goto err; (void)snprintf(tname, sizeof(tname), - %s/vi.XX, O_STR(sp, O_DIRECTORY)); + %s/vi.XX, O_STR(sp, O_TMP_DIRECTORY)); if ((fd = mkstemp(tname)) == -1) { msgq(sp, M_SYSERR, 237|Unable to create temporary file); Modified: head/contrib/nvi/common/options.c == --- head/contrib/nvi/common/options.c Wed May 15 18:38:28 2013 (r250666) +++ head/contrib/nvi/common/options.c Wed May 15 18:41:49 2013 (r250667) @@ -64,7 +64,7 @@ OPTLIST const optlist[] = { {columns, f_columns, OPT_NUM,OPT_NOSAVE}, /* O_COMMENT 4.4BSD */ {comment, NULL, OPT_0BOOL, 0}, -/* O_DIRECTORY 4BSD */ +/* O_TMP_DIRECTORY 4BSD */ {directory, NULL, OPT_STR,0}, /* O_EDCOMPATIBLE 4BSD */ {edcompatible,NULL, OPT_0BOOL, 0}, @@ -244,7 +244,7 @@ static OABBREV const abbrev[] = { {aw, O_AUTOWRITE}, /* 4BSD */ {bf, O_BEAUTIFY},/* 4BSD */ {co, O_COLUMNS}, /* 4.4BSD */ - {dir, O_DIRECTORY}, /* 4BSD */ + {dir, O_TMP_DIRECTORY}, /* 4BSD */ {eb, O_ERRORBELLS}, /* 4BSD */ {ed, O_EDCOMPATIBLE},/* 4BSD */ {ex, O_EXRC},/* System V (undocumented) */ @@ -347,7 +347,7 @@ opts_init(sp, oargs) */ (void)snprintf(b1, sizeof(b1), directory=%s, (s = getenv(TMPDIR)) == NULL ? _PATH_TMP : s); - OI(O_DIRECTORY, b1); + OI(O_TMP_DIRECTORY, b1); OI(O_ESCAPETIME, escapetime=6); OI(O_KEYTIME, keytime=6); OI(O_MATCHTIME, matchtime=7); Modified: head/contrib/nvi/include/options_def.h == --- head/contrib/nvi/include/options_def.h Wed May 15 18:38:28 2013 (r250666) +++ head/contrib/nvi/include/options_def.h Wed May 15 18:41:49 2013 (r250667) @@ -8,7 +8,7 @@ #define O_CEDIT 7 #define O_COLUMNS 8 #define O_COMMENT 9 -#define O_DIRECTORY 10 +#define O_TMP_DIRECTORY 10 #define O_EDCOMPATIBLE 11 #define O_ESCAPETIME 12 #define O_ERRORBELLS 13 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250597 - stable/9/usr.bin/calendar
Author: jh Date: Mon May 13 13:57:06 2013 New Revision: 250597 URL: http://svnweb.freebsd.org/changeset/base/250597 Log: MFC r249200: Correct the path. PR: 176256 Modified: stable/9/usr.bin/calendar/calendar.1 Directory Properties: stable/9/usr.bin/calendar/ (props changed) Modified: stable/9/usr.bin/calendar/calendar.1 == --- stable/9/usr.bin/calendar/calendar.1Mon May 13 12:43:03 2013 (r250596) +++ stable/9/usr.bin/calendar/calendar.1Mon May 13 13:57:06 2013 (r250597) @@ -28,7 +28,7 @@ .\ @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\ $FreeBSD$ .\ -.Dd June 13, 2002 +.Dd April 6, 2013 .Dt CALENDAR 1 .Os .Sh NAME @@ -230,7 +230,7 @@ do not send mail if this file exists. .El .Pp The following default calendar files are provided in -.Pa /usr/share/calendars: +.Pa /usr/share/calendar: .Pp .Bl -tag -width calendar.southafrica -compact .It Pa calendar.all ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250598 - stable/8/usr.bin/calendar
Author: jh Date: Mon May 13 14:00:24 2013 New Revision: 250598 URL: http://svnweb.freebsd.org/changeset/base/250598 Log: MFC r249200: Correct the path. PR: 176256 Modified: stable/8/usr.bin/calendar/calendar.1 Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendar.1 == --- stable/8/usr.bin/calendar/calendar.1Mon May 13 13:57:06 2013 (r250597) +++ stable/8/usr.bin/calendar/calendar.1Mon May 13 14:00:24 2013 (r250598) @@ -28,7 +28,7 @@ .\ @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\ $FreeBSD$ .\ -.Dd June 13, 2002 +.Dd April 6, 2013 .Dt CALENDAR 1 .Os .Sh NAME @@ -222,7 +222,7 @@ do not send mail if this file exists. .El .Pp The following default calendar files are provided in -.Pa /usr/share/calendars: +.Pa /usr/share/calendar: .Pp .Bl -tag -width calendar.southafrica -compact .It Pa calendar.all ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250558 - stable/9/sys/kern
Author: jh Date: Sun May 12 09:42:17 2013 New Revision: 250558 URL: http://svnweb.freebsd.org/changeset/base/250558 Log: MFC r249650: Include PID in the error message which is printed when the maxproc limit is exceeded. Improve formatting of the message while here. PR: kern/60550 Modified: stable/9/sys/kern/kern_fork.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_fork.c == --- stable/9/sys/kern/kern_fork.c Sun May 12 09:33:33 2013 (r250557) +++ stable/9/sys/kern/kern_fork.c Sun May 12 09:42:17 2013 (r250558) @@ -929,8 +929,8 @@ fork1(struct thread *td, int flags, int fail: sx_sunlock(proctree_lock); if (ppsratecheck(lastfail, curfail, 1)) - printf(maxproc limit exceeded by uid %i, please see tuning(7) and login.conf(5).\n, - td-td_ucred-cr_ruid); + printf(maxproc limit exceeded by uid %u (pid %d); see tuning(7) and login.conf(5)\n, + td-td_ucred-cr_ruid, p1-p_pid); sx_xunlock(allproc_lock); #ifdef MAC mac_proc_destroy(newproc); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r250443 - head/usr.sbin/ctladm
Author: jh Date: Fri May 10 09:58:32 2013 New Revision: 250443 URL: http://svnweb.freebsd.org/changeset/base/250443 Log: Check the return value of sbuf_finish(). MFC after:1 week Modified: head/usr.sbin/ctladm/ctladm.c Modified: head/usr.sbin/ctladm/ctladm.c == --- head/usr.sbin/ctladm/ctladm.c Fri May 10 09:37:58 2013 (r250442) +++ head/usr.sbin/ctladm/ctladm.c Fri May 10 09:58:32 2013 (r250443) @@ -546,7 +546,8 @@ retry: } if (xml != 0) { sbuf_printf(sb, /ctlfelist\n); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) + err(1, %s: sbuf_finish, __func__); printf(%s, sbuf_data(sb)); sbuf_delete(sb); } @@ -3493,7 +3494,8 @@ cctl_end_element(void *user_data, const errx(1, %s: no valid sbuf at level %d (name %s), __func__, devlist-level, name); - sbuf_finish(devlist-cur_sb[devlist-level]); + if (sbuf_finish(devlist-cur_sb[devlist-level]) != 0) + err(1, %s: sbuf_finish, __func__); str = strdup(sbuf_data(devlist-cur_sb[devlist-level])); if (str == NULL) err(1, %s can't allocate %zd bytes for string, __func__, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r249650 - head/sys/kern
Author: jh Date: Fri Apr 19 15:19:29 2013 New Revision: 249650 URL: http://svnweb.freebsd.org/changeset/base/249650 Log: Include PID in the error message which is printed when the maxproc limit is exceeded. Improve formatting of the message while here. PR: kern/60550 Submitted by: Lowell Gilbert, bde Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c == --- head/sys/kern/kern_fork.c Fri Apr 19 13:40:13 2013(r249649) +++ head/sys/kern/kern_fork.c Fri Apr 19 15:19:29 2013(r249650) @@ -930,8 +930,8 @@ fork1(struct thread *td, int flags, int fail: sx_sunlock(proctree_lock); if (ppsratecheck(lastfail, curfail, 1)) - printf(maxproc limit exceeded by uid %i, please see tuning(7) and login.conf(5).\n, - td-td_ucred-cr_ruid); + printf(maxproc limit exceeded by uid %u (pid %d); see tuning(7) and login.conf(5)\n, + td-td_ucred-cr_ruid, p1-p_pid); sx_xunlock(allproc_lock); #ifdef MAC mac_proc_destroy(newproc); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r249508 - in head/sys: conf geom/label
On 2013-04-15, Ivan Voras wrote: Introduce glabel labels based on GEOM ident attributes. In this initial implementation, error on the side of conservatism and only create labels for GEOMs of classes DISK and MULTIPATH. After this commit I get a panic on boot. My kernel has been compiled with gcc. panic: stack overflow detected; backtrace may be corrupted cpuid = 1 KDB: enter: panic [ thread pid 13 tid 19 ] Stopped at kdb_enter+0x3a: movl$0,kdb_why db bt Tracing pid 13 tid 19 td 0xc7322000 kdb_enter(c0f374a2,c0f374a2,c0f3a31b,c6edbabc,1,...) at kdb_enter+0x3a/frame 0xc6edba7c vpanic(c6edbabc,c6edbabc,c0a3ee02,c0f3a31b,c6edbb50,...) at vpanic+0x12d/frame 0xc6edbaa4 panic(c0f3a31b,c6edbb50,c09a5d98,c6edbb90,c6edbadc,...) at panic+0x14/frame 0xc6edbab0 __stack_chk_fail(c6edbb90,c6edbadc,c6edbad8,c6edbadc,1,...) at __stack_chk_fail+0x12/frame 0xc6edbabc g_label_disk_ident_taste(c7511e40,c6edbb90,80,15e,0,...) at g_label_disk_ident_taste+0x138/frame 0xc6edbb50 g_label_taste(c105a5e0,c732be00,0,229,c732bd80,...) at g_label_taste+0x486/frame 0xc6edbc4c g_new_provider_event(c732be00,0,c0f29730,100,80246,...) at g_new_provider_event+0xe8/frame 0xc6edbc6c g_run_events(c10de890,0,c0f29f9d,79,c6edbcf4,...) at g_run_events+0x31c/frame 0xc6edbcb0 g_event_procbody(0,c6edbd08,c0f30630,3d7,c72b92e8,...) at g_event_procbody+0x93/frame 0xc6edbcc8 fork_exit(c099da20,0,c6edbd08) at fork_exit+0xc0/frame 0xc6edbcf4 fork_trampoline() at fork_trampoline+0x8/frame 0xc6edbcf4 --- trap 0, eip = 0, esp = 0xc6edbd40, ebp = 0 --- -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r249200 - head/usr.bin/calendar
Author: jh Date: Sat Apr 6 13:42:37 2013 New Revision: 249200 URL: http://svnweb.freebsd.org/changeset/base/249200 Log: Correct the path. PR: 176256 Submitted by: jhs Modified: head/usr.bin/calendar/calendar.1 Modified: head/usr.bin/calendar/calendar.1 == --- head/usr.bin/calendar/calendar.1Sat Apr 6 13:39:02 2013 (r249199) +++ head/usr.bin/calendar/calendar.1Sat Apr 6 13:42:37 2013 (r249200) @@ -28,7 +28,7 @@ .\ @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\ $FreeBSD$ .\ -.Dd June 13, 2002 +.Dd April 6, 2013 .Dt CALENDAR 1 .Os .Sh NAME @@ -230,7 +230,7 @@ do not send mail if this file exists. .El .Pp The following default calendar files are provided in -.Pa /usr/share/calendars: +.Pa /usr/share/calendar: .Pp .Bl -tag -width calendar.southafrica -compact .It Pa calendar.all ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cm
Hi, On 2013-03-21, Martin Matuska wrote: Merge libzfs_core branch: includes MFV 238590, 238592, 247580 I am getting the following error after this commit: # zpool list failed to read pool configuration: bad address no pools available # zfs list failed to read pool configuration: bad address Reverting sys/cddl to r248570 makes it work again. From dmesg: ZFS filesystem version: 5 ZFS storage pool version: features support (5000) -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r245891 - head/sys/cam/scsi
Author: jh Date: Thu Jan 24 17:28:39 2013 New Revision: 245891 URL: http://svnweb.freebsd.org/changeset/base/245891 Log: Sanitize the element descriptor string before using it as a device name. Reported and tested by: Vitalij Satanivskij Reviewed by: gibbs, mav Modified: head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/scsi/scsi_enc_ses.c == --- head/sys/cam/scsi/scsi_enc_ses.cThu Jan 24 17:12:02 2013 (r245890) +++ head/sys/cam/scsi/scsi_enc_ses.cThu Jan 24 17:28:39 2013 (r245891) @@ -36,6 +36,7 @@ __FBSDID($FreeBSD$); #include sys/param.h +#include sys/ctype.h #include sys/errno.h #include sys/kernel.h #include sys/lock.h @@ -1053,10 +1054,11 @@ ses_set_physpath(enc_softc_t *enc, enc_e { struct ccb_dev_advinfo cdai; ses_setphyspath_callback_args_t args; - int ret; + int i, ret; struct sbuf sb; uint8_t *devid, *elmaddr; ses_element_t *elmpriv; + const char *c; ret = EIO; devid = NULL; @@ -1099,7 +1101,13 @@ ses_set_physpath(enc_softc_t *enc, enc_e elmpriv = elm-elm_private; if (elmpriv-descr != NULL elmpriv-descr_len 0) { sbuf_cat(sb, /elmdesc@); - sbuf_bcat(sb, elmpriv-descr, elmpriv-descr_len); + for (i = 0, c = elmpriv-descr; i elmpriv-descr_len; + i++, c++) { + if (!isprint(*c) || isspace(*c) || *c == '/') + sbuf_putc(sb, '_'); + else + sbuf_putc(sb, *c); + } } sbuf_finish(sb); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r245590 - stable/9/sys/dev/md
Author: jh Date: Fri Jan 18 08:10:00 2013 New Revision: 245590 URL: http://svnweb.freebsd.org/changeset/base/245590 Log: MFC r243373: Print correct unit number when attaching preloaded memory disks. Retire now unused mdunits variable. Modified: stable/9/sys/dev/md/md.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/md/md.c == --- stable/9/sys/dev/md/md.cFri Jan 18 05:58:02 2013(r245589) +++ stable/9/sys/dev/md/md.cFri Jan 18 08:10:00 2013(r245590) @@ -131,7 +131,6 @@ static g_access_t g_md_access; static void g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp __unused, struct g_provider *pp); -static int mdunits; static struct cdev *status_dev = 0; static struct sx md_sx; static struct unrhdr *md_uh; @@ -1243,7 +1242,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, } static void -md_preloaded(u_char *image, size_t length) +md_preloaded(u_char *image, size_t length, const char *name) { struct md_s *sc; int error; @@ -1261,6 +1260,10 @@ md_preloaded(u_char *image, size_t lengt rootdevnames[0] = ufs:/dev/md0; #endif mdinit(sc); + if (name != NULL) { + printf(%s%d: Preloaded image %s %zd bytes at %p\n, + MD_NAME, sc-unit, name, length, image); + } } static void @@ -1281,7 +1284,7 @@ g_md_init(struct g_class *mp __unused) md_uh = new_unrhdr(0, INT_MAX, NULL); #ifdef MD_ROOT_SIZE sx_xlock(md_sx); - md_preloaded(mfs_root.start, sizeof(mfs_root.start)); + md_preloaded(mfs_root.start, sizeof(mfs_root.start), NULL); sx_xunlock(md_sx); #endif /* XXX: are preload_* static or do they need Giant ? */ @@ -1297,10 +1300,8 @@ g_md_init(struct g_class *mp __unused) ptr = preload_fetch_addr(mod); len = preload_fetch_size(mod); if (ptr != NULL len != 0) { - printf(%s%d: Preloaded image %s %d bytes at %p\n, - MD_NAME, mdunits, name, len, ptr); sx_xlock(md_sx); - md_preloaded(ptr, len); + md_preloaded(ptr, len, name); sx_xunlock(md_sx); } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r244585 - in head: . sys/geom/label
On 2013-01-09, Warner Losh wrote: I do not object, but IMHO having names with the spaces in /dev is weird and possibly problematic. I agree and my my preference was also to disallow spaces. However I expected that someone might complain. This was the reason of my initial request to disable spaces, together with the fact that it changes the devctl(4) protocol (there might be other /dev/devctl readers besides devd). I'm not sure that the protocol changes are quire right yet... Just for the record, usb(4) already uses quoted values for certain devctl variables. See usb_notify_addq() in sys/dev/usb/usb_device.c. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r244585 - in head: . sys/geom/label
On 2013-01-07, John Baldwin wrote: I think if it isn't hard to do so, we should aim to preserve labels as they are generally intended to be human readable as-is. Just preserving spaces is probably sufficient for this as they are probably the most commonly used character in labels affected by this change. All right. I have prepared patches for review. - Quote device names in devctl(4) device events. This allows events to work for device names containing spaces. - Allow spaces again in device names. Requested by: jhb PR: kern/161912 %%% Index: sys/kern/kern_conf.c === --- sys/kern/kern_conf.c(revision 245155) +++ sys/kern/kern_conf.c(working copy) @@ -536,17 +536,17 @@ notify(struct cdev *dev, const char *ev, { static const char prefix[] = cdev=; char *data; - int namelen, mflags; + size_t datalen; + int mflags; if (cold) return; mflags = (flags MAKEDEV_NOWAIT) ? M_NOWAIT : M_WAITOK; - namelen = strlen(dev-si_name); - data = malloc(namelen + sizeof(prefix), M_TEMP, mflags); + datalen = strlen(dev-si_name) + sizeof(prefix) + 2; + data = malloc(datalen, M_TEMP, mflags); if (data == NULL) return; - memcpy(data, prefix, sizeof(prefix) - 1); - memcpy(data + sizeof(prefix) - 1, dev-si_name, namelen + 1); + snprintf(data, datalen, %s\%s\, prefix, dev-si_name); devctl_notify_f(DEVFS, CDEV, ev, data, mflags); free(data, M_TEMP); } @@ -699,11 +699,11 @@ prep_devname(struct cdev *dev, const cha for (to = dev-si_name; *from != '\0'; from++, to++) { /* -* Spaces and double quotation marks cause -* problems for the devctl(4) protocol. -* Reject names containing those characters. +* Double quotation marks cause problems for the +* devctl(4) protocol. Reject names containing +* those characters. */ - if (isspace(*from) || *from == '') + if (*from == '') return (EINVAL); /* Treat multiple sequential slashes as single. */ while (from[0] == '/' from[1] == '/') Index: sys/geom/geom_dev.c === --- sys/geom/geom_dev.c (revision 245155) +++ sys/geom/geom_dev.c (working copy) @@ -107,15 +107,15 @@ static void g_dev_attrchanged(struct g_consumer *cp, const char *attr) { struct cdev *dev; - char buf[SPECNAMELEN + 6]; + char buf[SPECNAMELEN + 8]; if (strcmp(attr, GEOM::media) == 0) { dev = cp-geom-softc; - snprintf(buf, sizeof(buf), cdev=%s, dev-si_name); + snprintf(buf, sizeof(buf), cdev=\%s\, dev-si_name); devctl_notify_f(DEVFS, CDEV, MEDIACHANGE, buf, M_WAITOK); dev = cp-cp_alias_dev; if (dev != NULL) { - snprintf(buf, sizeof(buf), cdev=%s, dev-si_name); + snprintf(buf, sizeof(buf), cdev=\%s\, dev-si_name); devctl_notify_f(DEVFS, CDEV, MEDIACHANGE, buf, M_WAITOK); } %%% Don't mangle spaces in label names. Requested by: jhb %%% Index: sys/geom/label/g_label.c === --- sys/geom/label/g_label.c(revision 245155) +++ sys/geom/label/g_label.c(working copy) @@ -148,7 +148,7 @@ g_label_mangle_name(char *label, size_t sb = sbuf_new(NULL, NULL, size, SBUF_FIXEDLEN); for (c = label; *c != '\0'; c++) { - if (!isprint(*c) || isspace(*c) || *c =='' || *c == '%') + if (!isprint(*c) || *c =='' || *c == '%') sbuf_printf(sb, %%%02X, *c); else sbuf_putc(sb, *c); Index: UPDATING === --- UPDATING(revision 245155) +++ UPDATING(working copy) @@ -33,9 +33,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 20121222: GEOM_LABEL now mangles label names read from file system metadata. - Mangling affect labels containing spaces, non-printable characters, - '%' or ''. Device names in /etc/fstab and other places may need to - be updated. + Mangling affect labels containing non-printable characters, '%' or + ''. Device names in /etc/fstab and other places may need to be + updated. 20121217: By default, only the 10 most recent kernel dumps will be saved. To %%% -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r244585 - in head: . sys/geom/label
On 2013-01-04, John Baldwin wrote: New Revision: 244585 Log: Mangle label names containing spaces, non-printable characters '%' or ''. Mangling is only done for label names read from file system metadata. Encoding resembles URL encoding. For example, the space character becomes %20. Ouch, mangling spaces seems unfortunate. I guess fixing the devctl protocol is too hard, and/or we can't just encode it at the protocol layer but leave the actual device names untouched? I initially proposed changing the devctl protocol but in a private discussion people preferred to not change the protocol. However, I think that allowing the space character only might be possible without changing the protocol as devd(8) can already handle strings enclosed in double quotes. usb(4) already uses such devctl variables. OS X preserves spaces in volume names and those can be quite common on ISO images, so mangling them really does seem to be a shame if we can avoid it. How important do you think this is? I understand that it's annoyance for people upgrading their systems but labels with spaces can still be used. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r245037 - stable/9/sbin/mdconfig
Author: jh Date: Fri Jan 4 11:57:27 2013 New Revision: 245037 URL: http://svnweb.freebsd.org/changeset/base/245037 Log: MFC r234047 by bjk: Fix a couple of style issues. Tweak grammar and markup while here. Modified: stable/9/sbin/mdconfig/mdconfig.8 Directory Properties: stable/9/sbin/mdconfig/ (props changed) Modified: stable/9/sbin/mdconfig/mdconfig.8 == --- stable/9/sbin/mdconfig/mdconfig.8 Fri Jan 4 11:11:12 2013 (r245036) +++ stable/9/sbin/mdconfig/mdconfig.8 Fri Jan 4 11:57:27 2013 (r245037) @@ -87,7 +87,7 @@ parameters specified and attach it to th Detach a memory disk from the system and release all resources. .It Fl t Ar type Select the type of the memory disk. -.Bl -tag -width preload +.Bl -tag -width malloc .It Cm malloc Storage for this type of memory disk is allocated with .Xr malloc 9 . @@ -104,31 +104,35 @@ becomes the backing store for this memor .It Cm swap Storage for this type of memory disk is allocated from buffer memory. -Pages get pushed out to the swap when the system is under memory +Pages get pushed out to swap when the system is under memory pressure, otherwise they stay in the operating memory. Using .Cm swap -backing is generally preferable over +backing is generally preferred instead of using .Cm malloc backing. .El .It Fl f Ar file -Filename to use for the vnode type memory disk. Options +Filename to use for the vnode type memory disk. +The .Fl a and .Fl t Ar vnode -are implied if not specified. +options are implied if not specified. .It Fl l List configured devices. If given with .Fl u , display details about that particular device. -If +If the .Fl v -option specified, show all details. +option is specified, show all details. .It Fl n -When printing md device names, print only the unit number without the -md prefix. +When printing +.Xr md 4 +device names, print only the unit number without the +.Xr md 4 +prefix. .It Fl s Ar size Size of the memory disk. .Ar Size @@ -137,11 +141,12 @@ is the number of 512 byte sectors unless or .Cm t which -denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. Options +denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. +The .Fl a and .Fl t Ar swap -are implied if not specified. +options are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for the memory disk, in bytes. .It Fl x Ar sectors/track @@ -175,12 +180,12 @@ Allocate and reserve all needed storage .It Oo Cm no Oc Ns Cm cluster Enable clustering on this disk. .It Oo Cm no Oc Ns Cm compress -Enable/Disable compression features to reduce memory usage. +Enable/disable compression features to reduce memory usage. .It Oo Cm no Oc Ns Cm force -Disable/Enable extra sanity checks to prevent the user from doing something +Disable/enable extra sanity checks to prevent the user from doing something that might adversely affect the system. .It Oo Cm no Oc Ns Cm readonly -Enable/Disable readonly mode. +Enable/disable readonly mode. .El .It Fl u Ar unit Request a specific unit number for the @@ -197,15 +202,15 @@ is provided for convenience as an abbrev .Fl t Ar vnode .Fl f Ar file . .Sh EXAMPLES -To create a 4 megabyte +Create a 4 megabyte .Xr malloc 9 backed memory disk. -The name of the allocated unit will be output on stdout like +The name of the allocated unit will be printed on stdout, such as .Dq Li md3 : .Pp .Dl mdconfig -a -t malloc -s 4m .Pp -To create a disk named +Create a disk named .Pa /dev/md4 with .Pa /tmp/boot.flp @@ -213,12 +218,12 @@ as backing storage: .Pp .Dl mdconfig -a -t vnode -f /tmp/boot.flp -u 4 .Pp -To detach and free all resources used by +Detach and free all resources used by .Pa /dev/md4 : .Pp .Dl mdconfig -d -u 4 .Pp -To create a 128MByte swap backed disk, initialize an +Create a 128MByte swap backed disk, initialize an .Xr ffs 7 file system on it, and mount it on .Pa /tmp : @@ -229,7 +234,7 @@ mount /dev/md10 /tmp chmod 1777 /tmp .Ed .Pp -To create a 5MB file-backed disk +Create a 5MB file-backed disk .Ns ( Fl a and .Fl t Ar vnode @@ -242,7 +247,7 @@ newfs md0c mount /dev/md0c /mnt .Ed .Pp -To create an +Create an .Xr md 4 device out of an ISO 9660 CD image file .Ns ( Fl a ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r245038 - in stable/9: sbin/mdconfig sys/dev/md
Author: jh Date: Fri Jan 4 12:06:59 2013 New Revision: 245038 URL: http://svnweb.freebsd.org/changeset/base/245038 Log: MFC r243372: Disallow attaching preloaded memory disks via ioctl. - The feature is dangerous because the kernel code didn't check validity of the memory address provided from user space. - It seems that mdconfig(8) never really supported attaching preloaded memory disks. - Preloaded memory disks are automatically attached during md(4) initialization. Thus there shouldn't be much use for the feature. PR: kern/169683 Modified: stable/9/sbin/mdconfig/mdconfig.c stable/9/sys/dev/md/md.c Directory Properties: stable/9/sbin/mdconfig/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sbin/mdconfig/mdconfig.c == --- stable/9/sbin/mdconfig/mdconfig.c Fri Jan 4 11:57:27 2013 (r245037) +++ stable/9/sbin/mdconfig/mdconfig.c Fri Jan 4 12:06:59 2013 (r245038) @@ -62,7 +62,7 @@ usage(void) mdconfig -d -u unit [-o [no]force]\n mdconfig -l [-v] [-n] [-u unit]\n mdconfig file\n); - fprintf(stderr, \t\ttype = {malloc, preload, vnode, swap}\n); + fprintf(stderr, \t\ttype = {malloc, vnode, swap}\n); fprintf(stderr, \t\toption = {cluster, compress, reserve}\n); fprintf(stderr, \t\tsize = %%d (512 byte blocks), %%db (B),\n); fprintf(stderr, \t\t %%dk (kB), %%dm (MB), %%dg (GB) or\n); @@ -115,9 +115,6 @@ main(int argc, char **argv) if (!strcmp(optarg, malloc)) { mdio.md_type = MD_MALLOC; mdio.md_options = MD_AUTOUNIT | MD_COMPRESS; - } else if (!strcmp(optarg, preload)) { - mdio.md_type = MD_PRELOAD; - mdio.md_options = 0; } else if (!strcmp(optarg, vnode)) { mdio.md_type = MD_VNODE; mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; Modified: stable/9/sys/dev/md/md.c == --- stable/9/sys/dev/md/md.cFri Jan 4 11:57:27 2013(r245037) +++ stable/9/sys/dev/md/md.cFri Jan 4 12:06:59 2013(r245038) @@ -854,27 +854,6 @@ mdinit(struct md_s *sc) DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); } -/* - * XXX: we should check that the range they feed us is mapped. - * XXX: we should implement read-only. - */ - -static int -mdcreate_preload(struct md_s *sc, struct md_ioctl *mdio) -{ - - if (mdio-md_options ~(MD_AUTOUNIT | MD_FORCE)) - return (EINVAL); - if (mdio-md_base == 0) - return (EINVAL); - sc-flags = mdio-md_options MD_FORCE; - /* Cast to pointer size, then to pointer to avoid warning */ - sc-pl_ptr = (u_char *)(uintptr_t)mdio-md_base; - sc-pl_len = (size_t)sc-mediasize; - return (0); -} - - static int mdcreate_malloc(struct md_s *sc, struct md_ioctl *mdio) { @@ -1186,8 +1165,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd error = mdcreate_malloc(sc, mdio); break; case MD_PRELOAD: - sc-start = mdstart_preload; - error = mdcreate_preload(sc, mdio); + /* +* We disallow attaching preloaded memory disks via +* ioctl. Preloaded memory disks are automatically +* attached in g_md_init(). +*/ + error = EOPNOTSUPP; break; case MD_VNODE: sc-start = mdstart_vnode; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r244584 - in head: share/man/man9 sys/kern
Author: jh Date: Sat Dec 22 13:33:28 2012 New Revision: 244584 URL: http://svnweb.freebsd.org/changeset/base/244584 Log: Reject spaces and double quotation marks in device names. devctl(4) and devd(8) can't handle names with such characters properly. PR: bin/144736, kern/161912 Discussed with: imp, kib, pjd Modified: head/share/man/man9/make_dev.9 head/sys/kern/kern_conf.c Modified: head/share/man/man9/make_dev.9 == --- head/share/man/man9/make_dev.9 Sat Dec 22 13:02:03 2012 (r244583) +++ head/share/man/man9/make_dev.9 Sat Dec 22 13:33:28 2012 (r244584) @@ -24,7 +24,7 @@ .\ .\ $FreeBSD$ .\ -.Dd May 3, 2011 +.Dd Dec 22, 2012 .Dt MAKE_DEV 9 .Os .Sh NAME @@ -364,6 +364,10 @@ or .Qq .. path component or ends with .Ql / . +.It Bq Er EINVAL +The +.Dv MAKEDEV_CHECKNAME +flag was specified and the provided device name contains invalid characters. .It Bq Er EEXIST The .Dv MAKEDEV_CHECKNAME Modified: head/sys/kern/kern_conf.c == --- head/sys/kern/kern_conf.c Sat Dec 22 13:02:03 2012(r244583) +++ head/sys/kern/kern_conf.c Sat Dec 22 13:33:28 2012(r244584) @@ -698,6 +698,13 @@ prep_devname(struct cdev *dev, const cha ; for (to = dev-si_name; *from != '\0'; from++, to++) { + /* +* Spaces and double quotation marks cause +* problems for the devctl(4) protocol. +* Reject names containing those characters. +*/ + if (isspace(*from) || *from == '') + return (EINVAL); /* Treat multiple sequential slashes as single. */ while (from[0] == '/' from[1] == '/') from++; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r244585 - in head: . sys/geom/label
Author: jh Date: Sat Dec 22 13:43:12 2012 New Revision: 244585 URL: http://svnweb.freebsd.org/changeset/base/244585 Log: Mangle label names containing spaces, non-printable characters '%' or ''. Mangling is only done for label names read from file system metadata. Encoding resembles URL encoding. For example, the space character becomes %20. Help by: kib Discussed with: imp, kib, pjd Modified: head/UPDATING head/sys/geom/label/g_label.c Modified: head/UPDATING == --- head/UPDATING Sat Dec 22 13:33:28 2012(r244584) +++ head/UPDATING Sat Dec 22 13:43:12 2012(r244585) @@ -26,6 +26,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run ln -s 'abort:false,junk:false' /etc/malloc.conf.) +20121222: + GEOM_LABEL now mangles label names read from file system metadata. + Mangling affect labels containing spaces, non-printable characters, + '%' or ''. Device names in /etc/fstab and other places may need to + be updated. + 20121217: By default, only the 10 most recent kernel dumps will be saved. To restore the previous behaviour (no limit on the number of kernel dumps Modified: head/sys/geom/label/g_label.c == --- head/sys/geom/label/g_label.c Sat Dec 22 13:33:28 2012 (r244584) +++ head/sys/geom/label/g_label.c Sat Dec 22 13:43:12 2012 (r244585) @@ -34,8 +34,10 @@ __FBSDID($FreeBSD$); #include sys/lock.h #include sys/mutex.h #include sys/bio.h +#include sys/ctype.h #include sys/malloc.h #include sys/libkern.h +#include sys/sbuf.h #include sys/sysctl.h #include geom/geom.h #include geom/geom_slice.h @@ -138,6 +140,26 @@ g_label_is_name_ok(const char *label) return (1); } +static void +g_label_mangle_name(char *label, size_t size) +{ + struct sbuf *sb; + const u_char *c; + + sb = sbuf_new(NULL, NULL, size, SBUF_FIXEDLEN); + for (c = label; *c != '\0'; c++) { + if (!isprint(*c) || isspace(*c) || *c =='' || *c == '%') + sbuf_printf(sb, %%%02X, *c); + else + sbuf_putc(sb, *c); + } + if (sbuf_finish(sb) != 0) + label[0] = '\0'; + else + strlcpy(label, sbuf_data(sb), size); + sbuf_delete(sb); +} + static struct g_geom * g_label_create(struct gctl_req *req, struct g_class *mp, struct g_provider *pp, const char *label, const char *dir, off_t mediasize) @@ -323,6 +345,7 @@ g_label_taste(struct g_class *mp, struct continue; g_topology_unlock(); g_labels[i]-ld_taste(cp, label, sizeof(label)); + g_label_mangle_name(label, sizeof(label)); g_topology_lock(); if (label[0] == '\0') continue; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r244547 - in stable/9/sys: dev/fdc geom geom/bde geom/cache geom/label geom/mountver geom/multipath geom/nop geom/sched vm
Author: jh Date: Fri Dec 21 18:25:05 2012 New Revision: 244547 URL: http://svnweb.freebsd.org/changeset/base/244547 Log: MFC r24: - Don't pass geom and provider names as format strings. - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Modified: stable/9/sys/dev/fdc/fdc.c stable/9/sys/geom/bde/g_bde.c stable/9/sys/geom/cache/g_cache.c stable/9/sys/geom/geom.h stable/9/sys/geom/geom_aes.c stable/9/sys/geom/geom_dev.c stable/9/sys/geom/geom_mbr.c stable/9/sys/geom/geom_slice.c stable/9/sys/geom/geom_slice.h stable/9/sys/geom/label/g_label.c stable/9/sys/geom/mountver/g_mountver.c stable/9/sys/geom/multipath/g_multipath.c stable/9/sys/geom/nop/g_nop.c stable/9/sys/geom/sched/g_sched.c stable/9/sys/vm/swap_pager.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/fdc/fdc.c == --- stable/9/sys/dev/fdc/fdc.c Fri Dec 21 18:00:11 2012(r244546) +++ stable/9/sys/dev/fdc/fdc.c Fri Dec 21 18:25:05 2012(r244547) @@ -865,7 +865,7 @@ fdc_worker(struct fdc_data *fdc) g_orphan_provider(fd-fd_provider, ENXIO); fd-fd_provider-flags |= G_PF_WITHER; fd-fd_provider = - g_new_providerf(fd-fd_geom, fd-fd_geom-name); + g_new_providerf(fd-fd_geom, %s, fd-fd_geom-name); g_error_provider(fd-fd_provider, 0); g_topology_unlock(); return (fdc_biodone(fdc, ENXIO)); @@ -2011,7 +2011,7 @@ fd_attach2(void *arg, int flag) fd-fd_geom = g_new_geomf(g_fd_class, fd%d, device_get_unit(fd-dev)); - fd-fd_provider = g_new_providerf(fd-fd_geom, fd-fd_geom-name); + fd-fd_provider = g_new_providerf(fd-fd_geom, %s, fd-fd_geom-name); fd-fd_geom-softc = fd; g_error_provider(fd-fd_provider, 0); } Modified: stable/9/sys/geom/bde/g_bde.c == --- stable/9/sys/geom/bde/g_bde.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/bde/g_bde.c Fri Dec 21 18:25:05 2012 (r244547) @@ -188,7 +188,7 @@ g_bde_create_geom(struct gctl_req *req, /* XXX: error check */ kproc_create(g_bde_worker, gp, sc-thread, 0, 0, g_bde %s, gp-name); - pp = g_new_providerf(gp, gp-name); + pp = g_new_providerf(gp, %s, gp-name); #if 0 /* * XXX: Disable this for now. Appearantly UFS no longer Modified: stable/9/sys/geom/cache/g_cache.c == --- stable/9/sys/geom/cache/g_cache.c Fri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/cache/g_cache.c Fri Dec 21 18:25:05 2012 (r244547) @@ -501,7 +501,7 @@ g_cache_create(struct g_class *mp, struc return (NULL); } - gp = g_new_geomf(mp, md-md_name); + gp = g_new_geomf(mp, %s, md-md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc-sc_type = type; sc-sc_bshift = bshift; Modified: stable/9/sys/geom/geom.h == --- stable/9/sys/geom/geom.hFri Dec 21 18:00:11 2012(r244546) +++ stable/9/sys/geom/geom.hFri Dec 21 18:25:05 2012(r244547) @@ -263,8 +263,10 @@ int g_handleattr_int(struct bio *bp, con int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val); int g_handleattr_str(struct bio *bp, const char *attribute, const char *str); struct g_consumer * g_new_consumer(struct g_geom *gp); -struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...); -struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...); +struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...) +__printflike(2, 3); +struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...) +__printflike(2, 3); int g_retaste(struct g_class *mp); void g_spoil(struct g_provider *pp, struct g_consumer *cp); int g_std_access(struct g_provider *pp, int dr, int dw, int de); Modified: stable/9/sys/geom/geom_aes.c == --- stable/9/sys/geom/geom_aes.cFri Dec 21 18:00:11 2012 (r244546) +++ stable/9/sys/geom/geom_aes.cFri Dec 21 18:25:05 2012 (r244547) @@ -344,7 +344,7 @@ g_aes_taste(struct g_class *mp, struct g } } g_topology_lock(); - pp = g_new_providerf(gp, gp-name); + pp = g_new_providerf(gp, %s, gp-name); pp-mediasize = mediasize - sectorsize; pp-sectorsize = sectorsize;
svn commit: r244208 - stable/9/lib/libgeom
Author: jh Date: Fri Dec 14 11:38:15 2012 New Revision: 244208 URL: http://svnweb.freebsd.org/changeset/base/244208 Log: MFC r242130: Improve libgeom XML parsing error handling. - Abort parsing and return an error if we run out of memory. - Return EILSEQ from geom_xml2tree() for XML syntax errors. Modified: stable/9/lib/libgeom/geom_xml2tree.c Directory Properties: stable/9/lib/libgeom/ (props changed) Modified: stable/9/lib/libgeom/geom_xml2tree.c == --- stable/9/lib/libgeom/geom_xml2tree.cFri Dec 14 09:00:18 2012 (r244207) +++ stable/9/lib/libgeom/geom_xml2tree.cFri Dec 14 11:38:15 2012 (r244208) @@ -56,6 +56,8 @@ struct mystate { struct sbuf *sbuf[20]; struct gconf*config; int nident; + XML_Parser parser; + int error; }; static void @@ -85,6 +87,8 @@ StartElement(void *userData, const char if (!strcmp(name, class) mt-class == NULL) { mt-class = calloc(1, sizeof *mt-class); if (mt-class == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -98,6 +102,8 @@ StartElement(void *userData, const char if (!strcmp(name, geom) mt-geom == NULL) { mt-geom = calloc(1, sizeof *mt-geom); if (mt-geom == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -116,6 +122,8 @@ StartElement(void *userData, const char if (!strcmp(name, consumer) mt-consumer == NULL) { mt-consumer = calloc(1, sizeof *mt-consumer); if (mt-consumer == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -137,6 +145,8 @@ StartElement(void *userData, const char if (!strcmp(name, provider) mt-provider == NULL) { mt-provider = calloc(1, sizeof *mt-provider); if (mt-provider == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -180,16 +190,19 @@ EndElement(void *userData, const char *n char *p; mt = userData; - sbuf_finish(mt-sbuf[mt-level]); - p = strdup(sbuf_data(mt-sbuf[mt-level])); + p = NULL; + if (sbuf_finish(mt-sbuf[mt-level]) == 0) + p = strdup(sbuf_data(mt-sbuf[mt-level])); + sbuf_delete(mt-sbuf[mt-level]); + mt-sbuf[mt-level] = NULL; + mt-level--; if (p == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; } - sbuf_delete(mt-sbuf[mt-level]); - mt-sbuf[mt-level] = NULL; - mt-level--; if (strlen(p) == 0) { free(p); p = NULL; @@ -249,12 +262,16 @@ EndElement(void *userData, const char *n if (mt-config != NULL) { gc = calloc(1, sizeof *gc); if (gc == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; } gc-lg_name = strdup(name); if (gc-lg_name == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -334,7 +351,7 @@ geom_xml2tree(struct gmesh *gmp, char *p struct ggeom *ge; struct gprovider *pr; struct gconsumer *co; - int i; + int error, i; memset(gmp, 0, sizeof *gmp); LIST_INIT(gmp-lg_class); @@ -347,14 +364,22 @@ geom_xml2tree(struct gmesh *gmp, char *p return (ENOMEM); } mt-mesh = gmp; + mt-parser = parser; + error = 0; XML_SetUserData(parser, mt); XML_SetElementHandler(parser, StartElement,
Re: svn commit: r244075 - stable/9/bin/ls
On 2012-12-10, Greg Lehey wrote: MFC to r242840: I found confusing that this commit merges changes not mentioned in the commit message below. It make me while to notice to before the revision number. Also the commit didn't record mergeinfo. Add y flag and environment variable LS_SAMESORT to specify the same sorting order for time and name with the -t option. IEEE Std 1003.2 (POSIX.2) mandates that the -t option sort in descending order, and that if two files have the same timestamp, they should be sorted in ascending order of their names. The -r flag reverses both of these sort orders, so they're never the same. This creates significant problems for sequentially named files stored on FAT file systems, where it can be impossible to list them in the order in which they were created. Add , (comma) option to print file sizes grouped and separated by thousands using the non-monetary separator returned by localeconv(3), typically a comma or period. Modified: stable/9/bin/ls/cmp.c == --- stable/9/bin/ls/cmp.c Mon Dec 10 02:44:47 2012(r244074) +++ stable/9/bin/ls/cmp.c Mon Dec 10 03:11:19 2012(r244075) @@ -78,6 +78,9 @@ modcmp(const FTSENT *a, const FTSENT *b) if (b-fts_statp-st_mtim.tv_nsec a-fts_statp-st_mtim.tv_nsec) return (-1); + if (f_samesort) + return (strcoll(b-fts_name, a-fts_name)); + else return (strcoll(a-fts_name, b-fts_name)); } Wrong indentation. Merge error? @@ -104,6 +107,9 @@ acccmp(const FTSENT *a, const FTSENT *b) if (b-fts_statp-st_atim.tv_nsec a-fts_statp-st_atim.tv_nsec) return (-1); + if (f_samesort) + return (strcoll(b-fts_name, a-fts_name)); + else return (strcoll(a-fts_name, b-fts_name)); } Ditto. @@ -130,6 +136,9 @@ birthcmp(const FTSENT *a, const FTSENT * if (b-fts_statp-st_birthtim.tv_nsec a-fts_statp-st_birthtim.tv_nsec) return (-1); + if (f_samesort) + return (strcoll(b-fts_name, a-fts_name)); + else return (strcoll(a-fts_name, b-fts_name)); } Ditto. @@ -156,6 +165,9 @@ statcmp(const FTSENT *a, const FTSENT *b if (b-fts_statp-st_ctim.tv_nsec a-fts_statp-st_ctim.tv_nsec) return (-1); + if (f_samesort) + return (strcoll(b-fts_name, a-fts_name)); + else return (strcoll(a-fts_name, b-fts_name)); } Ditto. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243942 - stable/9/sbin/fsck_msdosfs
Author: jh Date: Thu Dec 6 08:35:46 2012 New Revision: 243942 URL: http://svnweb.freebsd.org/changeset/base/243942 Log: MFC r242511: Print a newline after the error message. PR: bin/168447 Modified: stable/9/sbin/fsck_msdosfs/check.c Directory Properties: stable/9/sbin/fsck_msdosfs/ (props changed) Modified: stable/9/sbin/fsck_msdosfs/check.c == --- stable/9/sbin/fsck_msdosfs/check.c Thu Dec 6 08:32:28 2012 (r243941) +++ stable/9/sbin/fsck_msdosfs/check.c Thu Dec 6 08:35:46 2012 (r243942) @@ -68,6 +68,7 @@ checkfilesys(const char *fname) if (dosfs 0) { perror(Can't open); + printf(\n); return 8; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243943 - stable/8/sbin/fsck_msdosfs
Author: jh Date: Thu Dec 6 08:36:30 2012 New Revision: 243943 URL: http://svnweb.freebsd.org/changeset/base/243943 Log: MFC r242511: Print a newline after the error message. PR: bin/168447 Modified: stable/8/sbin/fsck_msdosfs/check.c Directory Properties: stable/8/sbin/fsck_msdosfs/ (props changed) Modified: stable/8/sbin/fsck_msdosfs/check.c == --- stable/8/sbin/fsck_msdosfs/check.c Thu Dec 6 08:35:46 2012 (r243942) +++ stable/8/sbin/fsck_msdosfs/check.c Thu Dec 6 08:36:30 2012 (r243943) @@ -68,6 +68,7 @@ checkfilesys(const char *fname) if (dosfs 0) { perror(Can't open); + printf(\n); return 8; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r243942 - stable/9/sbin/fsck_msdosfs
On 2012-12-06, Alfred Perlstein wrote: I think perror writes to STDERR, printf to STDOUT. (am I wrong?) perror(3) prints on stderr. However fsck uses its own perror() (renamed to perr() in head) which prints on stdout. You might better use warn()? Using warn(3) here wouldn't be correct. For additional details, please see the following mail: http://lists.freebsd.org/pipermail/svn-src-all/2012-November/060990.html -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243618 - stable/8/sys/dev/md
Author: jh Date: Tue Nov 27 16:37:36 2012 New Revision: 243618 URL: http://svnweb.freebsd.org/changeset/base/243618 Log: MFC r238991: Disallow sectorsize larger than MAXPHYS and mediasize smaller than sectorsize. PR: 169947 Modified: stable/8/sys/dev/md/md.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/md/ (props changed) Modified: stable/8/sys/dev/md/md.c == --- stable/8/sys/dev/md/md.cTue Nov 27 16:23:12 2012(r243617) +++ stable/8/sys/dev/md/md.cTue Nov 27 16:37:36 2012(r243618) @@ -1032,7 +1032,7 @@ mdcreate_swap(struct md_s *sc, struct md * Range check. Disallow negative sizes or any size less then the * size of a page. Then round to a page. */ - if (sc-mediasize == 0 || (sc-mediasize % PAGE_SIZE) != 0) + if (sc-mediasize = 0 || (sc-mediasize % PAGE_SIZE) != 0) return (EDOM); /* @@ -1073,6 +1073,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd struct md_ioctl *mdio; struct md_s *sc; int error, i; + unsigned sectsize; if (md_debug) printf(mdctlioctl(%s %lx %p %x %p)\n, @@ -1101,6 +1102,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd default: return (EINVAL); } + if (mdio-md_sectorsize == 0) + sectsize = DEV_BSIZE; + else + sectsize = mdio-md_sectorsize; + if (sectsize MAXPHYS || mdio-md_mediasize sectsize) + return (EINVAL); if (mdio-md_options MD_AUTOUNIT) sc = mdnew(-1, error, mdio-md_type); else { @@ -1113,10 +1120,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd if (mdio-md_options MD_AUTOUNIT) mdio-md_unit = sc-unit; sc-mediasize = mdio-md_mediasize; - if (mdio-md_sectorsize == 0) - sc-sectorsize = DEV_BSIZE; - else - sc-sectorsize = mdio-md_sectorsize; + sc-sectorsize = sectsize; error = EDOOFUS; switch (sc-type) { case MD_MALLOC: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243477 - stable/7/lib/libc/rpc
Author: jh Date: Sat Nov 24 08:33:27 2012 New Revision: 243477 URL: http://svnweb.freebsd.org/changeset/base/243477 Log: MFC r235143 by kib: Plug a leak. PR: 167068 Tested by:Oliver Pinter Modified: stable/7/lib/libc/rpc/auth_unix.c Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/rpc/auth_unix.c == --- stable/7/lib/libc/rpc/auth_unix.c Sat Nov 24 07:02:31 2012 (r243476) +++ stable/7/lib/libc/rpc/auth_unix.c Sat Nov 24 08:33:27 2012 (r243477) @@ -185,6 +185,7 @@ authunix_create(machname, uid, gid, len, AUTH * authunix_create_default() { + AUTH *auth; int ngids; long ngids_max; char machname[MAXHOSTNAMELEN + 1]; @@ -207,8 +208,10 @@ authunix_create_default() if (ngids NGRPS) ngids = NGRPS; /* XXX: interface problem; those should all have been unsigned */ - return (authunix_create(machname, (int)uid, (int)gid, ngids, - (int *)gids)); + auth = authunix_create(machname, (int)uid, (int)gid, ngids, + (int *)gids); + free(gids); + return (auth); } /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243372 - in head: sbin/mdconfig sys/dev/md
Author: jh Date: Wed Nov 21 16:56:47 2012 New Revision: 243372 URL: http://svnweb.freebsd.org/changeset/base/243372 Log: Disallow attaching preloaded memory disks via ioctl. - The feature is dangerous because the kernel code didn't check validity of the memory address provided from user space. - It seems that mdconfig(8) never really supported attaching preloaded memory disks. - Preloaded memory disks are automatically attached during md(4) initialization. Thus there shouldn't be much use for the feature. PR: kern/169683 Discussed on: freebsd-hackers Modified: head/sbin/mdconfig/mdconfig.c head/sys/dev/md/md.c Modified: head/sbin/mdconfig/mdconfig.c == --- head/sbin/mdconfig/mdconfig.c Wed Nov 21 09:50:31 2012 (r243371) +++ head/sbin/mdconfig/mdconfig.c Wed Nov 21 16:56:47 2012 (r243372) @@ -84,7 +84,7 @@ usage(void) mdconfig -r -u unit -s size [-o [no]force]\n mdconfig -l [-v] [-n] [-u unit]\n mdconfig file\n); - fprintf(stderr, \t\ttype = {malloc, preload, vnode, swap}\n); + fprintf(stderr, \t\ttype = {malloc, vnode, swap}\n); fprintf(stderr, \t\toption = {cluster, compress, reserve}\n); fprintf(stderr, \t\tsize = %%d (512 byte blocks), %%db (B),\n); fprintf(stderr, \t\t %%dk (kB), %%dm (MB), %%dg (GB) or\n); @@ -148,8 +148,6 @@ main(int argc, char **argv) if (!strcmp(optarg, malloc)) { mdio.md_type = MD_MALLOC; mdio.md_options |= MD_AUTOUNIT | MD_COMPRESS; - } else if (!strcmp(optarg, preload)) { - mdio.md_type = MD_PRELOAD; } else if (!strcmp(optarg, vnode)) { mdio.md_type = MD_VNODE; mdio.md_options |= MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cWed Nov 21 09:50:31 2012(r243371) +++ head/sys/dev/md/md.cWed Nov 21 16:56:47 2012(r243372) @@ -854,27 +854,6 @@ mdinit(struct md_s *sc) DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); } -/* - * XXX: we should check that the range they feed us is mapped. - * XXX: we should implement read-only. - */ - -static int -mdcreate_preload(struct md_s *sc, struct md_ioctl *mdio) -{ - - if (mdio-md_options ~(MD_AUTOUNIT | MD_FORCE)) - return (EINVAL); - if (mdio-md_base == 0) - return (EINVAL); - sc-flags = mdio-md_options MD_FORCE; - /* Cast to pointer size, then to pointer to avoid warning */ - sc-pl_ptr = (u_char *)(uintptr_t)mdio-md_base; - sc-pl_len = (size_t)sc-mediasize; - return (0); -} - - static int mdcreate_malloc(struct md_s *sc, struct md_ioctl *mdio) { @@ -1238,8 +1217,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd error = mdcreate_malloc(sc, mdio); break; case MD_PRELOAD: - sc-start = mdstart_preload; - error = mdcreate_preload(sc, mdio); + /* +* We disallow attaching preloaded memory disks via +* ioctl. Preloaded memory disks are automatically +* attached in g_md_init(). +*/ + error = EOPNOTSUPP; break; case MD_VNODE: sc-start = mdstart_vnode; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243373 - head/sys/dev/md
Author: jh Date: Wed Nov 21 17:05:57 2012 New Revision: 243373 URL: http://svnweb.freebsd.org/changeset/base/243373 Log: Print correct unit number when attaching preloaded memory disks. Retire now unused mdunits variable. Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cWed Nov 21 16:56:47 2012(r243372) +++ head/sys/dev/md/md.cWed Nov 21 17:05:57 2012(r243373) @@ -137,7 +137,6 @@ static g_access_t g_md_access; static void g_md_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp __unused, struct g_provider *pp); -static int mdunits; static struct cdev *status_dev = 0; static struct sx md_sx; static struct unrhdr *md_uh; @@ -1309,7 +1308,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, } static void -md_preloaded(u_char *image, size_t length) +md_preloaded(u_char *image, size_t length, const char *name) { struct md_s *sc; int error; @@ -1327,6 +1326,10 @@ md_preloaded(u_char *image, size_t lengt rootdevnames[0] = MD_ROOT_FSTYPE :/dev/md0; #endif mdinit(sc); + if (name != NULL) { + printf(%s%d: Preloaded image %s %zd bytes at %p\n, + MD_NAME, sc-unit, name, length, image); + } } static void @@ -1347,7 +1350,7 @@ g_md_init(struct g_class *mp __unused) md_uh = new_unrhdr(0, INT_MAX, NULL); #ifdef MD_ROOT_SIZE sx_xlock(md_sx); - md_preloaded(mfs_root.start, sizeof(mfs_root.start)); + md_preloaded(mfs_root.start, sizeof(mfs_root.start), NULL); sx_xunlock(md_sx); #endif /* XXX: are preload_* static or do they need Giant ? */ @@ -1363,10 +1366,8 @@ g_md_init(struct g_class *mp __unused) ptr = preload_fetch_addr(mod); len = preload_fetch_size(mod); if (ptr != NULL len != 0) { - printf(%s%d: Preloaded image %s %d bytes at %p\n, - MD_NAME, mdunits, name, len, ptr); sx_xlock(md_sx); - md_preloaded(ptr, len); + md_preloaded(ptr, len, name); sx_xunlock(md_sx); } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r243328 - head/lib/libutil
Hi! On 2012-11-20, Baptiste Daroussin wrote: change mode the group file to 0644 after a successfull rename(2) int gr_mkdb(void) { - return (rename(tempname, group_file)); + int ret; + + ret = rename(tempname, group_file); + + if (ret == 0) + chmod(group_file, 0644); + + return (ret); } Rename+chmod is not an atomic operation. There is a window when the file has wrong permissions. Also, you don't check the return value of chmod(). Maybe chmod first and then rename? -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r243333 - in head/sys: dev/fdc geom geom/bde geom/cache geom/label geom/mountver geom/multipath geom/nop geom/sched vm
Author: jh Date: Tue Nov 20 12:32:18 2012 New Revision: 24 URL: http://svnweb.freebsd.org/changeset/base/24 Log: - Don't pass geom and provider names as format strings. - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Reviewed by: pjd Modified: head/sys/dev/fdc/fdc.c head/sys/geom/bde/g_bde.c head/sys/geom/cache/g_cache.c head/sys/geom/geom.h head/sys/geom/geom_aes.c head/sys/geom/geom_dev.c head/sys/geom/geom_mbr.c head/sys/geom/geom_slice.c head/sys/geom/geom_slice.h head/sys/geom/label/g_label.c head/sys/geom/mountver/g_mountver.c head/sys/geom/multipath/g_multipath.c head/sys/geom/nop/g_nop.c head/sys/geom/sched/g_sched.c head/sys/vm/swap_pager.c Modified: head/sys/dev/fdc/fdc.c == --- head/sys/dev/fdc/fdc.c Tue Nov 20 12:21:02 2012(r243332) +++ head/sys/dev/fdc/fdc.c Tue Nov 20 12:32:18 2012(r24) @@ -865,7 +865,7 @@ fdc_worker(struct fdc_data *fdc) g_orphan_provider(fd-fd_provider, ENXIO); fd-fd_provider-flags |= G_PF_WITHER; fd-fd_provider = - g_new_providerf(fd-fd_geom, fd-fd_geom-name); + g_new_providerf(fd-fd_geom, %s, fd-fd_geom-name); g_error_provider(fd-fd_provider, 0); g_topology_unlock(); return (fdc_biodone(fdc, ENXIO)); @@ -2011,7 +2011,7 @@ fd_attach2(void *arg, int flag) fd-fd_geom = g_new_geomf(g_fd_class, fd%d, device_get_unit(fd-dev)); - fd-fd_provider = g_new_providerf(fd-fd_geom, fd-fd_geom-name); + fd-fd_provider = g_new_providerf(fd-fd_geom, %s, fd-fd_geom-name); fd-fd_geom-softc = fd; g_error_provider(fd-fd_provider, 0); } Modified: head/sys/geom/bde/g_bde.c == --- head/sys/geom/bde/g_bde.c Tue Nov 20 12:21:02 2012(r243332) +++ head/sys/geom/bde/g_bde.c Tue Nov 20 12:32:18 2012(r24) @@ -184,7 +184,7 @@ g_bde_create_geom(struct gctl_req *req, /* XXX: error check */ kproc_create(g_bde_worker, gp, sc-thread, 0, 0, g_bde %s, gp-name); - pp = g_new_providerf(gp, gp-name); + pp = g_new_providerf(gp, %s, gp-name); pp-stripesize = kp-zone_cont; pp-stripeoffset = 0; pp-mediasize = sc-mediasize; Modified: head/sys/geom/cache/g_cache.c == --- head/sys/geom/cache/g_cache.c Tue Nov 20 12:21:02 2012 (r243332) +++ head/sys/geom/cache/g_cache.c Tue Nov 20 12:32:18 2012 (r24) @@ -502,7 +502,7 @@ g_cache_create(struct g_class *mp, struc return (NULL); } - gp = g_new_geomf(mp, md-md_name); + gp = g_new_geomf(mp, %s, md-md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); sc-sc_type = type; sc-sc_bshift = bshift; Modified: head/sys/geom/geom.h == --- head/sys/geom/geom.hTue Nov 20 12:21:02 2012(r243332) +++ head/sys/geom/geom.hTue Nov 20 12:32:18 2012(r24) @@ -271,8 +271,10 @@ int g_handleattr_int(struct bio *bp, con int g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val); int g_handleattr_str(struct bio *bp, const char *attribute, const char *str); struct g_consumer * g_new_consumer(struct g_geom *gp); -struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...); -struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...); +struct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...) +__printflike(2, 3); +struct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...) +__printflike(2, 3); void g_resize_provider(struct g_provider *pp, off_t size); int g_retaste(struct g_class *mp); void g_spoil(struct g_provider *pp, struct g_consumer *cp); Modified: head/sys/geom/geom_aes.c == --- head/sys/geom/geom_aes.cTue Nov 20 12:21:02 2012(r243332) +++ head/sys/geom/geom_aes.cTue Nov 20 12:32:18 2012(r24) @@ -342,7 +342,7 @@ g_aes_taste(struct g_class *mp, struct g } } g_topology_lock(); - pp = g_new_providerf(gp, gp-name); + pp = g_new_providerf(gp, %s, gp-name); pp-mediasize = mediasize - sectorsize; pp-sectorsize = sectorsize; g_error_provider(pp, 0); Modified: head/sys/geom/geom_dev.c == ---
Re: svn commit: r243328 - head/lib/libutil
On 2012-11-20, Baptiste Daroussin wrote: Does this looks better to you? http://people.freebsd.org/~bapt/gr_util.diff Yes. Thank you. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r242725 - head/bin/ls
On 2012-11-08, Greg Lehey wrote: New Revision: 242725 - return (strcoll(a-fts_name, b-fts_name)); +if (f_samesort) + return (strcoll(b-fts_name, a-fts_name)); +else + return (strcoll(a-fts_name, b-fts_name)); Please use tabs instead of spaces in indentations. Similarly in r242722. This patch should fix some whitespace problems: %%% Index: bin/ls/ls.c === --- bin/ls/ls.c (revision 242746) +++ bin/ls/ls.c (working copy) @@ -185,7 +185,7 @@ main(int argc, char *argv[]) fts_options = FTS_PHYSICAL; if (getenv(LS_SAMESORT)) f_samesort = 1; - while ((ch = getopt(argc, argv, + while ((ch = getopt(argc, argv, 1ABCD:FGHILPRSTUWXZabcdfghiklmnopqrstuwxy,)) != -1) { switch (ch) { /* @@ -241,7 +241,7 @@ main(int argc, char *argv[]) f_timesort = 1; f_sizesort = 0; break; -/* Other flags. Please keep alphabetic. */ + /* Other flags. Please keep alphabetic. */ case ',': f_thousands = 1; break; @@ -250,10 +250,10 @@ main(int argc, char *argv[]) f_octal = 1; f_octal_escape = 0; break; -case 'D': -f_timeformat = optarg; -break; -case 'F': + case 'D': + f_timeformat = optarg; + break; + case 'F': f_type = 1; f_slash = 0; break; @@ -861,7 +861,7 @@ label_out: d.s_size = sizelen; d.s_user = maxuser; } -if (f_thousands)/* make space for commas */ + if (f_thousands)/* make space for commas */ d.s_size += (d.s_size - 1) / 3; printfcn(d); output = 1; Index: bin/ls/cmp.c === --- bin/ls/cmp.c(revision 242746) +++ bin/ls/cmp.c(working copy) @@ -78,9 +78,9 @@ modcmp(const FTSENT *a, const FTSENT *b) if (b-fts_statp-st_mtim.tv_nsec a-fts_statp-st_mtim.tv_nsec) return (-1); -if (f_samesort) + if (f_samesort) return (strcoll(b-fts_name, a-fts_name)); -else + else return (strcoll(a-fts_name, b-fts_name)); } @@ -107,9 +107,9 @@ acccmp(const FTSENT *a, const FTSENT *b) if (b-fts_statp-st_atim.tv_nsec a-fts_statp-st_atim.tv_nsec) return (-1); -if (f_samesort) + if (f_samesort) return (strcoll(b-fts_name, a-fts_name)); -else + else return (strcoll(a-fts_name, b-fts_name)); } @@ -136,9 +136,9 @@ birthcmp(const FTSENT *a, const FTSENT * if (b-fts_statp-st_birthtim.tv_nsec a-fts_statp-st_birthtim.tv_nsec) return (-1); -if (f_samesort) + if (f_samesort) return (strcoll(b-fts_name, a-fts_name)); -else + else return (strcoll(a-fts_name, b-fts_name)); } @@ -165,9 +165,9 @@ statcmp(const FTSENT *a, const FTSENT *b if (b-fts_statp-st_ctim.tv_nsec a-fts_statp-st_ctim.tv_nsec) return (-1); -if (f_samesort) + if (f_samesort) return (strcoll(b-fts_name, a-fts_name)); -else + else return (strcoll(a-fts_name, b-fts_name)); } %%% -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r242699 - stable/9/sys/dev/md
Author: jh Date: Wed Nov 7 16:52:01 2012 New Revision: 242699 URL: http://svnweb.freebsd.org/changeset/base/242699 Log: MFC r238991: Disallow sectorsize larger than MAXPHYS and mediasize smaller than sectorsize. PR: 169947 Modified: stable/9/sys/dev/md/md.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/md/md.c == --- stable/9/sys/dev/md/md.cWed Nov 7 16:34:09 2012(r242698) +++ stable/9/sys/dev/md/md.cWed Nov 7 16:52:01 2012(r242699) @@ -1081,7 +1081,7 @@ mdcreate_swap(struct md_s *sc, struct md * Range check. Disallow negative sizes or any size less then the * size of a page. Then round to a page. */ - if (sc-mediasize == 0 || (sc-mediasize % PAGE_SIZE) != 0) + if (sc-mediasize = 0 || (sc-mediasize % PAGE_SIZE) != 0) return (EDOM); /* @@ -1122,6 +1122,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd struct md_ioctl *mdio; struct md_s *sc; int error, i; + unsigned sectsize; if (md_debug) printf(mdctlioctl(%s %lx %p %x %p)\n, @@ -1150,6 +1151,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd default: return (EINVAL); } + if (mdio-md_sectorsize == 0) + sectsize = DEV_BSIZE; + else + sectsize = mdio-md_sectorsize; + if (sectsize MAXPHYS || mdio-md_mediasize sectsize) + return (EINVAL); if (mdio-md_options MD_AUTOUNIT) sc = mdnew(-1, error, mdio-md_type); else { @@ -1162,10 +1169,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd if (mdio-md_options MD_AUTOUNIT) mdio-md_unit = sc-unit; sc-mediasize = mdio-md_mediasize; - if (mdio-md_sectorsize == 0) - sc-sectorsize = DEV_BSIZE; - else - sc-sectorsize = mdio-md_sectorsize; + sc-sectorsize = sectsize; error = EDOOFUS; switch (sc-type) { case MD_MALLOC: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r242511 - head/sbin/fsck_msdosfs
Author: jh Date: Sat Nov 3 09:18:37 2012 New Revision: 242511 URL: http://svn.freebsd.org/changeset/base/242511 Log: Print a newline after the error message. PR: bin/168447 Submitted by: Boris Kochergin Modified: head/sbin/fsck_msdosfs/check.c Modified: head/sbin/fsck_msdosfs/check.c == --- head/sbin/fsck_msdosfs/check.c Sat Nov 3 04:56:08 2012 (r242510) +++ head/sbin/fsck_msdosfs/check.c Sat Nov 3 09:18:37 2012 (r242511) @@ -68,6 +68,7 @@ checkfilesys(const char *fname) if (dosfs 0) { perr(Can't open `%s', fname); + printf(\n); return 8; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r242399 - stable/8/bin/cat
Author: jh Date: Wed Oct 31 17:00:36 2012 New Revision: 242399 URL: http://svn.freebsd.org/changeset/base/242399 Log: MFC r238652: style(9). Modified: stable/8/bin/cat/cat.c Directory Properties: stable/8/bin/cat/ (props changed) Modified: stable/8/bin/cat/cat.c == --- stable/8/bin/cat/cat.c Wed Oct 31 15:04:27 2012(r242398) +++ stable/8/bin/cat/cat.c Wed Oct 31 17:00:36 2012(r242399) @@ -58,11 +58,11 @@ __FBSDID($FreeBSD$); #include err.h #include fcntl.h #include locale.h +#include stddef.h #include stdio.h #include stdlib.h #include string.h #include unistd.h -#include stddef.h int bflag, eflag, nflag, sflag, tflag, vflag; int rval; @@ -77,16 +77,20 @@ static void raw_cat(int); static int udom_open(const char *path, int flags); #endif -/* Memory strategy threshold, in pages: if physmem is larger then this, use a - * large buffer */ -#define PHYSPAGES_THRESHOLD (32*1024) - -/* Maximum buffer size in bytes - do not allow it to grow larger than this */ -#define BUFSIZE_MAX (2*1024*1024) - -/* Small (default) buffer size in bytes. It's inefficient for this to be - * smaller than MAXPHYS */ -#define BUFSIZE_SMALL (MAXPHYS) +/* + * Memory strategy threshold, in pages: if physmem is larger than this, + * use a large buffer. + */ +#definePHYSPAGES_THRESHOLD (32 * 1024) + +/* Maximum buffer size in bytes - do not allow it to grow larger than this. */ +#defineBUFSIZE_MAX (2 * 1024 * 1024) + +/* + * Small (default) buffer size in bytes. It's inefficient for this to be + * smaller than MAXPHYS. + */ +#defineBUFSIZE_SMALL (MAXPHYS) int main(int argc, char *argv[]) @@ -144,13 +148,12 @@ usage(void) static void scanfiles(char *argv[], int cooked) { - int i = 0; + int fd, i; char *path; FILE *fp; + i = 0; while ((path = argv[i]) != NULL || i == 0) { - int fd; - if (path == NULL || strcmp(path, -) == 0) { filename = stdin; fd = STDIN_FILENO; @@ -261,12 +264,12 @@ raw_cat(int rfd) if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) - bsize = MIN(BUFSIZE_MAX, MAXPHYS*8); + bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8); else bsize = BUFSIZE_SMALL; } else - bsize = MAX(sbuf.st_blksize, - (blksize_t)sysconf(_SC_PAGESIZE)); + bsize = MAX(sbuf.st_blksize, + (blksize_t)sysconf(_SC_PAGESIZE)); if ((buf = malloc(bsize)) == NULL) err(1, malloc() failure of IO buffer); } @@ -327,7 +330,7 @@ udom_open(const char *path, int flags) break; } } - return(fd); + return (fd); } #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r242400 - stable/8/bin/cat
Author: jh Date: Wed Oct 31 17:01:56 2012 New Revision: 242400 URL: http://svn.freebsd.org/changeset/base/242400 Log: MFC r238653: Use proper error message when fstat(2) fails on stdout. PR: bin/159746 Modified: stable/8/bin/cat/cat.c Directory Properties: stable/8/bin/cat/ (props changed) Modified: stable/8/bin/cat/cat.c == --- stable/8/bin/cat/cat.c Wed Oct 31 17:00:36 2012(r242399) +++ stable/8/bin/cat/cat.c Wed Oct 31 17:01:56 2012(r242400) @@ -260,7 +260,7 @@ raw_cat(int rfd) wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, sbuf)) - err(1, %s, filename); + err(1, stdout); if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r242130 - head/lib/libgeom
Author: jh Date: Fri Oct 26 12:46:33 2012 New Revision: 242130 URL: http://svn.freebsd.org/changeset/base/242130 Log: Improve libgeom XML parsing error handling. - Abort parsing and return an error if we run out of memory. - Return EILSEQ from geom_xml2tree() for XML syntax errors. Silence on: freebsd-geom Modified: head/lib/libgeom/geom_xml2tree.c Modified: head/lib/libgeom/geom_xml2tree.c == --- head/lib/libgeom/geom_xml2tree.cFri Oct 26 12:41:01 2012 (r242129) +++ head/lib/libgeom/geom_xml2tree.cFri Oct 26 12:46:33 2012 (r242130) @@ -56,6 +56,8 @@ struct mystate { struct sbuf *sbuf[20]; struct gconf*config; int nident; + XML_Parser parser; + int error; }; static void @@ -85,6 +87,8 @@ StartElement(void *userData, const char if (!strcmp(name, class) mt-class == NULL) { mt-class = calloc(1, sizeof *mt-class); if (mt-class == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -98,6 +102,8 @@ StartElement(void *userData, const char if (!strcmp(name, geom) mt-geom == NULL) { mt-geom = calloc(1, sizeof *mt-geom); if (mt-geom == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -116,6 +122,8 @@ StartElement(void *userData, const char if (!strcmp(name, consumer) mt-consumer == NULL) { mt-consumer = calloc(1, sizeof *mt-consumer); if (mt-consumer == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -137,6 +145,8 @@ StartElement(void *userData, const char if (!strcmp(name, provider) mt-provider == NULL) { mt-provider = calloc(1, sizeof *mt-provider); if (mt-provider == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -180,16 +190,19 @@ EndElement(void *userData, const char *n char *p; mt = userData; - sbuf_finish(mt-sbuf[mt-level]); - p = strdup(sbuf_data(mt-sbuf[mt-level])); + p = NULL; + if (sbuf_finish(mt-sbuf[mt-level]) == 0) + p = strdup(sbuf_data(mt-sbuf[mt-level])); + sbuf_delete(mt-sbuf[mt-level]); + mt-sbuf[mt-level] = NULL; + mt-level--; if (p == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; } - sbuf_delete(mt-sbuf[mt-level]); - mt-sbuf[mt-level] = NULL; - mt-level--; if (strlen(p) == 0) { free(p); p = NULL; @@ -249,12 +262,16 @@ EndElement(void *userData, const char *n if (mt-config != NULL) { gc = calloc(1, sizeof *gc); if (gc == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; } gc-lg_name = strdup(name); if (gc-lg_name == NULL) { + mt-error = errno; + XML_StopParser(mt-parser, 0); warn(Cannot allocate memory during processing of '%s' element, name); return; @@ -334,7 +351,7 @@ geom_xml2tree(struct gmesh *gmp, char *p struct ggeom *ge; struct gprovider *pr; struct gconsumer *co; - int i; + int error, i; memset(gmp, 0, sizeof *gmp); LIST_INIT(gmp-lg_class); @@ -347,14 +364,22 @@ geom_xml2tree(struct gmesh *gmp, char *p return (ENOMEM); } mt-mesh = gmp; + mt-parser = parser; + error = 0; XML_SetUserData(parser, mt); XML_SetElementHandler(parser, StartElement, EndElement); XML_SetCharacterDataHandler(parser, CharData);
svn commit: r241222 - stable/9/sys/kern
Author: jh Date: Fri Oct 5 09:47:54 2012 New Revision: 241222 URL: http://svn.freebsd.org/changeset/base/241222 Log: MFC r239257: Reserve room for the terminating NUL when setting or getting kernel environment variables. KENV_MNAMELEN and KENV_MVALLEN doesn't include space for the terminating NUL. Modified: stable/9/sys/kern/kern_environment.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/dev/ (props changed) stable/9/sys/dev/e1000/ (props changed) stable/9/sys/dev/isp/ (props changed) stable/9/sys/dev/ixgbe/ (props changed) stable/9/sys/dev/puc/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/modules/ (props changed) Modified: stable/9/sys/kern/kern_environment.c == --- stable/9/sys/kern/kern_environment.cFri Oct 5 07:51:21 2012 (r241221) +++ stable/9/sys/kern/kern_environment.cFri Oct 5 09:47:54 2012 (r241222) @@ -143,9 +143,9 @@ sys_kenv(td, uap) break; } - name = malloc(KENV_MNAMELEN, M_TEMP, M_WAITOK); + name = malloc(KENV_MNAMELEN + 1, M_TEMP, M_WAITOK); - error = copyinstr(uap-name, name, KENV_MNAMELEN, NULL); + error = copyinstr(uap-name, name, KENV_MNAMELEN + 1, NULL); if (error) goto done; @@ -176,8 +176,8 @@ sys_kenv(td, uap) error = EINVAL; goto done; } - if (len KENV_MVALLEN) - len = KENV_MVALLEN; + if (len KENV_MVALLEN + 1) + len = KENV_MVALLEN + 1; value = malloc(len, M_TEMP, M_WAITOK); error = copyinstr(uap-value, value, len, NULL); if (error) { @@ -389,10 +389,10 @@ setenv(const char *name, const char *val KENV_CHECK; namelen = strlen(name) + 1; - if (namelen KENV_MNAMELEN) + if (namelen KENV_MNAMELEN + 1) return (-1); vallen = strlen(value) + 1; - if (vallen KENV_MVALLEN) + if (vallen KENV_MVALLEN + 1) return (-1); buf = malloc(namelen + vallen, M_KENV, M_WAITOK); sprintf(buf, %s=%s, name, value); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r241223 - stable/9/sbin/camcontrol
Author: jh Date: Fri Oct 5 10:44:50 2012 New Revision: 241223 URL: http://svn.freebsd.org/changeset/base/241223 Log: MFC r239612: Check the return value of sbuf_finish(). Modified: stable/9/sbin/camcontrol/camcontrol.c Directory Properties: stable/9/sbin/camcontrol/ (props changed) Modified: stable/9/sbin/camcontrol/camcontrol.c == --- stable/9/sbin/camcontrol/camcontrol.c Fri Oct 5 09:47:54 2012 (r241222) +++ stable/9/sbin/camcontrol/camcontrol.c Fri Oct 5 10:44:50 2012 (r241223) @@ -4757,7 +4757,10 @@ try_long: smp_report_general_sbuf(response, sizeof(*response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx(%s: sbuf_finish, __func__); + goto bailout; + } printf(%s, sbuf_data(sb)); @@ -5128,7 +5131,10 @@ smpmaninfo(struct cam_device *device, in smp_report_manuf_info_sbuf(response, sizeof(response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx(%s: sbuf_finish, __func__); + goto bailout; + } printf(%s, sbuf_data(sb)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r241098 - stable/8/usr.sbin/lpr/common_source
Author: jh Date: Mon Oct 1 14:52:34 2012 New Revision: 241098 URL: http://svn.freebsd.org/changeset/base/241098 Log: MFC r238546: Remove trailing whitespace. Modified: stable/8/usr.sbin/lpr/common_source/common.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/lpr/lpd/ (props changed) Modified: stable/8/usr.sbin/lpr/common_source/common.c == --- stable/8/usr.sbin/lpr/common_source/common.cMon Oct 1 12:28:58 2012(r241097) +++ stable/8/usr.sbin/lpr/common_source/common.cMon Oct 1 14:52:34 2012(r241098) @@ -136,7 +136,7 @@ getq(const struct printer *pp, struct jo /* * Estimate the array size by taking the size of the directory file -* and dividing it by a multiple of the minimum size entry. +* and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); @@ -641,7 +641,7 @@ trstat_write(struct printer *pp, tr_send * secs=n - seconds it took to transfer the file * bytes=n - number of bytes transfered (ie, bytecount) * bps=n.nen - Bytes/sec (if the transfer was big enough -* for this to be useful) +* for this to be useful) * ! top=str - type of printer (if the type is defined in * printcap, and if this statline is for sending * a file to that ptr) @@ -719,7 +719,7 @@ trstat_write(struct printer *pp, tr_send if (remspace 1) { strcpy(eostat, \n); } else { - /* probably should back up to just before the final x=.. */ + /* probably should back up to just before the final x=.. */ strcpy(statline+STATLINE_SIZE-2, \n); } statfile = open(statfname, O_WRONLY|O_APPEND, 0664); @@ -732,7 +732,7 @@ trstat_write(struct printer *pp, tr_send close(statfile); return; -#undef UPD_EOSTAT +#undef UPD_EOSTAT } #include stdarg.h ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r241099 - stable/8/usr.sbin/lpr/common_source
Author: jh Date: Mon Oct 1 14:55:22 2012 New Revision: 241099 URL: http://svn.freebsd.org/changeset/base/241099 Log: MFC r238547: Make sure that arraysz is initialized to a value larger than zero. arraysz could get initialized to zero on ZFS because ZFS reports directory sizes differently compared to UFS. PR: bin/169493 Modified: stable/8/usr.sbin/lpr/common_source/common.c Directory Properties: stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/lpr/lpd/ (props changed) Modified: stable/8/usr.sbin/lpr/common_source/common.c == --- stable/8/usr.sbin/lpr/common_source/common.cMon Oct 1 14:52:34 2012(r241098) +++ stable/8/usr.sbin/lpr/common_source/common.cMon Oct 1 14:55:22 2012(r241099) @@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); + if (arraysz 16) + arraysz = 16; queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r240407 - stable/9/bin/cat
Author: jh Date: Wed Sep 12 15:59:03 2012 New Revision: 240407 URL: http://svn.freebsd.org/changeset/base/240407 Log: MFC r238652: style(9). Modified: stable/9/bin/cat/cat.c Directory Properties: stable/9/bin/cat/ (props changed) Modified: stable/9/bin/cat/cat.c == --- stable/9/bin/cat/cat.c Wed Sep 12 15:36:44 2012(r240406) +++ stable/9/bin/cat/cat.c Wed Sep 12 15:59:03 2012(r240407) @@ -58,11 +58,11 @@ __FBSDID($FreeBSD$); #include err.h #include fcntl.h #include locale.h +#include stddef.h #include stdio.h #include stdlib.h #include string.h #include unistd.h -#include stddef.h int bflag, eflag, nflag, sflag, tflag, vflag; int rval; @@ -77,16 +77,20 @@ static void raw_cat(int); static int udom_open(const char *path, int flags); #endif -/* Memory strategy threshold, in pages: if physmem is larger then this, use a - * large buffer */ -#define PHYSPAGES_THRESHOLD (32*1024) - -/* Maximum buffer size in bytes - do not allow it to grow larger than this */ -#define BUFSIZE_MAX (2*1024*1024) - -/* Small (default) buffer size in bytes. It's inefficient for this to be - * smaller than MAXPHYS */ -#define BUFSIZE_SMALL (MAXPHYS) +/* + * Memory strategy threshold, in pages: if physmem is larger than this, + * use a large buffer. + */ +#definePHYSPAGES_THRESHOLD (32 * 1024) + +/* Maximum buffer size in bytes - do not allow it to grow larger than this. */ +#defineBUFSIZE_MAX (2 * 1024 * 1024) + +/* + * Small (default) buffer size in bytes. It's inefficient for this to be + * smaller than MAXPHYS. + */ +#defineBUFSIZE_SMALL (MAXPHYS) int main(int argc, char *argv[]) @@ -144,13 +148,12 @@ usage(void) static void scanfiles(char *argv[], int cooked) { - int i = 0; + int fd, i; char *path; FILE *fp; + i = 0; while ((path = argv[i]) != NULL || i == 0) { - int fd; - if (path == NULL || strcmp(path, -) == 0) { filename = stdin; fd = STDIN_FILENO; @@ -261,12 +264,12 @@ raw_cat(int rfd) if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) - bsize = MIN(BUFSIZE_MAX, MAXPHYS*8); + bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8); else bsize = BUFSIZE_SMALL; } else - bsize = MAX(sbuf.st_blksize, - (blksize_t)sysconf(_SC_PAGESIZE)); + bsize = MAX(sbuf.st_blksize, + (blksize_t)sysconf(_SC_PAGESIZE)); if ((buf = malloc(bsize)) == NULL) err(1, malloc() failure of IO buffer); } @@ -327,7 +330,7 @@ udom_open(const char *path, int flags) break; } } - return(fd); + return (fd); } #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r240408 - stable/9/bin/cat
Author: jh Date: Wed Sep 12 16:01:48 2012 New Revision: 240408 URL: http://svn.freebsd.org/changeset/base/240408 Log: MFC r238653: Use proper error message when fstat(2) fails on stdout. PR: bin/159746 Modified: stable/9/bin/cat/cat.c Directory Properties: stable/9/bin/cat/ (props changed) Modified: stable/9/bin/cat/cat.c == --- stable/9/bin/cat/cat.c Wed Sep 12 15:59:03 2012(r240407) +++ stable/9/bin/cat/cat.c Wed Sep 12 16:01:48 2012(r240408) @@ -260,7 +260,7 @@ raw_cat(int rfd) wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, sbuf)) - err(1, %s, filename); + err(1, stdout); if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r240319 - stable/9/usr.sbin/lpr/common_source
Author: jh Date: Mon Sep 10 16:24:16 2012 New Revision: 240319 URL: http://svn.freebsd.org/changeset/base/240319 Log: MFC r238546: Remove trailing whitespace. Modified: stable/9/usr.sbin/lpr/common_source/common.c Directory Properties: stable/9/usr.sbin/lpr/ (props changed) stable/9/usr.sbin/lpr/filters/ (props changed) stable/9/usr.sbin/lpr/lpd/ (props changed) Modified: stable/9/usr.sbin/lpr/common_source/common.c == --- stable/9/usr.sbin/lpr/common_source/common.cMon Sep 10 16:19:12 2012(r240318) +++ stable/9/usr.sbin/lpr/common_source/common.cMon Sep 10 16:24:16 2012(r240319) @@ -136,7 +136,7 @@ getq(const struct printer *pp, struct jo /* * Estimate the array size by taking the size of the directory file -* and dividing it by a multiple of the minimum size entry. +* and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); @@ -641,7 +641,7 @@ trstat_write(struct printer *pp, tr_send * secs=n - seconds it took to transfer the file * bytes=n - number of bytes transfered (ie, bytecount) * bps=n.nen - Bytes/sec (if the transfer was big enough -* for this to be useful) +* for this to be useful) * ! top=str - type of printer (if the type is defined in * printcap, and if this statline is for sending * a file to that ptr) @@ -719,7 +719,7 @@ trstat_write(struct printer *pp, tr_send if (remspace 1) { strcpy(eostat, \n); } else { - /* probably should back up to just before the final x=.. */ + /* probably should back up to just before the final x=.. */ strcpy(statline+STATLINE_SIZE-2, \n); } statfile = open(statfname, O_WRONLY|O_APPEND, 0664); @@ -732,7 +732,7 @@ trstat_write(struct printer *pp, tr_send close(statfile); return; -#undef UPD_EOSTAT +#undef UPD_EOSTAT } #include stdarg.h ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r240322 - stable/9/usr.sbin/lpr/common_source
Author: jh Date: Mon Sep 10 16:28:45 2012 New Revision: 240322 URL: http://svn.freebsd.org/changeset/base/240322 Log: MFC r238547: Make sure that arraysz is initialized to a value larger than zero. arraysz could get initialized to zero on ZFS because ZFS reports directory sizes differently compared to UFS. PR: bin/169493 Modified: stable/9/usr.sbin/lpr/common_source/common.c Directory Properties: stable/9/usr.sbin/lpr/ (props changed) stable/9/usr.sbin/lpr/filters/ (props changed) stable/9/usr.sbin/lpr/lpd/ (props changed) Modified: stable/9/usr.sbin/lpr/common_source/common.c == --- stable/9/usr.sbin/lpr/common_source/common.cMon Sep 10 16:27:19 2012(r240321) +++ stable/9/usr.sbin/lpr/common_source/common.cMon Sep 10 16:28:45 2012(r240322) @@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); + if (arraysz 16) + arraysz = 16; queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r239612 - head/sbin/camcontrol
Author: jh Date: Thu Aug 23 16:25:36 2012 New Revision: 239612 URL: http://svn.freebsd.org/changeset/base/239612 Log: Check the return value of sbuf_finish(). Modified: head/sbin/camcontrol/camcontrol.c Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Thu Aug 23 12:20:29 2012 (r239611) +++ head/sbin/camcontrol/camcontrol.c Thu Aug 23 16:25:36 2012 (r239612) @@ -4758,7 +4758,10 @@ try_long: smp_report_general_sbuf(response, sizeof(*response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx(%s: sbuf_finish, __func__); + goto bailout; + } printf(%s, sbuf_data(sb)); @@ -5129,7 +5132,10 @@ smpmaninfo(struct cam_device *device, in smp_report_manuf_info_sbuf(response, sizeof(response), sb); - sbuf_finish(sb); + if (sbuf_finish(sb) != 0) { + warnx(%s: sbuf_finish, __func__); + goto bailout; + } printf(%s, sbuf_data(sb)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r239257 - head/sys/kern
Author: jh Date: Tue Aug 14 19:16:30 2012 New Revision: 239257 URL: http://svn.freebsd.org/changeset/base/239257 Log: Reserve room for the terminating NUL when setting or getting kernel environment variables. KENV_MNAMELEN and KENV_MVALLEN doesn't include space for the terminating NUL. Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c == --- head/sys/kern/kern_environment.cTue Aug 14 17:53:52 2012 (r239256) +++ head/sys/kern/kern_environment.cTue Aug 14 19:16:30 2012 (r239257) @@ -143,9 +143,9 @@ sys_kenv(td, uap) break; } - name = malloc(KENV_MNAMELEN, M_TEMP, M_WAITOK); + name = malloc(KENV_MNAMELEN + 1, M_TEMP, M_WAITOK); - error = copyinstr(uap-name, name, KENV_MNAMELEN, NULL); + error = copyinstr(uap-name, name, KENV_MNAMELEN + 1, NULL); if (error) goto done; @@ -176,8 +176,8 @@ sys_kenv(td, uap) error = EINVAL; goto done; } - if (len KENV_MVALLEN) - len = KENV_MVALLEN; + if (len KENV_MVALLEN + 1) + len = KENV_MVALLEN + 1; value = malloc(len, M_TEMP, M_WAITOK); error = copyinstr(uap-value, value, len, NULL); if (error) { @@ -389,10 +389,10 @@ setenv(const char *name, const char *val KENV_CHECK; namelen = strlen(name) + 1; - if (namelen KENV_MNAMELEN) + if (namelen KENV_MNAMELEN + 1) return (-1); vallen = strlen(value) + 1; - if (vallen KENV_MVALLEN) + if (vallen KENV_MVALLEN + 1) return (-1); buf = malloc(namelen + vallen, M_KENV, M_WAITOK); sprintf(buf, %s=%s, name, value); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238991 - head/sys/dev/md
Author: jh Date: Thu Aug 2 15:05:34 2012 New Revision: 238991 URL: http://svn.freebsd.org/changeset/base/238991 Log: Disallow sectorsize larger than MAXPHYS and mediasize smaller than sectorsize. PR: 169947 Submitted by: Filip Palian (original version) Reviewed by: kib Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cThu Aug 2 13:57:49 2012(r238990) +++ head/sys/dev/md/md.cThu Aug 2 15:05:34 2012(r238991) @@ -1090,7 +1090,7 @@ mdresize(struct md_s *sc, struct md_ioct case MD_VNODE: break; case MD_SWAP: - if (mdio-md_mediasize == 0 || + if (mdio-md_mediasize = 0 || (mdio-md_mediasize % PAGE_SIZE) != 0) return (EDOM); oldpages = OFF_TO_IDX(round_page(sc-mediasize)); @@ -1148,7 +1148,7 @@ mdcreate_swap(struct md_s *sc, struct md * Range check. Disallow negative sizes or any size less then the * size of a page. Then round to a page. */ - if (sc-mediasize == 0 || (sc-mediasize % PAGE_SIZE) != 0) + if (sc-mediasize = 0 || (sc-mediasize % PAGE_SIZE) != 0) return (EDOM); /* @@ -1189,6 +1189,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd struct md_ioctl *mdio; struct md_s *sc; int error, i; + unsigned sectsize; if (md_debug) printf(mdctlioctl(%s %lx %p %x %p)\n, @@ -1217,6 +1218,12 @@ xmdctlioctl(struct cdev *dev, u_long cmd default: return (EINVAL); } + if (mdio-md_sectorsize == 0) + sectsize = DEV_BSIZE; + else + sectsize = mdio-md_sectorsize; + if (sectsize MAXPHYS || mdio-md_mediasize sectsize) + return (EINVAL); if (mdio-md_options MD_AUTOUNIT) sc = mdnew(-1, error, mdio-md_type); else { @@ -1229,10 +1236,7 @@ xmdctlioctl(struct cdev *dev, u_long cmd if (mdio-md_options MD_AUTOUNIT) mdio-md_unit = sc-unit; sc-mediasize = mdio-md_mediasize; - if (mdio-md_sectorsize == 0) - sc-sectorsize = DEV_BSIZE; - else - sc-sectorsize = mdio-md_sectorsize; + sc-sectorsize = sectsize; error = EDOOFUS; switch (sc-type) { case MD_MALLOC: @@ -1282,6 +1286,8 @@ xmdctlioctl(struct cdev *dev, u_long cmd sc = mdfind(mdio-md_unit); if (sc == NULL) return (ENOENT); + if (mdio-md_mediasize sc-sectorsize) + return (EINVAL); if (mdio-md_mediasize sc-mediasize !(sc-flags MD_FORCE) !(mdio-md_options MD_FORCE)) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238652 - head/bin/cat
Author: jh Date: Fri Jul 20 08:31:36 2012 New Revision: 238652 URL: http://svn.freebsd.org/changeset/base/238652 Log: style(9). Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c == --- head/bin/cat/cat.c Fri Jul 20 07:49:26 2012(r238651) +++ head/bin/cat/cat.c Fri Jul 20 08:31:36 2012(r238652) @@ -58,11 +58,11 @@ __FBSDID($FreeBSD$); #include err.h #include fcntl.h #include locale.h +#include stddef.h #include stdio.h #include stdlib.h #include string.h #include unistd.h -#include stddef.h static int bflag, eflag, nflag, sflag, tflag, vflag; static int rval; @@ -77,16 +77,20 @@ static void raw_cat(int); static int udom_open(const char *path, int flags); #endif -/* Memory strategy threshold, in pages: if physmem is larger then this, use a - * large buffer */ -#define PHYSPAGES_THRESHOLD (32*1024) - -/* Maximum buffer size in bytes - do not allow it to grow larger than this */ -#define BUFSIZE_MAX (2*1024*1024) - -/* Small (default) buffer size in bytes. It's inefficient for this to be - * smaller than MAXPHYS */ -#define BUFSIZE_SMALL (MAXPHYS) +/* + * Memory strategy threshold, in pages: if physmem is larger than this, + * use a large buffer. + */ +#definePHYSPAGES_THRESHOLD (32 * 1024) + +/* Maximum buffer size in bytes - do not allow it to grow larger than this. */ +#defineBUFSIZE_MAX (2 * 1024 * 1024) + +/* + * Small (default) buffer size in bytes. It's inefficient for this to be + * smaller than MAXPHYS. + */ +#defineBUFSIZE_SMALL (MAXPHYS) int main(int argc, char *argv[]) @@ -144,13 +148,12 @@ usage(void) static void scanfiles(char *argv[], int cooked) { - int i = 0; + int fd, i; char *path; FILE *fp; + i = 0; while ((path = argv[i]) != NULL || i == 0) { - int fd; - if (path == NULL || strcmp(path, -) == 0) { filename = stdin; fd = STDIN_FILENO; @@ -261,12 +264,12 @@ raw_cat(int rfd) if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) - bsize = MIN(BUFSIZE_MAX, MAXPHYS*8); + bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8); else bsize = BUFSIZE_SMALL; } else - bsize = MAX(sbuf.st_blksize, - (blksize_t)sysconf(_SC_PAGESIZE)); + bsize = MAX(sbuf.st_blksize, + (blksize_t)sysconf(_SC_PAGESIZE)); if ((buf = malloc(bsize)) == NULL) err(1, malloc() failure of IO buffer); } @@ -327,7 +330,7 @@ udom_open(const char *path, int flags) break; } } - return(fd); + return (fd); } #endif ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238653 - head/bin/cat
Author: jh Date: Fri Jul 20 08:33:23 2012 New Revision: 238653 URL: http://svn.freebsd.org/changeset/base/238653 Log: Use proper error message when fstat(2) fails on stdout. PR: bin/159746 Submitted by: Alex K. Modified: head/bin/cat/cat.c Modified: head/bin/cat/cat.c == --- head/bin/cat/cat.c Fri Jul 20 08:31:36 2012(r238652) +++ head/bin/cat/cat.c Fri Jul 20 08:33:23 2012(r238653) @@ -260,7 +260,7 @@ raw_cat(int rfd) wfd = fileno(stdout); if (buf == NULL) { if (fstat(wfd, sbuf)) - err(1, %s, filename); + err(1, stdout); if (S_ISREG(sbuf.st_mode)) { /* If there's plenty of RAM, use a large copy buffer */ if (sysconf(_SC_PHYS_PAGES) PHYSPAGES_THRESHOLD) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238546 - head/usr.sbin/lpr/common_source
Author: jh Date: Tue Jul 17 09:31:05 2012 New Revision: 238546 URL: http://svn.freebsd.org/changeset/base/238546 Log: Remove trailing whitespace. MFC after:2 weeks Modified: head/usr.sbin/lpr/common_source/common.c Modified: head/usr.sbin/lpr/common_source/common.c == --- head/usr.sbin/lpr/common_source/common.cTue Jul 17 03:18:12 2012 (r238545) +++ head/usr.sbin/lpr/common_source/common.cTue Jul 17 09:31:05 2012 (r238546) @@ -136,7 +136,7 @@ getq(const struct printer *pp, struct jo /* * Estimate the array size by taking the size of the directory file -* and dividing it by a multiple of the minimum size entry. +* and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); @@ -641,7 +641,7 @@ trstat_write(struct printer *pp, tr_send * secs=n - seconds it took to transfer the file * bytes=n - number of bytes transfered (ie, bytecount) * bps=n.nen - Bytes/sec (if the transfer was big enough -* for this to be useful) +* for this to be useful) * ! top=str - type of printer (if the type is defined in * printcap, and if this statline is for sending * a file to that ptr) @@ -719,7 +719,7 @@ trstat_write(struct printer *pp, tr_send if (remspace 1) { strcpy(eostat, \n); } else { - /* probably should back up to just before the final x=.. */ + /* probably should back up to just before the final x=.. */ strcpy(statline+STATLINE_SIZE-2, \n); } statfile = open(statfname, O_WRONLY|O_APPEND, 0664); @@ -732,7 +732,7 @@ trstat_write(struct printer *pp, tr_send close(statfile); return; -#undef UPD_EOSTAT +#undef UPD_EOSTAT } #include stdarg.h ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238547 - head/usr.sbin/lpr/common_source
Author: jh Date: Tue Jul 17 09:34:52 2012 New Revision: 238547 URL: http://svn.freebsd.org/changeset/base/238547 Log: Make sure that arraysz is initialized to a value larger than zero. arraysz could get initialized to zero on ZFS because ZFS reports directory sizes differently compared to UFS. PR: bin/169493 Tested by:swills MFC after:2 weeks Modified: head/usr.sbin/lpr/common_source/common.c Modified: head/usr.sbin/lpr/common_source/common.c == --- head/usr.sbin/lpr/common_source/common.cTue Jul 17 09:31:05 2012 (r238546) +++ head/usr.sbin/lpr/common_source/common.cTue Jul 17 09:34:52 2012 (r238547) @@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo * and dividing it by a multiple of the minimum size entry. */ arraysz = (stbuf.st_size / 24); + if (arraysz 16) + arraysz = 16; queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *)); if (queue == NULL) goto errdone; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r238497 - stable/7/sbin/mount_ntfs
Author: jh Date: Sun Jul 15 19:05:58 2012 New Revision: 238497 URL: http://svn.freebsd.org/changeset/base/238497 Log: MFC r230642: Remove trailing whitespace. Modified: stable/7/sbin/mount_ntfs/mount_ntfs.c Directory Properties: stable/7/sbin/mount_ntfs/ (props changed) Modified: stable/7/sbin/mount_ntfs/mount_ntfs.c == --- stable/7/sbin/mount_ntfs/mount_ntfs.c Sun Jul 15 19:04:12 2012 (r238496) +++ stable/7/sbin/mount_ntfs/mount_ntfs.c Sun Jul 15 19:05:58 2012 (r238497) @@ -162,7 +162,7 @@ main(argc, argv) } /* -* Resolve the mountpoint with realpath(3) and remove unnecessary +* Resolve the mountpoint with realpath(3) and remove unnecessary * slashes from the devicename if there are any. */ (void)checkpath(dir, mntpath); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r236901 - stable/8/sbin/mount
Author: jh Date: Mon Jun 11 18:02:30 2012 New Revision: 236901 URL: http://svn.freebsd.org/changeset/base/236901 Log: MFC r230373: Change mount_fs() to not exit on error. The failok mount option requires that errors are passed to the caller. PR: 163668 Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c == --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 17:54:40 2012 (r236900) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:02:30 2012 (r236901) @@ -86,7 +86,6 @@ mount_fs(const char *vfstype, int argc, char fstype[32]; char errmsg[255]; char *p, *val; - int ret; strlcpy(fstype, vfstype, sizeof(fstype)); memset(errmsg, 0, sizeof(errmsg)); @@ -129,10 +128,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(iov, iovlen, fspath, mntpath, (size_t)-1); build_iovec(iov, iovlen, from, dev, (size_t)-1); build_iovec(iov, iovlen, errmsg, errmsg, sizeof(errmsg)); - - ret = nmount(iov, iovlen, mntflags); - if (ret 0) - err(1, %s %s, dev, errmsg); - return (ret); + if (nmount(iov, iovlen, mntflags) == -1) { + warn(%s: %s, dev, errmsg); + return (1); + } + return (0); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r236904 - stable/8/sbin/mount
Author: jh Date: Mon Jun 11 18:22:04 2012 New Revision: 236904 URL: http://svn.freebsd.org/changeset/base/236904 Log: MFC r230377: Don't print the nmount(2) provided error message if it is empty. Modified: stable/8/sbin/mount/mount_fs.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount_fs.c == --- stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:10:12 2012 (r236903) +++ stable/8/sbin/mount/mount_fs.c Mon Jun 11 18:22:04 2012 (r236904) @@ -130,7 +130,10 @@ mount_fs(const char *vfstype, int argc, build_iovec(iov, iovlen, errmsg, errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, mntflags) == -1) { - warn(%s: %s, dev, errmsg); + if (*errmsg != '\0') + warn(%s: %s, dev, errmsg); + else + warn(%s, dev); return (1); } return (0); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r236440 - stable/8/sbin/mount_ntfs
Author: jh Date: Sat Jun 2 10:14:55 2012 New Revision: 236440 URL: http://svn.freebsd.org/changeset/base/236440 Log: MFC r230642: Remove trailing whitespace. Modified: stable/8/sbin/mount_ntfs/mount_ntfs.c Directory Properties: stable/8/sbin/mount_ntfs/ (props changed) Modified: stable/8/sbin/mount_ntfs/mount_ntfs.c == --- stable/8/sbin/mount_ntfs/mount_ntfs.c Sat Jun 2 09:10:51 2012 (r236439) +++ stable/8/sbin/mount_ntfs/mount_ntfs.c Sat Jun 2 10:14:55 2012 (r236440) @@ -162,7 +162,7 @@ main(argc, argv) } /* -* Resolve the mountpoint with realpath(3) and remove unnecessary +* Resolve the mountpoint with realpath(3) and remove unnecessary * slashes from the devicename if there are any. */ (void)checkpath(dir, mntpath); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r235509 - stable/8/usr.sbin/wake
Author: jh Date: Wed May 16 17:26:14 2012 New Revision: 235509 URL: http://svn.freebsd.org/changeset/base/235509 Log: MFC r232102: Exit with proper status when wake() fails. PR: bin/153527 Modified: stable/8/usr.sbin/wake/wake.c Directory Properties: stable/8/usr.sbin/wake/ (props changed) Modified: stable/8/usr.sbin/wake/wake.c == --- stable/8/usr.sbin/wake/wake.c Wed May 16 15:53:38 2012 (r235508) +++ stable/8/usr.sbin/wake/wake.c Wed May 16 17:26:14 2012 (r235509) @@ -165,14 +165,17 @@ send_wakeup(int bpf, struct ether_addr c int main(int argc, char *argv[]) { - int n; + int n, rval; if (argc 3) usage(); - for (n = 2; n argc; n++) - if (wake(argv[1], argv[n])) + for (n = 2; n argc; n++) { + if (wake(argv[1], argv[n])) { + rval = 1; warnx(error sending Wake on LAN frame over %s to %s, argv[1], argv[n]); - return (0); + } + } + exit(rval); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r235449 - in stable/9/sys: i386/conf kern
Author: jh Date: Mon May 14 15:46:37 2012 New Revision: 235449 URL: http://svn.freebsd.org/changeset/base/235449 Log: MFC r234489: The value of flags matching VNOVAL can't be supported. Return EOPNOTSUPP from setfflags() in this case. This fixes the return value of chflags(path, -1). Modified: stable/9/sys/kern/vfs_syscalls.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/kern/vfs_syscalls.c == --- stable/9/sys/kern/vfs_syscalls.cMon May 14 15:20:39 2012 (r235448) +++ stable/9/sys/kern/vfs_syscalls.cMon May 14 15:46:37 2012 (r235449) @@ -2743,6 +2743,10 @@ setfflags(td, vp, flags) struct mount *mp; struct vattr vattr; + /* We can't support the value matching VNOVAL. */ + if (flags == VNOVAL) + return (EOPNOTSUPP); + /* * Prevent non-root users from setting flags on devices. When * a device is reused, users can retain ownership of the device ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r235131 - in stable/9/sys: fs/ext2fs i386/conf kern
Author: jh Date: Mon May 7 15:30:53 2012 New Revision: 235131 URL: http://svn.freebsd.org/changeset/base/235131 Log: MFC r234104: Apply changes from r233787 to ext2fs: - Use more natural ip-i_flags instead of vap-va_flags in the final flags check. - Style improvements. No functional change intended. MFC r234139: Restore the blank line incorrectly removed in r234104. Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c == --- stable/9/sys/fs/ext2fs/ext2_vnops.c Mon May 7 15:06:07 2012 (r235130) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Mon May 7 15:30:53 2012 (r235131) @@ -426,23 +426,23 @@ ext2_setattr(ap) * if securelevel 0 and any existing system flags are set. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); } ip-i_flags = vap-va_flags; } else { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap-va_flags UF_SETTABLE) != vap-va_flags) return (EPERM); ip-i_flags = SF_SETTABLE; ip-i_flags |= (vap-va_flags UF_SETTABLE); } ip-i_flag |= IN_CHANGE; - if (vap-va_flags (IMMUTABLE | APPEND)) + if (ip-i_flags (IMMUTABLE | APPEND)) return (0); } if (ip-i_flags (IMMUTABLE | APPEND)) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r235010 - in stable/9/sys: i386/conf kern ufs/ufs
Author: jh Date: Fri May 4 15:51:23 2012 New Revision: 235010 URL: http://svn.freebsd.org/changeset/base/235010 Log: MFC r233875: Add a check for unsupported file flags to ufs_setattr(). Modified: stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c == --- stable/9/sys/ufs/ufs/ufs_vnops.cFri May 4 15:49:08 2012 (r235009) +++ stable/9/sys/ufs/ufs/ufs_vnops.cFri May 4 15:51:23 2012 (r235010) @@ -528,6 +528,10 @@ ufs_setattr(ap) return (EINVAL); } if (vap-va_flags != VNOVAL) { + if ((vap-va_flags ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | + UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | + SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0) + return (EOPNOTSUPP); if (vp-v_mount-mnt_flag MNT_RDONLY) return (EROFS); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234929 - in stable/9/sys: i386/conf kern ufs/ufs
Author: jh Date: Wed May 2 15:15:28 2012 New Revision: 234929 URL: http://svn.freebsd.org/changeset/base/234929 Log: MFC r233787: - Use more natural ip-i_flags instead of vap-va_flags in the final flags check. - Add a comment for the immutable/append check done after handling of the flags. - Style improvements. No functional change intended. MFC r234421: The part about exec atime no longer applies in the comment. Modified: stable/9/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/ufs/ufs/ufs_vnops.c == --- stable/9/sys/ufs/ufs/ufs_vnops.cWed May 2 14:38:43 2012 (r234928) +++ stable/9/sys/ufs/ufs/ufs_vnops.cWed May 2 15:15:28 2012 (r234929) @@ -547,8 +547,8 @@ ufs_setattr(ap) * processes. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); @@ -562,8 +562,8 @@ ufs_setattr(ap) ip-i_flags = vap-va_flags; DIP_SET(ip, i_flags, vap-va_flags); } else { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap-va_flags UF_SETTABLE) != vap-va_flags) return (EPERM); ip-i_flags = SF_SETTABLE; @@ -572,9 +572,14 @@ ufs_setattr(ap) } ip-i_flag |= IN_CHANGE; error = UFS_UPDATE(vp, 0); - if (vap-va_flags (IMMUTABLE | APPEND)) + if (ip-i_flags (IMMUTABLE | APPEND)) return (error); } + /* +* If immutable or append, no one can change any of its attributes +* except the ones already handled (in some cases, file flags +* including the immutability flags themselves for the superuser). +*/ if (ip-i_flags (IMMUTABLE | APPEND)) return (EPERM); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234489 - head/sys/kern
Author: jh Date: Fri Apr 20 10:08:30 2012 New Revision: 234489 URL: http://svn.freebsd.org/changeset/base/234489 Log: The value of flags matching VNOVAL can't be supported. Return EOPNOTSUPP from setfflags() in this case. This fixes the return value of chflags(path, -1). Discussed with: bde MFC after:2 weeks Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c == --- head/sys/kern/vfs_syscalls.cFri Apr 20 10:06:28 2012 (r234488) +++ head/sys/kern/vfs_syscalls.cFri Apr 20 10:08:30 2012 (r234489) @@ -2744,6 +2744,10 @@ setfflags(td, vp, flags) struct mount *mp; struct vattr vattr; + /* We can't support the value matching VNOVAL. */ + if (flags == VNOVAL) + return (EOPNOTSUPP); + /* * Prevent non-root users from setting flags on devices. When * a device is reused, users can retain ownership of the device ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234421 - head/sys/ufs/ufs
Author: jh Date: Wed Apr 18 15:19:00 2012 New Revision: 234421 URL: http://svn.freebsd.org/changeset/base/234421 Log: The part about exec atime no longer applies in the comment. Pointed out by: bde Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cWed Apr 18 13:50:17 2012 (r234420) +++ head/sys/ufs/ufs/ufs_vnops.cWed Apr 18 15:19:00 2012 (r234421) @@ -573,9 +573,8 @@ ufs_setattr(ap) } /* * If immutable or append, no one can change any of its attributes -* except the ones already handled (exec atime and, in some cases -* for the superuser, file flags including the immutability flags -* themselves). +* except the ones already handled (in some cases, file flags +* including the immutability flags themselves for the superuser). */ if (ip-i_flags (IMMUTABLE | APPEND)) return (EPERM); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234422 - head/sys/fs/tmpfs
Author: jh Date: Wed Apr 18 15:22:08 2012 New Revision: 234422 URL: http://svn.freebsd.org/changeset/base/234422 Log: Return EOPNOTSUPP rather than EPERM for the SF_SNAPSHOT flag because tmpfs doesn't support snapshots. Suggested by: bde Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c == --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Apr 18 15:19:00 2012 (r234421) +++ head/sys/fs/tmpfs/tmpfs_subr.c Wed Apr 18 15:22:08 2012 (r234422) @@ -1080,7 +1080,7 @@ tmpfs_chflags(struct vnode *vp, int flag if ((flags ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND | - SF_NOUNLINK | SF_SNAPSHOT)) != 0) + SF_NOUNLINK)) != 0) return (EOPNOTSUPP); /* Disallow this operation if the file system is mounted read-only. */ @@ -1104,9 +1104,6 @@ tmpfs_chflags(struct vnode *vp, int flag if (error) return (error); } - /* The snapshot flag cannot be toggled. */ - if ((flags ^ node-tn_flags) SF_SNAPSHOT) - return (EPERM); } else { if (node-tn_flags (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234346 - head/sys/fs/tmpfs
Author: jh Date: Mon Apr 16 18:07:42 2012 New Revision: 234346 URL: http://svn.freebsd.org/changeset/base/234346 Log: tmpfs: Allow update mounts only for certain options. Since r230208 update mounts were allowed if the list of mount options contained the export option. This is not correct as tmpfs doesn't really support updating all options. Reviewed by: kevlo, trociny Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs.h == --- head/sys/fs/tmpfs/tmpfs.h Mon Apr 16 17:30:19 2012(r234345) +++ head/sys/fs/tmpfs/tmpfs.h Mon Apr 16 18:07:42 2012(r234346) @@ -387,6 +387,9 @@ struct tmpfs_mount { * tmpfs_pool.c. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; + + /* Read-only status. */ + int tm_ronly; }; #define TMPFS_LOCK(tm) mtx_lock((tm)-allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock((tm)-allnode_lock) Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c == --- head/sys/fs/tmpfs/tmpfs_vfsops.cMon Apr 16 17:30:19 2012 (r234345) +++ head/sys/fs/tmpfs/tmpfs_vfsops.cMon Apr 16 18:07:42 2012 (r234346) @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { NULL }; +static const char *tmpfs_updateopts[] = { + from, export, NULL +}; + /* - */ static int @@ -150,12 +154,13 @@ tmpfs_mount(struct mount *mp) return (EINVAL); if (mp-mnt_flag MNT_UPDATE) { - /* -* Only support update mounts for NFS export. -*/ - if (vfs_flagopt(mp-mnt_optnew, export, NULL, 0)) - return (0); - return (EOPNOTSUPP); + /* Only support update mounts for certain options. */ + if (vfs_filteropt(mp-mnt_optnew, tmpfs_updateopts) != 0) + return (EOPNOTSUPP); + if (vfs_flagopt(mp-mnt_optnew, ro, NULL, 0) != + ((struct tmpfs_mount *)mp-mnt_data)-tm_ronly) + return (EOPNOTSUPP); + return (0); } vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY); @@ -228,6 +233,7 @@ tmpfs_mount(struct mount *mp) tmpfs_node_ctor, tmpfs_node_dtor, tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); + tmp-tm_ronly = (mp-mnt_flag MNT_RDONLY) != 0; /* Allocate the root node. */ error = tmpfs_alloc_node(tmp, VDIR, root_uid, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234347 - head/sys/fs/tmpfs
Author: jh Date: Mon Apr 16 18:10:34 2012 New Revision: 234347 URL: http://svn.freebsd.org/changeset/base/234347 Log: Sync tmpfs_chflags() with the recent changes to UFS: - Add a check for unsupported file flags. - Return EPERM when an user without PRIV_VFS_SYSFLAGS privilege attempts to toggle SF_SETTABLE flags. Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c == --- head/sys/fs/tmpfs/tmpfs_subr.c Mon Apr 16 18:07:42 2012 (r234346) +++ head/sys/fs/tmpfs/tmpfs_subr.c Mon Apr 16 18:10:34 2012 (r234347) @@ -1078,6 +1078,11 @@ tmpfs_chflags(struct vnode *vp, int flag node = VP_TO_TMPFS_NODE(vp); + if ((flags ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE | + UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND | + SF_NOUNLINK | SF_SNAPSHOT)) != 0) + return (EOPNOTSUPP); + /* Disallow this operation if the file system is mounted read-only. */ if (vp-v_mount-mnt_flag MNT_RDONLY) return EROFS; @@ -1093,27 +1098,22 @@ tmpfs_chflags(struct vnode *vp, int flag * flags, or modify flags if any system flags are set. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (node-tn_flags - (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (node-tn_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); } - /* Snapshot flag cannot be set or cleared */ - if (((flags SF_SNAPSHOT) != 0 - (node-tn_flags SF_SNAPSHOT) == 0) || - ((flags SF_SNAPSHOT) == 0 - (node-tn_flags SF_SNAPSHOT) != 0)) + /* The snapshot flag cannot be toggled. */ + if ((flags ^ node-tn_flags) SF_SNAPSHOT) return (EPERM); - node-tn_flags = flags; } else { - if (node-tn_flags - (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || - (flags UF_SETTABLE) != flags) + if (node-tn_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + ((flags ^ node-tn_flags) SF_SETTABLE)) return (EPERM); - node-tn_flags = SF_SETTABLE; - node-tn_flags |= (flags UF_SETTABLE); } + node-tn_flags = flags; node-tn_status |= TMPFS_NODE_CHANGED; MPASS(VOP_ISLOCKED(vp)); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r230252 - head/sys/fs/tmpfs
On 2012-01-23, Mikolaj Golub wrote: I see two issues with this patch: What do you think about this patch? %%% Index: sys/fs/tmpfs/tmpfs.h === --- sys/fs/tmpfs/tmpfs.h(revision 234201) +++ sys/fs/tmpfs/tmpfs.h(working copy) @@ -387,6 +387,9 @@ struct tmpfs_mount { * tmpfs_pool.c. */ uma_zone_t tm_dirent_pool; uma_zone_t tm_node_pool; + + /* Read-only status. */ + int tm_ronly; }; #define TMPFS_LOCK(tm) mtx_lock((tm)-allnode_lock) #define TMPFS_UNLOCK(tm) mtx_unlock((tm)-allnode_lock) Index: sys/fs/tmpfs/tmpfs_vfsops.c === --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 234201) +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy) @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = { NULL }; +static const char *tmpfs_updateopts[] = { + from, export, NULL +}; + /* - */ static int @@ -150,12 +154,13 @@ tmpfs_mount(struct mount *mp) return (EINVAL); if (mp-mnt_flag MNT_UPDATE) { - /* -* Only support update mounts for NFS export. -*/ - if (vfs_flagopt(mp-mnt_optnew, export, NULL, 0)) - return (0); - return (EOPNOTSUPP); + /* Only support update mounts for certain options. */ + if (vfs_filteropt(mp-mnt_optnew, tmpfs_updateopts) != 0) + return (EOPNOTSUPP); + if (vfs_flagopt(mp-mnt_optnew, ro, NULL, 0) != + ((struct tmpfs_mount *)mp-mnt_data)-tm_ronly) + return (EOPNOTSUPP); + return (0); } vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY); @@ -228,6 +233,7 @@ tmpfs_mount(struct mount *mp) tmpfs_node_ctor, tmpfs_node_dtor, tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); + tmp-tm_ronly = (mp-mnt_flag MNT_RDONLY) != 0; /* Allocate the root node. */ error = tmpfs_alloc_node(tmp, VDIR, root_uid, %%% -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234202 - head/lib/libc/sys
Author: jh Date: Fri Apr 13 05:40:26 2012 New Revision: 234202 URL: http://svn.freebsd.org/changeset/base/234202 Log: Additional manual page updates for r234103. Submitted by: bde Modified: head/lib/libc/sys/chflags.2 Modified: head/lib/libc/sys/chflags.2 == --- head/lib/libc/sys/chflags.2 Fri Apr 13 04:22:42 2012(r234201) +++ head/lib/libc/sys/chflags.2 Fri Apr 13 05:40:26 2012(r234202) @@ -28,7 +28,7 @@ .\@(#)chflags.2 8.3 (Berkeley) 5/2/95 .\ $FreeBSD$ .\ -.Dd Apr 10, 2012 +.Dd Apr 13, 2012 .Dt CHFLAGS 2 .Os .Sh NAME @@ -123,7 +123,7 @@ for details.) .Pp The .Dv SF_SNAPSHOT -flag is maintained by the system and cannot be changed by any user. +flag is maintained by the system and cannot be toggled. .Sh RETURN VALUES .Rv -std .Sh ERRORS @@ -153,12 +153,12 @@ or is set and the user is either not the super-user or securelevel is greater than 0. .It Bq Er EPERM -A non-super-user tries to set one of +A non-super-user attempted to toggle one of .Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND , or .Dv SF_NOUNLINK . .It Bq Er EPERM -User tries to set or remove the +An attempt was made to toggle the .Dv SF_SNAPSHOT flag. .It Bq Er EROFS @@ -173,7 +173,9 @@ An .Tn I/O error occurred while reading from or writing to the file system. .It Bq Er EOPNOTSUPP -The underlying file system does not support file flags. +The underlying file system does not support file flags, or +does not support all of the flags set in +.Fa flags . .El .Pp The @@ -198,12 +200,12 @@ or is set and the user is either not the super-user or securelevel is greater than 0. .It Bq Er EPERM -A non-super-user tries to set one of +A non-super-user attempted to toggle one of .Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND , or .Dv SF_NOUNLINK . .It Bq Er EPERM -User tries to set or remove the +An attempt was made to toggle the .Dv SF_SNAPSHOT flag. .It Bq Er EROFS @@ -213,7 +215,9 @@ An .Tn I/O error occurred while reading from or writing to the file system. .It Bq Er EOPNOTSUPP -The underlying file system does not support file flags. +The underlying file system does not support file flags, or +does not support all of the flags set in +.Fa flags . .El .Sh SEE ALSO .Xr chflags 1 , ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234203 - head/sys/fs/ext2fs
Author: jh Date: Fri Apr 13 05:48:31 2012 New Revision: 234203 URL: http://svn.freebsd.org/changeset/base/234203 Log: Apply changes from r234103 to ext2fs: Return EPERM from ext2_setattr() when an user without PRIV_VFS_SYSFLAGS privilege attempts to toggle SF_SETTABLE flags. Flags are now stored to ip-i_flags in one place after all checks. Also, remove SF_NOUNLINK from the checks because ext2fs doesn't support that flag. Reviewed by: bde Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c == --- head/sys/fs/ext2fs/ext2_vnops.c Fri Apr 13 05:40:26 2012 (r234202) +++ head/sys/fs/ext2fs/ext2_vnops.c Fri Apr 13 05:48:31 2012 (r234203) @@ -424,21 +424,17 @@ ext2_setattr(ap) * if securelevel 0 and any existing system flags are set. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip-i_flags - (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip-i_flags (SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); } - ip-i_flags = vap-va_flags; } else { - if (ip-i_flags - (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || - (vap-va_flags UF_SETTABLE) != vap-va_flags) + if (ip-i_flags (SF_IMMUTABLE | SF_APPEND) || + ((vap-va_flags ^ ip-i_flags) SF_SETTABLE)) return (EPERM); - ip-i_flags = SF_SETTABLE; - ip-i_flags |= (vap-va_flags UF_SETTABLE); } + ip-i_flags = vap-va_flags; ip-i_flag |= IN_CHANGE; if (ip-i_flags (IMMUTABLE | APPEND)) return (0); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234139 - head/sys/fs/ext2fs
Author: jh Date: Wed Apr 11 15:48:50 2012 New Revision: 234139 URL: http://svn.freebsd.org/changeset/base/234139 Log: Restore the blank line incorrectly removed in r234104. Pointed out by: bde Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c == --- head/sys/fs/ext2fs/ext2_vnops.c Wed Apr 11 15:42:02 2012 (r234138) +++ head/sys/fs/ext2fs/ext2_vnops.c Wed Apr 11 15:48:50 2012 (r234139) @@ -407,6 +407,7 @@ ext2_setattr(ap) /* Disallow flags not supported by ext2fs. */ if(vap-va_flags ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP)) return (EOPNOTSUPP); + if (vp-v_mount-mnt_flag MNT_RDONLY) return (EROFS); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234103 - in head: lib/libc/sys sys/ufs/ufs
Author: jh Date: Tue Apr 10 15:59:37 2012 New Revision: 234103 URL: http://svn.freebsd.org/changeset/base/234103 Log: - Return EPERM from ufs_setattr() when an user without PRIV_VFS_SYSFLAGS privilege attempts to toggle SF_SETTABLE flags. - Use the '^' operator in the SF_SNAPSHOT anti-toggling check. Flags are now stored to ip-i_flags in one place after all checks. Submitted by: bde Modified: head/lib/libc/sys/chflags.2 head/sys/ufs/ufs/ufs_vnops.c Modified: head/lib/libc/sys/chflags.2 == --- head/lib/libc/sys/chflags.2 Tue Apr 10 15:58:22 2012(r234102) +++ head/lib/libc/sys/chflags.2 Tue Apr 10 15:59:37 2012(r234103) @@ -28,7 +28,7 @@ .\@(#)chflags.2 8.3 (Berkeley) 5/2/95 .\ $FreeBSD$ .\ -.Dd Oct 29, 2010 +.Dd Apr 10, 2012 .Dt CHFLAGS 2 .Os .Sh NAME @@ -114,8 +114,7 @@ The and .Dv SF_ARCHIVED flags may only be set or unset by the super-user. -Attempts to set these flags by non-super-users are rejected, attempts by -non-superusers to clear flags that are already unset are silently ignored. +Attempts to toggle these flags by non-super-users are rejected. These flags may be set at any time, but normally may only be unset when the system is in single-user mode. (See Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cTue Apr 10 15:58:22 2012 (r234102) +++ head/sys/ufs/ufs/ufs_vnops.cTue Apr 10 15:59:37 2012 (r234103) @@ -555,23 +555,17 @@ ufs_setattr(ap) if (error) return (error); } - /* Snapshot flag cannot be set or cleared */ - if (((vap-va_flags SF_SNAPSHOT) != 0 -(ip-i_flags SF_SNAPSHOT) == 0) || - ((vap-va_flags SF_SNAPSHOT) == 0 -(ip-i_flags SF_SNAPSHOT) != 0)) + /* The snapshot flag cannot be toggled. */ + if ((vap-va_flags ^ ip-i_flags) SF_SNAPSHOT) return (EPERM); - ip-i_flags = vap-va_flags; - DIP_SET(ip, i_flags, vap-va_flags); } else { if (ip-i_flags (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || - (vap-va_flags UF_SETTABLE) != vap-va_flags) + ((vap-va_flags ^ ip-i_flags) SF_SETTABLE)) return (EPERM); - ip-i_flags = SF_SETTABLE; - ip-i_flags |= (vap-va_flags UF_SETTABLE); - DIP_SET(ip, i_flags, ip-i_flags); } + ip-i_flags = vap-va_flags; + DIP_SET(ip, i_flags, vap-va_flags); ip-i_flag |= IN_CHANGE; error = UFS_UPDATE(vp, 0); if (ip-i_flags (IMMUTABLE | APPEND)) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r234104 - head/sys/fs/ext2fs
Author: jh Date: Tue Apr 10 16:05:52 2012 New Revision: 234104 URL: http://svn.freebsd.org/changeset/base/234104 Log: Apply changes from r233787 to ext2fs: - Use more natural ip-i_flags instead of vap-va_flags in the final flags check. - Style improvements. No functional change intended. MFC after:2 weeks Modified: head/sys/fs/ext2fs/ext2_vnops.c Modified: head/sys/fs/ext2fs/ext2_vnops.c == --- head/sys/fs/ext2fs/ext2_vnops.c Tue Apr 10 15:59:37 2012 (r234103) +++ head/sys/fs/ext2fs/ext2_vnops.c Tue Apr 10 16:05:52 2012 (r234104) @@ -407,7 +407,6 @@ ext2_setattr(ap) /* Disallow flags not supported by ext2fs. */ if(vap-va_flags ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP)) return (EOPNOTSUPP); - if (vp-v_mount-mnt_flag MNT_RDONLY) return (EROFS); /* @@ -424,23 +423,23 @@ ext2_setattr(ap) * if securelevel 0 and any existing system flags are set. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); } ip-i_flags = vap-va_flags; } else { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap-va_flags UF_SETTABLE) != vap-va_flags) return (EPERM); ip-i_flags = SF_SETTABLE; ip-i_flags |= (vap-va_flags UF_SETTABLE); } ip-i_flag |= IN_CHANGE; - if (vap-va_flags (IMMUTABLE | APPEND)) + if (ip-i_flags (IMMUTABLE | APPEND)) return (0); } if (ip-i_flags (IMMUTABLE | APPEND)) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r233961 - head/sys/x86/x86
Hi, On 2012-04-06, Justin T. Gibbs wrote: Fix interrupt load balancing regression, introduced in revision 222813, that left all un-pinned interrupts assigned to CPU 0. sys/x86/x86/intr_machdep.c: In intr_shuffle_irqs(), remove CPU_SETOF() call that initialized the intr_cpus cpuset to only contain CPU0. This initialization is too late and nullifies the results of calls the intr_add_cpu() that occur much earlier in the boot process. Since intr_cpus is statically initialized to the empty set, and all processors, including the BSP, already add themselves to intr_cpus no special initialization for the BSP is necessary. My Pentium 4 system hangs on boot after this commit. These are the last lines from a verbose boot: SMP: AP CPU #1 Launched! cpu1 AP: ID: 0x0100 VER: 0x00050014 LDR: 0x DFR: 0x lint0: 0x00010700 lint1: 0x0400 TPR: 0x SVR: 0x01ff timer: 0x000100ef therm: 0x0001 err: 0x00f0 pmc: 0x00010400 The system boots with r233960. Some information: CPU: Intel(R) Pentium(R) 4 CPU 2.60GHz (2605.96-MHz 686-class CPU) Origin = GenuineIntel Id = 0xf29 Family = f Model = 2 Stepping = 9 Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE Features2=0x4400CNXT-ID,xTPR real memory = 2147483648 (2048 MB) avail memory = 2085228544 (1988 MB) Event timer LAPIC quality 400 ACPI APIC Table: A M I OEMAPIC FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs FreeBSD/SMP: 1 package(s) x 1 core(s) x 2 HTT threads cpu0 (BSP): APIC ID: 0 cpu1 (AP/HT): APIC ID: 1 -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r233961 - head/sys/x86/x86
On 2012-04-09, John Baldwin wrote: I suspect in your case intr_add_cpu() is never called. I think Attilio is not correct in that it is not called for the BSP. Yes, it is not called for the BSP in set_interrupt_apic_ids(). This used to work because bit 0 was assigned statically. Also, in a UP machine set_interrupt_apic_ids() is not called at all. Try this (untested): I can boot with the patch applied. Thanks! -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233875 - head/sys/ufs/ufs
Author: jh Date: Wed Apr 4 14:50:21 2012 New Revision: 233875 URL: http://svn.freebsd.org/changeset/base/233875 Log: Add a check for unsupported file flags to ufs_setattr(). Discussed with: bde MFC after:2 weeks Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cWed Apr 4 14:47:59 2012 (r233874) +++ head/sys/ufs/ufs/ufs_vnops.cWed Apr 4 14:50:21 2012 (r233875) @@ -526,6 +526,10 @@ ufs_setattr(ap) return (EINVAL); } if (vap-va_flags != VNOVAL) { + if ((vap-va_flags ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | + UF_OPAQUE | UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | + SF_APPEND | SF_NOUNLINK | SF_SNAPSHOT)) != 0) + return (EOPNOTSUPP); if (vp-v_mount-mnt_flag MNT_RDONLY) return (EROFS); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233787 - head/sys/ufs/ufs
Author: jh Date: Mon Apr 2 16:33:21 2012 New Revision: 233787 URL: http://svn.freebsd.org/changeset/base/233787 Log: - Use more natural ip-i_flags instead of vap-va_flags in the final flags check. - Add a comment for the immutable/append check done after handling of the flags. - Style improvements. No functional change intended. Submitted by: bde MFC after:2 weeks Modified: head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_vnops.c == --- head/sys/ufs/ufs/ufs_vnops.cMon Apr 2 16:33:07 2012 (r233786) +++ head/sys/ufs/ufs/ufs_vnops.cMon Apr 2 16:33:21 2012 (r233787) @@ -545,8 +545,8 @@ ufs_setattr(ap) * processes. */ if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { error = securelevel_gt(cred, 0); if (error) return (error); @@ -560,8 +560,8 @@ ufs_setattr(ap) ip-i_flags = vap-va_flags; DIP_SET(ip, i_flags, vap-va_flags); } else { - if (ip-i_flags -(SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + if (ip-i_flags + (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || (vap-va_flags UF_SETTABLE) != vap-va_flags) return (EPERM); ip-i_flags = SF_SETTABLE; @@ -570,9 +570,15 @@ ufs_setattr(ap) } ip-i_flag |= IN_CHANGE; error = UFS_UPDATE(vp, 0); - if (vap-va_flags (IMMUTABLE | APPEND)) + if (ip-i_flags (IMMUTABLE | APPEND)) return (error); } + /* +* If immutable or append, no one can change any of its attributes +* except the ones already handled (exec atime and, in some cases +* for the superuser, file flags including the immutability flags +* themselves). +*/ if (ip-i_flags (IMMUTABLE | APPEND)) return (EPERM); /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233755 - stable/9/lib/libcam
Author: jh Date: Sun Apr 1 08:40:52 2012 New Revision: 233755 URL: http://svn.freebsd.org/changeset/base/233755 Log: MFC r232450: Use snprintf(3) constantly when generating CAM error messages. PR: bin/57088 Modified: stable/9/lib/libcam/camlib.c Directory Properties: stable/9/lib/libcam/ (props changed) Modified: stable/9/lib/libcam/camlib.c == --- stable/9/lib/libcam/camlib.cSun Apr 1 08:14:50 2012 (r233754) +++ stable/9/lib/libcam/camlib.cSun Apr 1 08:40:52 2012 (r233755) @@ -121,7 +121,8 @@ cam_get_device(const char *path, char *d if (path == NULL) { - sprintf(cam_errbuf, %s: device pathname was NULL, func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: device pathname was NULL, func_name); return(-1); } @@ -143,7 +144,8 @@ cam_get_device(const char *path, char *d } if (*tmpstr == '\0') { - sprintf(cam_errbuf, %s: no text after slash, func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: no text after slash, func_name); free(newpath); return(-1); } @@ -170,9 +172,9 @@ cam_get_device(const char *path, char *d * If we only have 1, we don't have a valid device name. */ if (strlen(tmpstr) 2) { - sprintf(cam_errbuf, - %s: must have both device name and unit number, - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: must have both device name and unit number, +func_name); free(newpath); return(-1); } @@ -182,9 +184,9 @@ cam_get_device(const char *path, char *d * has probably given us all numbers. Point out the error. */ if (isdigit(*tmpstr)) { - sprintf(cam_errbuf, - %s: device name cannot begin with a number, - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: device name cannot begin with a number, +func_name); free(newpath); return(-1); } @@ -195,8 +197,8 @@ cam_get_device(const char *path, char *d * or he gave us a device name/number format we don't recognize. */ if (!isdigit(tmpstr[strlen(tmpstr) - 1])) { - sprintf(cam_errbuf, %s: unable to find device unit number, - func_name); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: unable to find device unit number, func_name); free(newpath); return(-1); } @@ -324,8 +326,9 @@ cam_open_btl(path_id_t path_id, target_i PERIPH_MATCH_LUN | PERIPH_MATCH_NAME; if (ioctl(fd, CAMIOCOMMAND, ccb) == -1) { - sprintf(cam_errbuf, %s: CAMIOCOMMAND ioctl failed\n - %s: %s, func_name, func_name, strerror(errno)); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: CAMIOCOMMAND ioctl failed\n +%s: %s, func_name, func_name, strerror(errno)); goto btl_bailout; } @@ -335,23 +338,26 @@ cam_open_btl(path_id_t path_id, target_i if ((ccb.ccb_h.status != CAM_REQ_CMP) || ((ccb.cdm.status != CAM_DEV_MATCH_LAST) (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { - sprintf(cam_errbuf, %s: CAM error %#x, CDM error %d - returned from XPT_DEV_MATCH ccb, func_name, - ccb.ccb_h.status, ccb.cdm.status); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: CAM error %#x, CDM error %d +returned from XPT_DEV_MATCH ccb, func_name, +ccb.ccb_h.status, ccb.cdm.status); goto btl_bailout; } if (ccb.cdm.status == CAM_DEV_MATCH_MORE) { - sprintf(cam_errbuf, %s: CDM reported more than one -passthrough device at %d:%d:%d!!\n, - func_name, path_id, target_id, target_lun); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: CDM reported more than one + passthrough device at %d:%d:%d!!\n, +func_name, path_id, target_id, target_lun); goto btl_bailout; } if (ccb.cdm.num_matches == 0) { - sprintf(cam_errbuf, %s: no passthrough device found at -%d:%d:%d, func_name, path_id, target_id, - target_lun); + snprintf(cam_errbuf, CAM_ERRBUF_SIZE, +%s: no
Re: svn commit: r233419 - head/sys/x86/include
Hi, On 2012-03-24, Dimitry Andric wrote: Fix the following clang warning in sys/dev/dcons/dcons.c, caused by the recent changes in sys/x86/include/endian.h: sys/dev/dcons/dcons.c:190:15: error: implicit conversion from '__uint32_t' (aka 'unsigned int') to '__uint16_t' (aka 'unsigned short') changes value from 1684238190 to 28526 [-Werror,-Wconstant-conversion] buf-magic = ntohl(DCONS_MAGIC); ^~ sys/sys/param.h:306:18: note: expanded from: #define ntohl(x)__ntohl(x) ^ ./x86/endian.h:128:20: note: expanded from: #define __ntohl(x) __bswap32(x) ^ ./x86/endian.h:78:20: note: expanded from: __bswap32_gen((__uint32_t)(x)) : __bswap32_var(x)) ^ ./x86/endian.h:68:26: note: expanded from: (((__uint32_t)__bswap16(x) 16) | __bswap16((x) 16)) ^ ./x86/endian.h:75:53: note: expanded from: __bswap16_gen((__uint16_t)(x)) : __bswap16_var(x))) ~ ^ This is because the __bswapXX_gen() macros (for x86) call the regular __bswapXX() macros. Since the __bswapXX_gen() variants are only called when their arguments are constant, there is no need to do that constancy check recursively. Also, it causes the above error with clang. Fix it by calling __bswap16_gen() from __bswap32_gen(), and similarly, __bswap32_gen() from __bswap64_gen(). While here, add extra parentheses around the __bswap16_gen() macro expansion, to prevent unexpected side effects. Modified: head/sys/x86/include/endian.h This commit seems to have broken kernel dumping for me. I always get: # savecore savecore: error reading first dump header at offset 4143647740 in /dev/ada0s1b: Invalid argument The offset varies. FreeBSD x 10.0-CURRENT FreeBSD 10.0-CURRENT #826 r233419M: Thu Mar 29 15:46:12 EEST 2012 x@x:X i386 Dumping works with r233418. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233543 - in stable/9/sys: i386/conf kern
Author: jh Date: Tue Mar 27 14:01:09 2012 New Revision: 233543 URL: http://svn.freebsd.org/changeset/base/233543 Log: MFC r233126: Cast wallclock.tv_sec to uint64_t to avoid overflow in the calculation. PR: kern/161552 Modified: stable/9/sys/kern/kern_racct.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/kern_racct.c == --- stable/9/sys/kern/kern_racct.c Tue Mar 27 12:25:47 2012 (r233542) +++ stable/9/sys/kern/kern_racct.c Tue Mar 27 14:01:09 2012 (r233543) @@ -736,7 +736,8 @@ racctd(void) mtx_lock(racct_lock); racct_set_locked(p, RACCT_CPU, runtime); racct_set_locked(p, RACCT_WALLCLOCK, - wallclock.tv_sec * 100 + wallclock.tv_usec); + (uint64_t)wallclock.tv_sec * 100 + + wallclock.tv_usec); mtx_unlock(racct_lock); PROC_UNLOCK(p); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233281 - in stable/9/sys: i386/conf kern
Author: jh Date: Wed Mar 21 16:16:59 2012 New Revision: 233281 URL: http://svn.freebsd.org/changeset/base/233281 Log: MFC r232975: Add an assert for proctree_lock to proc_to_reap(). Modified: stable/9/sys/kern/kern_exit.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/kern/kern_exit.c == --- stable/9/sys/kern/kern_exit.c Wed Mar 21 16:01:15 2012 (r233280) +++ stable/9/sys/kern/kern_exit.c Wed Mar 21 16:16:59 2012 (r233281) @@ -814,6 +814,8 @@ proc_to_reap(struct thread *td, struct p { struct proc *q; + sx_assert(proctree_lock, SA_XLOCKED); + q = td-td_proc; PROC_LOCK(p); if (pid != WAIT_ANY p-p_pid != pid p-p_pgid != -pid) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r233126 - head/sys/kern
Author: jh Date: Sun Mar 18 19:13:32 2012 New Revision: 233126 URL: http://svn.freebsd.org/changeset/base/233126 Log: Cast wallclock.tv_sec to uint64_t to avoid overflow in the calculation. PR: kern/161552 Reviewed by: trasz Tested by:Nikos Vassiliadis MFC after:1 week Modified: head/sys/kern/kern_racct.c Modified: head/sys/kern/kern_racct.c == --- head/sys/kern/kern_racct.c Sun Mar 18 19:12:11 2012(r233125) +++ head/sys/kern/kern_racct.c Sun Mar 18 19:13:32 2012(r233126) @@ -745,7 +745,8 @@ racctd(void) mtx_lock(racct_lock); racct_set_locked(p, RACCT_CPU, runtime); racct_set_locked(p, RACCT_WALLCLOCK, - wallclock.tv_sec * 100 + wallclock.tv_usec); + (uint64_t)wallclock.tv_sec * 100 + + wallclock.tv_usec); mtx_unlock(racct_lock); PROC_UNLOCK(p); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
Re: svn commit: r233120 - in stable/9/sys/fs: hpfs msdosfs ntfs
On 2012-03-18, Kevin Lo wrote: MFC r232483: Clean up style(9) nits Directory Properties: stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) This should have been merged to stable/9/sys/. Also, r232995 incorrectly recorded mergeinfo to stable/9/sys/fs/ntfs/. -- Jaakko ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r232975 - head/sys/kern
Author: jh Date: Wed Mar 14 15:52:23 2012 New Revision: 232975 URL: http://svn.freebsd.org/changeset/base/232975 Log: Add an assert for proctree_lock to proc_to_reap(). Discussed with: kib MFC after:1 week Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c == --- head/sys/kern/kern_exit.c Wed Mar 14 15:39:59 2012(r232974) +++ head/sys/kern/kern_exit.c Wed Mar 14 15:52:23 2012(r232975) @@ -814,6 +814,8 @@ proc_to_reap(struct thread *td, struct p { struct proc *q; + sx_assert(proctree_lock, SA_XLOCKED); + q = td-td_proc; PROC_LOCK(p); if (pid != WAIT_ANY p-p_pid != pid p-p_pgid != -pid) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org
svn commit: r232775 - stable/9/usr.sbin/wake
Author: jh Date: Sat Mar 10 08:27:37 2012 New Revision: 232775 URL: http://svn.freebsd.org/changeset/base/232775 Log: MFC r232102: Exit with proper status when wake() fails. PR: bin/153527 Modified: stable/9/usr.sbin/wake/wake.c Directory Properties: stable/9/usr.sbin/wake/ (props changed) Modified: stable/9/usr.sbin/wake/wake.c == --- stable/9/usr.sbin/wake/wake.c Sat Mar 10 08:25:49 2012 (r232774) +++ stable/9/usr.sbin/wake/wake.c Sat Mar 10 08:27:37 2012 (r232775) @@ -183,7 +183,7 @@ send_wakeup(int bpf, struct ether_addr c int main(int argc, char *argv[]) { - int bpf, n; + int bpf, n, rval; char ifname[IF_NAMESIZE]; if (argc 2) @@ -204,10 +204,13 @@ main(int argc, char *argv[]) if (n = argc) usage(); - for (; n argc; n++) - if (wake(bpf, argv[n])) + rval = 0; + for (; n argc; n++) { + if (wake(bpf, argv[n]) != 0) { + rval = 1; warn(Cannot send Wake on LAN frame over `%s' to `%s', ifname, argv[n]); - - return (0); + } + } + exit(rval); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org