svn commit: r229926 - stable/9/release/doc/en_US.ISO8859-1/relnotes
Author: hrs Date: Tue Jan 10 08:01:24 2012 New Revision: 229926 URL: http://svn.freebsd.org/changeset/base/229926 Log: Add relnotes items: machdep.disable_tsc_calibration tunable, ada(4) kern.cam.ada.write_cache sysctl, geom_map(4) added, readline(3) functions imported into libedit, and lib{md,crypt} SHA-256/-512 support added. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml == --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Tue Jan 10 07:46:35 2012(r229925) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Tue Jan 10 08:01:24 2012(r229926) @@ -587,12 +587,16 @@ supports Sony Playstation 3 using the OtherOS feature available on firmwares 3.15 and earlier. - A new &man.loader.8; tunable + A new &man.loader.8; tunable machdep.disable_tsc has been added. Setting this to a non-zero value disables use of TSC (Time Stamp Counter) by turning off boot-time CPU frequency calibration, DELAY(9) with TSC, and using TSC as a CPU - ticker. + ticker. Another new &man.loader.8; tunable + machdep.disable_tsc_calibration allows to + skip TSC frequency calibration only. This is useful when + one wants to use the nominal frequency of the chip in Intel + processors, for example. The &os; &man.usb.4; subsystem now supports USB packet filter. This allows to capture packets @@ -798,6 +802,26 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Disks and Storage + The &man.ada.4; driver now supports + write cache control. A new &man.sysctl.8 variable + kern.cam.ada.write_cache determines + whether write cache of the &man.ada.4; devices is enabled or + not. Setting to 1 enables and + 0 disables, and -1 + leaves it the device default. &man.sysctl.8 variables + kern.cam.ada.N.write_cache + can override the configuration in a per-device basis (the + default value is -1, which means to use + the global setting). Note that the value can be changed at + runtime, but it takes effect only after a device + reset. + + The &man.geom.map.4; GEOM class has + been added. This allows to generate multiple geom providers + based on a hard-coded layout of a device with no explicit + partition table such as embedded flash storage. For more + information, see &man.geom.map.4; manual page. + The &man.gpart.8; GEOM class now supports the following aliases for the MBR and EBR schemes: fat32, ebr, @@ -970,6 +994,16 @@ nfsuserd_enable="YES" half-duplex, and loopback, respectively. + &man.readline.3; API set has been + imported into libedit. This is + based on NetBSD's implementation and BSD licensed utilities + now use it instead of GNU + libreadline. + + libmd + and libcrypt now support SHA-256 + and SHA-512 algorithm. + The &man.netstat.1; utility now does not expose internal scope address representation used in the &os; kernel, which is derived from KAME IPv6 stack, in the results ___ 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: r229415 - head/lib/libvgl
On 2012-01-10 05:48, Eitan Adler wrote: On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: Last time I did benchmarking on this ~10 years ago, it was slower to use xor instead of using assignments... I'd be shocked if the compiler didn't optimize this away to an XCHG. Even with our ancient gcc 4.2 (on i386): VGLLine: [...] movl12(%ebp), %edx movl16(%ebp), %eax movl$1, -56(%ebp) xchgl %eax, %edx movl%edx, 12(%ebp) movl24(%ebp), %edx movl%eax, 16(%ebp) movl%ecx, %eax xchgl %edx, %esi movl%edx, 24(%ebp) movl-84(%ebp), %edx xchgl %eax, %edx movl%eax, -80(%ebp) movl%edx, -84(%ebp) With clang, the corresponding local variables seem to have been optimized away entirely (or rather, moved around). ___ 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: r229415 - head/lib/libvgl
On 2012-01-03 20:47, Pedro F. Giffuni wrote: Author: pfg Date: Tue Jan 3 19:47:32 2012 New Revision: 229415 URL: http://svn.freebsd.org/changeset/base/229415 Log: Integrate the line drawing algorithm from the book "Graphic Gems 1". http://www.graphicsgems.org/ At the time it claimed to be 3-4 times faster than the traditional algorithm. Btw, why is this library in the base system at all? It seems totally unused, except for one picobsd Makefile? ___ 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: r229927 - in stable/9: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd
Author: fabient Date: Tue Jan 10 08:16:28 2012 New Revision: 229927 URL: http://svn.freebsd.org/changeset/base/229927 Log: MFC r228431, r228502, r228802: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. Added: stable/9/share/man/man4/viawd.4 - copied unchanged from r228431, head/share/man/man4/viawd.4 stable/9/sys/dev/viawd/ - copied from r228431, head/sys/dev/viawd/ stable/9/sys/modules/viawd/ - copied from r228431, head/sys/modules/viawd/ Modified: stable/9/share/man/man4/Makefile stable/9/sys/amd64/conf/NOTES stable/9/sys/conf/files.amd64 stable/9/sys/conf/files.i386 stable/9/sys/dev/viawd/viawd.c stable/9/sys/dev/viawd/viawd.h stable/9/sys/i386/conf/NOTES stable/9/sys/modules/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/share/man/man4/Makefile == --- stable/9/share/man/man4/MakefileTue Jan 10 08:01:24 2012 (r229926) +++ stable/9/share/man/man4/MakefileTue Jan 10 08:16:28 2012 (r229927) @@ -501,6 +501,7 @@ MAN=aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -714,6 +715,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4=tpm.4 _urtw.4= urtw.4 +_viawd.4= viawd.4 _wpi.4=wpi.4 _xen.4=xen.4 Copied: stable/9/share/man/man4/viawd.4 (from r228431, head/share/man/man4/viawd.4) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/viawd.4 Tue Jan 10 08:16:28 2012 (r229927, copy of r228431, head/share/man/man4/viawd.4) @@ -0,0 +1,79 @@ +.\"- +.\" Copyright (c) 2011 Fabien Thomas +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 7, 2011 +.Dt VIAWD 4 +.Os +.Sh NAME +.Nm viawd +.Nd device driver for VIA south bridge watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device viawd" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +viawd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog interrupt timer present on +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). +.Pp +The VIA south bridge have a built-in watchdog timer, +which can be enabled and disabled by user's program and set between +1 to 1023 seconds. +.Pp +The +.Nm +driver when unloaded with running watchdog will reschedule the watchdog +to 5 minutes. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Fabien Thomas Aq fabi...@freebsd.org . Modified: stable/9/sys/amd64/conf/NOTES == --- stable/9/sys/amd64/conf/NOTES Tue Jan 10 08:01:24 2012 (r229926) +++ stable/9/sys/amd64/conf/NOTES Tue Jan 10 08:16:28 2012 (r229927) @@ -458,6 +458,7 @@ device tpm # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modifi
Re: svn commit: r229908 - head/usr.bin/brandelf
On Tue, Jan 10, 2012 at 02:58:29AM +, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Tue Jan 10 02:58:29 2012 > New Revision: 229908 > URL: http://svn.freebsd.org/changeset/base/229908 > > Log: > Fix warning when compiling with gcc46: >error: variable 'verbose' set but not use Maybe we should remove -v from the manual page as well or document as no-op? I'd still leave it in the code though, so there is no POLA violation. > Approved by:dim > MFC after: 3 days > > Modified: > head/usr.bin/brandelf/brandelf.c > > Modified: head/usr.bin/brandelf/brandelf.c > == > --- head/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:20 2012 > (r229907) > +++ head/usr.bin/brandelf/brandelf.c Tue Jan 10 02:58:29 2012 > (r229908) > @@ -64,7 +64,7 @@ main(int argc, char **argv) > const char *strtype = "FreeBSD"; > int type = ELFOSABI_FREEBSD; > int retval = 0; > - int ch, change = 0, verbose = 0, force = 0, listed = 0; > + int ch, change = 0, force = 0, listed = 0; > > while ((ch = getopt(argc, argv, "f:lt:v")) != -1) > switch (ch) { > @@ -84,7 +84,7 @@ main(int argc, char **argv) > listed = 1; > break; > case 'v': > - verbose = 1; > + /* does nothing */ > break; > case 't': > if (force) -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgp627O20skxd.pgp Description: PGP signature
svn commit: r229928 - in stable/8: share/man/man4 sys/amd64/conf sys/conf sys/dev/viawd sys/i386/conf sys/modules sys/modules/viawd
Author: fabient Date: Tue Jan 10 08:41:10 2012 New Revision: 229928 URL: http://svn.freebsd.org/changeset/base/229928 Log: MFC r228431, r228502, r228802: Add watchdog support for VIA south bridge chipset. Tested on VT8251, VX900 but CX700, VX800, VX855 should works. Added: stable/8/share/man/man4/viawd.4 - copied unchanged from r228431, head/share/man/man4/viawd.4 stable/8/sys/dev/viawd/ - copied from r228431, head/sys/dev/viawd/ stable/8/sys/modules/viawd/ - copied from r228431, head/sys/modules/viawd/ Modified: stable/8/share/man/man4/Makefile stable/8/sys/amd64/conf/NOTES stable/8/sys/conf/files.amd64 stable/8/sys/conf/files.i386 stable/8/sys/dev/viawd/viawd.c stable/8/sys/dev/viawd/viawd.h stable/8/sys/i386/conf/NOTES stable/8/sys/modules/Makefile Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/share/man/man4/Makefile == --- stable/8/share/man/man4/MakefileTue Jan 10 08:16:28 2012 (r229927) +++ stable/8/share/man/man4/MakefileTue Jan 10 08:41:10 2012 (r229928) @@ -482,6 +482,7 @@ MAN=aac.4 \ vga.4 \ vge.4 \ viapm.4 \ + ${_viawd.4} \ vinum.4 \ vkbd.4 \ vlan.4 \ @@ -688,6 +689,7 @@ _speaker.4= speaker.4 _spkr.4= spkr.4 _tpm.4=tpm.4 _urtw.4= urtw.4 +_viawd.4= viawd.4 _wpi.4=wpi.4 _xen.4=xen.4 Copied: stable/8/share/man/man4/viawd.4 (from r228431, head/share/man/man4/viawd.4) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/viawd.4 Tue Jan 10 08:41:10 2012 (r229928, copy of r228431, head/share/man/man4/viawd.4) @@ -0,0 +1,79 @@ +.\"- +.\" Copyright (c) 2011 Fabien Thomas +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 7, 2011 +.Dt VIAWD 4 +.Os +.Sh NAME +.Nm viawd +.Nd device driver for VIA south bridge watchdog timer +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device viawd" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +viawd_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides +.Xr watchdog 4 +support for the watchdog interrupt timer present on +VIA south bridge chipset (VT8251, CX700, VX800, VX855, VX900). +.Pp +The VIA south bridge have a built-in watchdog timer, +which can be enabled and disabled by user's program and set between +1 to 1023 seconds. +.Pp +The +.Nm +driver when unloaded with running watchdog will reschedule the watchdog +to 5 minutes. +.Sh SEE ALSO +.Xr watchdog 4 , +.Xr watchdog 8 , +.Xr watchdogd 8 , +.Xr watchdog 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and this manual page were written by +.An Fabien Thomas Aq fabi...@freebsd.org . Modified: stable/8/sys/amd64/conf/NOTES == --- stable/8/sys/amd64/conf/NOTES Tue Jan 10 08:16:28 2012 (r229927) +++ stable/8/sys/amd64/conf/NOTES Tue Jan 10 08:41:10 2012 (r229928) @@ -459,6 +459,7 @@ device tpm # device ichwd device amdsbwd +device viawd # # Temperature sensors: Modified: stable/8/sys/conf/files.amd64 =
Re: svn commit: r229908 - head/usr.bin/brandelf
On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: On Tue, Jan 10, 2012 at 02:58:29AM +, Eitan Adler wrote: Author: eadler (ports committer) Date: Tue Jan 10 02:58:29 2012 New Revision: 229908 URL: http://svn.freebsd.org/changeset/base/229908 Log: Fix warning when compiling with gcc46: error: variable 'verbose' set but not use Maybe we should remove -v from the manual page as well or document as no-op? I'd still leave it in the code though, so there is no POLA violation. It has been a no-op since the beginning of brandelf, and I have really no idea what the original author intended the verbose output to be. :) It is probably best to document it as a no-op now, to reduce possible confusion. ___ 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: r229929 - stable/9/sys/fs/pseudofs
Author: pho Date: Tue Jan 10 11:41:02 2012 New Revision: 229929 URL: http://svn.freebsd.org/changeset/base/229929 Log: MFC: r227550, r227576 Handle invalid large values for getdirentries(2) data buffer size. Fix build, use %d for int value formatting. Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c == --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Tue Jan 10 08:41:10 2012 (r229928) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Tue Jan 10 11:41:02 2012 (r229929) @@ -710,6 +710,13 @@ pfs_iterate(struct thread *td, struct pr return (0); } +/* Directory entry list */ +struct pfsentry { + STAILQ_ENTRY(pfsentry) link; + struct dirent entry; +}; +STAILQ_HEAD(pfsdirentlist, pfsentry); + /* * Return directory entries. */ @@ -722,12 +729,14 @@ pfs_readdir(struct vop_readdir_args *va) pid_t pid = pvd->pvd_pid; struct proc *p, *proc; struct pfs_node *pn; - struct dirent *entry; struct uio *uio; + struct pfsentry *pfsent, *pfsent2; + struct pfsdirentlist lst; off_t offset; int error, i, resid; - char *buf, *ent; + STAILQ_INIT(&lst); + error = 0; KASSERT(pd->pn_info == vn->v_mount->mnt_data, ("%s(): pn_info does not match mountpoint", __func__)); PFS_TRACE(("%s pid %lu", pd->pn_name, (unsigned long)pid)); @@ -747,8 +756,6 @@ pfs_readdir(struct vop_readdir_args *va) if (resid == 0) PFS_RETURN (0); - /* can't do this while holding the proc lock... */ - buf = malloc(resid, M_IOV, M_WAITOK | M_ZERO); sx_slock(&allproc_lock); pfs_lock(pd); @@ -756,7 +763,6 @@ pfs_readdir(struct vop_readdir_args *va) if (!pfs_visible(curthread, pd, pid, &proc)) { sx_sunlock(&allproc_lock); pfs_unlock(pd); - free(buf, M_IOV); PFS_RETURN (ENOENT); } KASSERT(pid == NO_PID || proc != NULL, @@ -770,57 +776,64 @@ pfs_readdir(struct vop_readdir_args *va) PROC_UNLOCK(proc); pfs_unlock(pd); sx_sunlock(&allproc_lock); - free(buf, M_IOV); PFS_RETURN (0); } } /* fill in entries */ - ent = buf; while (pfs_iterate(curthread, proc, pd, &pn, &p) != -1 && resid >= PFS_DELEN) { - entry = (struct dirent *)ent; - entry->d_reclen = PFS_DELEN; - entry->d_fileno = pn_fileno(pn, pid); + if ((pfsent = malloc(sizeof(struct pfsentry), M_IOV, + M_NOWAIT | M_ZERO)) == NULL) { + error = ENOMEM; + break; + } + pfsent->entry.d_reclen = PFS_DELEN; + pfsent->entry.d_fileno = pn_fileno(pn, pid); /* PFS_DELEN was picked to fit PFS_NAMLEN */ for (i = 0; i < PFS_NAMELEN - 1 && pn->pn_name[i] != '\0'; ++i) - entry->d_name[i] = pn->pn_name[i]; - entry->d_name[i] = 0; - entry->d_namlen = i; + pfsent->entry.d_name[i] = pn->pn_name[i]; + pfsent->entry.d_name[i] = 0; + pfsent->entry.d_namlen = i; switch (pn->pn_type) { case pfstype_procdir: KASSERT(p != NULL, ("reached procdir node with p == NULL")); - entry->d_namlen = snprintf(entry->d_name, + pfsent->entry.d_namlen = snprintf(pfsent->entry.d_name, PFS_NAMELEN, "%d", p->p_pid); /* fall through */ case pfstype_root: case pfstype_dir: case pfstype_this: case pfstype_parent: - entry->d_type = DT_DIR; + pfsent->entry.d_type = DT_DIR; break; case pfstype_file: - entry->d_type = DT_REG; +
svn commit: r229930 - head/share/man/man4
Author: melifaro Date: Tue Jan 10 12:45:24 2012 New Revision: 229930 URL: http://svn.freebsd.org/changeset/base/229930 Log: Add setsockopt(2) example to ng_ksocket(4). While here, fix formatting a bit Approved by: kib(mentor) MFC after: 2 weeks Modified: head/share/man/man4/ng_ksocket.4 Modified: head/share/man/man4/ng_ksocket.4 == --- head/share/man/man4/ng_ksocket.4Tue Jan 10 11:41:02 2012 (r229929) +++ head/share/man/man4/ng_ksocket.4Tue Jan 10 12:45:24 2012 (r229930) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2005 +.Dd January 09, 2012 .Dt NG_KSOCKET 4 .Os .Sh NAME @@ -199,7 +199,7 @@ For the address is the pathname as a doubly quoted string. .Pp Examples: -.Bl -tag -width XX +.Bl -tag -width "PF_LOCAL" .It Dv PF_LOCAL local/"/tmp/foo.socket" .It Dv PF_INET @@ -215,6 +215,12 @@ the normal form for that structure is used. In the future, more convenient encoding of the more common socket options may be supported. +.Pp +Setting socket options example: +.Bl -tag -width "PF_LOCAL" +.It Set FIB 2 for a socket (SOL_SOCKET, SO_SETFIB): +.Dv "setopt \&{ level=0x name=0x1014 data=[ 2 ] \&}" +.El .Sh SHUTDOWN This node shuts down upon receipt of a .Dv NGM_SHUTDOWN ___ 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: r229931 - stable/9/sys/fs/nullfs
Author: kib Date: Tue Jan 10 13:34:39 2012 New Revision: 229931 URL: http://svn.freebsd.org/changeset/base/229931 Log: MFC r229428: Document the state of the lowervp vnode for null_nodeget(). MFC r229600 (by dim): Output the correct vnode pointer. Modified: stable/9/sys/fs/nullfs/null_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/nullfs/null_subr.c == --- stable/9/sys/fs/nullfs/null_subr.c Tue Jan 10 12:45:24 2012 (r229930) +++ stable/9/sys/fs/nullfs/null_subr.c Tue Jan 10 13:34:39 2012 (r229931) @@ -198,6 +198,9 @@ null_nodeget(mp, lowervp, vpp) struct vnode *vp; int error; + ASSERT_VOP_LOCKED(lowervp, "lowervp"); + KASSERT(lowervp->v_usecount >= 1, ("Unreferenced vnode %p\n", lowervp)); + /* Lookup the hash firstly */ *vpp = null_hashget(mp, lowervp); if (*vpp != 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: r229932 - stable/9/sys/fs/nullfs
Author: kib Date: Tue Jan 10 13:41:14 2012 New Revision: 229932 URL: http://svn.freebsd.org/changeset/base/229932 Log: MFC r229431: Do the vput() for the lowervp in the null_nodeget() for error case too. Several callers of null_nodeget() did the cleanup itself, but several missed it, most prominent being null_bypass(). Remove the cleanup from the callers, now null_nodeget() handles lowervp free itself. Modified: stable/9/sys/fs/nullfs/null_subr.c stable/9/sys/fs/nullfs/null_vfsops.c stable/9/sys/fs/nullfs/null_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/nullfs/null_subr.c == --- stable/9/sys/fs/nullfs/null_subr.c Tue Jan 10 13:34:39 2012 (r229931) +++ stable/9/sys/fs/nullfs/null_subr.c Tue Jan 10 13:41:14 2012 (r229932) @@ -171,6 +171,8 @@ null_hashins(mp, xp) static void null_insmntque_dtr(struct vnode *vp, void *xp) { + + vput(((struct null_node *)xp)->null_lowervp); vp->v_data = NULL; vp->v_vnlock = &vp->v_lock; free(xp, M_NULLFSNODE); @@ -226,6 +228,7 @@ null_nodeget(mp, lowervp, vpp) error = getnewvnode("null", mp, &null_vnodeops, &vp); if (error) { + vput(lowervp); free(xp, M_NULLFSNODE); return (error); } Modified: stable/9/sys/fs/nullfs/null_vfsops.c == --- stable/9/sys/fs/nullfs/null_vfsops.cTue Jan 10 13:34:39 2012 (r229931) +++ stable/9/sys/fs/nullfs/null_vfsops.cTue Jan 10 13:41:14 2012 (r229932) @@ -157,8 +157,7 @@ nullfs_mount(struct mount *mp) * Make sure the node alias worked */ if (error) { - vrele(lowerrootvp); - free(xmp, M_NULLFSMNT); /* XXX */ + free(xmp, M_NULLFSMNT); return (error); } Modified: stable/9/sys/fs/nullfs/null_vnops.c == --- stable/9/sys/fs/nullfs/null_vnops.c Tue Jan 10 13:34:39 2012 (r229931) +++ stable/9/sys/fs/nullfs/null_vnops.c Tue Jan 10 13:41:14 2012 (r229932) @@ -365,9 +365,7 @@ null_lookup(struct vop_lookup_args *ap) vrele(lvp); } else { error = null_nodeget(dvp->v_mount, lvp, &vp); - if (error) - vput(lvp); - else + if (error == 0) *ap->a_vpp = vp; } } @@ -809,9 +807,7 @@ null_vptocnp(struct vop_vptocnp_args *ap NULLVPTOLOWERVP(*dvp); #endif VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */ - } else - vput(ldvp); - + } vn_lock(vp, locked | LK_RETRY); return (error); } ___ 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: r229933 - in head/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools
Author: syrinx Date: Tue Jan 10 15:29:03 2012 New Revision: 229933 URL: http://svn.freebsd.org/changeset/base/229933 Log: Implement an option to execute SNMP walks using GETBULK requests in bsnmpwalk(1) retrieving multiple values with a Single PDU. Reviewed by: philip@ Tested by:tsanand129 (at) gmail (dot) com Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.h Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1 == --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1Tue Jan 10 13:41:14 2012(r229932) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.1Tue Jan 10 15:29:03 2012(r229933) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2007 +.Dd January 10, 2012 .Dt BSNMPGET 1 .Os .Sh NAME @@ -112,7 +112,7 @@ objects whose values will be retrived, w received successfully. .Pp .Nm Bsnmpwalk -queries an agent with SMNP GetNextRequest packets, +queries an agent with ether SMNP GetNextRequest or GetBulkRequest packets, asking for values of OID instances that are a part of the object subtree rooted at the provided OIDs. .Pp @@ -220,7 +220,7 @@ The path of the posix local (unix domain transport is used. .It Fl M Ar max-repetitions The value for the max-repetitions field in a GetBulk PDU. -Default is 1. +Default is 10. .It Fl N Ar non-repeaters The value for the non-repeaters field in a GetBulk PDU. Default is 0. @@ -251,8 +251,17 @@ A binary localized privacy key to use wh By default plain text SNMPv3 PDUs are sent. .It Fl p Ar [get|getnext|getbulk] The PDU type to send by -.Nm bsmpget . -Default is get. +.Nm bsmpget +and +.Nm bsnmpwalk . +Default is get +for +.Nm bsmpget +and getnext for +.Nm bsnmpwalk . +Getbulk allows executing the so called SNMP "bulkwalks" allowing the values of +multiple columns to be retrived in a single PDU by +.Nm bsnmpwalk . .It Fl r Ar retries Number of resends of request packets before giving up if the agent does not respond after the first try. Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c == --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.cTue Jan 10 13:41:14 2012(r229932) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.cTue Jan 10 15:29:03 2012(r229933) @@ -76,8 +76,9 @@ usage(void) (program == BSNMPWALK) ? "[-dhnK]" : (program == BSNMPSET) ? "[-adehnK]" : "", - (program == BSNMPGET) ? " [-M max-repetitions] [-N non-repeaters]" : "", - (program == BSNMPGET) ? "[-p pdu] " : "", + (program == BSNMPGET || program == BSNMPWALK) ? + " [-M max-repetitions] [-N non-repeaters]" : "", + (program == BSNMPGET || program == BSNMPWALK) ? "[-p pdu] " : "", (program == BSNMPGET) ? " OID [OID ...]" : (program == BSNMPWALK || program == BSNMPSET) ? " [OID ...]" : "" @@ -150,7 +151,7 @@ snmptool_parse_options(struct snmp_tooli switch (program) { case BSNMPWALK: - opts = "dhnKA:b:C:I:i:l:o:P:r:s:t:U:v:"; + opts = "dhnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:"; break; case BSNMPGET: opts = "aDdehnKA:b:C:I:i:l:M:N:o:P:p:r:s:t:U:v:"; @@ -398,7 +399,7 @@ snmptool_get(struct snmp_toolinfo *snmpt } if (snmp_parse_resp(&resp, &req) >= 0) { - snmp_output_resp(snmptoolctx, &resp); + snmp_output_resp(snmptoolctx, &resp, NULL); break; } @@ -460,8 +461,14 @@ snmptool_walk(struct snmp_toolinfo *snmp struct snmp_pdu req, resp; struct asn_oid root;/* Keep the initial oid. */ int32_t outputs, rc; + uint32_t op; - snmp_pdu_create(&req, SNMP_PDU_GETNEXT); + if (GET_PDUTYPE(snmptoolctx) == SNMP_PDU_GETBULK) + op = SNMP_PDU_GETBULK; + else + op = SNMP_PDU_GETNEXT; + + snmp_pdu_create(&req, op); while ((rc = snmp_pdu_add_bindings(snmptoolctx, NULL, snmptool_add_vbind, &req, 1)) > 0) { @@ -470,6 +477,10 @@ snmptool_walk(struct snmp_toolinfo *snmp memset(&root, 0, sizeof(struct asn_oid)); asn_append_oid(&root, &(req.bindings[0].var)); + if (op == SNMP_PDU_GETBULK) + snmpget_fix_getbulk(&req, GET_MAXREP(snmptoolctx), + GET_NONREP(snmptoolctx)); + outputs = 0; while (snmp_dialog(&req, &resp) >= 0) { if ((snmp_parse_resp(&resp, &req)) < 0) { @@ -479,21 +490,24 @@ snmptool_walk(struct s
Re: svn commit: r229415 - head/lib/libvgl
Hello; --- Mar 10/1/12, Dimitry Andric ha scritto: > Data: Martedì 10 gennaio 2012, 03:07 > On 2012-01-03 20:47, Pedro F. Giffuni > wrote: > > Author: pfg > > Date: Tue Jan 3 19:47:32 2012 > > New Revision: 229415 > > URL: http://svn.freebsd.org/changeset/base/229415 > > > > Log: > > Integrate the line drawing algorithm from > the book "Graphic Gems 1". > > > > http://www.graphicsgems.org/ > > > > At the time it claimed to be 3-4 times > faster than the traditional > > algorithm. > > Btw, why is this library in the base system at all? > It seems totally unused, except for one picobsd > Makefile? > It's a very FreeBSD-specific library and it's the best example on how to do low level screen manipulation. I think it was not meant to live for so long in the base system but it's pretty small and specific so no one has taken the time to turn it into a port. I think it is still used in some ports like libggi. cheers, Pedro. ___ 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: r229934 - head/sys/vm
Author: kib Date: Tue Jan 10 18:05:44 2012 New Revision: 229934 URL: http://svn.freebsd.org/changeset/base/229934 Log: Change the type of the paging_in_progress refcounter from u_short to u_int. With the auto-sized buffer cache on the modern machines, UFS metadata can generate more the 65535 pages belonging to the buffers undergoing i/o, overflowing the counter. Reported and tested by: jimharris Reviewed by: alc MFC after:1 week Modified: head/sys/vm/vm_object.h Modified: head/sys/vm/vm_object.h == --- head/sys/vm/vm_object.h Tue Jan 10 15:29:03 2012(r229933) +++ head/sys/vm/vm_object.h Tue Jan 10 18:05:44 2012(r229934) @@ -96,7 +96,7 @@ struct vm_object { objtype_t type; /* type of pager */ u_short flags; /* see below */ u_short pg_color; /* (c) color of first page in obj */ - u_short paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ + u_int paging_in_progress; /* Paging (in or out) so don't collapse or destroy */ int resident_page_count;/* number of resident pages */ struct vm_object *backing_object; /* object that I'm a shadow of */ vm_ooffset_t backing_object_offset;/* Offset in backing object */ ___ 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: r229415 - head/lib/libvgl
Eitan Adler wrote this message on Mon, Jan 09, 2012 at 23:48 -0500: > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: > > Last time I did benchmarking on this ~10 years ago, it was slower to > > use xor instead of using assignments... > > I'd be shocked if the compiler didn't optimize this away to an XCHG. As someone else mentioned, it did... But it's still an obfuscation of the code... Not everyone knows this "trick" to swap two vars... If it isn't timing critical, it's better to be maintainable... Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." ___ 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: r229935 - stable/9/sys/conf
Author: jh Date: Tue Jan 10 18:20:19 2012 New Revision: 229935 URL: http://svn.freebsd.org/changeset/base/229935 Log: MFC r228021: Add LINT-NOINET LINT-NOINET6 and LINT-NOIP to the make clean target. This was missed in r221353. Modified: stable/9/sys/conf/makeLINT.mk Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/conf/makeLINT.mk == --- stable/9/sys/conf/makeLINT.mk Tue Jan 10 18:05:44 2012 (r229934) +++ stable/9/sys/conf/makeLINT.mk Tue Jan 10 18:20:19 2012 (r229935) @@ -6,7 +6,7 @@ all: clean: rm -f LINT .if ${TARGET} == "amd64" || ${TARGET} == "i386" - rm -f LINT-VIMAGE + rm -f LINT-VIMAGE LINT-NOINET LINT-NOINET6 LINT-NOIP .endif NOTES= ../../conf/NOTES NOTES ___ 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: r229936 - head/lib/libutil
Author: ghelmer Date: Tue Jan 10 18:43:27 2012 New Revision: 229936 URL: http://svn.freebsd.org/changeset/base/229936 Log: Set the FD_CLOEXEC flag on the open pidfile file descriptor. Discussed with: pjd, des Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c == --- head/lib/libutil/pidfile.c Tue Jan 10 18:20:19 2012(r229935) +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012(r229936) @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo free(pfh); return (NULL); } + + /* +* Prevent the file descriptor from escaping to other +* programs via exec(3). +*/ + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + error = errno; + unlink(pfh->pf_path); + close(fd); + free(pfh); + errno = error; + return (NULL); + } + /* * Remember file information, so in pidfile_write() we are sure we write * to the proper descriptor. ___ 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: r229415 - head/lib/libvgl
--- Mar 10/1/12, John-Mark Gurney ha scritto: > Eitan Adler wrote this message on > Mon, Jan 09, 2012 at 23:48 -0500: > > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney > > wrote: > > > Last time I did benchmarking on this ~10 years > > > ago, it was slower to use xor instead of > > > using assignments... > > > > I'd be shocked if the compiler didn't optimize this > > away to an XCHG. > > As someone else mentioned, it did... But it's still > an obfuscation of the code... > Not everyone knows this "trick" to swap two vars... > If it isn't timing critical, it's better to be > maintainable... > The code was taken from a book and it's pretty much ubiquitous as-is. If not everyone knows this "trick", then I guess it simply proves that there is a lot of value in reading books after all ;-). cheers, Pedro. ___ 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: r229937 - in head/lib: libc/gen libutil
Author: ghelmer Date: Tue Jan 10 19:53:25 2012 New Revision: 229937 URL: http://svn.freebsd.org/changeset/base/229937 Log: Add pidfile_fileno() to obtain the file descriptor for an open pidfile. Modified: head/lib/libc/gen/getnetgrent.c head/lib/libutil/libutil.h head/lib/libutil/pidfile.3 head/lib/libutil/pidfile.c Modified: head/lib/libc/gen/getnetgrent.c == --- head/lib/libc/gen/getnetgrent.c Tue Jan 10 18:43:27 2012 (r229936) +++ head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:53:25 2012 (r229937) @@ -203,9 +203,7 @@ setnetgrent(const char *group) if (parse_netgrp(group)) endnetgrent(); else { - grouphead.grname = (char *) - malloc(strlen(group) + 1); - strcpy(grouphead.grname, group); + grouphead.grname = strdup(group); } if (netf) fclose(netf); @@ -417,7 +415,7 @@ static int parse_netgrp(const char *group) { char *spos, *epos; - int len, strpos; + int len, strpos, freepos; #ifdef DEBUG int fields; #endif @@ -454,9 +452,9 @@ parse_netgrp(const char *group) while (pos != NULL && *pos != '\0') { if (*pos == '(') { grp = (struct netgrp *)malloc(sizeof (struct netgrp)); + if (grp == NULL) + return(1); bzero((char *)grp, sizeof (struct netgrp)); - grp->ng_next = grouphead.gr; - grouphead.gr = grp; pos++; gpos = strsep(&pos, ")"); #ifdef DEBUG @@ -477,6 +475,13 @@ parse_netgrp(const char *group) if (len > 0) { grp->ng_str[strpos] = (char *) malloc(len + 1); + if (grp->ng_str[strpos] == NULL) { + for (freepos = 0; freepos < strpos; freepos++) + if (grp->ng_str[freepos] != NULL) + free(grp->ng_str[freepos]); + free(grp); + return(1); + } bcopy(spos, grp->ng_str[strpos], len + 1); } @@ -490,6 +495,8 @@ parse_netgrp(const char *group) grp->ng_str[strpos] = NULL; } } + grp->ng_next = grouphead.gr; + grouphead.gr = grp; #ifdef DEBUG /* * Note: on other platforms, malformed netgroup @@ -526,7 +533,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep, *olinep; + char *pos, *spos, *linep; int len, olen; int cont; struct linelist *lp; @@ -534,6 +541,7 @@ read_for_group(const char *group) #ifdef YP char *result; int resultlen; + linep = NULL; while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { if (_netgr_yp_enabled) { @@ -554,6 +562,7 @@ read_for_group(const char *group) free(result); } #else + linep = NULL; while (fgets(line, LINSIZ, netf) != NULL) { #endif pos = (char *)&line; @@ -576,8 +585,14 @@ read_for_group(const char *group) pos++; if (*pos != '\n' && *pos != '\0') { lp = (struct linelist *)malloc(sizeof (*lp)); + if (lp == NULL) + return(NULL); lp->l_parsed = 0; lp->l_groupname = (char *)malloc(len + 1); + if (lp->l_groupname == NULL) { + free(lp); + return(NULL); + } bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -595,15 +610,15 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { -
svn commit: r229938 - head/lib/libc/gen
Author: ghelmer Date: Tue Jan 10 19:54:53 2012 New Revision: 229938 URL: http://svn.freebsd.org/changeset/base/229938 Log: Revert unintentional commit of changes to getnetgrent.c. Modified: head/lib/libc/gen/getnetgrent.c Modified: head/lib/libc/gen/getnetgrent.c == --- head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:53:25 2012 (r229937) +++ head/lib/libc/gen/getnetgrent.c Tue Jan 10 19:54:53 2012 (r229938) @@ -203,7 +203,9 @@ setnetgrent(const char *group) if (parse_netgrp(group)) endnetgrent(); else { - grouphead.grname = strdup(group); + grouphead.grname = (char *) + malloc(strlen(group) + 1); + strcpy(grouphead.grname, group); } if (netf) fclose(netf); @@ -415,7 +417,7 @@ static int parse_netgrp(const char *group) { char *spos, *epos; - int len, strpos, freepos; + int len, strpos; #ifdef DEBUG int fields; #endif @@ -452,9 +454,9 @@ parse_netgrp(const char *group) while (pos != NULL && *pos != '\0') { if (*pos == '(') { grp = (struct netgrp *)malloc(sizeof (struct netgrp)); - if (grp == NULL) - return(1); bzero((char *)grp, sizeof (struct netgrp)); + grp->ng_next = grouphead.gr; + grouphead.gr = grp; pos++; gpos = strsep(&pos, ")"); #ifdef DEBUG @@ -475,13 +477,6 @@ parse_netgrp(const char *group) if (len > 0) { grp->ng_str[strpos] = (char *) malloc(len + 1); - if (grp->ng_str[strpos] == NULL) { - for (freepos = 0; freepos < strpos; freepos++) - if (grp->ng_str[freepos] != NULL) - free(grp->ng_str[freepos]); - free(grp); - return(1); - } bcopy(spos, grp->ng_str[strpos], len + 1); } @@ -495,8 +490,6 @@ parse_netgrp(const char *group) grp->ng_str[strpos] = NULL; } } - grp->ng_next = grouphead.gr; - grouphead.gr = grp; #ifdef DEBUG /* * Note: on other platforms, malformed netgroup @@ -533,7 +526,7 @@ parse_netgrp(const char *group) static struct linelist * read_for_group(const char *group) { - char *pos, *spos, *linep; + char *pos, *spos, *linep, *olinep; int len, olen; int cont; struct linelist *lp; @@ -541,7 +534,6 @@ read_for_group(const char *group) #ifdef YP char *result; int resultlen; - linep = NULL; while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { if (_netgr_yp_enabled) { @@ -562,7 +554,6 @@ read_for_group(const char *group) free(result); } #else - linep = NULL; while (fgets(line, LINSIZ, netf) != NULL) { #endif pos = (char *)&line; @@ -585,14 +576,8 @@ read_for_group(const char *group) pos++; if (*pos != '\n' && *pos != '\0') { lp = (struct linelist *)malloc(sizeof (*lp)); - if (lp == NULL) - return(NULL); lp->l_parsed = 0; lp->l_groupname = (char *)malloc(len + 1); - if (lp->l_groupname == NULL) { - free(lp); - return(NULL); - } bcopy(spos, lp->l_groupname, len); *(lp->l_groupname + len) = '\0'; len = strlen(pos); @@ -610,15 +595,15 @@ read_for_group(const char *group) } else cont = 0; if (len > 0) { - linep = (char *)reallocf(linep, olen + len + 1); -
svn commit: r229939 - in head/sys/dev: e1000 ixgbe netmap
Author: luigi Date: Tue Jan 10 19:57:23 2012 New Revision: 229939 URL: http://svn.freebsd.org/changeset/base/229939 Log: small code cleanup in preparation for future modifications in the memory allocator used by netmap. No functional change, two small bug fixes: - in if_re.c add a missing bus_dmamap_sync() - in netmap.c comment out a spurious free() in an error handling block Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Tue Jan 10 19:54:53 2012(r229938) +++ head/sys/dev/e1000/if_em.c Tue Jan 10 19:57:23 2012(r229939) @@ -3297,16 +3297,15 @@ em_setup_transmit_ring(struct tx_ring *t #ifdef DEV_NETMAP if (slot) { int si = i + na->tx_rings[txr->me].nkr_hwofs; + uint64_t paddr; void *addr; if (si >= na->num_tx_desc) si -= na->num_tx_desc; - addr = NMB(slot + si); - txr->tx_base[i].buffer_addr = - htole64(vtophys(addr)); + addr = PNMB(slot + si, &paddr); + txr->tx_base[i].buffer_addr = htole64(paddr); /* reload the map for netmap mode */ - netmap_load_map(txr->txtag, - txbuf->map, addr, na->buff_size); + netmap_load_map(txr->txtag, txbuf->map, addr); } #endif /* DEV_NETMAP */ @@ -4104,9 +4103,6 @@ em_setup_receive_ring(struct rx_ring *rx sj += adapter->num_rx_desc; for (int j = 0; j != adapter->num_rx_desc; j++, sj++) { - void *addr; - int sz; - rxbuf = &rxr->rx_buffers[j]; /* no mbuf and regular mode -> skip this entry */ if (rxbuf->m_head == NULL && !slot) @@ -4115,12 +4111,20 @@ em_setup_receive_ring(struct rx_ring *rx if (sj >= adapter->num_rx_desc) sj -= adapter->num_rx_desc; /* see comment, set slot addr and map */ - addr = slot ? NMB(slot + sj) : rxbuf->m_head->m_data; - sz = slot ? na->buff_size : adapter->rx_mbuf_sz; - // XXX load or reload ? - netmap_load_map(rxr->rxtag, rxbuf->map, addr, sz); - /* Update descriptor */ - rxr->rx_base[j].buffer_addr = htole64(vtophys(addr)); + if (slot) { + uint64_t paddr; + void *addr = PNMB(slot + sj, &paddr); + netmap_load_map(rxr->rxtag, rxbuf->map, addr); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(paddr); + } else { + /* Get the memory mapping */ + bus_dmamap_load_mbuf_sg(rxr->rxtag, + rxbuf->map, rxbuf->m_head, seg, + &nsegs, BUS_DMA_NOWAIT); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); + } bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); } } Modified: head/sys/dev/e1000/if_igb.c == --- head/sys/dev/e1000/if_igb.c Tue Jan 10 19:54:53 2012(r229938) +++ head/sys/dev/e1000/if_igb.c Tue Jan 10 19:57:23 2012(r229939) @@ -3320,8 +3320,7 @@ igb_setup_transmit_ring(struct tx_ring * if (si < 0) si += na->num_tx_desc; - netmap_load_map(txr->txtag, txbuf->map, - NMB(slot + si), na->buff_size); + netmap_load_map(txr->txtag, txbuf->map, NMB(slot + si)); } #endif /* DEV_NETMAP */ /* clear the watch index */ @@ -4062,15 +4061,15 @@ igb_setup_receive_ring(struct rx_ring *r if (slot) { /* slot sj is mapped to the i-th NIC-ring entry */ int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + uint64_t paddr; void *addr; if (sj < 0) sj += na->num_rx_desc; - addr = NMB(slot + sj); - netmap_load_map(rxr->ptag, -
svn commit: r229940 - head/sys/dev/et
Author: yongari Date: Tue Jan 10 20:52:02 2012 New Revision: 229940 URL: http://svn.freebsd.org/changeset/base/229940 Log: style. No functional changes. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c == --- head/sys/dev/et/if_et.c Tue Jan 10 19:57:23 2012(r229939) +++ head/sys/dev/et/if_et.c Tue Jan 10 20:52:02 2012(r229940) @@ -363,8 +363,9 @@ fail: static int et_detach(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); if (device_is_attached(dev)) { ether_ifdetach(sc->ifp); ET_LOCK(sc); @@ -401,8 +402,9 @@ et_detach(device_t dev) static int et_shutdown(device_t dev) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; + sc = device_get_softc(dev); ET_LOCK(sc); et_stop(sc); ET_UNLOCK(sc); @@ -412,10 +414,11 @@ et_shutdown(device_t dev) static int et_miibus_readreg(device_t dev, int phy, int reg) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i, ret; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -455,10 +458,11 @@ back: static int et_miibus_writereg(device_t dev, int phy, int reg, int val0) { - struct et_softc *sc = device_get_softc(dev); + struct et_softc *sc; uint32_t val; int i; + sc = device_get_softc(dev); /* Stop any pending operations */ CSR_WRITE_4(sc, ET_MII_CMD, 0); @@ -593,10 +597,12 @@ et_miibus_statchg(device_t dev) static int et_ifmedia_upd_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; struct mii_softc *miisc; + sc = ifp->if_softc; + mii = device_get_softc(sc->sc_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); return (mii_mediachg(mii)); @@ -605,9 +611,10 @@ et_ifmedia_upd_locked(struct ifnet *ifp) static int et_ifmedia_upd(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; int res; + sc = ifp->if_softc; ET_LOCK(sc); res = et_ifmedia_upd_locked(ifp); ET_UNLOCK(sc); @@ -638,10 +645,11 @@ et_ifmedia_sts(struct ifnet *ifp, struct static void et_stop(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; + struct ifnet *ifp; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; callout_stop(&sc->sc_tick); /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0x); @@ -757,6 +765,7 @@ et_get_eaddr(device_t dev, uint8_t eaddr static void et_reset(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_MAC_CFG1, ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC | @@ -1163,10 +1172,11 @@ et_chip_attach(struct et_softc *sc) static void et_intr(void *xsc) { - struct et_softc *sc = xsc; + struct et_softc *sc; struct ifnet *ifp; uint32_t status; + sc = xsc; ET_LOCK(sc); ifp = sc->ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -1268,10 +1278,14 @@ et_init(void *xsc) static int et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); - struct ifreq *ifr = (struct ifreq *)data; - int error = 0, mask, max_framelen; + struct et_softc *sc; + struct mii_data *mii; + struct ifreq *ifr; + int error, mask, max_framelen; + + sc = ifp->if_softc; + ifr = (struct ifreq *)data; + error = 0; /* XXX LOCKSUSED */ switch (cmd) { @@ -1295,6 +1309,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFMEDIA: case SIOCGIFMEDIA: + mii = device_get_softc(sc->sc_miibus); error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd); break; @@ -1424,8 +1439,9 @@ et_start_locked(struct ifnet *ifp) static void et_start(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + sc = ifp->if_softc; ET_LOCK(sc); et_start_locked(ifp); ET_UNLOCK(sc); @@ -1456,6 +1472,7 @@ et_watchdog(struct et_softc *sc) static int et_stop_rxdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET_RXDMA_CTRL, ET_RXDMA_CTRL_HALT | ET_RXDMA_CTRL_RING1_ENABLE); @@ -1470,6 +1487,7 @@ et_stop_rxdma(struct et_softc *sc) static int et_stop_txdma(struct et_softc *sc) { + CSR_WRITE_4(sc, ET
Re: svn commit: r229667 - head/usr.sbin/daemon
On Jan 6, 2012, at 12:00 AM, Garrett Cooper wrote: > On Thu, Jan 5, 2012 at 6:58 PM, Doug Barton wrote: >> On 01/05/2012 14:48, Guy Helmer wrote: >>> Allow daemon(8) to run pidfile_open() before relenquishing privileges >>> so pid files can be written in /var/run when started as root. >> >> I'm not sure how useful this is since when daemon is exiting it won't be >> able to remove the pid file (unless I'm missing something). >> >> Isn't it better to pre-create the pid file with the proper permissions >> for the unprivileged user? > >As another aside, the file descriptor never has fcntl(, > FD_CLOEXEC) run on it, so it leaks the file descriptors across execs.. > that's not good... I just added an fcntl(…, FD_CLOEXEC) call to pidfile_open() so this particular problem should be resolved. Guy This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. ___ 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: r229936 - head/lib/libutil
On Tue, Jan 10, 2012 at 06:43:27PM +, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 18:43:27 2012 > New Revision: 229936 > URL: http://svn.freebsd.org/changeset/base/229936 > > Log: > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > > Discussed with: pjd, des Could you also update manual page to note that pidfile_open(3) can now also set errno via fcntl(2)? > Modified: > head/lib/libutil/pidfile.c > > Modified: head/lib/libutil/pidfile.c > == > --- head/lib/libutil/pidfile.cTue Jan 10 18:20:19 2012 > (r229935) > +++ head/lib/libutil/pidfile.cTue Jan 10 18:43:27 2012 > (r229936) > @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo > free(pfh); > return (NULL); > } > + > + /* > + * Prevent the file descriptor from escaping to other > + * programs via exec(3). > + */ > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { > + error = errno; > + unlink(pfh->pf_path); > + close(fd); > + free(pfh); > + errno = error; > + return (NULL); > + } > + > /* >* Remember file information, so in pidfile_write() we are sure we write >* to the proper descriptor. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgpWO5Vpt0BZm.pgp Description: PGP signature
Re: svn commit: r229936 - head/lib/libutil
On Tue, Jan 10, 2012 at 10:25:26PM +0100, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 06:43:27PM +, Guy Helmer wrote: > > Author: ghelmer > > Date: Tue Jan 10 18:43:27 2012 > > New Revision: 229936 > > URL: http://svn.freebsd.org/changeset/base/229936 > > > > Log: > > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > > > > Discussed with: pjd, des > > Could you also update manual page to note that pidfile_open(3) can now > also set errno via fcntl(2)? Actually, it would also be useful to document the fact that we now set FD_CLOEXEC flag, so one doesn't have to look at the code to find it. > > Modified: > > head/lib/libutil/pidfile.c > > > > Modified: head/lib/libutil/pidfile.c > > == > > --- head/lib/libutil/pidfile.c Tue Jan 10 18:20:19 2012 > > (r229935) > > +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 > > (r229936) > > @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo > > free(pfh); > > return (NULL); > > } > > + > > + /* > > +* Prevent the file descriptor from escaping to other > > +* programs via exec(3). > > +*/ > > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { > > + error = errno; > > + unlink(pfh->pf_path); > > + close(fd); > > + free(pfh); > > + errno = error; > > + return (NULL); > > + } > > + > > /* > > * Remember file information, so in pidfile_write() we are sure we write > > * to the proper descriptor. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgp8YEXkPK2hH.pgp Description: PGP signature
svn commit: r229941 - head/lib/libutil
Author: ghelmer Date: Tue Jan 10 21:39:43 2012 New Revision: 229941 URL: http://svn.freebsd.org/changeset/base/229941 Log: Document that pidfile_open() now sets the FD_CLOEXEC flag on the open file descriptor, and that errors can be returned as a result of the fcntl(2) system call. Modified: head/lib/libutil/pidfile.3 Modified: head/lib/libutil/pidfile.3 == --- head/lib/libutil/pidfile.3 Tue Jan 10 20:52:02 2012(r229940) +++ head/lib/libutil/pidfile.3 Tue Jan 10 21:39:43 2012(r229941) @@ -79,6 +79,9 @@ argument is .Dv NULL , .Pa /var/run/ Ns Ao Va progname Ac Ns Pa .pid file will be used. +The +.Fn pidfile_open +function sets the FD_CLOEXEC close-on-exec flag on the open file descriptor. .Pp The .Fn pidfile_write @@ -200,6 +203,7 @@ The function may also fail and set .Va errno for any errors specified for the +.Xr fcntl 2 , .Xr fstat 2 , .Xr open 2 , and ___ 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: r229936 - head/lib/libutil
On Jan 10, 2012, at 3:27 PM, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 10:25:26PM +0100, Pawel Jakub Dawidek wrote: >> On Tue, Jan 10, 2012 at 06:43:27PM +, Guy Helmer wrote: >>> Author: ghelmer >>> Date: Tue Jan 10 18:43:27 2012 >>> New Revision: 229936 >>> URL: http://svn.freebsd.org/changeset/base/229936 >>> >>> Log: >>> Set the FD_CLOEXEC flag on the open pidfile file descriptor. >>> >>> Discussed with: pjd, des >> >> Could you also update manual page to note that pidfile_open(3) can now >> also set errno via fcntl(2)? > > Actually, it would also be useful to document the fact that we now set > FD_CLOEXEC flag, so one doesn't have to look at the code to find it. Thanks for reminding me, I mean to do that earlier. Guy > >>> Modified: >>> head/lib/libutil/pidfile.c >>> >>> Modified: head/lib/libutil/pidfile.c >>> == >>> --- head/lib/libutil/pidfile.c Tue Jan 10 18:20:19 2012 >>> (r229935) >>> +++ head/lib/libutil/pidfile.c Tue Jan 10 18:43:27 2012 >>> (r229936) >>> @@ -137,6 +137,20 @@ pidfile_open(const char *path, mode_t mo >>> free(pfh); >>> return (NULL); >>> } >>> + >>> + /* >>> +* Prevent the file descriptor from escaping to other >>> +* programs via exec(3). >>> +*/ >>> + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { >>> + error = errno; >>> + unlink(pfh->pf_path); >>> + close(fd); >>> + free(pfh); >>> + errno = error; >>> + return (NULL); >>> + } >>> + >>> /* >>> * Remember file information, so in pidfile_write() we are sure we write >>> * to the proper descriptor. > > -- > Pawel Jakub Dawidek http://www.wheelsystems.com > FreeBSD committer http://www.FreeBSD.org > Am I Evil? Yes, I Am! http://yomoli.com This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. ___ 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: r229937 - in head/lib: libc/gen libutil
On Tue, Jan 10, 2012 at 07:53:25PM +, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 19:53:25 2012 > New Revision: 229937 > URL: http://svn.freebsd.org/changeset/base/229937 > > Log: > Add pidfile_fileno() to obtain the file descriptor for an open > pidfile. > > Modified: > head/lib/libc/gen/getnetgrent.c > head/lib/libutil/libutil.h > head/lib/libutil/pidfile.3 > head/lib/libutil/pidfile.c [...] > @@ -92,6 +94,10 @@ to start a child process. > The > .Fn pidfile_remove > function closes and removes a pidfile. > +.Pp > +The > +.Fn pidfile_fileno > +function returns the file descriptor for the open pid file. In other places in this manual page we use 'pidfile' as a single word. > .Sh RETURN VALUES > The > .Fn pidfile_open > @@ -105,15 +111,25 @@ If an error occurs, > will be set. > .Pp > .Rv -std pidfile_write pidfile_close pidfile_remove > +.Pp > +The > +.Fn pidfile_fileno > +function returns the low-level file descriptor. > +It returns -1 and sets I think you should also use .Va or .Li macro for -1. > +.Va errno > +if a NULL > +.Vt pidfh > +is specified, or if the pidfile is no longer open. > .Sh EXAMPLES > The following example shows in which order these functions should be used. > Note that it is safe to pass > .Dv NULL > to > .Fn pidfile_write , > -.Fn pidfile_remove > -and > +.Fn pidfile_remove , > .Fn pidfile_close > +and > +.Fn pidfile_fileno > functions. > .Bd -literal > struct pidfh *pfh; > @@ -244,6 +260,16 @@ and > system calls and the > .Xr flopen 3 > library function. > +.Pp > +The > +.Fn pidfile_fileno > +function will fail if: > +.Bl -tag -width Er > +.It Bq Er EDOOFUS > +Improper function use. > +Probably called not from the process which used > +.Fn pidfile_open . > +.El > .Sh SEE ALSO > .Xr open 2 , > .Xr daemon 3 , > > Modified: head/lib/libutil/pidfile.c > == > --- head/lib/libutil/pidfile.cTue Jan 10 18:43:27 2012 > (r229936) > +++ head/lib/libutil/pidfile.cTue Jan 10 19:53:25 2012 > (r229937) > @@ -266,3 +266,13 @@ pidfile_remove(struct pidfh *pfh) > > return (_pidfile_remove(pfh, 1)); > } > + > +int > +pidfile_fileno(struct pidfh *pfh) > +{ Missing empty line here for function without local variables. > + if (pfh == NULL || pfh->pf_fd == -1) { > + errno = EDOOFUS; > + return (-1); > + } > + return (pfh->pf_fd); > +} BTW. If you are working on pidfile, it would be nice to move pidfile structure declaration into pidfile.c. There is no need to expose it. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgpDbtcHGbcpg.pgp Description: PGP signature
svn commit: r229942 - head/lib/libutil
Author: ghelmer Date: Tue Jan 10 21:47:58 2012 New Revision: 229942 URL: http://svn.freebsd.org/changeset/base/229942 Log: Style fixes courtesy of pjd. Modified: head/lib/libutil/pidfile.3 head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.3 == --- head/lib/libutil/pidfile.3 Tue Jan 10 21:39:43 2012(r229941) +++ head/lib/libutil/pidfile.3 Tue Jan 10 21:47:58 2012(r229942) @@ -100,7 +100,7 @@ function closes and removes a pidfile. .Pp The .Fn pidfile_fileno -function returns the file descriptor for the open pid file. +function returns the file descriptor for the open pidfile. .Sh RETURN VALUES The .Fn pidfile_open @@ -118,7 +118,9 @@ will be set. The .Fn pidfile_fileno function returns the low-level file descriptor. -It returns -1 and sets +It returns +.Li -1 +and sets .Va errno if a NULL .Vt pidfh Modified: head/lib/libutil/pidfile.c == --- head/lib/libutil/pidfile.c Tue Jan 10 21:39:43 2012(r229941) +++ head/lib/libutil/pidfile.c Tue Jan 10 21:47:58 2012(r229942) @@ -270,6 +270,7 @@ pidfile_remove(struct pidfh *pfh) int pidfile_fileno(struct pidfh *pfh) { + if (pfh == NULL || pfh->pf_fd == -1) { errno = EDOOFUS; return (-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"
Re: svn commit: r229937 - in head/lib: libc/gen libutil
On Jan 10, 2012, at 3:42 PM, Pawel Jakub Dawidek wrote: > On Tue, Jan 10, 2012 at 07:53:25PM +, Guy Helmer wrote: >> Author: ghelmer >> Date: Tue Jan 10 19:53:25 2012 >> New Revision: 229937 >> URL: http://svn.freebsd.org/changeset/base/229937 >> >> Log: >> Add pidfile_fileno() to obtain the file descriptor for an open >> pidfile. > > BTW. If you are working on pidfile, it would be nice to move pidfile > structure declaration into pidfile.c. There is no need to expose it. Is that change likely to require a "make universe" to validate? Guy This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. ___ 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: r229937 - in head/lib: libc/gen libutil
On Tue, Jan 10, 2012 at 03:52:35PM -0600, Guy Helmer wrote: > > On Jan 10, 2012, at 3:42 PM, Pawel Jakub Dawidek wrote: > > > On Tue, Jan 10, 2012 at 07:53:25PM +, Guy Helmer wrote: > >> Author: ghelmer > >> Date: Tue Jan 10 19:53:25 2012 > >> New Revision: 229937 > >> URL: http://svn.freebsd.org/changeset/base/229937 > >> > >> Log: > >> Add pidfile_fileno() to obtain the file descriptor for an open > >> pidfile. > > > > BTW. If you are working on pidfile, it would be nice to move pidfile > > structure declaration into pidfile.c. There is no need to expose it. > > > Is that change likely to require a "make universe" to validate? Nice try:) No, I won't take the responsibility:) Ok, seriously. Nothing should use this structure directly. You will still need forward declaration in pidfile.h. It is not something that is arch-depended, so simple buildworld should be sufficient. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgpe4acggNAI9.pgp Description: PGP signature
Re: svn commit: r229937 - in head/lib: libc/gen libutil
On Tue, Jan 10, 2012 at 07:53:25PM +, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 19:53:25 2012 > New Revision: 229937 > URL: http://svn.freebsd.org/changeset/base/229937 > > Log: > Add pidfile_fileno() to obtain the file descriptor for an open > pidfile. > > Modified: > head/lib/libc/gen/getnetgrent.c > head/lib/libutil/libutil.h > head/lib/libutil/pidfile.3 > head/lib/libutil/pidfile.c [...] > Modified: head/lib/libutil/libutil.h > == > --- head/lib/libutil/libutil.hTue Jan 10 18:43:27 2012 > (r229936) > +++ head/lib/libutil/libutil.hTue Jan 10 19:53:25 2012 > (r229937) > @@ -170,6 +170,7 @@ struct pidfh *pidfile_open(const char *p > int pidfile_write(struct pidfh *pfh); > int pidfile_close(struct pidfh *pfh); > int pidfile_remove(struct pidfh *pfh); > +int pidfile_fileno(struct pidfh *pfh); > #endif > > #ifdef _UFS_UFS_QUOTA_H_ One more thing. You also need to add link in Makefile, so that 'man pidfile_fileno' will work. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgpz2q6KTOn50.pgp Description: PGP signature
svn commit: r229943 - head/lib/libutil
Author: ghelmer Date: Tue Jan 10 22:22:35 2012 New Revision: 229943 URL: http://svn.freebsd.org/changeset/base/229943 Log: Add link for pidfile_fileno.3 to pidfile.3 - thanks again pjd! Modified: head/lib/libutil/Makefile Modified: head/lib/libutil/Makefile == --- head/lib/libutil/Makefile Tue Jan 10 21:47:58 2012(r229942) +++ head/lib/libutil/Makefile Tue Jan 10 22:22:35 2012(r229943) @@ -58,7 +58,8 @@ MLINKS+=uucplock.3 uu_lock.3 uucplock.3 MLINKS+=pidfile.3 pidfile_open.3 \ pidfile.3 pidfile_write.3 \ pidfile.3 pidfile_close.3 \ - pidfile.3 pidfile_remove.3 + pidfile.3 pidfile_remove.3 \ + pidfile.3 pidfile_fileno.3 MLINKS+=quotafile.3 quota_open.3 \ quotafile.3 quota_fsname.3 \ quotafile.3 quota_qfname.3 \ ___ 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: r229944 - head/sbin/hastd
Author: pjd Date: Tue Jan 10 22:24:57 2012 New Revision: 229944 URL: http://svn.freebsd.org/changeset/base/229944 Log: Don't touch pidfiles when running in foreground. Before that change we would create an empty pidfile on start and check if it changed on SIGHUP. MFC after:3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c == --- head/sbin/hastd/hastd.c Tue Jan 10 22:22:35 2012(r229943) +++ head/sbin/hastd/hastd.c Tue Jan 10 22:24:57 2012(r229944) @@ -68,6 +68,8 @@ static struct hastd_config *cfg; bool sigexit_received = false; /* PID file handle. */ struct pidfh *pfh; +/* Do we run in foreground? */ +static bool foreground; /* How often check for hooks running for too long. */ #defineREPORT_INTERVAL 5 @@ -531,7 +533,7 @@ hastd_reload(void) /* * Check if pidfile's path has changed. */ - if (strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { + if (!foreground && strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid); if (newpfh == NULL) { if (errno == EEXIST) { @@ -1155,7 +1157,6 @@ main(int argc, char *argv[]) struct hastd_listen *lst; const char *pidfile; pid_t otherpid; - bool foreground; int debuglevel; sigset_t mask; @@ -1220,16 +1221,23 @@ main(int argc, char *argv[]) pjdlog_exitx(EX_CONFIG, "Pidfile path is too long."); } } - pfh = pidfile_open(cfg->hc_pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - pjdlog_exitx(EX_TEMPFAIL, - "Another hastd is already running, pidfile: %s, pid: %jd.", - cfg->hc_pidfile, (intmax_t)otherpid); - } - /* If we cannot create pidfile for other reasons, only warn. */ - pjdlog_errno(LOG_WARNING, "Unable to open or create pidfile %s", - cfg->hc_pidfile); + + if (!foreground) { + pfh = pidfile_open(cfg->hc_pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + pjdlog_exitx(EX_TEMPFAIL, + "Another hastd is already running, pidfile: %s, pid: %jd.", + cfg->hc_pidfile, (intmax_t)otherpid); + } + /* +* If we cannot create pidfile for other reasons, +* only warn. +*/ + pjdlog_errno(LOG_WARNING, + "Unable to open or create pidfile %s", + cfg->hc_pidfile); + } } /* ___ 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: r229945 - in head/sbin: hastctl hastd
Author: pjd Date: Tue Jan 10 22:39:07 2012 New Revision: 229945 URL: http://svn.freebsd.org/changeset/base/229945 Log: For functions that return -1 on failure check exactly for -1 and not for any negative number. MFC after:3 days Modified: head/sbin/hastctl/hastctl.c head/sbin/hastd/control.c head/sbin/hastd/ebuf.c head/sbin/hastd/event.c head/sbin/hastd/hast_proto.c head/sbin/hastd/hastd.c head/sbin/hastd/hooks.c head/sbin/hastd/metadata.c head/sbin/hastd/nv.c head/sbin/hastd/primary.c head/sbin/hastd/proto.c head/sbin/hastd/proto_common.c head/sbin/hastd/proto_socketpair.c head/sbin/hastd/proto_tcp.c head/sbin/hastd/proto_uds.c head/sbin/hastd/secondary.c head/sbin/hastd/subr.c Modified: head/sbin/hastctl/hastctl.c == --- head/sbin/hastctl/hastctl.c Tue Jan 10 22:24:57 2012(r229944) +++ head/sbin/hastctl/hastctl.c Tue Jan 10 22:39:07 2012(r229945) @@ -104,7 +104,7 @@ create_one(struct hast_resource *res, in ec = 0; pjdlog_prefix_set("[%s] ", res->hr_name); - if (provinfo(res, true) < 0) { + if (provinfo(res, true) == -1) { ec = EX_NOINPUT; goto end; } @@ -146,7 +146,7 @@ create_one(struct hast_resource *res, in res->hr_localoff = METADATA_SIZE + mapsize; - if (metadata_write(res) < 0) { + if (metadata_write(res) == -1) { ec = EX_IOERR; goto end; } @@ -401,15 +401,15 @@ main(int argc, char *argv[]) debug++; break; case 'e': - if (expand_number(optarg, &extentsize) < 0) + if (expand_number(optarg, &extentsize) == -1) errx(EX_USAGE, "Invalid extentsize"); break; case 'k': - if (expand_number(optarg, &keepdirty) < 0) + if (expand_number(optarg, &keepdirty) == -1) errx(EX_USAGE, "Invalid keepdirty"); break; case 'm': - if (expand_number(optarg, &mediasize) < 0) + if (expand_number(optarg, &mediasize) == -1) errx(EX_USAGE, "Invalid mediasize"); break; case 'h': @@ -479,13 +479,13 @@ main(int argc, char *argv[]) } /* Setup control connection... */ - if (proto_client(NULL, cfg->hc_controladdr, &controlconn) < 0) { + if (proto_client(NULL, cfg->hc_controladdr, &controlconn) == -1) { pjdlog_exit(EX_OSERR, "Unable to setup control connection to %s", cfg->hc_controladdr); } /* ...and connect to hastd. */ - if (proto_connect(controlconn, HAST_TIMEOUT) < 0) { + if (proto_connect(controlconn, HAST_TIMEOUT) == -1) { pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s", cfg->hc_controladdr); } @@ -494,14 +494,14 @@ main(int argc, char *argv[]) exit(EX_CONFIG); /* Send the command to the server... */ - if (hast_proto_send(NULL, controlconn, nv, NULL, 0) < 0) { + if (hast_proto_send(NULL, controlconn, nv, NULL, 0) == -1) { pjdlog_exit(EX_UNAVAILABLE, "Unable to send command to hastd via %s", cfg->hc_controladdr); } nv_free(nv); /* ...and receive reply. */ - if (hast_proto_recv_hdr(controlconn, &nv) < 0) { + if (hast_proto_recv_hdr(controlconn, &nv) == -1) { pjdlog_exit(EX_UNAVAILABLE, "cannot receive reply from hastd via %s", cfg->hc_controladdr); Modified: head/sbin/hastd/control.c == --- head/sbin/hastd/control.c Tue Jan 10 22:24:57 2012(r229944) +++ head/sbin/hastd/control.c Tue Jan 10 22:39:07 2012(r229945) @@ -115,7 +115,7 @@ control_set_role_common(struct hastd_con * doing that work. */ if (res->hr_workerpid != 0) { - if (kill(res->hr_workerpid, SIGTERM) < 0) { + if (kill(res->hr_workerpid, SIGTERM) == -1) { pjdlog_errno(LOG_WARNING, "Unable to kill worker process %u", (unsigned int)res->hr_workerpid); @@ -167,7 +167,7 @@ control_status_worker(struct hast_resour "Unable to prepare control header"); goto end; } - if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) == -1) { error = errno; pjdlog_errno(LOG_ERR, "Unable to
svn commit: r229946 - head/sbin/hastd
Author: pjd Date: Tue Jan 10 22:41:09 2012 New Revision: 229946 URL: http://svn.freebsd.org/changeset/base/229946 Log: - Fix a bug where pidfile was removed in SIGHUP when it hasn't changed in configuration file. - Log the fact that pidfile has changed. MFC after:3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c == --- head/sbin/hastd/hastd.c Tue Jan 10 22:39:07 2012(r229945) +++ head/sbin/hastd/hastd.c Tue Jan 10 22:41:09 2012(r229946) @@ -573,10 +573,14 @@ hastd_reload(void) /* * Switch to new pidfile. */ - (void)pidfile_remove(pfh); - pfh = newpfh; - (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, - sizeof(cfg->hc_pidfile)); + if (newpfh != NULL) { + pjdlog_info("Pidfile changed from %s to %s.", cfg->hc_pidfile, + newcfg->hc_pidfile); + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + } /* * Switch to new listen addresses. Close all that were removed. */ ___ 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: r229945 - in head/sbin: hastctl hastd
On 01/10/2012 14:39, Pawel Jakub Dawidek wrote: > For functions that return -1 on failure check exactly for -1 and not for > any negative number. what is the likelihood that at some point in the future the semantics for those functions will change, such that more than one negative value may be returned? -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ ___ 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: r229945 - in head/sbin: hastctl hastd
On Tue, Jan 10, 2012 at 02:43:29PM -0800, Doug Barton wrote: > On 01/10/2012 14:39, Pawel Jakub Dawidek wrote: > > For functions that return -1 on failure check exactly for -1 and not for > > any negative number. > > what is the likelihood that at some point in the future the semantics > for those functions will change, such that more than one negative value > may be returned? This is of course just being extra careful, but what if the function will start returning negative values different than -1 on success? This works in both direction, but is really only theory. All in all, the manual pages now clearly state that those functions return -1 on failure. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com pgp2N9ctEk3mv.pgp Description: PGP signature
svn commit: r229947 - head/sys/dev/netmap
Author: luigi Date: Tue Jan 10 23:02:01 2012 New Revision: 229947 URL: http://svn.freebsd.org/changeset/base/229947 Log: other simplifications in the internal interfaces to the memory allocator. Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c == --- head/sys/dev/netmap/netmap.cTue Jan 10 22:41:09 2012 (r229946) +++ head/sys/dev/netmap/netmap.cTue Jan 10 23:02:01 2012 (r229947) @@ -152,8 +152,10 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, free_b * Buffer 0 is the 'junk' buffer. */ static void -netmap_new_bufs(struct netmap_buf_pool *p, struct netmap_slot *slot, u_int n) +netmap_new_bufs(struct netmap_if *nifp __unused, + struct netmap_slot *slot, u_int n) { + struct netmap_buf_pool *p = &nm_buf_pool; uint32_t bi = 0;/* index in the bitmap */ uint32_t mask, j, i = 0;/* slot counter */ @@ -182,8 +184,10 @@ netmap_new_bufs(struct netmap_buf_pool * static void -netmap_free_buf(struct netmap_buf_pool *p, uint32_t i) +netmap_free_buf(struct netmap_if *nifp __unused, uint32_t i) { + struct netmap_buf_pool *p = &nm_buf_pool; + uint32_t pos, mask; if (i >= p->total_buffers) { D("invalid free index %d", i); @@ -399,15 +403,13 @@ netmap_dtor(void *data) ring = na->tx_rings[i].ring; lim = na->tx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) - netmap_free_buf(&nm_buf_pool, - ring->slot[j].buf_idx); + netmap_free_buf(nifp, ring->slot[j].buf_idx); ND("rx queue %d", i); ring = na->rx_rings[i].ring; lim = na->rx_rings[i].nkr_num_slots; for (j = 0; j < lim; j++) - netmap_free_buf(&nm_buf_pool, - ring->slot[j].buf_idx); + netmap_free_buf(nifp, ring->slot[j].buf_idx); } NMA_UNLOCK(); netmap_free_rings(na); @@ -516,7 +518,7 @@ error: */ ring->avail = kring->nr_hwavail = numdesc - 1; ring->cur = kring->nr_hwcur = 0; - netmap_new_bufs(&nm_buf_pool, ring->slot, numdesc); + netmap_new_bufs(nifp, ring->slot, numdesc); ofs += sizeof(struct netmap_ring) + numdesc * sizeof(struct netmap_slot); @@ -535,7 +537,7 @@ error: kring->nkr_num_slots = numdesc; ring->cur = kring->nr_hwcur = 0; ring->avail = kring->nr_hwavail = 0; /* empty */ - netmap_new_bufs(&nm_buf_pool, ring->slot, numdesc); + netmap_new_bufs(nifp, ring->slot, numdesc); ofs += sizeof(struct netmap_ring) + numdesc * sizeof(struct netmap_slot); } @@ -580,8 +582,9 @@ netmap_mmap(__unused struct cdev *dev, v { if (nprot & PROT_EXEC) return (-1);// XXX -1 or EINVAL ? + ND("request for offset 0x%x", (uint32_t)offset); - *paddr = vtophys(netmap_mem_d->nm_buffer) + offset; + *paddr = netmap_ofstophys(offset); return (0); } @@ -953,8 +956,7 @@ error: nmr->nr_numrings = na->num_queues; nmr->nr_numslots = na->num_tx_desc; nmr->nr_memsize = netmap_mem_d->nm_totalsize; - nmr->nr_offset = - ((char *) nifp - (char *) netmap_mem_d->nm_buffer); + nmr->nr_offset = netmap_if_offset(nifp); break; case NIOCUNREGIF: ___ 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: r229936 - head/lib/libutil
On Tue, Jan 10, 2012 at 06:43:27PM +, Guy Helmer wrote: > Author: ghelmer > Date: Tue Jan 10 18:43:27 2012 > New Revision: 229936 > URL: http://svn.freebsd.org/changeset/base/229936 > Log: > Set the FD_CLOEXEC flag on the open pidfile file descriptor. > Discussed with: pjd, des > Modified: > head/lib/libutil/pidfile.c > + /* > + * Prevent the file descriptor from escaping to other > + * programs via exec(3). > + */ > + if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { Consider adding O_CLOEXEC to the flopen() flags instead. That saves a system call and removes a possible race condition with fork/exec from threads or signal handlers. -- Jilles Tjoelker ___ 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: r229948 - head/sys/net80211
Author: adrian Date: Tue Jan 10 23:37:32 2012 New Revision: 229948 URL: http://svn.freebsd.org/changeset/base/229948 Log: Add in the vendor extension bit in the radiotap header. Modified: head/sys/net80211/ieee80211_radiotap.h Modified: head/sys/net80211/ieee80211_radiotap.h == --- head/sys/net80211/ieee80211_radiotap.h Tue Jan 10 23:02:01 2012 (r229947) +++ head/sys/net80211/ieee80211_radiotap.h Tue Jan 10 23:37:32 2012 (r229948) @@ -190,6 +190,7 @@ enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_DB_ANTNOISE = 13, /* NB: gap for netbsd definitions */ IEEE80211_RADIOTAP_XCHANNEL = 18, + IEEE80211_RADIOTAP_VENDOREXT = 30, IEEE80211_RADIOTAP_EXT = 31, }; ___ 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: r229949 - head/sys/dev/ath
Author: adrian Date: Wed Jan 11 00:16:44 2012 New Revision: 229949 URL: http://svn.freebsd.org/changeset/base/229949 Log: style(9) changes. This shouldn't change functionality. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c == --- head/sys/dev/ath/if_ath_tx.cTue Jan 10 23:37:32 2012 (r229948) +++ head/sys/dev/ath/if_ath_tx.cWed Jan 11 00:16:44 2012 (r229949) @@ -435,7 +435,8 @@ ath_tx_setds_11n(struct ath_softc *sc, s * Setup the last descriptor in the list. * bf_prev points to the last; bf is NULL here. */ - ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, bf_first->bf_desc); + ath_hal_setuplasttxdesc(sc->sc_ah, bf_prev->bf_desc, + bf_first->bf_desc); /* * Set the first descriptor bf_lastds field to point to @@ -481,7 +482,8 @@ ath_tx_handoff_mcast(struct ath_softc *s * Hand-off packet to a hardware queue. */ static void -ath_tx_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, struct ath_buf *bf) +ath_tx_handoff_hw(struct ath_softc *sc, struct ath_txq *txq, +struct ath_buf *bf) { struct ath_hal *ah = sc->sc_ah; @@ -548,7 +550,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, * frame at SWBA. */ if (!qbusy) { - ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); + ath_hal_puttxbuf(ah, txq->axq_qnum, + bf->bf_daddr); txq->axq_flags &= ~ATH_TXQ_PUTPENDING; DPRINTF(sc, ATH_DEBUG_XMIT, "%s: TXDP[%u] = %p (%p) depth %d\n", @@ -566,7 +569,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%p (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + (caddr_t)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); if ((txq->axq_flags & ATH_TXQ_PUTPENDING) && !qbusy) { /* * The q was busy when we previously tried @@ -599,7 +603,8 @@ ath_tx_handoff_hw(struct ath_softc *sc, DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%p (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - (caddr_t)bf->bf_daddr, bf->bf_desc, txq->axq_depth); + (caddr_t)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); } #endif /* IEEE80211_SUPPORT_TDMA */ if (bf->bf_state.bfs_aggr) @@ -652,7 +657,8 @@ ath_tx_handoff(struct ath_softc *sc, str static int ath_tx_tag_crypto(struct ath_softc *sc, struct ieee80211_node *ni, -struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, int *keyix) +struct mbuf *m0, int iswep, int isfrag, int *hdrlen, int *pktlen, +int *keyix) { if (iswep) { const struct ieee80211_cipher *cip; @@ -671,7 +677,7 @@ ath_tx_tag_crypto(struct ath_softc *sc, * 802.11 layer counts failures and provides * debugging/diagnostics. */ - return 0; + return (0); } /* * Adjust the packet + header lengths for the crypto @@ -698,7 +704,7 @@ ath_tx_tag_crypto(struct ath_softc *sc, } else (*keyix) = HAL_TXKEYIX_INVALID; - return 1; + return (1); } static uint8_t @@ -720,7 +726,7 @@ ath_tx_get_rtscts_rate(struct ath_hal *a if (shortPreamble) ctsrate |= rt->info[cix].shortPreamble; - return ctsrate; + return (ctsrate); } /* @@ -737,7 +743,7 @@ ath_tx_calc_ctsduration(struct ath_hal * if (rt->info[cix].phy == IEEE80211_T_HT) { printf("%s: HT rate where it shouldn't be (0x%x)\n", __func__, rt->info[cix].rateCode); - return -1; + return (-1); } /* @@ -765,7 +771,7 @@ ath_tx_calc_ctsduration(struct ath_hal * ctsduration += rt->info[rix].lpAckDuration; } - return ctsduration; + return (ctsduration); } /* @@ -1906,9 +1912,11 @@ ath_tx_addto_baw(struct ath_softc *sc, s if (bf->bf_state.bfs_addedbaw) device_printf(sc->sc_dev, - "%s: re-added? tid=%d, seqno %d; window %d:%d; baw head=%d tail=%d\n", + "%s: re-added? tid=%d, seqno %d; window
svn commit: r229950 - head/sys/dev/ath
Author: adrian Date: Wed Jan 11 00:18:33 2012 New Revision: 229950 URL: http://svn.freebsd.org/changeset/base/229950 Log: Re-enable the PHY radar error frames if sc_dodfs is set. This was messing up a local port of the atheros reference radar detection code; I'll fix the port instead. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c == --- head/sys/dev/ath/if_ath.c Wed Jan 11 00:16:44 2012(r229949) +++ head/sys/dev/ath/if_ath.c Wed Jan 11 00:18:33 2012(r229950) @@ -2486,6 +2486,13 @@ ath_calcrxfilter(struct ath_softc *sc) if (IEEE80211_IS_CHAN_HT(ic->ic_curchan)) rfilt |= HAL_RX_FILTER_COMPBAR; + /* +* Enable radar PHY errors if requested by the +* DFS module. +*/ + if (sc->sc_dodfs) + rfilt |= HAL_RX_FILTER_PHYRADAR; + DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, %s if_flags 0x%x\n", __func__, rfilt, ieee80211_opmode_name[ic->ic_opmode], ifp->if_flags); return rfilt; ___ 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: r229951 - head/lib/libutil
Author: pjd Date: Wed Jan 11 00:31:04 2012 New Revision: 229951 URL: http://svn.freebsd.org/changeset/base/229951 Log: Constify arguments. Modified: head/lib/libutil/libutil.h head/lib/libutil/pidfile.c Modified: head/lib/libutil/libutil.h == --- head/lib/libutil/libutil.h Wed Jan 11 00:18:33 2012(r229950) +++ head/lib/libutil/libutil.h Wed Jan 11 00:31:04 2012(r229951) @@ -170,7 +170,7 @@ struct pidfh *pidfile_open(const char *p int pidfile_write(struct pidfh *pfh); int pidfile_close(struct pidfh *pfh); int pidfile_remove(struct pidfh *pfh); -int pidfile_fileno(struct pidfh *pfh); +int pidfile_fileno(const struct pidfh *pfh); #endif #ifdef _UFS_UFS_QUOTA_H_ Modified: head/lib/libutil/pidfile.c == --- head/lib/libutil/pidfile.c Wed Jan 11 00:18:33 2012(r229950) +++ head/lib/libutil/pidfile.c Wed Jan 11 00:31:04 2012(r229951) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); static int _pidfile_remove(struct pidfh *pfh, int freeit); static int -pidfile_verify(struct pidfh *pfh) +pidfile_verify(const struct pidfh *pfh) { struct stat sb; @@ -268,7 +268,7 @@ pidfile_remove(struct pidfh *pfh) } int -pidfile_fileno(struct pidfh *pfh) +pidfile_fileno(const struct pidfh *pfh) { if (pfh == NULL || pfh->pf_fd == -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"
Re: svn commit: r229908 - head/usr.bin/brandelf
On Tue Jan 10 12, Dimitry Andric wrote: > On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: > >On Tue, Jan 10, 2012 at 02:58:29AM +, Eitan Adler wrote: > >>Author: eadler (ports committer) > >>Date: Tue Jan 10 02:58:29 2012 > >>New Revision: 229908 > >>URL: http://svn.freebsd.org/changeset/base/229908 > >> > >>Log: > >> Fix warning when compiling with gcc46: > >> error: variable 'verbose' set but not use > > > >Maybe we should remove -v from the manual page as well or document as > >no-op? > >I'd still leave it in the code though, so there is no POLA violation. > > It has been a no-op since the beginning of brandelf, and I have really > no idea what the original author intended the verbose output to be. :) > > It is probably best to document it as a no-op now, to reduce possible > confusion. shouldn't brandelf be replaced with the version from the elftoolchain project? any news when the first import is going to happen? cheers. alex ___ 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: r229908 - head/usr.bin/brandelf
On Wed Jan 11 12, Alexander Best wrote: > On Tue Jan 10 12, Dimitry Andric wrote: > > On 2012-01-10 09:21, Pawel Jakub Dawidek wrote: > > >On Tue, Jan 10, 2012 at 02:58:29AM +, Eitan Adler wrote: > > >>Author: eadler (ports committer) > > >>Date: Tue Jan 10 02:58:29 2012 > > >>New Revision: 229908 > > >>URL: http://svn.freebsd.org/changeset/base/229908 > > >> > > >>Log: > > >> Fix warning when compiling with gcc46: > > >> error: variable 'verbose' set but not use > > > > > >Maybe we should remove -v from the manual page as well or document as > > >no-op? > > >I'd still leave it in the code though, so there is no POLA violation. > > > > It has been a no-op since the beginning of brandelf, and I have really > > no idea what the original author intended the verbose output to be. :) > > > > It is probably best to document it as a no-op now, to reduce possible > > confusion. > > shouldn't brandelf be replaced with the version from the elftoolchain project? > any news when the first import is going to happen? also you might want to report your changes to the elftoolchain project, because otherwise your commit will be reverted when the import happens. cheers. alex > > cheers. > alex ___ 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: r229952 - head/sys/net80211
Author: adrian Date: Wed Jan 11 01:09:08 2012 New Revision: 229952 URL: http://svn.freebsd.org/changeset/base/229952 Log: Add the MCS radiotype entry. Modified: head/sys/net80211/ieee80211_radiotap.c head/sys/net80211/ieee80211_radiotap.h Modified: head/sys/net80211/ieee80211_radiotap.c == --- head/sys/net80211/ieee80211_radiotap.c Wed Jan 11 00:31:04 2012 (r229951) +++ head/sys/net80211/ieee80211_radiotap.c Wed Jan 11 01:09:08 2012 (r229952) @@ -325,6 +325,10 @@ radiotap_offset(struct ieee80211_radiota .align = sizeof(uint32_t), .width = 2*sizeof(uint32_t), }, + [IEEE80211_RADIOTAP_MCS] = { + .align = sizeof(uint8_t), + .width = 3*sizeof(uint8_t), + }, }; uint32_t present = le32toh(rh->it_present); int off, i; Modified: head/sys/net80211/ieee80211_radiotap.h == --- head/sys/net80211/ieee80211_radiotap.h Wed Jan 11 00:31:04 2012 (r229951) +++ head/sys/net80211/ieee80211_radiotap.h Wed Jan 11 01:09:08 2012 (r229952) @@ -190,6 +190,7 @@ enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_DB_ANTNOISE = 13, /* NB: gap for netbsd definitions */ IEEE80211_RADIOTAP_XCHANNEL = 18, + IEEE80211_RADIOTAP_MCS = 19, IEEE80211_RADIOTAP_VENDOREXT = 30, IEEE80211_RADIOTAP_EXT = 31, }; ___ 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: r229953 - stable/9/sys/fs/nfsclient
Author: rmacklem Date: Wed Jan 11 01:24:35 2012 New Revision: 229953 URL: http://svn.freebsd.org/changeset/base/229953 Log: MFC: r228827 During investigation of an NFSv4 client crash reported by glebius@, jhb@ spotted that nfscl_getstateid() might modify credentials when called from nfsrpc_read() for the case where p != NULL, whereas nfsrpc_read() only did a crdup() to get new credentials for p == NULL. This bug was introduced by r195510, since pre-r195510 nfscl_getstateid() only modified credentials for the p == NULL case. This patch modifies nfsrpc_read()/nfsrpc_write() so that they do crdup() for the p != NULL case. It is conceivable that this bug caused the crash reported by glebius@, but that will not be determined for some time, since the crash occurred after about 1month of operation. Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/9/sys/fs/nfsclient/nfs_clrpcops.cWed Jan 11 01:09:08 2012 (r229952) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.cWed Jan 11 01:24:35 2012 (r229953) @@ -1232,8 +1232,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop newcred = cred; if (NFSHASNFSV4(nmp)) { nfhp = np->n_fhp; - if (p == NULL) - newcred = NFSNEWCRED(cred); + newcred = NFSNEWCRED(cred); } retrycnt = 0; do { @@ -1263,7 +1262,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop expireret == 0 && clidrev != 0 && retrycnt < 4)); if (error && retrycnt >= 4) error = EIO; - if (NFSHASNFSV4(nmp) && p == NULL) + if (NFSHASNFSV4(nmp)) NFSFREECRED(newcred); return (error); } @@ -1384,8 +1383,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio clidrev = nmp->nm_clp->nfsc_clientidrev; newcred = cred; if (NFSHASNFSV4(nmp)) { - if (p == NULL) - newcred = NFSNEWCRED(cred); + newcred = NFSNEWCRED(cred); nfhp = np->n_fhp; } retrycnt = 0; @@ -1435,7 +1433,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio ((error == NFSERR_STALESTATEID || error == NFSERR_STALEDONTRECOVER) && called_from_strategy != 0))) error = EIO; - if (NFSHASNFSV4(nmp) && p == NULL) + if (NFSHASNFSV4(nmp)) NFSFREECRED(newcred); return (error); } ___ 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: r229955 - stable/8/sys/fs/nfsclient
Author: rmacklem Date: Wed Jan 11 01:58:49 2012 New Revision: 229955 URL: http://svn.freebsd.org/changeset/base/229955 Log: MFC: r228827 During investigation of an NFSv4 client crash reported by glebius@, jhb@ spotted that nfscl_getstateid() might modify credentials when called from nfsrpc_read() for the case where p != NULL, whereas nfsrpc_read() only did a crdup() to get new credentials for p == NULL. This bug was introduced by r195510, since pre-r195510 nfscl_getstateid() only modified credentials for the p == NULL case. This patch modifies nfsrpc_read()/nfsrpc_write() so that they do crdup() for the p != NULL case. It is conceivable that this bug caused the crash reported by glebius@, but that will not be determined for some time, since the crash occurred after about 1month of operation. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c == --- stable/8/sys/fs/nfsclient/nfs_clrpcops.cWed Jan 11 01:42:16 2012 (r229954) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.cWed Jan 11 01:58:49 2012 (r229955) @@ -1232,8 +1232,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop newcred = cred; if (NFSHASNFSV4(nmp)) { nfhp = np->n_fhp; - if (p == NULL) - newcred = NFSNEWCRED(cred); + newcred = NFSNEWCRED(cred); } retrycnt = 0; do { @@ -1263,7 +1262,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop expireret == 0 && clidrev != 0 && retrycnt < 4)); if (error && retrycnt >= 4) error = EIO; - if (NFSHASNFSV4(nmp) && p == NULL) + if (NFSHASNFSV4(nmp)) NFSFREECRED(newcred); return (error); } @@ -1384,8 +1383,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio clidrev = nmp->nm_clp->nfsc_clientidrev; newcred = cred; if (NFSHASNFSV4(nmp)) { - if (p == NULL) - newcred = NFSNEWCRED(cred); + newcred = NFSNEWCRED(cred); nfhp = np->n_fhp; } retrycnt = 0; @@ -1435,7 +1433,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio ((error == NFSERR_STALESTATEID || error == NFSERR_STALEDONTRECOVER) && called_from_strategy != 0))) error = EIO; - if (NFSHASNFSV4(nmp) && p == NULL) + if (NFSHASNFSV4(nmp)) NFSFREECRED(newcred); return (error); } ___ 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: r229667 - head/usr.sbin/daemon
On Tue, Jan 10, 2012 at 1:01 PM, Guy Helmer wrote: > On Jan 6, 2012, at 12:00 AM, Garrett Cooper wrote: > >> On Thu, Jan 5, 2012 at 6:58 PM, Doug Barton wrote: >>> On 01/05/2012 14:48, Guy Helmer wrote: Allow daemon(8) to run pidfile_open() before relenquishing privileges so pid files can be written in /var/run when started as root. >>> >>> I'm not sure how useful this is since when daemon is exiting it won't be >>> able to remove the pid file (unless I'm missing something). >>> >>> Isn't it better to pre-create the pid file with the proper permissions >>> for the unprivileged user? >> >> As another aside, the file descriptor never has fcntl(, >> FD_CLOEXEC) run on it, so it leaks the file descriptors across execs.. >> that's not good... > > I just added an fcntl(…, FD_CLOEXEC) call to pidfile_open() so this > particular problem should be resolved. I saw -- thanks! -Garrett ___ 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: r229956 - head/sys/fs/nfs
Author: rmacklem Date: Wed Jan 11 02:46:42 2012 New Revision: 229956 URL: http://svn.freebsd.org/changeset/base/229956 Log: jwd@ reported via email that the "CacheSize" field reported by "nfsstat -e -s" would go negative after using the "-z" option to zero out the stats. This patch fixes that by not zeroing out the srvcache_size field for "-z", since it is the size of the cache and not a counter. MFC after:2 weeks Modified: head/sys/fs/nfs/nfs_commonport.c Modified: head/sys/fs/nfs/nfs_commonport.c == --- head/sys/fs/nfs/nfs_commonport.cWed Jan 11 01:58:49 2012 (r229955) +++ head/sys/fs/nfs/nfs_commonport.cWed Jan 11 02:46:42 2012 (r229956) @@ -483,7 +483,6 @@ nfssvc_call(struct thread *p, struct nfs newnfsstats.srvcache_nonidemdonehits = 0; newnfsstats.srvcache_misses = 0; newnfsstats.srvcache_tcppeak = 0; - newnfsstats.srvcache_size = 0; newnfsstats.srvclients = 0; newnfsstats.srvopenowners = 0; newnfsstats.srvopens = 0; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"