Re: svn commit: r244112 - head/sys/kern
On 12/15/12 11:45 PM, Andriy Gapon wrote: on 16/12/2012 07:00 Ian Lepore said the following: The question here isn't whether aborting or continuing beyond that point is a good idea. Some developer already made that choice by coding a KASSERT() instead of a panic(). The developer decided that a production machine should try to keep running at that point. Please don't perpetuate this argument. The point of KASSERT is not that the developer intended that the system should try to keep running in production. The point is that (1) the KASSERT should not be hit in production as was established in testing *and* (2) having all KASSERTs enabled in production is too expensive. That's all. I don't understand, we have a few partners running KASSERT enabled kernels. Depending on workload our machines can have enough CPU free for this. -Alfred ___ 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: r244112 - head/sys/kern
on 16/12/2012 10:06 Alfred Perlstein said the following: > On 12/15/12 11:45 PM, Andriy Gapon wrote: >> on 16/12/2012 07:00 Ian Lepore said the following: >>> Some developer already made that choice by coding a >>> KASSERT() instead of a panic(). >> Please don't perpetuate this argument. The point of KASSERT is not that the >> developer intended that the system should try to keep running in production. >> The point is that (1) the KASSERT should not be hit in production as was >> established in testing *and* (2) having all KASSERTs enabled in production is >> too expensive. That's all. >> > I don't understand, we have a few partners running KASSERT enabled kernels. > > Depending on workload our machines can have enough CPU free for this. Yes, sure. I have stated the reason why KASSERT is controlled by INVARIANTS. I haven't said that it must turned off in production. -- Andriy Gapon ___ 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: r244271 - head/usr.sbin/iostat
On Sat, Dec 15, 2012 at 05:00:39PM -0800, Adrian Chadd wrote: > Hi, > > People may have scripts based on the current output. > > You should have introduced a new parameter which modifies the output > behaviour in the way you wanted, rather than modifying the existing > behaviour. > > Please consider reverting your change (which is a good idea, btw) and > adding a new modifier that outputs the value(s), rather than a %age. It is a pity that this question did not arise when I published this patch on hackers@: http://lists.freebsd.org/pipermail/freebsd-hackers/2012-September/040558.html I got then only one (private) reply from David Wolfskill, who though it was a good idea but had to go only to head (10.x) due to the changed behavior. I don't have plans to MFC this. I will revert the change, if other people also think I have to. I wont add a new modifier introducing yet another ugliness to iostat(8): iostat -Ix behavior before the change contradicted what was described in the man: -IDisplay total statistics for a given time period, rather than aver- age statistics for each second during that time period. In my opinion, preserving the wrong behaviour and adding yet another switch to have the desirable one is worse. So I'd rather just revert this back and keep using my sysutils/devstat utility, which already gives me what I want. -- Mikolaj Golub ___ 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: r243515 - head/sys/kern
on 13/12/2012 22:17 Attilio Rao said the following: > Right, but as I said, for the time being we can at least have a > correct panic() semantic and take the right time to fix the > generic_stop_cpus() and then absorb also the panic() fix into it. > Right now the mechanism is still broken in panic and it can be fixed > with a very easy fix, so we should just do it. > This will also help vendors like Sandvine which may have hit just this bug > too. Perhaps I got confused... Could you please re-explain to me your suggestion to fix panic(9)? Because I thought that it would require exactly the same steps as fixing generic_stop_cpus(). Sorry about this. -- Andriy Gapon ___ 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: r244288 - head/sys/kern
Author: pjd Date: Sun Dec 16 13:56:38 2012 New Revision: 244288 URL: http://svnweb.freebsd.org/changeset/base/244288 Log: Use 'cred' variable. Obtained from:WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c == --- head/sys/kern/kern_sig.cSun Dec 16 11:16:13 2012(r244287) +++ head/sys/kern/kern_sig.cSun Dec 16 13:56:38 2012(r244288) @@ -3210,8 +3210,7 @@ coredump(struct thread *td) MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td); _STOPEVENT(p, S_CORE, 0); - name = expand_name(p->p_comm, td->td_ucred->cr_uid, p->p_pid, td, - compress); + name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); if (name == NULL) { PROC_UNLOCK(p); #ifdef AUDIT ___ 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: r244289 - in stable/9/sys: fs/nfs fs/nfsclient nfs
Author: rmacklem Date: Sun Dec 16 14:01:56 2012 New Revision: 244289 URL: http://svnweb.freebsd.org/changeset/base/244289 Log: MFC: r243782 Add an nfssvc() option to the kernel for the new NFS client which dumps out the actual options being used by an NFS mount. This will be used to add a "-m" option to nfsstat(1). Modified: stable/9/sys/fs/nfs/nfs_var.h stable/9/sys/fs/nfsclient/nfs_clport.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/nfs/nfs_nfssvc.c stable/9/sys/nfs/nfssvc.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_var.h == --- stable/9/sys/fs/nfs/nfs_var.h Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfs/nfs_var.h Sun Dec 16 14:01:56 2012 (r244289) @@ -313,6 +313,7 @@ void nfsd_init(void); int nfsd_checkrootexp(struct nfsrv_descript *); /* nfs_clvfsops.c */ +void nfscl_retopts(struct nfsmount *, char *, size_t); /* nfs_commonport.c */ int nfsrv_checksockseqnum(struct socket *, tcp_seq); Modified: stable/9/sys/fs/nfsclient/nfs_clport.c == --- stable/9/sys/fs/nfsclient/nfs_clport.c Sun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Sun Dec 16 14:01:56 2012 (r244289) @@ -1207,6 +1207,9 @@ nfssvc_nfscl(struct thread *td, struct n struct nfscbd_args nfscbdarg; struct nfsd_nfscbd_args nfscbdarg2; int error; + struct nameidata nd; + struct nfscl_dumpmntopts dumpmntopts; + char *buf; if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); @@ -1239,6 +1242,28 @@ nfssvc_nfscl(struct thread *td, struct n if (error) return (error); error = nfscbd_nfsd(td, &nfscbdarg2); + } else if (uap->flag & NFSSVC_DUMPMNTOPTS) { + error = copyin(uap->argp, &dumpmntopts, sizeof(dumpmntopts)); + if (error == 0 && (dumpmntopts.ndmnt_blen < 256 || + dumpmntopts.ndmnt_blen > 1024)) + error = EINVAL; + if (error == 0) + error = nfsrv_lookupfilename(&nd, + dumpmntopts.ndmnt_fname, td); + if (error == 0 && strcmp(nd.ni_vp->v_mount->mnt_vfc->vfc_name, + "nfs") != 0) { + vput(nd.ni_vp); + error = EINVAL; + } + if (error == 0) { + buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK); + nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf, + dumpmntopts.ndmnt_blen); + vput(nd.ni_vp); + error = copyout(buf, dumpmntopts.ndmnt_buf, + dumpmntopts.ndmnt_blen); + free(buf, M_TEMP); + } } else { error = EINVAL; } Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c == --- stable/9/sys/fs/nfsclient/nfs_clvfsops.cSun Dec 16 13:56:38 2012 (r244288) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.cSun Dec 16 14:01:56 2012 (r244289) @@ -1630,3 +1630,105 @@ nfs_getnlminfo(struct vnode *vp, uint8_t } } +/* + * This function prints out an option name, based on the conditional + * argument. + */ +static __inline void nfscl_printopt(struct nfsmount *nmp, int testval, +char *opt, char **buf, size_t *blen) +{ + int len; + + if (testval != 0 && *blen > strlen(opt)) { + len = snprintf(*buf, *blen, "%s", opt); + if (len != strlen(opt)) + printf("EEK!!\n"); + *buf += len; + *blen -= len; + } +} + +/* + * This function printf out an options integer value. + */ +static __inline void nfscl_printoptval(struct nfsmount *nmp, int optval, +char *opt, char **buf, size_t *blen) +{ + int len; + + if (*blen > strlen(opt) + 1) { + /* Could result in truncated output string. */ + len = snprintf(*buf, *blen, "%s=%d", opt, optval); + if (len < *blen) { + *buf += len; + *blen -= len; + } + } +} + +/* + * Load the option flags and values into the buffer. + */ +void nfscl_retopts(struct nfsmount *nmp, char *buffer, size_t buflen) +{ + char *buf; + size_t blen; + + buf = buffer; + blen = buflen; + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV4) != 0, "nfsv4", &buf, + &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf,
svn commit: r244291 - stable/9/usr.bin/nfsstat
Author: rmacklem Date: Sun Dec 16 14:10:12 2012 New Revision: 244291 URL: http://svnweb.freebsd.org/changeset/base/244291 Log: MFC: r243783 Add a "-m" option to nfsstat, which dumps out the actual options used by all NFS mounts. Works for the new/default NFS client only. Modified: stable/9/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.c == --- stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:09:18 2012 (r244290) +++ stable/9/usr.bin/nfsstat/nfsstat.c Sun Dec 16 14:10:12 2012 (r244291) @@ -107,14 +107,36 @@ main(int argc, char **argv) int ch; char *memf, *nlistf; char errbuf[_POSIX2_LINE_MAX]; + int mntlen, i; + char buf[1024]; + struct statfs *mntbuf; + struct nfscl_dumpmntopts dumpmntopts; interval = 0; memf = nlistf = NULL; - while ((ch = getopt(argc, argv, "cesWM:N:ow:z")) != -1) + while ((ch = getopt(argc, argv, "cesWM:mN:ow:z")) != -1) switch(ch) { case 'M': memf = optarg; break; + case 'm': + /* Display mount options for NFS mount points. */ + mntlen = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntlen; i++) { + if (strcmp(mntbuf->f_fstypename, "nfs") == 0) { + dumpmntopts.ndmnt_fname = + mntbuf->f_mntonname; + dumpmntopts.ndmnt_buf = buf; + dumpmntopts.ndmnt_blen = sizeof(buf); + if (nfssvc(NFSSVC_DUMPMNTOPTS, + &dumpmntopts) >= 0) + printf("%s on %s\n%s\n", + mntbuf->f_mntfromname, + mntbuf->f_mntonname, buf); + } + mntbuf++; + } + exit(0); case 'N': nlistf = optarg; break; @@ -646,7 +668,7 @@ void usage(void) { (void)fprintf(stderr, - "usage: nfsstat [-ceoszW] [-M core] [-N system] [-w wait]\n"); + "usage: nfsstat [-cemoszW] [-M core] [-N system] [-w wait]\n"); exit(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: r244292 - stable/9/usr.bin/nfsstat
Author: rmacklem Date: Sun Dec 16 14:13:10 2012 New Revision: 244292 URL: http://svnweb.freebsd.org/changeset/base/244292 Log: MFC: r243784 Document the "-m" option added by r243783. This is a content change. Modified: stable/9/usr.bin/nfsstat/nfsstat.1 Directory Properties: stable/9/usr.bin/nfsstat/ (props changed) Modified: stable/9/usr.bin/nfsstat/nfsstat.1 == --- stable/9/usr.bin/nfsstat/nfsstat.1 Sun Dec 16 14:10:12 2012 (r244291) +++ stable/9/usr.bin/nfsstat/nfsstat.1 Sun Dec 16 14:13:10 2012 (r244292) @@ -28,7 +28,7 @@ .\" From: @(#)nfsstat.18.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd May 4, 2011 +.Dd November 14, 2012 .Dt NFSSTAT 1 .Os .Sh NAME @@ -38,7 +38,7 @@ statistics .Sh SYNOPSIS .Nm -.Op Fl ceoszW +.Op Fl cemoszW .Op Fl M Ar core .Op Fl N Ar system .Op Fl w Ar wait @@ -62,6 +62,12 @@ This option is incompatible with Extract values associated with the name list from the specified core instead of the default .Pa /dev/kmem . +.It Fl m +Report the mount options for all new NFS client mounts. +This option overrides all others and +.Nm +will exit after completing the report. +This option is only supported by the new NFS client. .It Fl N Extract the name list from the specified system instead of the default .Pa /boot/kernel/kernel . ___ 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: r244293 - head/sys/kern
Author: pjd Date: Sun Dec 16 14:14:18 2012 New Revision: 244293 URL: http://svnweb.freebsd.org/changeset/base/244293 Log: Make the check easier to read. Obtained from:WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c == --- head/sys/kern/kern_sig.cSun Dec 16 14:13:10 2012(r244292) +++ head/sys/kern/kern_sig.cSun Dec 16 14:14:18 2012(r244293) @@ -3218,8 +3218,7 @@ coredump(struct thread *td) #endif return (EINVAL); } - if (((sugid_coredump == 0) && p->p_flag & P_SUGID) || - do_coredump == 0) { + if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); #ifdef AUDIT audit_proc_coredump(td, name, EFAULT); ___ 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: r244294 - head/sys/kern
Author: pjd Date: Sun Dec 16 14:24:59 2012 New Revision: 244294 URL: http://svnweb.freebsd.org/changeset/base/244294 Log: Don't add audit record when coredumps are disabled or name cannot be expanded. Discussed with: rwatson Obtained from:WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c == --- head/sys/kern/kern_sig.cSun Dec 16 14:14:18 2012(r244293) +++ head/sys/kern/kern_sig.cSun Dec 16 14:24:59 2012(r244294) @@ -3213,16 +3213,10 @@ coredump(struct thread *td) name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); if (name == NULL) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, NULL, EINVAL); -#endif return (EINVAL); } if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, name, EFAULT); -#endif free(name, M_TEMP); return (EFAULT); } @@ -3238,9 +3232,6 @@ coredump(struct thread *td) limit = (off_t)lim_cur(p, RLIMIT_CORE); if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { PROC_UNLOCK(p); -#ifdef AUDIT - audit_proc_coredump(td, name, EFBIG); -#endif free(name, M_TEMP); return (EFBIG); } ___ 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: r244295 - head/sbin/growfs
Author: trasz Date: Sun Dec 16 14:37:25 2012 New Revision: 244295 URL: http://svnweb.freebsd.org/changeset/base/244295 Log: When growing a filesystem, don't leave unused space at the end if there is not enough room for a full cylinder group. Reviewed by: mckusick@ Modified: head/sbin/growfs/growfs.c Modified: head/sbin/growfs/growfs.c == --- head/sbin/growfs/growfs.c Sun Dec 16 14:24:59 2012(r244294) +++ head/sbin/growfs/growfs.c Sun Dec 16 14:37:25 2012(r244295) @@ -1611,17 +1611,20 @@ main(int argc, char **argv) } sblock.fs_ncg = howmany(sblock.fs_size, sblock.fs_fpg); + /* +* Allocate last cylinder group only if there is enough room +* for at least one data block. +*/ if (sblock.fs_size % sblock.fs_fpg != 0 && - sblock.fs_size % sblock.fs_fpg < cgdmin(&sblock, sblock.fs_ncg)) { - /* -* The space in the new last cylinder group is too small, -* so revert back. -*/ + sblock.fs_size <= cgdmin(&sblock, sblock.fs_ncg - 1)) { + humanize_number(oldsizebuf, sizeof(oldsizebuf), + (sblock.fs_size % sblock.fs_fpg) * sblock.fs_fsize, + "B", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); + warnx("no room to allocate last cylinder group; " + "leaving %s unused", oldsizebuf); sblock.fs_ncg--; if (sblock.fs_magic == FS_UFS1_MAGIC) sblock.fs_old_ncyl = sblock.fs_ncg * sblock.fs_old_cpg; - printf("Warning: %jd sector(s) cannot be allocated.\n", - (intmax_t)fsbtodb(&sblock, sblock.fs_size % sblock.fs_fpg)); sblock.fs_size = sblock.fs_ncg * sblock.fs_fpg; } ___ 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: r244296 - head/sys/kern
Author: pjd Date: Sun Dec 16 14:53:27 2012 New Revision: 244296 URL: http://svnweb.freebsd.org/changeset/base/244296 Log: Move expand_name() after process lock is released. This fixed panic where we hold mutex (process lock) and try to obtain sleepable lock (vnode lock in expand_name()). The panic could occur when %I was used in kern.corefile. Additionally we avoid expand_name() overhead when coredumps are disabled. Obtained from:WHEEL Systems Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c == --- head/sys/kern/kern_sig.cSun Dec 16 14:37:25 2012(r244295) +++ head/sys/kern/kern_sig.cSun Dec 16 14:53:27 2012(r244296) @@ -3210,14 +3210,8 @@ coredump(struct thread *td) MPASS((p->p_flag & P_HADTHREADS) == 0 || p->p_singlethread == td); _STOPEVENT(p, S_CORE, 0); - name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); - if (name == NULL) { - PROC_UNLOCK(p); - return (EINVAL); - } if (!do_coredump || (!sugid_coredump && (p->p_flag & P_SUGID) != 0)) { PROC_UNLOCK(p); - free(name, M_TEMP); return (EFAULT); } @@ -3232,11 +3226,14 @@ coredump(struct thread *td) limit = (off_t)lim_cur(p, RLIMIT_CORE); if (limit == 0 || racct_get_available(p, RACCT_CORE) == 0) { PROC_UNLOCK(p); - free(name, M_TEMP); return (EFBIG); } PROC_UNLOCK(p); + name = expand_name(p->p_comm, cred->cr_uid, p->p_pid, td, compress); + if (name == NULL) + return (EINVAL); + restart: NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, name, td); flags = O_CREAT | FWRITE | O_NOFOLLOW; ___ 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: r244297 - stable/9/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:55:11 2012 New Revision: 244297 URL: http://svnweb.freebsd.org/changeset/base/244297 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.1 stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.1 == --- stable/9/usr.bin/cut/cut.1 Sun Dec 16 14:53:27 2012(r244296) +++ stable/9/usr.bin/cut/cut.1 Sun Dec 16 16:55:11 2012(r244297) @@ -68,7 +68,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -78,14 +78,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/9/usr.bin/cut/cut.c == --- stable/9/usr.bin/cut/cut.c Sun Dec 16 14:53:27 2012(r244296) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 16:55:11 2012(r244297) @@ -164,7 +164,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in -* any order. We handle "-3-5" although there's no real reason too. +* any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -187,9 +187,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 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: r244298 - stable/8/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:55:40 2012 New Revision: 244298 URL: http://svnweb.freebsd.org/changeset/base/244298 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.1 stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.1 == --- stable/8/usr.bin/cut/cut.1 Sun Dec 16 16:55:11 2012(r244297) +++ stable/8/usr.bin/cut/cut.1 Sun Dec 16 16:55:40 2012(r244298) @@ -72,7 +72,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -82,14 +82,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/8/usr.bin/cut/cut.c == --- stable/8/usr.bin/cut/cut.c Sun Dec 16 16:55:11 2012(r244297) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 16:55:40 2012(r244298) @@ -168,7 +168,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in -* any order. We handle "-3-5" although there's no real reason too. +* any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -191,9 +191,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 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: r244299 - stable/7/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:55:59 2012 New Revision: 244299 URL: http://svnweb.freebsd.org/changeset/base/244299 Log: MFC r236866,r236867: - Consistenly mention columns and fields - Add -b to short error messages Approved by: kevlo Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.1 stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.1 == --- stable/7/usr.bin/cut/cut.1 Sun Dec 16 16:55:40 2012(r244298) +++ stable/7/usr.bin/cut/cut.1 Sun Dec 16 16:55:59 2012(r244299) @@ -72,7 +72,7 @@ The items specified by .Ar list can be in terms of column position or in terms of fields delimited by a special character. -Column numbering starts from 1. +Column and field numbering start from 1. .Pp The .Ar list @@ -82,14 +82,14 @@ number ranges. Number ranges consist of a number, a dash .Pq Sq \- , and a second number -and select the fields or columns from the first number to the second, +and select the columns or fields from the first number to the second, inclusive. Numbers or number ranges may be preceded by a dash, which selects all -fields or columns from 1 to the last number. +columns or fields from 1 to the last number. Numbers or number ranges may be followed by a dash, which selects all -fields or columns from the last number to the end of the line. +columns or fields from the last number to the end of the line. Numbers and number ranges may be repeated, overlapping, and in any order. -It is not an error to select fields or columns not present in the +It is not an error to select columns or fields not present in the input line. .Pp The options are as follows: Modified: stable/7/usr.bin/cut/cut.c == --- stable/7/usr.bin/cut/cut.c Sun Dec 16 16:55:40 2012(r244298) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 16:55:59 2012(r244299) @@ -168,7 +168,7 @@ get_list(char *list) * set a byte in the positions array to indicate if a field or * column is to be selected; use +1, it's 1-based, not 0-based. * Numbers and number ranges may be overlapping, repeated, and in -* any order. We handle "-3-5" although there's no real reason too. +* any order. We handle "-3-5" although there's no real reason to. */ for (; (p = strsep(&list, ", \t")) != NULL;) { setautostart = start = stop = 0; @@ -191,9 +191,9 @@ get_list(char *list) } } if (*p) - errx(1, "[-cf] list: illegal list value"); + errx(1, "[-bcf] list: illegal list value"); if (!stop || !start) - errx(1, "[-cf] list: values may not include zero"); + errx(1, "[-bcf] list: values may not include zero"); if (maxval < stop) { maxval = stop; needpos(maxval + 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: r244300 - stable/9/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:59:42 2012 New Revision: 244300 URL: http://svnweb.freebsd.org/changeset/base/244300 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.c == --- stable/9/usr.bin/cut/cut.c Sun Dec 16 16:55:59 2012(r244299) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 16:59:42 2012(r244300) @@ -50,25 +50,25 @@ __FBSDID("$FreeBSD$"); #include #include -intbflag; -intcflag; -wchar_tdchar; -char dcharmb[MB_LEN_MAX + 1]; -intdflag; -intfflag; -intnflag; -intsflag; - -size_t autostart, autostop, maxval; -char * positions; - -intb_cut(FILE *, const char *); -intb_n_cut(FILE *, const char *); -intc_cut(FILE *, const char *); -intf_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static chardcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static voidget_list(char *); +static voidneedpos(size_t); +static voidusage(void); int main(int argc, char *argv[]) @@ -153,7 +153,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -208,7 +208,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -227,7 +227,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -261,7 +261,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -323,7 +323,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -358,7 +358,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; ___ 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: r244301 - stable/7/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:59:44 2012 New Revision: 244301 URL: http://svnweb.freebsd.org/changeset/base/244301 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.c == --- stable/7/usr.bin/cut/cut.c Sun Dec 16 16:59:42 2012(r244300) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 16:59:44 2012(r244301) @@ -54,25 +54,25 @@ __FBSDID("$FreeBSD$"); #include #include -intbflag; -intcflag; -wchar_tdchar; -char dcharmb[MB_LEN_MAX + 1]; -intdflag; -intfflag; -intnflag; -intsflag; - -size_t autostart, autostop, maxval; -char * positions; - -intb_cut(FILE *, const char *); -intb_n_cut(FILE *, const char *); -intc_cut(FILE *, const char *); -intf_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static chardcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static voidget_list(char *); +static voidneedpos(size_t); +static voidusage(void); int main(int argc, char *argv[]) @@ -157,7 +157,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -212,7 +212,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -231,7 +231,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -265,7 +265,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -327,7 +327,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -362,7 +362,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; ___ 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: r244302 - stable/8/usr.bin/cut
Author: eadler Date: Sun Dec 16 16:59:59 2012 New Revision: 244302 URL: http://svnweb.freebsd.org/changeset/base/244302 Log: MFC r227162: Add missing static keywords to cut(1) Approved by: ed Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.c == --- stable/8/usr.bin/cut/cut.c Sun Dec 16 16:59:44 2012(r244301) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 16:59:59 2012(r244302) @@ -54,25 +54,25 @@ __FBSDID("$FreeBSD$"); #include #include -intbflag; -intcflag; -wchar_tdchar; -char dcharmb[MB_LEN_MAX + 1]; -intdflag; -intfflag; -intnflag; -intsflag; - -size_t autostart, autostop, maxval; -char * positions; - -intb_cut(FILE *, const char *); -intb_n_cut(FILE *, const char *); -intc_cut(FILE *, const char *); -intf_cut(FILE *, const char *); -void get_list(char *); -void needpos(size_t); -static void usage(void); +static int bflag; +static int cflag; +static wchar_t dchar; +static chardcharmb[MB_LEN_MAX + 1]; +static int dflag; +static int fflag; +static int nflag; +static int sflag; + +static size_t autostart, autostop, maxval; +static char * positions; + +static int b_cut(FILE *, const char *); +static int b_n_cut(FILE *, const char *); +static int c_cut(FILE *, const char *); +static int f_cut(FILE *, const char *); +static voidget_list(char *); +static voidneedpos(size_t); +static voidusage(void); int main(int argc, char *argv[]) @@ -157,7 +157,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void get_list(char *list) { size_t setautostart, start, stop; @@ -212,7 +212,7 @@ get_list(char *list) memset(positions + 1, '1', autostart); } -void +static void needpos(size_t n) { static size_t npos; @@ -231,7 +231,7 @@ needpos(size_t n) } } -int +static int b_cut(FILE *fp, const char *fname __unused) { int ch, col; @@ -265,7 +265,7 @@ b_cut(FILE *fp, const char *fname __unus * Although this function also handles the case where -n is not specified, * b_cut() ought to be much faster. */ -int +static int b_n_cut(FILE *fp, const char *fname) { size_t col, i, lbuflen; @@ -327,7 +327,7 @@ b_n_cut(FILE *fp, const char *fname) return (warned); } -int +static int c_cut(FILE *fp, const char *fname) { wint_t ch; @@ -362,7 +362,7 @@ out: return (0); } -int +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; ___ 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: r244303 - stable/9/usr.bin/cut
Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244303 URL: http://svnweb.freebsd.org/changeset/base/244303 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/9/usr.bin/cut/cut.1 stable/9/usr.bin/cut/cut.c Directory Properties: stable/9/usr.bin/cut/ (props changed) Modified: stable/9/usr.bin/cut/cut.1 == --- stable/9/usr.bin/cut/cut.1 Sun Dec 16 16:59:59 2012(r244302) +++ stable/9/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012(r244303) @@ -31,7 +31,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -47,7 +47,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -119,6 +119,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/9/usr.bin/cut/cut.c == --- stable/9/usr.bin/cut/cut.c Sun Dec 16 16:59:59 2012(r244302) +++ stable/9/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012(r244303) @@ -58,6 +58,7 @@ static intdflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -67,6 +68,7 @@ static intb_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static voidget_list(char *); +static int is_delim(wchar_t); static voidneedpos(size_t); static voidusage(void); @@ -84,7 +86,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -111,6 +113,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -119,9 +124,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -359,18 +364,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -394,7 +411,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -421,8 +438,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') +
svn commit: r244304 - stable/7/usr.bin/cut
Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244304 URL: http://svnweb.freebsd.org/changeset/base/244304 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/7/usr.bin/cut/cut.1 stable/7/usr.bin/cut/cut.c Directory Properties: stable/7/usr.bin/cut/ (props changed) Modified: stable/7/usr.bin/cut/cut.1 == --- stable/7/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012(r244303) +++ stable/7/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012(r244304) @@ -35,7 +35,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -51,7 +51,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -123,6 +123,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/7/usr.bin/cut/cut.c == --- stable/7/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012(r244303) +++ stable/7/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012(r244304) @@ -62,6 +62,7 @@ static intdflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -71,6 +72,7 @@ static intb_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static voidget_list(char *); +static int is_delim(wchar_t); static voidneedpos(size_t); static voidusage(void); @@ -88,7 +90,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -115,6 +117,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -123,9 +128,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -363,18 +368,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -398,7 +415,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -425,8 +442,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') +
svn commit: r244305 - stable/8/usr.bin/cut
Author: eadler Date: Sun Dec 16 17:01:23 2012 New Revision: 244305 URL: http://svnweb.freebsd.org/changeset/base/244305 Log: MFC r243320,r243474: Add 'w' flag to: Use whitespace (spaces and tabs) as the delimiter. Consecutive spaces and tabs count as one single field separator. Approved by: cperciva (implicit) Modified: stable/8/usr.bin/cut/cut.1 stable/8/usr.bin/cut/cut.c Directory Properties: stable/8/usr.bin/cut/ (props changed) Modified: stable/8/usr.bin/cut/cut.1 == --- stable/8/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012(r244304) +++ stable/8/usr.bin/cut/cut.1 Sun Dec 16 17:01:23 2012(r244305) @@ -35,7 +35,7 @@ .\" @(#)cut.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 21, 2006 +.Dd August 8, 2012 .Dt CUT 1 .Os .Sh NAME @@ -51,7 +51,7 @@ .Op Ar .Nm .Fl f Ar list -.Op Fl d Ar delim +.Op Fl w | Fl d Ar delim .Op Fl s .Op Ar .Sh DESCRIPTION @@ -123,6 +123,9 @@ that form the character are selected. .It Fl s Suppress lines with no field delimiter characters. Unless specified, lines with no delimiters are passed through unmodified. +.It Fl w +Use whitespace (spaces and tabs) as the delimiter. +Consecutive spaces and tabs count as one single field separator. .El .Sh ENVIRONMENT The Modified: stable/8/usr.bin/cut/cut.c == --- stable/8/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012(r244304) +++ stable/8/usr.bin/cut/cut.c Sun Dec 16 17:01:23 2012(r244305) @@ -62,6 +62,7 @@ static intdflag; static int fflag; static int nflag; static int sflag; +static int wflag; static size_t autostart, autostop, maxval; static char * positions; @@ -71,6 +72,7 @@ static intb_n_cut(FILE *, const char *) static int c_cut(FILE *, const char *); static int f_cut(FILE *, const char *); static voidget_list(char *); +static int is_delim(wchar_t); static voidneedpos(size_t); static voidusage(void); @@ -88,7 +90,7 @@ main(int argc, char *argv[]) dchar = '\t'; /* default delimiter is \t */ strcpy(dcharmb, "\t"); - while ((ch = getopt(argc, argv, "b:c:d:f:sn")) != -1) + while ((ch = getopt(argc, argv, "b:c:d:f:snw")) != -1) switch(ch) { case 'b': get_list(optarg); @@ -115,6 +117,9 @@ main(int argc, char *argv[]) case 'n': nflag = 1; break; + case 'w': + wflag = 1; + break; case '?': default: usage(); @@ -123,9 +128,9 @@ main(int argc, char *argv[]) argv += optind; if (fflag) { - if (bflag || cflag || nflag) + if (bflag || cflag || nflag || (wflag && dflag)) usage(); - } else if (!(bflag || cflag) || dflag || sflag) + } else if (!(bflag || cflag) || dflag || sflag || wflag) usage(); else if (!bflag && nflag) usage(); @@ -363,18 +368,30 @@ out: } static int +is_delim(wchar_t ch) +{ + if (wflag) { + if (ch == ' ' || ch == '\t') + return 1; + } else { + if (ch == dchar) + return 1; + } + return 0; +} + +static int f_cut(FILE *fp, const char *fname) { wchar_t ch; int field, i, isdelim; char *pos, *p; - wchar_t sep; int output; char *lbuf, *mlbuf; size_t clen, lbuflen, reallen; mlbuf = NULL; - for (sep = dchar; (lbuf = fgetln(fp, &lbuflen)) != NULL;) { + while ((lbuf = fgetln(fp, &lbuflen)) != NULL) { reallen = lbuflen; /* Assert EOL has a newline. */ if (*(lbuf + lbuflen - 1) != '\n') { @@ -398,7 +415,7 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; /* this should work if newline is delimiter */ - if (ch == sep) + if (is_delim(ch)) isdelim = 1; if (ch == '\n') { if (!isdelim && !sflag) @@ -425,8 +442,13 @@ f_cut(FILE *fp, const char *fname) if (clen == 0) clen = 1; p += clen; - if (ch == '\n' || ch == sep) + if (ch == '\n' || is_delim(ch)) { + /* compress whitespace */ + if (wflag && ch != '\n') +
Re: svn commit: r244112 - head/sys/kern
On 15 December 2012 23:45, Andriy Gapon wrote: > on 16/12/2012 07:00 Ian Lepore said the following: >> The question here isn't whether aborting or continuing beyond that point >> is a good idea. Some developer already made that choice by coding a >> KASSERT() instead of a panic(). The developer decided that a production >> machine should try to keep running at that point. > > Please don't perpetuate this argument. The point of KASSERT is not that the > developer intended that the system should try to keep running in production. > The point is that (1) the KASSERT should not be hit in production as was > established in testing *and* (2) having all KASSERTs enabled in production is > too expensive. That's all. You can't possibly believe that once the kernel is in production, "testing" stops. That's why Alfred and I want to mak KASSERT() optionally just print that it happened and maybe add some further information, then continue. It doesn't change the status quo with the default, GENERIC "production" kernel. It still crashes where it would normally crash (timing bugs otherwise.) It still won't crash where it wouldn't trigger a kassert. A shipping, production kernel doesn't have KASSERT enabled. You may assert "assertions are supposed to crash", yet we ship with assertions disabled. Please, tell the software engineers here what you think that implies about what we think about those assertions. Let me give you a hint - if you ship with them disabled, they don't get run. So obviously we don't think there's a big enough problem to cause any real issues. Now, this may not be the case at all - in which case, those shouldn't be disabled in production kernels, for all the reasons everyone above has said. Yet, they're disabled. The status quo _does not change_ by default. Adrian ___ 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: r243515 - head/sys/kern
On Sun, Dec 16, 2012 at 1:59 AM, Andriy Gapon wrote: > on 13/12/2012 22:17 Attilio Rao said the following: >> Right, but as I said, for the time being we can at least have a >> correct panic() semantic and take the right time to fix the >> generic_stop_cpus() and then absorb also the panic() fix into it. >> Right now the mechanism is still broken in panic and it can be fixed >> with a very easy fix, so we should just do it. >> This will also help vendors like Sandvine which may have hit just this bug >> too. > > > Perhaps I got confused... > Could you please re-explain to me your suggestion to fix panic(9)? > Because I thought that it would require exactly the same steps as fixing > generic_stop_cpus(). Sorry about this. - about generic_stop_cpus() we need to implement all the things we discussed which are quite a few and for some things, like avoiding races between stop map, wakeup and set of cupid I admit I'm still not sure how easilly can be done without locking - about panic(), the check is much more easy, just see my first response to Ryan, because we don't have the wakeup/restart race as generic_stop_cpu() does. I propose to at least fix panic for the time being. Once generic_stop_cpus() is fully functional we can get rid of panic() chunk altogether. Attilio -- Peace can only be achieved by understanding - A. Einstein ___ 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: r243515 - head/sys/kern
on 16/12/2012 20:49 Attilio Rao said the following: > - about panic(), the check is much more easy, just see my first > response to Ryan, because we don't have the wakeup/restart race as > generic_stop_cpu() does That's what I meant - could you please resend that message to me? -- Andriy Gapon ___ 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: r244307 - head/sys/boot/sparc64/boot1
Author: marius Date: Sun Dec 16 20:43:29 2012 New Revision: 244307 URL: http://svnweb.freebsd.org/changeset/base/244307 Log: Restore pre-r234898 printing of boot loader and path. MFC after:3 days Modified: head/sys/boot/sparc64/boot1/boot1.c Modified: head/sys/boot/sparc64/boot1/boot1.c == --- head/sys/boot/sparc64/boot1/boot1.c Sun Dec 16 19:51:34 2012 (r244306) +++ head/sys/boot/sparc64/boot1/boot1.c Sun Dec 16 20:43:29 2012 (r244307) @@ -340,11 +340,11 @@ main(int ac, char **av) } #ifdef ZFSBOOT - printf(" \n>> FreeBSD/sparc64 ZFS boot block\nBoot path: %s\n", + printf(" \n>> FreeBSD/sparc64 ZFS boot block\n Boot path: %s\n", bootpath); #else - printf(" \n>> FreeBSD/sparc64 boot block\nBoot path: %s\n" - " Boot loader: %s\n", "", bootpath, path); + printf(" \n>> FreeBSD/sparc64 boot block\n Boot path: %s\n" + " Boot loader: %s\n", bootpath, path); #endif if (domount(bootpath) == -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: r244308 - head/sys/sparc64/conf
Author: marius Date: Sun Dec 16 20:54:07 2012 New Revision: 244308 URL: http://svnweb.freebsd.org/changeset/base/244308 Log: Revert r237842 and switch back to SCHED_ULE. All problems I encountered with the latter have been fixed with r241780. MFC after:3 days Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC == --- head/sys/sparc64/conf/GENERIC Sun Dec 16 20:43:29 2012 (r244307) +++ head/sys/sparc64/conf/GENERIC Sun Dec 16 20:54:07 2012 (r244308) @@ -26,7 +26,7 @@ makeoptions DEBUG=-g# Build kernel wit # Platforms supported # At this time all platforms are supported, as-is. -optionsSCHED_4BSD # 4BSD scheduler +optionsSCHED_ULE # ULE scheduler optionsPREEMPTION # Enable kernel thread preemption optionsINET# InterNETworking optionsINET6 # IPv6 communications protocols ___ 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: r244316 - head/sbin/savecore
Author: pjd Date: Sun Dec 16 22:59:25 2012 New Revision: 244316 URL: http://svnweb.freebsd.org/changeset/base/244316 Log: Prefer snprintf() over sprintf(). Obtained from:WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sun Dec 16 22:06:28 2012 (r244315) +++ head/sbin/savecore/savecore.c Sun Dec 16 22:59:25 2012 (r244316) @@ -543,7 +543,7 @@ DoFile(const char *savedir, const char * writebounds(bounds + 1); - sprintf(buf, "info.%d", bounds); + snprintf(buf, sizeof(buf), "info.%d", bounds); /* * Create or overwrite any existing dump header files. @@ -556,12 +556,12 @@ DoFile(const char *savedir, const char * } oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/ if (compress) { - sprintf(filename, "%s.%d.gz", istextdump ? "textdump.tar" : - "vmcore", bounds); + snprintf(filename, sizeof(filename), "%s.%d.gz", + istextdump ? "textdump.tar" : "vmcore", bounds); fp = zopen(filename, "w"); } else { - sprintf(filename, "%s.%d", istextdump ? "textdump.tar" : - "vmcore", bounds); + snprintf(filename, sizeof(filename), "%s.%d", + istextdump ? "textdump.tar" : "vmcore", bounds); fp = fopen(filename, "w"); } if (fp == NULL) { ___ 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: r244317 - head/sbin/savecore
Author: pjd Date: Sun Dec 16 22:59:58 2012 New Revision: 244317 URL: http://svnweb.freebsd.org/changeset/base/244317 Log: Sort flags properly. Obtained from:WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sun Dec 16 22:59:25 2012 (r244316) +++ head/sbin/savecore/savecore.c Sun Dec 16 22:59:58 2012 (r244317) @@ -663,15 +663,15 @@ main(int argc, char **argv) case 'c': clear = 1; break; + case 'f': + force = 1; + break; case 'k': keep = 1; break; case 'v': verbose++; break; - case 'f': - force = 1; - break; case 'z': compress = 1; break; ___ 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: r244318 - in head: sbin/setkey usr.sbin/ndp
Author: eadler Date: Sun Dec 16 23:00:13 2012 New Revision: 244318 URL: http://svnweb.freebsd.org/changeset/base/244318 Log: Minor wording improvments to some manual pages Approved by: bcr (mentor) Obtained from:DragonflyBSD (a5294ca835317c68c919ab43936da4f05ab6e926) MFC after:3 days Modified: head/sbin/setkey/setkey.8 head/usr.sbin/ndp/ndp.8 Modified: head/sbin/setkey/setkey.8 == --- head/sbin/setkey/setkey.8 Sun Dec 16 22:59:58 2012(r244317) +++ head/sbin/setkey/setkey.8 Sun Dec 16 23:00:13 2012(r244318) @@ -110,7 +110,7 @@ Loop forever and dump all the messages t .Dv PF_KEY socket. .Fl xx -makes each timestamps unformatted. +makes each timestamp unformatted. .El .Ss Configuration syntax With Modified: head/usr.sbin/ndp/ndp.8 == --- head/usr.sbin/ndp/ndp.8 Sun Dec 16 22:59:58 2012(r244317) +++ head/usr.sbin/ndp/ndp.8 Sun Dec 16 23:00:13 2012(r244318) @@ -231,8 +231,8 @@ responding to requests for .Ar hostname even though the host address is not its own. .It Fl t -Print timestamp on each entry, -making it possible to merge output with +Print timestamp for each entry, +to make it possible to merge the output with .Xr tcpdump 1 . Most useful when used with .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: r244319 - head/sbin/savecore
Author: pjd Date: Sun Dec 16 23:04:31 2012 New Revision: 244319 URL: http://svnweb.freebsd.org/changeset/base/244319 Log: Make use of the fact that we changed working directory to the dump directory earlier. Obtained from:WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sun Dec 16 23:00:13 2012 (r244318) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:04:31 2012 (r244319) @@ -188,17 +188,16 @@ check_space(const char *savedir, off_t d FILE *fp; off_t minfree, spacefree, totfree, needed; struct statfs fsbuf; - char buf[100], path[MAXPATHLEN]; + char buf[100]; - if (statfs(savedir, &fsbuf) < 0) { + if (statfs(".", &fsbuf) < 0) { syslog(LOG_ERR, "%s: %m", savedir); exit(1); } spacefree = ((off_t) fsbuf.f_bavail * fsbuf.f_bsize) / 1024; totfree = ((off_t) fsbuf.f_bfree * fsbuf.f_bsize) / 1024; - (void)snprintf(path, sizeof(path), "%s/minfree", savedir); - if ((fp = fopen(path, "r")) == NULL) + if ((fp = fopen("minfree", "r")) == NULL) minfree = 0; else { if (fgets(buf, sizeof(buf), fp) == NULL) ___ 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: r244320 - head/sbin/savecore
Author: pjd Date: Sun Dec 16 23:06:12 2012 New Revision: 244320 URL: http://svnweb.freebsd.org/changeset/base/244320 Log: Implement -m option to savecore(8) that allows to limit number of kernel dumps stored. Once the limit is reached it restarts from 0. Reviewed by: avg Obtained from:WHEEL Systems Modified: head/sbin/savecore/savecore.8 head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.8 == --- head/sbin/savecore/savecore.8 Sun Dec 16 23:04:31 2012 (r244319) +++ head/sbin/savecore/savecore.8 Sun Dec 16 23:06:12 2012 (r244320) @@ -28,7 +28,7 @@ .\" From: @(#)savecore.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 14, 2012 +.Dd December 17, 2012 .Dt SAVECORE 8 .Os .Sh NAME @@ -45,6 +45,7 @@ .Op Ar device ... .Nm .Op Fl fkvz +.Op Fl m Ar maxdumps .Op Ar directory Op Ar device ... .Sh DESCRIPTION The @@ -59,7 +60,7 @@ and enters a reboot message and informat the system log. .Pp The options are as follows: -.Bl -tag -width indent +.Bl -tag -width ".Fl m Ar maxdumps" .It Fl C Check to see if a dump exists, and display a brief message to indicate the status. @@ -77,6 +78,12 @@ Force a dump to be taken even if either dump header information is inconsistent. .It Fl k Do not clear the dump after saving it. +.It Fl m Ar maxdumps +Maximum number of dumps to store. +Once the number of stored dumps is equal to +.Ar maxdumps +the counter will restart from +.Dv 0 . .It Fl v Print out some additional debugging information. Specify twice for more information. Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sun Dec 16 23:04:31 2012 (r244319) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:06:12 2012 (r244320) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); static int checkfor, compress, clear, force, keep, verbose;/* flags */ static int nfound, nsaved, nerr; /* statistics */ +static int maxdumps; extern FILE *zopen(const char *, const char *); @@ -178,12 +179,62 @@ writebounds(int bounds) { fclose(fp); } +static off_t +file_size(const char *path) +{ + struct stat sb; + + /* Ignore all errors, those file may not exists. */ + if (stat(path, &sb) == -1) + return (0); + return (sb.st_size); +} + +static off_t +saved_dump_size(int bounds) +{ + static char path[PATH_MAX]; + off_t dumpsize; + + dumpsize = 0; + + (void)snprintf(path, sizeof(path), "info.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "vmcore.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds); + dumpsize += file_size(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds); + dumpsize += file_size(path); + + return (dumpsize); +} + +static void +saved_dump_remove(int bounds) +{ + static char path[PATH_MAX]; + + (void)snprintf(path, sizeof(path), "info.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "vmcore.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "vmcore.%d.gz", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d", bounds); + (void)unlink(path); + (void)snprintf(path, sizeof(path), "textdump.tar.%d.gz", bounds); + (void)unlink(path); +} + /* * Check that sufficient space is available on the disk that holds the * save directory. */ static int -check_space(const char *savedir, off_t dumpsize) +check_space(const char *savedir, off_t dumpsize, int bounds) { FILE *fp; off_t minfree, spacefree, totfree, needed; @@ -208,7 +259,8 @@ check_space(const char *savedir, off_t d } needed = dumpsize / 1024 + 2; /* 2 for info file */ - if (((minfree > 0) ? spacefree : totfree) - needed < minfree) { + needed -= saved_dump_size(bounds); + if ((minfree > 0 ? spacefree : totfree) - needed < minfree) { syslog(LOG_WARNING, "no dump, not enough free space on device (%lld available, need %lld)", (long long)(minfree > 0 ? spacefree : totfree), @@ -367,7 +419,7 @@ DoTextdumpFile(int fd, off_t dumpsize, o static void DoFile(const char *savedir, const char *device) { - static char filename[PATH_MAX]; + static char infoname[PATH_MAX], corename[PATH_MAX]; static char *buf = NULL; struct kerneldumpheader kdhf, kdhl; off_t mediasize, dumpsize, firsthd, lasthd; @@ -382,6 +434,9 @@ DoFile(const char *savedir, const char *
svn commit: r244321 - head/sbin/savecore
Author: pjd Date: Sun Dec 16 23:09:27 2012 New Revision: 244321 URL: http://svnweb.freebsd.org/changeset/base/244321 Log: With rotating kernel dumps the higest dump number is not necessarily the last one. To make it easier to find the last one create symlinks with 'last' suffix that will point to the files of the last coredump, eg.: info.last -> info.5 textdump.tar.last.gz -> textdump.tar.5.gz Reviewed by: avg Obtained from:WHEEL Systems Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c == --- head/sbin/savecore/savecore.c Sun Dec 16 23:06:12 2012 (r244320) +++ head/sbin/savecore/savecore.c Sun Dec 16 23:09:27 2012 (r244321) @@ -229,6 +229,17 @@ saved_dump_remove(int bounds) (void)unlink(path); } +static void +symlinks_remove(void) +{ + + (void)unlink("info.last"); + (void)unlink("vmcore.last"); + (void)unlink("vmcore.last.gz"); + (void)unlink("textdump.tar.last"); + (void)unlink("textdump.tar.last.gz"); +} + /* * Check that sufficient space is available on the disk that holds the * save directory. @@ -419,7 +430,7 @@ DoTextdumpFile(int fd, off_t dumpsize, o static void DoFile(const char *savedir, const char *device) { - static char infoname[PATH_MAX], corename[PATH_MAX]; + static char infoname[PATH_MAX], corename[PATH_MAX], linkname[PATH_MAX]; static char *buf = NULL; struct kerneldumpheader kdhf, kdhl; off_t mediasize, dumpsize, firsthd, lasthd; @@ -664,6 +675,23 @@ DoFile(const char *savedir, const char * goto closeall; } + symlinks_remove(); + if (symlink(infoname, "info.last") == -1) { + syslog(LOG_WARNING, "unable to create symlink %s/%s: %m", + savedir, "info.last"); + } + if (compress) { + snprintf(linkname, sizeof(linkname), "%s.last.gz", + istextdump ? "textdump.tar" : "vmcore"); + } else { + snprintf(linkname, sizeof(linkname), "%s.last", + istextdump ? "textdump.tar" : "vmcore"); + } + if (symlink(corename, linkname) == -1) { + syslog(LOG_WARNING, "unable to create symlink %s/%s: %m", + savedir, linkname); + } + nsaved++; if (verbose) ___ 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: r244323 - in head: . etc/defaults
Author: pjd Date: Sun Dec 16 23:29:56 2012 New Revision: 244323 URL: http://svnweb.freebsd.org/changeset/base/244323 Log: Use new savecore(8) option and limit number of kernel dumps that will be kept around to the 10 most recent ones. Add UPDATING entry with info how to return to the previous behaviour (no limits). Obtained from:WHEEL Systems Modified: head/UPDATING head/etc/defaults/rc.conf Modified: head/UPDATING == --- head/UPDATING Sun Dec 16 23:23:34 2012(r244322) +++ head/UPDATING Sun Dec 16 23:29:56 2012(r244323) @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +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 + stored in the dump directory) add the following line to /etc/rc.conf: + + savecore_flags="" + 20121201: With the addition of auditdistd(8), a new auditdistd user is now depended on during installworld. "mergemaster -p" can be used to add Modified: head/etc/defaults/rc.conf == --- head/etc/defaults/rc.conf Sun Dec 16 23:23:34 2012(r244322) +++ head/etc/defaults/rc.conf Sun Dec 16 23:29:56 2012(r244323) @@ -605,7 +605,9 @@ chkprintcap_enable="NO" # Run chkprintca chkprintcap_flags="-d" # Create missing directories by default. dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). dumpdir="/var/crash" # Directory where crash dumps are to be stored -savecore_flags="" # Used if dumpdev is enabled above, and present. +savecore_flags="-m 10" # Used if dumpdev is enabled above, and present. + # By default, only the 10 most recent kernel dumps + # are saved. crashinfo_enable="YES" # Automatically generate crash dump summary. crashinfo_program="/usr/sbin/crashinfo"# Script to generate crash dump summary. quota_enable="NO" # turn on quotas on startup (or NO). ___ 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: r244112 - head/sys/kern
On Sun, Dec 16, 2012 at 09:23:13AM -0800, Adrian Chadd wrote: > On 15 December 2012 23:45, Andriy Gapon wrote: > > on 16/12/2012 07:00 Ian Lepore said the following: > >> The question here isn't whether aborting or continuing beyond that point > >> is a good idea. Some developer already made that choice by coding a > >> KASSERT() instead of a panic(). The developer decided that a production > >> machine should try to keep running at that point. > > > > Please don't perpetuate this argument. The point of KASSERT is not that the > > developer intended that the system should try to keep running in production. > > The point is that (1) the KASSERT should not be hit in production as was > > established in testing *and* (2) having all KASSERTs enabled in production > > is > > too expensive. That's all. > > You can't possibly believe that once the kernel is in production, > "testing" stops. > > That's why Alfred and I want to mak KASSERT() optionally just print > that it happened and maybe add some further information, then > continue. > > It doesn't change the status quo with the default, GENERIC > "production" kernel. It still crashes where it would normally crash > (timing bugs otherwise.) It still won't crash where it wouldn't > trigger a kassert. A shipping, production kernel doesn't have KASSERT > enabled. > > You may assert "assertions are supposed to crash", yet we ship with > assertions disabled. Please, tell the software engineers here what you > think that implies about what we think about those assertions. Let me > give you a hint - if you ship with them disabled, they don't get run. > So obviously we don't think there's a big enough problem to cause any > real issues. Now, this may not be the case at all - in which case, > those shouldn't be disabled in production kernels, for all the reasons > everyone above has said. Yet, they're disabled. It is correct (and standard practice) to ship with assertions disabled. This is recognition of the fact that assertions and run time error checks are two different beasts. Anything expressed as a KASSERT really should be ironclad by the time the code is deemed ready for production, and time spent verifying it isn't worth it. Creating a new class of checks for recoverable errors would be welcome. Just report the unexpected state and move on. A subset of these - the lightweight ones - could be enabled in production too, and that would be quite welcome too. Why not introduce new macros? Why change the meaning of a KASSERT? > > The status quo _does not change_ by default. > So now we have a knob that could be used to change the behaviour of all the KASSERTs in the system; one that hints that it may be possible to continue even if an assertion in the FreeBSD kernel doesn't hold good (this is the part that bothers me). I know all the KASSERTs I've looked at or written are genuine assertions -- the code simply wouldn't be able to cope if they were violated. You'd get NULL dereferences, or worse, access protected structures without corresponding locks held, etc. Regards, Navdeep ___ 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: r244324 - in stable/9/sys: kern security/audit
Author: pjd Date: Sun Dec 16 23:41:34 2012 New Revision: 244324 URL: http://svnweb.freebsd.org/changeset/base/244324 Log: MFC r243719,r243720,r243722,r243723,r243726,r243727,r243746: r243719: IFp4 @208450: Remove redundant call to AUDIT_ARG_UPATH1(). Path will be remembered by the following NDINIT(AUDITVNODE1) call. Sponsored by: The FreeBSD Foundation (auditdistd) r243720: IFp4 @208381: For VOP_GETATTR() we just need vnode to be shared-locked. Sponsored by: The FreeBSD Foundation (auditdistd) r243722: IFp4 @208382: Currently on each record write we call VFS_STATFS() to get available space on the file system as well as VOP_GETATTR() to get trail file size. We can assume that trail file is only updated by the audit worker, so instead of asking for file size on every write, get file size on trail switch only (it should be zero, but it's not expensive) and use global variable audit_size protected by the audit worker lock to keep track of trail file's size. This eliminates VOP_GETATTR() call for every write. VFS_STATFS() is satisfied from in-memory data (mount->mnt_stat), so shouldn't be expensive. Sponsored by: The FreeBSD Foundation (auditdistd) r243723: IFp4 @208383: Currently when we discover that trail file is greater than configured limit we send AUDIT_TRIGGER_ROTATE_KERNEL trigger to the auditd daemon once. If for some reason auditd didn't rotate trail file it will never be rotated. Change it by sending the trigger when trail file size grows by the configured limit. For example if the limit is 1MB, we will send trigger on 1MB, 2MB, 3MB, etc. This is also needed for the auditd change that will be committed soon where auditd may ignore the trigger - it might be ignored if kernel requests the trail file to be rotated too quickly (often than once a second) which would result in overwriting previous trail file. Sponsored by: The FreeBSD Foundation (auditdistd) r243726: IFp4 @208451: Fix path handling for *at() syscalls. Before the change directory descriptor was totally ignored, so the relative path argument was appended to current working directory path and not to the path provided by descriptor, thus wrong paths were stored in audit logs. Now that we use directory descriptor in vfs_lookup, move AUDIT_ARG_UPATH1() and AUDIT_ARG_UPATH2() calls to the place where we hold file descriptors table lock, so we are sure paths will be resolved according to the same directory in audit record and in actual operation. Sponsored by: The FreeBSD Foundation (auditdistd) Reviewed by: rwatson r243727: IFp4 @208452: Audit handling for missing events: - AUE_READLINKAT - AUE_FACCESSAT - AUE_MKDIRAT - AUE_MKFIFOAT - AUE_MKNODAT - AUE_SYMLINKAT Sponsored by: FreeBSD Foundation (auditdistd) r243746: Fix one more compilation issue. Sponsored by: FreeBSD Foundation (auditdistd) Modified: stable/9/sys/kern/vfs_lookup.c stable/9/sys/kern/vfs_mount.c stable/9/sys/security/audit/audit.c stable/9/sys/security/audit/audit.h stable/9/sys/security/audit/audit_arg.c stable/9/sys/security/audit/audit_bsm.c stable/9/sys/security/audit/audit_bsm_klib.c stable/9/sys/security/audit/audit_private.h stable/9/sys/security/audit/audit_worker.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_lookup.c == --- stable/9/sys/kern/vfs_lookup.c Sun Dec 16 23:29:56 2012 (r244323) +++ stable/9/sys/kern/vfs_lookup.c Sun Dec 16 23:41:34 2012 (r244324) @@ -163,17 +163,6 @@ namei(struct nameidata *ndp) error = copyinstr(ndp->ni_dirp, cnp->cn_pnbuf, MAXPATHLEN, (size_t *)&ndp->ni_pathlen); - if (error == 0) { - /* -* If we are auditing the kernel pathname, save the user -* pathname. -*/ - if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG_UPATH1(td, cnp->cn_pnbuf); - if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG_UPATH2(td, cnp->cn_pnbuf); - } - /* * Don't allow empty pathnames. */ @@ -216,6 +205,14 @@ namei(struct nameidata *ndp) ndp->ni_rootdir = fdp->fd_rdir; ndp->ni_topdir = fdp->fd_jdir; + /* +* If we are auditing the kernel pathname, save the user pathname. +*/ + if (cnp->cn_flags & AUDITVNODE1) + AUDIT_ARG_UPATH1(td, ndp->ni_dirfd, cnp->cn_pnbuf); + if (cnp->cn_flags & AUDITVNODE2) + AUDIT_ARG_UPATH2(td, ndp->ni_dirfd, cnp->cn_pnbuf); + dp = NULL; if (cnp->cn_pnbuf[0] != '/') { if (ndp->ni_startdir != NULL) { Modified: stable/9/sys/kern/vfs_mount.c
svn commit: r244325 - head/sbin/route
Author: hrs Date: Sun Dec 16 23:46:59 2012 New Revision: 244325 URL: http://svnweb.freebsd.org/changeset/base/244325 Log: - Fix strtol() error handling. - Add a range condition of given FIB number and the related error messages. - Fix free() problem. Spotted by: Artyom Mirgorodskiy Discussed with: glebius Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c == --- head/sbin/route/route.c Sun Dec 16 23:41:34 2012(r244324) +++ head/sbin/route/route.c Sun Dec 16 23:46:59 2012(r244325) @@ -260,19 +260,25 @@ static int fiboptlist_range(const char *arg, struct fibl_head_t *flh) { struct fibl *fl; - char *str, *token, *endptr; + char *str0, *str, *token, *endptr; int fib[2], i, error; - str = strdup(arg); + str0 = str = strdup(arg); error = 0; i = 0; while ((token = strsep(&str, "-")) != NULL) { switch (i) { case 0: case 1: + errno = 0; fib[i] = strtol(token, &endptr, 0); - if (*endptr != '\0' || (fib[i] == 0 && - (errno == EINVAL || errno == ERANGE))) + if (errno == 0) { + if (*endptr != '\0' || + fib[i] < 0 || + (numfibs != -1 && fib[i] > numfibs - 1)) + errno = EINVAL; + } + if (errno) error = 1; break; default: @@ -296,7 +302,7 @@ fiboptlist_range(const char *arg, struct TAILQ_INSERT_TAIL(flh, fl, fl_next); } fiboptlist_range_ret: - free(str); + free(str0); return (error); } @@ -305,7 +311,7 @@ static int fiboptlist_csv(const char *arg, struct fibl_head_t *flh) { struct fibl *fl; - char *str, *token, *endptr; + char *str0, *str, *token, *endptr; int fib, error; if (strcmp("all", arg) == 0) { @@ -319,14 +325,14 @@ fiboptlist_csv(const char *arg, struct f else snprintf(str, ALLSTRLEN - 1, "%d", 0); } else if (strcmp("default", arg) == 0) { - str = calloc(1, ALLSTRLEN); + str0 = str = calloc(1, ALLSTRLEN); if (str == NULL) { error = 1; goto fiboptlist_csv_ret; } snprintf(str, ALLSTRLEN - 1, "%d", defaultfib); } else - str = strdup(arg); + str0 = str = strdup(arg); error = 0; while ((token = strsep(&str, ",")) != NULL) { @@ -335,9 +341,15 @@ fiboptlist_csv(const char *arg, struct f if (error) goto fiboptlist_csv_ret; } else { + errno = 0; fib = strtol(token, &endptr, 0); - if (*endptr != '\0' || (fib == 0 && - (errno == EINVAL || errno == ERANGE))) { + if (errno == 0) { + if (*endptr != '\0' || + fib < 0 || + (numfibs != -1 && fib > numfibs - 1)) + errno = EINVAL; + } + if (errno) { error = 1; goto fiboptlist_csv_ret; } @@ -351,7 +363,7 @@ fiboptlist_csv(const char *arg, struct f } } fiboptlist_csv_ret: - free(str); + free(str0); return (error); } @@ -396,7 +408,7 @@ flushroutes(int argc, char *argv[]) usage(*argv); error = fiboptlist_csv(*++argv, &fibl_head); if (error) - usage(*argv); + errx(EX_USAGE, "invalid fib number: %s", *argv); break; default: usage(*argv); @@ -815,7 +827,8 @@ newroute(int argc, char **argv) usage(NULL); error = fiboptlist_csv(*++argv, &fibl_head); if (error) - usage(NULL); + errx(EX_USAGE, + "invalid fib number: %s", *argv); break; case K_IFA: if (!--argc) @@ -1383,10 +1396,16 @@ monitor(int argc, char *argv[]) case K_FIB: if (
svn commit: r244331 - head/usr.sbin/gssd
Author: rmacklem Date: Mon Dec 17 00:31:55 2012 New Revision: 244331 URL: http://svnweb.freebsd.org/changeset/base/244331 Log: Fix the gssd daemon so that it uses syslog() to report an error instead of calling err() when it is daemonized, so that the error gets logged. Discussed with: rwatson, jhb Tested by:Illias A. Marinos, Herbert Poeckl MFC after:2 weeks Modified: head/usr.sbin/gssd/gssd.c Modified: head/usr.sbin/gssd/gssd.c == --- head/usr.sbin/gssd/gssd.c Mon Dec 17 00:22:48 2012(r244330) +++ head/usr.sbin/gssd/gssd.c Mon Dec 17 00:31:55 2012(r244331) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -106,21 +107,43 @@ main(int argc, char **argv) sun.sun_len = SUN_LEN(&sun); fd = socket(AF_LOCAL, SOCK_STREAM, 0); if (!fd) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't create local gssd socket"); + exit(1); + } err(1, "Can't create local gssd socket"); } oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO); if (bind(fd, (struct sockaddr *) &sun, sun.sun_len) < 0) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't bind local gssd socket"); + exit(1); + } err(1, "Can't bind local gssd socket"); } umask(oldmask); if (listen(fd, SOMAXCONN) < 0) { + if (debug_level == 0) { + syslog(LOG_ERR, "Can't listen on local gssd socket"); + exit(1); + } err(1, "Can't listen on local gssd socket"); } xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE); if (!xprt) { + if (debug_level == 0) { + syslog(LOG_ERR, + "Can't create transport for local gssd socket"); + exit(1); + } err(1, "Can't create transport for local gssd socket"); } if (!svc_reg(xprt, GSSD, GSSDVERS, gssd_1, NULL)) { + if (debug_level == 0) { + syslog(LOG_ERR, + "Can't register service for local gssd socket"); + exit(1); + } err(1, "Can't register service for local gssd socket"); } ___ 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: r244332 - head/sys/boot/i386/efi
Author: rpaulo Date: Mon Dec 17 00:34:07 2012 New Revision: 244332 URL: http://svnweb.freebsd.org/changeset/base/244332 Log: amd64 only has rela sections. Modified: head/sys/boot/i386/efi/ldscript.amd64 Modified: head/sys/boot/i386/efi/ldscript.amd64 == --- head/sys/boot/i386/efi/ldscript.amd64 Mon Dec 17 00:31:55 2012 (r244331) +++ head/sys/boot/i386/efi/ldscript.amd64 Mon Dec 17 00:34:07 2012 (r244332) @@ -50,19 +50,19 @@ SECTIONS . = ALIGN(4096); .dynamic : { *(.dynamic) } . = ALIGN(4096); - .rel.dyn : { -*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) -*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) -*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) -*(.rel.got) -*(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) -*(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) -*(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) -*(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) -*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) -*(.rel.plt) + .rela.dyn: { +*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) +*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) +*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) +*(.rela.got) +*(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) +*(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) +*(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) +*(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) +*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) +*(.rela.plt) *(.relset_*) -*(.rel.dyn .rel.dyn.*) +*(.rela.dyn .rela.dyn.*) } . = ALIGN(4096); .reloc : { *(.reloc) } ___ 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: r244112 - head/sys/kern
On 16 December 2012 15:32, Navdeep Parhar wrote: >> The status quo _does not change_ by default. > > So now we have a knob that could be used to change the behaviour of all > the KASSERTs in the system; one that hints that it may be possible to > continue even if an assertion in the FreeBSD kernel doesn't hold good > (this is the part that bothers me). I know all the KASSERTs I've looked > at or written are genuine assertions -- the code simply wouldn't be able > to cope if they were violated. You'd get NULL dereferences, or worse, > access protected structures without corresponding locks held, etc. In that case, those failures should be handled gracefully, or they should immediately panic the kernel. Claiming that a KASSERT() is optional at this point is basically us as a project saying "We know that if the kernel gets to this point and it fails this check, everything is busted after this." Ie, "Hey, if you disable KASSERT(), your data is potentially toast." Yet we ship with KASSERT() disabled. Silent data corruption, race conditions, etc. Not everything leads to a NULL pointer dereference. Again, we ship with KASSERT disabled in GENERIC on shipping production releases. The concerns you have with KASSERT printing out when Alfred's modification is enabled -does not change the fact that the kernel does _EXACTLY THIS_ kind of "oh well, I'll keep going" behaviour in a GENERIC, production, release kernel-. Adrian ___ 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: r244337 - in stable/9/sys: amd64/amd64 i386/i386
Author: kib Date: Mon Dec 17 05:13:15 2012 New Revision: 244337 URL: http://svnweb.freebsd.org/changeset/base/244337 Log: MFC r243836: Print the frame addresses for the backtraces on i386 and amd64. Modified: stable/9/sys/amd64/amd64/db_trace.c stable/9/sys/i386/i386/db_trace.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/db_trace.c == --- stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/amd64/amd64/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -186,7 +186,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static int db_numargs(struct amd64_frame *); -static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t, +void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -230,12 +231,13 @@ db_numargs(fp) } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; long *argp; db_addr_t callpc; + void *frame; { db_printf("%s(", name); #if 0 @@ -250,6 +252,8 @@ db_print_stack_entry(name, narg, argnp, #endif db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%lx", (register_t)frame); db_printf("\n"); } @@ -341,7 +345,7 @@ db_nextframe(struct amd64_frame **fp, db return; } - db_print_stack_entry(name, 0, 0, 0, rip); + db_print_stack_entry(name, 0, 0, 0, rip, &(*fp)->f_frame); /* * Point to base of trapframe which is just above the @@ -437,7 +441,8 @@ db_backtrace(struct thread *td, struct t * Don't try to walk back on a stack for a * process that hasn't actually been run yet. */ - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, + actframe); break; } first = FALSE; @@ -451,7 +456,7 @@ db_backtrace(struct thread *td, struct t narg = db_numargs(frame); } - db_print_stack_entry(name, narg, argnp, argp, pc); + db_print_stack_entry(name, narg, argnp, argp, pc, actframe); if (actframe != frame) { /* `frame' belongs to caller. */ @@ -465,7 +470,7 @@ db_backtrace(struct thread *td, struct t if (INKERNEL((long)pc) && !INKERNEL((long)frame)) { sym = db_search_symbol(pc, DB_STGY_ANY, &offset); db_symbol_values(sym, &name, NULL); - db_print_stack_entry(name, 0, 0, 0, pc); + db_print_stack_entry(name, 0, 0, 0, pc, frame); break; } if (!INKERNEL((long) frame)) { Modified: stable/9/sys/i386/i386/db_trace.c == --- stable/9/sys/i386/i386/db_trace.c Mon Dec 17 01:10:06 2012 (r244336) +++ stable/9/sys/i386/i386/db_trace.c Mon Dec 17 05:13:15 2012 (r244337) @@ -176,7 +176,8 @@ db_ss(struct db_variable *vp, db_expr_t static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); -static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t); +static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, +void *); static void decode_syscall(int, struct thread *); static const char * watchtype_str(int type); @@ -220,12 +221,13 @@ retry: } static void -db_print_stack_entry(name, narg, argnp, argp, callpc) +db_print_stack_entry(name, narg, argnp, argp, callpc, frame) const char *name; int narg; char **argnp; int *argp; db_addr_t callpc; + void *frame; { int n = narg >= 0 ? narg : 5; @@ -242,6 +244,8 @@ db_print_stack_entry(name, narg, argnp, db_printf(",..."); db_printf(") at "); db_printsym(callpc, DB_STGY_PROC); + if (frame != NULL) + db_printf("/frame 0x%r", (register_t)frame); db_printf("\n"); } @@ -326,7 +330,7 @@ db_nextframe(struct i386_frame **fp, db_ return; } - db_print_stack_entry(name, 0, 0, 0, eip); + db_print_stack_entry(name, 0, 0, 0, eip, &(*fp)->f_fra
svn commit: r244338 - stable/9/sys/kern
Author: kib Date: Mon Dec 17 05:15:51 2012 New Revision: 244338 URL: http://svnweb.freebsd.org/changeset/base/244338 Log: MFC r244076: Do not ignore zero address, possibly returned by the vm_map_find() call. Modified: stable/9/sys/kern/vfs_bio.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_bio.c == --- stable/9/sys/kern/vfs_bio.c Mon Dec 17 05:13:15 2012(r244337) +++ stable/9/sys/kern/vfs_bio.c Mon Dec 17 05:15:51 2012(r244338) @@ -2139,15 +2139,16 @@ restart: if (maxsize != bp->b_kvasize) { vm_offset_t addr = 0; + int rv; bfreekva(bp); vm_map_lock(buffer_map); if (vm_map_findspace(buffer_map, - vm_map_min(buffer_map), maxsize, &addr)) { + vm_map_min(buffer_map), maxsize, &addr)) { /* -* Uh oh. Buffer map is to fragmented. We -* must defragment the map. +* Buffer map is too fragmented. +* We must defragment the map. */ atomic_add_int(&bufdefragcnt, 1); vm_map_unlock(buffer_map); @@ -2156,22 +2157,21 @@ restart: brelse(bp); goto restart; } - if (addr) { - vm_map_insert(buffer_map, NULL, 0, - addr, addr + maxsize, - VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); - - bp->b_kvabase = (caddr_t) addr; - bp->b_kvasize = maxsize; - atomic_add_long(&bufspace, bp->b_kvasize); - atomic_add_int(&bufreusecnt, 1); - } + rv = vm_map_insert(buffer_map, NULL, 0, addr, + addr + maxsize, VM_PROT_ALL, VM_PROT_ALL, + MAP_NOFAULT); + KASSERT(rv == KERN_SUCCESS, + ("vm_map_insert(buffer_map) rv %d", rv)); vm_map_unlock(buffer_map); + bp->b_kvabase = (caddr_t)addr; + bp->b_kvasize = maxsize; + atomic_add_long(&bufspace, bp->b_kvasize); + atomic_add_int(&bufreusecnt, 1); } bp->b_saveaddr = bp->b_kvabase; bp->b_data = bp->b_saveaddr; } - return(bp); + return (bp); } /* ___ 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: r244339 - stable/9/sys/amd64/amd64
Author: kib Date: Mon Dec 17 05:18:16 2012 New Revision: 244339 URL: http://svnweb.freebsd.org/changeset/base/244339 Log: MFC r244077: Add amd64-specific ddb command "show pte". The command displays the hierarchy of the page table entries which map the specified address. Modified: stable/9/sys/amd64/amd64/pmap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/pmap.c == --- stable/9/sys/amd64/amd64/pmap.c Mon Dec 17 05:15:51 2012 (r244338) +++ stable/9/sys/amd64/amd64/pmap.c Mon Dec 17 05:18:16 2012 (r244339) @@ -5462,3 +5462,46 @@ pmap_align_superpage(vm_object_t object, else *addr = ((*addr + PDRMASK) & ~PDRMASK) + superpage_offset; } + +#include "opt_ddb.h" +#ifdef DDB +#include + +DB_SHOW_COMMAND(pte, pmap_print_pte) +{ + pmap_t pmap; + pml4_entry_t *pml4; + pdp_entry_t *pdp; + pd_entry_t *pde; + pt_entry_t *pte; + vm_offset_t va; + + if (have_addr) { + va = (vm_offset_t)addr; + pmap = PCPU_GET(curpmap); /* XXX */ + } else { + db_printf("show pte addr\n"); + return; + } + pml4 = pmap_pml4e(pmap, va); + db_printf("VA %#016lx pml4e %#016lx", va, *pml4); + if ((*pml4 & PG_V) == 0) { + db_printf("\n"); + return; + } + pdp = pmap_pml4e_to_pdpe(pml4, va); + db_printf(" pdpe %#016lx", *pdp); + if ((*pdp & PG_V) == 0 || (*pdp & PG_PS) != 0) { + db_printf("\n"); + return; + } + pde = pmap_pdpe_to_pde(pdp, va); + db_printf(" pde %#016lx", *pde); + if ((*pde & PG_V) == 0 || (*pde & PG_PS) != 0) { + db_printf("\n"); + return; + } + pte = pmap_pde_to_pte(pde, va); + db_printf(" pte %#016lx\n", *pte); +} +#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: r244340 - stable/9/share/man/man4
Author: eadler Date: Mon Dec 17 05:31:42 2012 New Revision: 244340 URL: http://svnweb.freebsd.org/changeset/base/244340 Log: MFC r241836: Remove {harp,hfa,idt} man pages as they were removed in r179308. PR: docs/171234 Approved by: cperciva (implicit) Deleted: stable/9/share/man/man4/harp.4 stable/9/share/man/man4/hfa.4 stable/9/share/man/man4/idt.4 Modified: stable/9/share/man/man4/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/Makefile == --- stable/9/share/man/man4/MakefileMon Dec 17 05:18:16 2012 (r244339) +++ stable/9/share/man/man4/MakefileMon Dec 17 05:31:42 2012 (r244340) @@ -148,9 +148,7 @@ MAN=aac.4 \ gpib.4 \ gre.4 \ h_ertt.4 \ - harp.4 \ hatm.4 \ - hfa.4 \ hifn.4 \ hme.4 \ hpet.4 \ @@ -164,7 +162,6 @@ MAN=aac.4 \ icmp.4 \ icmp6.4 \ ida.4 \ - idt.4 \ ifmib.4 \ igb.4 \ igmp.4 \ ___ 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: r244341 - head/sys/dev/ale
Author: yongari Date: Mon Dec 17 06:01:57 2012 New Revision: 244341 URL: http://svnweb.freebsd.org/changeset/base/244341 Log: Make sure to stop both TX and RX MACs in ale_stop_mac(). Previously it used to stop TX MAC only such that MAC reconfiguration after getting a link didn't work as expected. PR: kern/173652 Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c == --- head/sys/dev/ale/if_ale.c Mon Dec 17 05:31:42 2012(r244340) +++ head/sys/dev/ale/if_ale.c Mon Dec 17 06:01:57 2012(r244341) @@ -2932,7 +2932,7 @@ ale_stop_mac(struct ale_softc *sc) reg = CSR_READ_4(sc, ALE_MAC_CFG); if ((reg & (MAC_CFG_TX_ENB | MAC_CFG_RX_ENB)) != 0) { - reg &= ~MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; + reg &= ~(MAC_CFG_TX_ENB | MAC_CFG_RX_ENB); CSR_WRITE_4(sc, ALE_MAC_CFG, reg); } ___ 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: r244342 - stable/9/usr.bin/less
Author: delphij Date: Mon Dec 17 06:35:15 2012 New Revision: 244342 URL: http://svnweb.freebsd.org/changeset/base/244342 Log: Note that the manual page of less(1) says: Note that a preprocessor cannot output an empty file, since that is interpreted as meaning there is no replacement, and the origi- nal file is used. To avoid this, if LESSOPEN starts with two ver- tical bars, the exit status of the script becomes meaningful. If the exit status is zero, the output is considered to be replace- ment text, even if it empty. If the exit status is nonzero, any output is ignored and the original file is used. For compatibil- ity with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. Use two pipe symbols for zless, so that zless'ing a compressed empty file will give output rather than being interpreted as its compressed form, which is typically a binary. Thanks Mark Nudelman for pointing out this difference and the suggested solution. Reported by: Matthias Meyser PR: bin/168839 Modified: stable/9/usr.bin/less/zless.sh Directory Properties: stable/9/usr.bin/less/ (props changed) Modified: stable/9/usr.bin/less/zless.sh == --- stable/9/usr.bin/less/zless.sh Mon Dec 17 06:01:57 2012 (r244341) +++ stable/9/usr.bin/less/zless.sh Mon Dec 17 06:35:15 2012 (r244342) @@ -3,5 +3,5 @@ # $FreeBSD$ # -export LESSOPEN="|/usr/bin/lesspipe.sh %s" +export LESSOPEN="||/usr/bin/lesspipe.sh %s" exec /usr/bin/less "$@" ___ 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: r244343 - stable/8/usr.bin/less
Author: delphij Date: Mon Dec 17 06:38:22 2012 New Revision: 244343 URL: http://svnweb.freebsd.org/changeset/base/244343 Log: MFC r243834: Note that the manual page of less(1) says: Note that a preprocessor cannot output an empty file, since that is interpreted as meaning there is no replacement, and the origi- nal file is used. To avoid this, if LESSOPEN starts with two ver- tical bars, the exit status of the script becomes meaningful. If the exit status is zero, the output is considered to be replace- ment text, even if it empty. If the exit status is nonzero, any output is ignored and the original file is used. For compatibil- ity with previous versions of less, if LESSOPEN starts with only one vertical bar, the exit status of the preprocessor is ignored. Use two pipe symbols for zless, so that zless'ing a compressed empty file will give output rather than being interpreted as its compressed form, which is typically a binary. Thanks Mark Nudelman for pointing out this difference and the suggested solution. Reported by: Matthias Meyser PR: bin/168839 Modified: stable/8/usr.bin/less/zless.sh Directory Properties: stable/8/usr.bin/less/ (props changed) Modified: stable/8/usr.bin/less/zless.sh == --- stable/8/usr.bin/less/zless.sh Mon Dec 17 06:35:15 2012 (r244342) +++ stable/8/usr.bin/less/zless.sh Mon Dec 17 06:38:22 2012 (r244343) @@ -3,5 +3,5 @@ # $FreeBSD$ # -export LESSOPEN="|/usr/bin/lesspipe.sh %s" +export LESSOPEN="||/usr/bin/lesspipe.sh %s" exec /usr/bin/less "$@" ___ 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: r244344 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Mon Dec 17 06:43:08 2012 New Revision: 244344 URL: http://svnweb.freebsd.org/changeset/base/244344 Log: MFC r243807: Use SA_ZPL_CRTIME instead of SA_ZPL_CTIME for creation time. Submitted by: phil.stone at gmx.com Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:38:22 2012(r244343) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:43:08 2012(r244344) @@ -2682,7 +2682,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &crtime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CRTIME(zfsvfs), NULL, &crtime, 16); if (vp->v_type == VBLK || vp->v_type == VCHR) SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zfsvfs), NULL, &rdev, 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: r244345 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Author: delphij Date: Mon Dec 17 06:44:16 2012 New Revision: 244345 URL: http://svnweb.freebsd.org/changeset/base/244345 Log: MFC r243807: Use SA_ZPL_CRTIME instead of SA_ZPL_CTIME for creation time. Submitted by: phil.stone at gmx.com Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c == --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:43:08 2012(r244344) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Dec 17 06:44:16 2012(r244345) @@ -2683,7 +2683,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &crtime, 16); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CRTIME(zfsvfs), NULL, &crtime, 16); if (vp->v_type == VBLK || vp->v_type == VCHR) SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_RDEV(zfsvfs), NULL, &rdev, 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"