Re: svn commit: r230997 - head/release
On 4. Feb 2012, at 23:00 , Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sat Feb 4 23:00:27 2012 > New Revision: 230997 > URL: http://svn.freebsd.org/changeset/base/230997 > > Log: > Fix installation script after r230482 -- a missing character apparently. > Now, back to convalescing. Cool. Thanks! I'll give it a try. > Modified: > head/release/rc.local > > Modified: head/release/rc.local > == > --- head/release/rc.local Sat Feb 4 20:17:07 2012(r230996) > +++ head/release/rc.local Sat Feb 4 23:00:27 2012(r230997) > @@ -18,7 +18,7 @@ if [ $? -eq 0 ]; then > # goes multiuser > touch /tmp/bsdinstall_log > tail -f /tmp/bsdinstall_log > /dev/ttyv2 & > - /usr/libexec/getty autologin ttyv3 > + /usr/libexec/getty autologin ttyv3 & > EXTERNAL_VTY_STARTED=1 > fi > else -- Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231009 - head/sys/net
Author: glebius Date: Sun Feb 5 08:31:15 2012 New Revision: 231009 URL: http://svn.freebsd.org/changeset/base/231009 Log: In ifa_init() initialize if_data.ifi_datalen. This would be required after upcoming changes from bz@. Discussed with: bz Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sun Feb 5 07:19:00 2012(r231008) +++ head/sys/net/if.c Sun Feb 5 08:31:15 2012(r231009) @@ -1416,6 +1416,7 @@ ifa_init(struct ifaddr *ifa) mtx_init(&ifa->ifa_mtx, "ifaddr", NULL, MTX_DEF); refcount_init(&ifa->ifa_refcnt, 1); + ifa->if_data.ifi_datalen = sizeof(ifa->if_data); } void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231010 - head/sys/net
Author: glebius Date: Sun Feb 5 08:53:05 2012 New Revision: 231010 URL: http://svn.freebsd.org/changeset/base/231010 Log: Better comment for ifa_init(), ifa_ref(), ifa_free(). Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sun Feb 5 08:31:15 2012(r231009) +++ head/sys/net/if.c Sun Feb 5 08:53:05 2012(r231010) @@ -1408,7 +1408,7 @@ if_maddr_runlock(struct ifnet *ifp) } /* - * Reference count functions for ifaddrs. + * Initialization, desctruction and refcounting functions for ifaddrs. */ void ifa_init(struct ifaddr *ifa) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231011 - head/usr.bin/systat
Author: ed Date: Sun Feb 5 09:17:49 2012 New Revision: 231011 URL: http://svn.freebsd.org/changeset/base/231011 Log: Whitespace fixes. - Remove redundant empty lines. - Replace ^L by \014. This allows you to safely cat/grep/etc this file without causing confusion. Modified: head/usr.bin/systat/icmp.c head/usr.bin/systat/ifstat.c head/usr.bin/systat/iostat.c head/usr.bin/systat/ip.c head/usr.bin/systat/netcmds.c head/usr.bin/systat/netstat.c head/usr.bin/systat/pigs.c head/usr.bin/systat/tcp.c Modified: head/usr.bin/systat/icmp.c == --- head/usr.bin/systat/icmp.c Sun Feb 5 08:53:05 2012(r231010) +++ head/usr.bin/systat/icmp.c Sun Feb 5 09:17:49 2012(r231011) @@ -277,4 +277,3 @@ fetchicmp(void) if (sysctl(name, 4, &icmpstat, &len, 0, 0) < 0) return; } - Modified: head/usr.bin/systat/ifstat.c == --- head/usr.bin/systat/ifstat.cSun Feb 5 08:53:05 2012 (r231010) +++ head/usr.bin/systat/ifstat.cSun Feb 5 09:17:49 2012 (r231011) @@ -58,7 +58,6 @@ static const int col3 = C3; static const int col4 = C4; static const int col5 = C5; - SLIST_HEAD(, if_stat) curlist; SLIST_HEAD(, if_stat_disp) displist; @@ -85,7 +84,7 @@ static void sort_interface_list(void); static u_int getifnum(void); #define IFSTAT_ERR(n, s) do {\ - putchar(''); \ + putchar('\014');\ closeifstat(wnd); \ err((n), (s)); \ } while (0) @@ -143,7 +142,6 @@ static u_int getifnum(void); mvprintw(p->if_ypos+1, col2-3, "%s", (const char *)"out"); \ } while (0) - WINDOW * openifstat(void) { @@ -170,7 +168,6 @@ closeifstat(WINDOW *w) return; } - void labelifstat(void) { @@ -254,7 +251,6 @@ fetchifstat(void) IFSTAT_ERR(2, "error getting time of day"); (void)getifmibdata(ifp->if_row, &ifp->if_mib); - new_inb = ifp->if_mib.ifmd_data.ifi_ibytes; new_outb = ifp->if_mib.ifmd_data.ifi_obytes; Modified: head/usr.bin/systat/iostat.c == --- head/usr.bin/systat/iostat.cSun Feb 5 08:53:05 2012 (r231010) +++ head/usr.bin/systat/iostat.cSun Feb 5 09:17:49 2012 (r231011) @@ -254,7 +254,6 @@ barlabels(int row) return (row); } - void showiostat(void) { Modified: head/usr.bin/systat/ip.c == --- head/usr.bin/systat/ip.cSun Feb 5 08:53:05 2012(r231010) +++ head/usr.bin/systat/ip.cSun Feb 5 09:17:49 2012(r231011) @@ -337,4 +337,3 @@ fetchip(void) if (sysctl(name, 4, &curstat.u, &len, 0, 0) < 0) return; } - Modified: head/usr.bin/systat/netcmds.c == --- head/usr.bin/systat/netcmds.c Sun Feb 5 08:53:05 2012 (r231010) +++ head/usr.bin/systat/netcmds.c Sun Feb 5 09:17:49 2012 (r231011) @@ -121,7 +121,6 @@ netcmd(const char *cmd, const char *args return (0); } - static void changeitems(const char *args, int onoff) { Modified: head/usr.bin/systat/netstat.c == --- head/usr.bin/systat/netstat.c Sun Feb 5 08:53:05 2012 (r231010) +++ head/usr.bin/systat/netstat.c Sun Feb 5 09:17:49 2012 (r231011) @@ -349,7 +349,6 @@ enter_sysctl(struct inpcb *inp, struct x } } - static struct netinfo * enter(struct inpcb *inp, int state, const char *proto) { @@ -437,7 +436,6 @@ enter(struct inpcb *inp, int state, cons #defineSNDCC RCVCC+7 #defineSTATE SNDCC+7 - void labelnetstat(void) { Modified: head/usr.bin/systat/pigs.c == --- head/usr.bin/systat/pigs.c Sun Feb 5 08:53:05 2012(r231010) +++ head/usr.bin/systat/pigs.c Sun Feb 5 09:17:49 2012(r231011) @@ -81,7 +81,6 @@ closepigs(WINDOW *w) delwin(w); } - void showpigs(void) { Modified: head/usr.bin/systat/tcp.c == --- head/usr.bin/systat/tcp.c Sun Feb 5 08:53:05 2012(r231010) +++ head/usr.bin/systat/tcp.c Sun Feb 5 09:17:49 2012(r231011) @@ -324,4 +324,3 @@ fetchtcp(void) if (sysctl(name, 4, &curstat, &len, 0, 0) < 0) return; } - _
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sat, Feb 04, 2012 at 08:16:42PM +0200, Mikolaj Golub wrote: > ref8-amd64:/home/trociny% uname -r > 8.2-STABLE > ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 > ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 > daemon: process already running, pid: 19799 > > kopusha:~% uname -r > 10.0-CURRENT > kopusha:~% daemon -p /tmp/sleep.pid sleep 10 > kopusha:~% daemon -p /tmp/sleep.pid sleep 10 > kopusha:~% Mikolaj, eventhough what we had in 8.2-STABLE looks correct, it also isn't correct. Passing open descriptor to a process that doesn't expect that is bad behaviour. If you pass, eg. open descriptor to a directory and the process is using chroot(2) or jail(2) to sandbox itself it will be able to escape from that sandbox. Passing descriptor to a file has smaller security implication, but it is still wrong. For example hastd, as you probably know, asserts, before sandboxing, that he knows about all open descriptors - if there are some unknown descriptors open it won't run. Also, daemon was passing open descriptor to a pidfile that the child process cannot clean up, because he doesn't know its name. This leaves pidfile with stale PID in it once the process exits, which is also bad. In my opinion, to make daemon(8) work with pidfiles, it cannot exit after executing the given command. It should stay around with pidfile open and just wait for the child to exit. Once the child exits, it should remove the pidfile and also exit. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl pgpbLwNve4Rfr.pgp Description: PGP signature
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sat, Feb 04, 2012 at 10:32:56AM -0600, Guy Helmer wrote: > > On Feb 4, 2012, at 1:42 AM, Pawel Jakub Dawidek wrote: > > > On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote: > >> Author: ghelmer > >> Date: Wed Feb 1 16:40:59 2012 > >> New Revision: 230869 > >> URL: http://svn.freebsd.org/changeset/base/230869 > >> > >> Log: > >> Change the notes about the pidfile to include Doug's preference > >> for pre-creating the pidfile with appropriate owner and permissions. > >> > >> Requested by dougb > > > > Pre-creating pidfiles? That sounds weird. The common practise is to turn > > eg. /var/run/.pid into /var/run//pid where directory > > has appropriate permissions. Pre-creating pidfiles is simply wrong, > > because applications create pidfile on start and unlink it on exit. > > If application has no permission to remove files from /var/run/ it will > > leave pidfile with stale PID in it, which is bad. Changing application > > to truncate pidfile on exit instead of unlinking it also is a bad idea > > especially because there is working solution - pid directory. > > I prefer this approach, but dougb prefers the other approach. Each has > positives and negatives. I tried to accommodate both approaches. I seem to miss positives of the other approach. Leaving stale PIDs in pidfile is something we should avoid at all costs, so recommending that in the manual page is not the best recommendation. I for one would prefer to recommend against it. Even if pidfile is truncated on exit it still leave a mess in /var/run/. But currently it is not truncated on exit (pidfile(3) just unlinks the file, without truncating it first), so we end up with stale PIDs. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl pgpdJ0GKSGer1.pgp Description: PGP signature
svn commit: r231012 - head/sys/kern
Author: mm Date: Sun Feb 5 10:59:50 2012 New Revision: 231012 URL: http://svn.freebsd.org/changeset/base/231012 Log: Analogous to r230407 a separate path buffer in vfs_mount.c is required for r230129. Fixes a out of bounds write to fspath. MFC after:10 days Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c == --- head/sys/kern/vfs_mount.c Sun Feb 5 09:17:49 2012(r231011) +++ head/sys/kern/vfs_mount.c Sun Feb 5 10:59:50 2012(r231012) @@ -1039,6 +1039,7 @@ vfs_domount( struct vfsconf *vfsp; struct nameidata nd; struct vnode *vp; + char *pathbuf; int error; /* @@ -1102,12 +1103,15 @@ vfs_domount( NDFREE(&nd, NDF_ONLY_PNBUF); vp = nd.ni_vp; if ((fsflags & MNT_UPDATE) == 0) { - error = vn_path_to_global_path(td, vp, fspath, MNAMELEN); + pathbuf = malloc(MNAMELEN, M_TEMP, M_WAITOK); + strcpy(pathbuf, fspath); + error = vn_path_to_global_path(td, vp, pathbuf, MNAMELEN); /* debug.disablefullpath == 1 results in ENODEV */ if (error == 0 || error == ENODEV) { - error = vfs_domount_first(td, vfsp, fspath, vp, + error = vfs_domount_first(td, vfsp, pathbuf, vp, fsflags, optlist); } + free(pathbuf, M_TEMP); } else error = vfs_domount_update(td, vp, fsflags, optlist); mtx_unlock(&Giant); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r230869 - head/usr.sbin/daemon
On 02/05/2012 01:59, Pawel Jakub Dawidek wrote: > I seem to miss positives of the other approach. Leaving stale PIDs in > pidfile is something we should avoid at all costs, so recommending that > in the manual page is not the best recommendation. Which is worse ... potentially stale pidfiles that get cleaned up at every boot, or stale directories that never do? I'm also not sure why you think this method will leave behind a stale pidfile. The idea is that the pidfile is pre-created with the ownership that daemon is going to su to, for the express purpose of allowing it to delete the pidfile when the process exits. If you're saying that this method doesn't work then please point out the problem ASAP because numerous ports rc.d scripts do this now. Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ signature.asc Description: OpenPGP digital signature
svn commit: r231013 - head/sys/net
Author: glebius Date: Sun Feb 5 12:52:28 2012 New Revision: 231013 URL: http://svn.freebsd.org/changeset/base/231013 Log: Fix typo in r231010. Submitted by: linimon Modified: head/sys/net/if.c Modified: head/sys/net/if.c == --- head/sys/net/if.c Sun Feb 5 10:59:50 2012(r231012) +++ head/sys/net/if.c Sun Feb 5 12:52:28 2012(r231013) @@ -1408,7 +1408,7 @@ if_maddr_runlock(struct ifnet *ifp) } /* - * Initialization, desctruction and refcounting functions for ifaddrs. + * Initialization, destruction and refcounting functions for ifaddrs. */ void ifa_init(struct ifaddr *ifa) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231014 - head/sys/modules
Author: jhibbits Date: Sun Feb 5 13:29:01 2012 New Revision: 231014 URL: http://svn.freebsd.org/changeset/base/231014 Log: Add exca to powerpc modules build as a dependency for cbb. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Sun Feb 5 12:52:28 2012(r231013) +++ head/sys/modules/Makefile Sun Feb 5 13:29:01 2012(r231014) @@ -764,6 +764,7 @@ _cardbus= cardbus _cbb= cbb _cfi= cfi _cpufreq= cpufreq +_exca= exca _nvram=powermac_nvram _pccard= pccard _smbfs=smbfs ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sun, Feb 05, 2012 at 04:46:53AM -0800, Doug Barton wrote: > On 02/05/2012 01:59, Pawel Jakub Dawidek wrote: > > > I seem to miss positives of the other approach. Leaving stale PIDs in > > pidfile is something we should avoid at all costs, so recommending that > > in the manual page is not the best recommendation. > > Which is worse ... potentially stale pidfiles that get cleaned up at > every boot, or stale directories that never do? Every boot might be very rare situation on servers. Those directories should be cleaned when application is deinstalled and not when process exits. > I'm also not sure why you think this method will leave behind a stale > pidfile. The idea is that the pidfile is pre-created with the ownership > that daemon is going to su to, for the express purpose of allowing it to > delete the pidfile when the process exits. If you're saying that this > method doesn't work then please point out the problem ASAP because > numerous ports rc.d scripts do this now. Great, but this is not how UNIX permissions work. To remove directory entry you have to have rights to modify the directory. Having write permission to file within the directory won't allow you to remove it. -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl pgpxeCBmGNsRq.pgp Description: PGP signature
Re: svn commit: r231014 - head/sys/modules
On Feb 5, 2012, at 8:29 AM, Justin Hibbits wrote: Author: jhibbits Date: Sun Feb 5 13:29:01 2012 New Revision: 231014 URL: http://svn.freebsd.org/changeset/base/231014 Log: Add exca to powerpc modules build as a dependency for cbb. Approved by: nwhitehorn (mentor) sigh. I really should stop committing first thing in the morning. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231015 - head/sbin/hastd
Author: trociny Date: Sun Feb 5 15:21:08 2012 New Revision: 231015 URL: http://svn.freebsd.org/changeset/base/231015 Log: Fix the regression introduced in r226859: if the local component is out of date BIO_READ requests got lost instead of being sent to the remote component. Reviewed by: pjd MFC after:1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c == --- head/sbin/hastd/primary.c Sun Feb 5 13:29:01 2012(r231014) +++ head/sbin/hastd/primary.c Sun Feb 5 15:21:08 2012(r231015) @@ -1255,7 +1255,7 @@ ggate_recv_thread(void *arg) pjdlog_debug(2, "ggate_recv: (%p) Moving request to the send queues.", hio); refcount_init(&hio->hio_countdown, ncomps); - for (ii = ncomp; ii < ncomps; ii++) + for (ii = ncomp; ii < ncomp + ncomps; ii++) QUEUE_INSERT1(hio, send, ii); } /* NOTREACHED */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231016 - head/sbin/hastd
Author: trociny Date: Sun Feb 5 15:23:32 2012 New Revision: 231016 URL: http://svn.freebsd.org/changeset/base/231016 Log: If a local write request is from the synchronization thread, when it is synchronizing data that is out of date on the local component, we should not send G_GATE_CMD_DONE acknowledge to the kernel. This fixes the issue, observed in async mode, when on synchronization from the remote component the worker terminated with "G_GATE_CMD_DONE failed" error. Reported by: Artem Kajalainen Reviewed by: pjd MFC after:1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c == --- head/sbin/hastd/primary.c Sun Feb 5 15:21:08 2012(r231015) +++ head/sbin/hastd/primary.c Sun Feb 5 15:23:32 2012(r231016) @@ -1326,7 +1326,8 @@ local_send_thread(void *arg) } else { hio->hio_errors[ncomp] = 0; if (hio->hio_replication == - HAST_REPLICATION_ASYNC) { + HAST_REPLICATION_ASYNC && + !ISSYNCREQ(hio)) { ggio->gctl_error = 0; write_complete(res, hio); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231019 - head/sys/powerpc/aim
Author: andreast Date: Sun Feb 5 15:59:18 2012 New Revision: 231019 URL: http://svn.freebsd.org/changeset/base/231019 Log: Revert the _NOPROF entries on cpu_throw, cpu_switch and savectx. They can be profiled too now. MFC after:2 weeks Modified: head/sys/powerpc/aim/swtch64.S Modified: head/sys/powerpc/aim/swtch64.S == --- head/sys/powerpc/aim/swtch64.S Sun Feb 5 15:54:32 2012 (r231018) +++ head/sys/powerpc/aim/swtch64.S Sun Feb 5 15:59:18 2012 (r231019) @@ -68,7 +68,7 @@ /* * void cpu_throw(struct thread *old, struct thread *new) */ -ENTRY_NOPROF(cpu_throw) +ENTRY(cpu_throw) mr %r13, %r4 b cpu_switchin @@ -79,7 +79,7 @@ ENTRY_NOPROF(cpu_throw) * * Switch to a new thread saving the current state in the old thread. */ -ENTRY_NOPROF(cpu_switch) +ENTRY(cpu_switch) ld %r6,TD_PCB(%r3) /* Get the old thread's PCB ptr */ std %r12,PCB_CONTEXT(%r6) /* Save the non-volatile GP regs. These can now be used for scratch */ @@ -237,7 +237,7 @@ blocked_loop: * savectx(pcb) * Update pcb, saving current processor state */ -ENTRY_NOPROF(savectx) +ENTRY(savectx) std %r12,PCB_CONTEXT(%r3) /* Save the non-volatile GP regs. */ std %r13,PCB_CONTEXT+1*8(%r3) std %r14,PCB_CONTEXT+2*8(%r3) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r230482 - head/release
On 01/28/12 04:30, TAKAHASHI Yoshihiro wrote: In article<1f971db2-9cc6-41c9-9296-039d63e05...@freebsd.org> Nathan Whitehorn writes: I think we didn't make PC98 release media for 9.0, but that's a good point. I'm out of commission right now due to an injury, so patches would be welcome. TERM=xterm This code is also used on pc98, right? I think on pc98 we still need to use TERM=cons25w, to support Japanese character sets and keyboard input. How about the attached patch? --- TAKAHASHI Yoshihiro The top half looks OK. The bottom half (the menu) is relevant only for serial consoles. I guess people could be viewing a remote serial console on a PC-98 graphics console, but then it shouldn't be conditionalized on PC98 machines. -Nathan ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231024 - head/sys/dev/sound/pci/hda
Author: mav Date: Sun Feb 5 16:41:06 2012 New Revision: 231024 URL: http://svn.freebsd.org/changeset/base/231024 Log: Remove extra semicolon. Submitted by: emaste Modified: head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdacc.c == --- head/sys/dev/sound/pci/hda/hdacc.c Sun Feb 5 16:23:55 2012 (r231023) +++ head/sys/dev/sound/pci/hda/hdacc.c Sun Feb 5 16:41:06 2012 (r231024) @@ -612,7 +612,7 @@ hdacc_stream_intr(device_t dev, int dir, struct hdacc_softc *codec = device_get_softc(dev); device_t child; - if ((child = codec->streams[dir][stream]) != NULL); + if ((child = codec->streams[dir][stream]) != NULL) HDAC_STREAM_INTR(child, dir, stream); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231025 - in head: share/man/man4 sys/netinet sys/sys
Author: glebius Date: Sun Feb 5 16:53:02 2012 New Revision: 231025 URL: http://svn.freebsd.org/changeset/base/231025 Log: Add new socket options: TCP_KEEPINIT, TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT, that allow to control initial timeout, idle time, idle re-send interval and idle send count on a per-socket basis. Reviewed by: andre, bz, lstewart Modified: head/share/man/man4/tcp.4 head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timer.h head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/sys/param.h Modified: head/share/man/man4/tcp.4 == --- head/share/man/man4/tcp.4 Sun Feb 5 16:41:06 2012(r231024) +++ head/share/man/man4/tcp.4 Sun Feb 5 16:53:02 2012(r231025) @@ -38,7 +38,7 @@ .\" From: @(#)tcp.48.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd November 14, 2011 +.Dd February 5, 2012 .Dt TCP 4 .Os .Sh NAME @@ -146,6 +146,65 @@ connection. See .Xr mod_cc 4 for details. +.It Dv TCP_KEEPINIT +This write-only +.Xr setsockopt 2 +option accepts a per-socket timeout argument of +.Vt "u_int" +in seconds, for new, non-established +.Tn TCP +connections. +For the global default in milliseconds see +.Va keepinit +in the +.Sx MIB Variables +section further down. +.It Dv TCP_KEEPIDLE +This write-only +.Xr setsockopt 2 +option accepts an argument of +.Vt "u_int" +for the amount of time, in seconds, that the connection must be idle +before keepalive probes (if enabled) are sent for the connection of this +socket. +If set on a listening socket, the value is inherited by the newly created +socket upon +.Xr accept 2 . +For the global default in milliseconds see +.Va keepidle +in the +.Sx MIB Variables +section further down. +.It Dv TCP_KEEPINTVL +This write-only +.Xr setsockopt 2 +option accepts an argument of +.Vt "u_int" +to set the per-socket interval, in seconds, between keepalive probes sent +to a peer. +If set on a listening socket, the value is inherited by the newly created +socket upon +.Xr accept 2 . +For the global default in milliseconds see +.Va keepintvl +in the +.Sx MIB Variables +section further down. +.It Dv TCP_KEEPCNT +This write-only +.Xr setsockopt 2 +option accepts an argument of +.Vt "u_int" +and allows a per-socket tuning of the number of probes sent, with no response, +before the connection will be dropped. +If set on a listening socket, the value is inherited by the newly created +socket upon +.Xr accept 2 . +For the global default see the +.Va keepcnt +in the +.Sx MIB Variables +section further down. .It Dv TCP_NODELAY Under most circumstances, .Tn TCP @@ -296,17 +355,21 @@ The Maximum Segment Lifetime, in millise Timeout, in milliseconds, for new, non-established .Tn TCP connections. +The default is 75000 msec. .It Va keepidle Amount of time, in milliseconds, that the connection must be idle before keepalive probes (if enabled) are sent. +The default is 720 msec (2 hours). .It Va keepintvl The interval, in milliseconds, between keepalive probes sent to remote machines, when no response is received on a .Va keepidle probe. -After -.Dv TCPTV_KEEPCNT -(default 8) probes are sent, with no response, the connection is dropped. +The default is 75000 msec. +.It Va keepcnt +Number of probes sent, with no response, before a connection +is dropped. +The default is 8 packets. .It Va always_keepalive Assume that .Dv SO_KEEPALIVE Modified: head/sys/netinet/tcp.h == --- head/sys/netinet/tcp.h Sun Feb 5 16:41:06 2012(r231024) +++ head/sys/netinet/tcp.h Sun Feb 5 16:53:02 2012(r231025) @@ -159,6 +159,10 @@ struct tcphdr { #define TCP_MD5SIG 0x10/* use MD5 digests (RFC2385) */ #defineTCP_INFO0x20/* retrieve tcp_info structure */ #defineTCP_CONGESTION 0x40/* get/set congestion control algorithm */ +#defineTCP_KEEPINIT0x80/* N, time to establish connection */ +#defineTCP_KEEPIDLE0x100 /* L,N,X start keeplives after this period */ +#defineTCP_KEEPINTVL 0x200 /* L,N interval between keepalives */ +#defineTCP_KEEPCNT 0x400 /* L,N number of keepalives before close */ #defineTCP_CA_NAME_MAX 16 /* max congestion control name length */ Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cSun Feb 5 16:41:06 2012 (r231024) +++ head/sys/netinet/tcp_input.cSun Feb 5 16:53:02 2012 (r231025) @@ -1446,7 +1446,7 @@ tcp_do_segment(struct mbuf *m, struct tc */ tp->t_rcvtime = ticks; if (TCPS_HAVEESTABLISHED(tp->t_state)) - tcp_timer_activate(tp, TT_KEEP, tcp_keepidle); +
svn commit: r231026 - head/sys/powerpc/ofw
Author: nwhitehorn Date: Sun Feb 5 16:54:26 2012 New Revision: 231026 URL: http://svn.freebsd.org/changeset/base/231026 Log: Make sure to remap adjusted resources. Modified: head/sys/powerpc/ofw/ofw_pci.c Modified: head/sys/powerpc/ofw/ofw_pci.c == --- head/sys/powerpc/ofw/ofw_pci.c Sun Feb 5 16:53:02 2012 (r231025) +++ head/sys/powerpc/ofw/ofw_pci.c Sun Feb 5 16:54:26 2012 (r231026) @@ -431,6 +431,7 @@ ofw_pci_adjust_resource(device_t bus, de { struct rman *rm = NULL; struct ofw_pci_softc *sc = device_get_softc(bus); + int error; switch (type) { case SYS_RES_MEMORY: @@ -445,7 +446,22 @@ ofw_pci_adjust_resource(device_t bus, de if (!rman_is_region_manager(res, rm)) return (EINVAL); - return (rman_adjust_resource(res, start, end)); + + error = rman_adjust_resource(res, start, end); + if (error) + return (error); + + if (rman_get_flags(res) & RF_ACTIVE) { + /* Remap memory resources */ + error = ofw_pci_deactivate_resource(bus, child, type, + rman_get_rid(res), res); + if (error) + return (error); + error = ofw_pci_activate_resource(bus, child, type, + rman_get_rid(res), res); + } + + return (error); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231042 - in head/sys/boot/ficl: . i386
Author: rpaulo Date: Sun Feb 5 20:00:39 2012 New Revision: 231042 URL: http://svn.freebsd.org/changeset/base/231042 Log: Fix clang warnings. Modified: head/sys/boot/ficl/fileaccess.c head/sys/boot/ficl/i386/sysdep.h Modified: head/sys/boot/ficl/fileaccess.c == --- head/sys/boot/ficl/fileaccess.c Sun Feb 5 19:59:01 2012 (r231041) +++ head/sys/boot/ficl/fileaccess.c Sun Feb 5 20:00:39 2012 (r231042) @@ -420,6 +420,6 @@ void ficlCompileFile(FICL_SYSTEM *pSys) ficlSetEnv(pSys, "file-ext", FICL_TRUE); #endif /* FICL_HAVE_FTRUNCATE */ #else -&pSys; +(void)pSys; #endif /* FICL_WANT_FILE */ } Modified: head/sys/boot/ficl/i386/sysdep.h == --- head/sys/boot/ficl/i386/sysdep.hSun Feb 5 19:59:01 2012 (r231041) +++ head/sys/boot/ficl/i386/sysdep.hSun Feb 5 20:00:39 2012 (r231042) @@ -58,7 +58,7 @@ #include #if !defined IGNORE/* Macro to silence unused param warnings */ -#define IGNORE(x) &x +#define IGNORE(x) (void)x #endif /* @@ -405,7 +405,7 @@ void *ficlRealloc(void *p, size_t size); #if FICL_MULTITHREAD int ficlLockDictionary(short fLock); #else -#define ficlLockDictionary(x) 0 /* ignore */ +#define ficlLockDictionary(x) /* ignore */ #endif /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231044 - in head: lib/libc/powerpc lib/libc/powerpc/gen lib/libc/powerpc64 lib/libc/powerpc64/gen sys/powerpc/include
Author: andreast Date: Sun Feb 5 20:04:43 2012 New Revision: 231044 URL: http://svn.freebsd.org/changeset/base/231044 Log: Replace the assembler macro WEAK_ALIAS with a new macro WEAK_REFERENCE which has the same API as __weak_reference(). Give 'x' in SYS.h a more meaningful name. Tested on 32- and 64-bit PowerMac. Reviewed by: bde Modified: head/lib/libc/powerpc/SYS.h head/lib/libc/powerpc/gen/setjmp.S head/lib/libc/powerpc64/SYS.h head/lib/libc/powerpc64/gen/setjmp.S head/sys/powerpc/include/asm.h Modified: head/lib/libc/powerpc/SYS.h == --- head/lib/libc/powerpc/SYS.h Sun Feb 5 20:04:21 2012(r231043) +++ head/lib/libc/powerpc/SYS.h Sun Feb 5 20:04:43 2012(r231044) @@ -33,38 +33,38 @@ #include #include -#define _SYSCALL(x)\ +#define_SYSCALL(name) \ .text; \ .align 2; \ - li 0,(__CONCAT(SYS_,x)); \ + li 0,(__CONCAT(SYS_, name)); \ sc -#defineSYSCALL(x) \ +#defineSYSCALL(name) \ .text; \ .align 2; \ 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ -ENTRY(__CONCAT(__sys_,x)); \ - WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ - WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ - _SYSCALL(x);\ +ENTRY(__CONCAT(__sys_, name)); \ + WEAK_REFERENCE(__CONCAT(__sys_, name), name); \ + WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\ + _SYSCALL(name); \ bso 2b -#definePSEUDO(x) \ +#definePSEUDO(name)\ .text; \ .align 2; \ -ENTRY(__CONCAT(__sys_,x)); \ - WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ - _SYSCALL(x);\ +ENTRY(__CONCAT(__sys_, name)); \ + WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\ + _SYSCALL(name); \ bnslr; \ b PIC_PLT(CNAME(HIDENAME(cerror))) -#defineRSYSCALL(x) \ +#defineRSYSCALL(name) \ .text; \ .align 2; \ 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ -ENTRY(__CONCAT(__sys_,x)); \ - WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ - WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x)); \ - _SYSCALL(x);\ +ENTRY(__CONCAT(__sys_, name)); \ + WEAK_REFERENCE(__CONCAT(__sys_, name), name); \ + WEAK_REFERENCE(__CONCAT(__sys_, name), __CONCAT(_, name));\ + _SYSCALL(name); \ bnslr; \ b PIC_PLT(CNAME(HIDENAME(cerror))) Modified: head/lib/libc/powerpc/gen/setjmp.S == --- head/lib/libc/powerpc/gen/setjmp.S Sun Feb 5 20:04:21 2012 (r231043) +++ head/lib/libc/powerpc/gen/setjmp.S Sun Feb 5 20:04:43 2012 (r231044) @@ -69,7 +69,7 @@ ENTRY(setjmp) li %r3,0 /* return (0) */ blr - WEAK_ALIAS(longjmp, __longjmp) + WEAK_REFERENCE(CNAME(__longjmp), longjmp) ENTRY(__longjmp) lmw %r9,20(%r3) /* restore regs */ mr %r6,%r4 /* save val param */ Modified: head/lib/libc/powerpc64/SYS.h == --- head/lib/libc/powerpc64/SYS.h Sun Feb 5 20:04:21 2012 (r231043) +++ head/lib/libc/powerpc64/SYS.h Sun Feb 5 20:04:43 2012 (r231044) @@ -33,13 +33,13 @@ #include #include -#define _SYSCALL(x)\ +#define_SYSCALL(name)
svn commit: r231046 - head/sys/powerpc/ofw
Author: nwhitehorn Date: Sun Feb 5 20:07:45 2012 New Revision: 231046 URL: http://svn.freebsd.org/changeset/base/231046 Log: Inherit from PCI bridge driver instead of manually specifying all of its methods. Obtained from:sparc64 MFC after:1 week Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c == --- head/sys/powerpc/ofw/ofw_pcib_pci.c Sun Feb 5 20:06:43 2012 (r231045) +++ head/sys/powerpc/ofw/ofw_pcib_pci.c Sun Feb 5 20:07:45 2012 (r231046) @@ -56,31 +56,10 @@ static int ofw_pcib_pci_route_interrupt( static device_method_t ofw_pcib_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ofw_pcib_pci_probe), - DEVMETHOD(device_attach,ofw_pcib_pci_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume,bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_read_ivar,pcib_read_ivar), - DEVMETHOD(bus_write_ivar, pcib_write_ivar), - DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_release_resource), - DEVMETHOD(bus_activate_resource,bus_generic_activate_resource), - DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr), + DEVMETHOD(device_attach,ofw_pcib_pci_attach), /* pcib interface */ - DEVMETHOD(pcib_maxslots,pcib_maxslots), - DEVMETHOD(pcib_read_config, pcib_read_config), - DEVMETHOD(pcib_write_config,pcib_write_config), DEVMETHOD(pcib_route_interrupt, ofw_pcib_pci_route_interrupt), - DEVMETHOD(pcib_alloc_msi, pcib_alloc_msi), - DEVMETHOD(pcib_release_msi, pcib_release_msi), - DEVMETHOD(pcib_alloc_msix, pcib_alloc_msix), - DEVMETHOD(pcib_release_msix,pcib_release_msix), - DEVMETHOD(pcib_map_msi, pcib_map_msi), /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, ofw_pcib_pci_get_node), @@ -101,8 +80,8 @@ struct ofw_pcib_softc { struct ofw_bus_iinfoops_iinfo; }; -DEFINE_CLASS_0(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, -sizeof(struct ofw_pcib_softc)); +DEFINE_CLASS_1(pcib, ofw_pcib_pci_driver, ofw_pcib_pci_methods, +sizeof(struct ofw_pcib_softc), pcib_driver); DRIVER_MODULE(ofw_pcib, pci, ofw_pcib_pci_driver, pcib_devclass, 0, 0); static int ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231054 - head/usr.bin/rpcgen
Author: dim Date: Sun Feb 5 20:55:38 2012 New Revision: 231054 URL: http://svn.freebsd.org/changeset/base/231054 Log: In usr.bin/rpcgen/rpc_main.c, properly check the return value of strlcpy(), in addition to checking that of strlcat(). MFC after:1 week Modified: head/usr.bin/rpcgen/rpc_main.c Modified: head/usr.bin/rpcgen/rpc_main.c == --- head/usr.bin/rpcgen/rpc_main.c Sun Feb 5 20:53:06 2012 (r231053) +++ head/usr.bin/rpcgen/rpc_main.c Sun Feb 5 20:55:38 2012 (r231054) @@ -1125,9 +1125,11 @@ parseargs(int argc, const char *argv[], if (++i == argc) { return (0); } - (void) strlcpy(pathbuf, argv[i], sizeof(pathbuf)); - if (strlcat(pathbuf, "/cpp", sizeof(pathbuf)) - >= sizeof(pathbuf)) { + if (strlcpy(pathbuf, argv[i], + sizeof(pathbuf)) >= sizeof(pathbuf) + || strlcat(pathbuf, "/cpp", + sizeof(pathbuf)) >= + sizeof(pathbuf)) { warnx("argument too long"); return (0); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sun, 5 Feb 2012 10:39:38 +0100 Pawel Jakub Dawidek wrote: PJD> On Sat, Feb 04, 2012 at 08:16:42PM +0200, Mikolaj Golub wrote: >> ref8-amd64:/home/trociny% uname -r >> 8.2-STABLE >> ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 >> ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10 >> daemon: process already running, pid: 19799 >> >> kopusha:~% uname -r >> 10.0-CURRENT >> kopusha:~% daemon -p /tmp/sleep.pid sleep 10 >> kopusha:~% daemon -p /tmp/sleep.pid sleep 10 >> kopusha:~% PJD> Mikolaj, eventhough what we had in 8.2-STABLE looks correct, it also PJD> isn't correct. PJD> Passing open descriptor to a process that doesn't expect that is bad PJD> behaviour. If you pass, eg. open descriptor to a directory and the PJD> process is using chroot(2) or jail(2) to sandbox itself it will be able PJD> to escape from that sandbox. Passing descriptor to a file has smaller PJD> security implication, but it is still wrong. For example hastd, as you PJD> probably know, asserts, before sandboxing, that he knows about all open PJD> descriptors - if there are some unknown descriptors open it won't run. PJD> Also, daemon was passing open descriptor to a pidfile that the child PJD> process cannot clean up, because he doesn't know its name. This leaves PJD> pidfile with stale PID in it once the process exits, which is also bad. PJD> In my opinion, to make daemon(8) work with pidfiles, it cannot exit PJD> after executing the given command. It should stay around with pidfile PJD> open and just wait for the child to exit. Once the child exits, it PJD> should remove the pidfile and also exit. Ok, using hastd code as a reference :-) here is my implementation. -- Mikolaj Golub Index: usr.sbin/daemon/daemon.c === --- usr.sbin/daemon/daemon.c (revision 231014) +++ usr.sbin/daemon/daemon.c (working copy) @@ -32,26 +32,31 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include -#include #include #include +#include +#include #include #include #include static void restrict_process(const char *); +static void wait_child(pid_t, sigset_t *); +static void dummy_sighandler(int); static void usage(void); int main(int argc, char *argv[]) { struct pidfh *pfh = NULL; - int ch, nochdir, noclose, errcode; + sigset_t mask, oldmask; + int ch, nochdir, noclose; const char *pidfile, *user; - pid_t otherpid; + pid_t otherpid, pid; nochdir = noclose = 1; pidfile = user = NULL; @@ -82,40 +87,96 @@ main(int argc, char *argv[]) if (user != NULL) restrict_process(user); + if (pidfile == NULL) { + /* + * This is a simple case. Daemonize and exec. + */ + if (daemon(nochdir, noclose) == -1) + err(1, NULL); + + execvp(argv[0], argv); + + /* + * execvp() failed -- report the error. The child is + * now running, so the exit status doesn't matter. + */ + err(1, "%s", argv[0]); + } + /* * Try to open the pidfile before calling daemon(3), - * to be able to report the error intelligently + * to be able to report the error intelligently. */ - if (pidfile) { - pfh = pidfile_open(pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { -errx(3, "process already running, pid: %d", -otherpid); - } - err(2, "pidfile ``%s''", pidfile); + pfh = pidfile_open(pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + otherpid); } + err(2, "pidfile ``%s''", pidfile); } - if (daemon(nochdir, noclose) == -1) err(1, NULL); + /* + * We want to keep pidfile open while the command is running + * and remove it on exit. So we execute the command in a + * forked process and wait for the child to exit. We don't + * want the waiting daemon to be killed leaving the running + * process and the stale pidfile, so we pass received SIGHUP, + * SIGINT and SIGTERM to the children expecting to get SIGCHLD + * eventually. + */ - /* Now that we are the child, write out the pid */ - if (pidfile) - pidfile_write(pfh); - - execvp(argv[0], argv); - /* - * execvp() failed -- unlink pidfile if any, and - * report the error + * Restore default actions for interesting signals in case + * the parent process decided to ignore some of them. */ - errcode = errno; /* Preserve errcode -- unlink may reset it */ - if (pidfile) + if (signal(SIGHUP, SIG_DFL) == SIG_ERR) + err(1, "signal"); + if (signal(SIGINT, SIG_DFL) == SIG_ERR) + err(1, "signal"); + if (signal(SIGTERM, SIG_DFL) == SIG_ERR) + err(1, "signal"); + /* + * Because SIGCHLD is ignored by default, setup dummy handler + * for it, so we can mask it. + */ + if (signal(SIGCHLD, dummy_sighandler) == SIG_ERR) + err(1, "signal"); + /* + * Block interesting signals. + */ + sigemptyset(&mask); + sigaddset(&mask, SIGHUP); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + sigaddse
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: > Ok, using hastd code as a reference :-) here is my implementation. - I'd not pass selected signals to the child. The parent can still be killed with a whole bunch of different signals that are not passed or cannot be caught or the child process handle them gracefully. Signals should be send to the PID from the pidfile anyway. If someone is sending signals to the parent he has no right to expect well behaviour from the parent. - Now that we handle the pidfile fully in the parent, I'd move dropping provileges after fork(2) and pidfile_write(3). This way pidfiles will always be created with root privileges and we can forget about all the mess with pid directories, etc. - With the above you can wait for child to exit with simple wait(2). -- Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://tupytaj.pl pgpEewgyvkM0J.pgp Description: PGP signature
Re: svn commit: r230869 - head/usr.sbin/daemon
Hi Pawel, On Feb 5, 2012 1:48 PM, "Pawel Jakub Dawidek" wrote: > > On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: > > Ok, using hastd code as a reference :-) here is my implementation. > > - I'd not pass selected signals to the child. The parent can still be > killed with a whole bunch of different signals that are not passed or > cannot be caught or the child process handle them gracefully. > Signals should be send to the PID from the pidfile anyway. If someone > is sending signals to the parent he has no right to expect well > behaviour from the parent. > > - Now that we handle the pidfile fully in the parent, I'd move dropping > provileges after fork(2) and pidfile_write(3). This way pidfiles will > always be created with root privileges and we can forget about all the > mess with pid directories, etc. > > - With the above you can wait for child to exit with simple wait(2). If you are going to wait for the child anyway, you are doing almost everything supervise does. All you now need is a Unix domain socket interface so you can receive commands in daemon(1), and run daemon(1) at boot. AND you can remove all the pidfile code :) Jos ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231055 - head/share/man/man5
Author: dim Date: Sun Feb 5 23:02:13 2012 New Revision: 231055 URL: http://svn.freebsd.org/changeset/base/231055 Log: Regenerate src.conf.5, after r230972 added the WITHOUT_SOURCELESS build options. MFC after:2 weeks Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 == --- head/share/man/man5/src.conf.5 Sun Feb 5 20:55:38 2012 (r231054) +++ head/share/man/man5/src.conf.5 Sun Feb 5 23:02:13 2012 (r231055) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru .\" $FreeBSD$ -.Dd January 13, 2012 +.Dd February 5, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -869,6 +869,23 @@ as a set-user-ID root program. Set to not build the .Bx 4.4 legacy docs. +.It Va WITHOUT_SOURCELESS +.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS 230972 2012-02-04 00:54:43Z rmh +Set to not build kernel modules that include sourceless code (either microcode or native code for host CPU). +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_SOURCELESS_HOST +.It +.Va WITHOUT_SOURCELESS_UCODE +.El +.It Va WITHOUT_SOURCELESS_HOST +.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS_HOST 230972 2012-02-04 00:54:43Z rmh +Set to not build kernel modules that include sourceless native code for host CPU. +.It Va WITHOUT_SOURCELESS_UCODE +.\" from FreeBSD: head/tools/build/options/WITHOUT_SOURCELESS_UCODE 230972 2012-02-04 00:54:43Z rmh +Set to not build kernel modules that include sourceless microcode. .It Va WITHOUT_SSP .\" from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru Set to not build world with propolice stack smashing protection. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231057 - in head: contrib/llvm/tools/bugpoint contrib/llvm/tools/llc contrib/llvm/tools/lli contrib/llvm/tools/llvm-ar contrib/llvm/tools/llvm-as contrib/llvm/tools/llvm-bcanalyzer con...
Author: dim Date: Sun Feb 5 23:56:22 2012 New Revision: 231057 URL: http://svn.freebsd.org/changeset/base/231057 Log: Add a WITH_CLANG_EXTRAS option for src.conf(5), disabled by default, that builds the following additional llvm/clang tools: - bugpoint - llc - lli - llvm-ar - llvm-as - llvm-bcanalyzer - llvm-diff - llvm-dis - llvm-extract - llvm-ld - llvm-link - llvm-mc - llvm-nm - llvm-objdump - llvm-prof - llvm-ranlib - llvm-rtdyld - llvm-stub - macho-dump - opt These tools are mainly useful for people that want to manipulate llvm bitcode (.bc) and llvm assembly language (.ll) files, or want to tinker with llvm and clang themselves. MFC after:2 weeks Added: head/contrib/llvm/tools/bugpoint/ - copied from r230910, vendor/llvm/dist/tools/bugpoint/ head/contrib/llvm/tools/llc/ - copied from r230910, vendor/llvm/dist/tools/llc/ head/contrib/llvm/tools/lli/ - copied from r230910, vendor/llvm/dist/tools/lli/ head/contrib/llvm/tools/llvm-ar/ - copied from r230910, vendor/llvm/dist/tools/llvm-ar/ head/contrib/llvm/tools/llvm-as/ - copied from r230910, vendor/llvm/dist/tools/llvm-as/ head/contrib/llvm/tools/llvm-bcanalyzer/ - copied from r230910, vendor/llvm/dist/tools/llvm-bcanalyzer/ head/contrib/llvm/tools/llvm-diff/ - copied from r230910, vendor/llvm/dist/tools/llvm-diff/ head/contrib/llvm/tools/llvm-dis/ - copied from r230910, vendor/llvm/dist/tools/llvm-dis/ head/contrib/llvm/tools/llvm-extract/ - copied from r230910, vendor/llvm/dist/tools/llvm-extract/ head/contrib/llvm/tools/llvm-ld/ - copied from r230910, vendor/llvm/dist/tools/llvm-ld/ head/contrib/llvm/tools/llvm-link/ - copied from r230910, vendor/llvm/dist/tools/llvm-link/ head/contrib/llvm/tools/llvm-mc/ - copied from r230910, vendor/llvm/dist/tools/llvm-mc/ head/contrib/llvm/tools/llvm-nm/ - copied from r230910, vendor/llvm/dist/tools/llvm-nm/ head/contrib/llvm/tools/llvm-objdump/ - copied from r230910, vendor/llvm/dist/tools/llvm-objdump/ head/contrib/llvm/tools/llvm-prof/ - copied from r230910, vendor/llvm/dist/tools/llvm-prof/ head/contrib/llvm/tools/llvm-ranlib/ - copied from r230910, vendor/llvm/dist/tools/llvm-ranlib/ head/contrib/llvm/tools/llvm-rtdyld/ - copied from r230910, vendor/llvm/dist/tools/llvm-rtdyld/ head/contrib/llvm/tools/llvm-stub/ - copied from r230910, vendor/llvm/dist/tools/llvm-stub/ head/contrib/llvm/tools/macho-dump/ - copied from r230910, vendor/llvm/dist/tools/macho-dump/ head/contrib/llvm/tools/opt/ - copied from r230910, vendor/llvm/dist/tools/opt/ head/lib/clang/libllvmarchive/ head/lib/clang/libllvmarchive/Makefile (contents, props changed) head/lib/clang/libllvmdebuginfo/ head/lib/clang/libllvmdebuginfo/Makefile (contents, props changed) head/lib/clang/libllvmexecutionengine/ head/lib/clang/libllvmexecutionengine/Makefile (contents, props changed) head/lib/clang/libllvminterpreter/ head/lib/clang/libllvminterpreter/Makefile (contents, props changed) head/lib/clang/libllvmjit/ head/lib/clang/libllvmjit/Makefile (contents, props changed) head/lib/clang/libllvmlinker/ head/lib/clang/libllvmlinker/Makefile (contents, props changed) head/lib/clang/libllvmmcdisassembler/ head/lib/clang/libllvmmcdisassembler/Makefile (contents, props changed) head/lib/clang/libllvmmcjit/ head/lib/clang/libllvmmcjit/Makefile (contents, props changed) head/lib/clang/libllvmobject/ head/lib/clang/libllvmobject/Makefile (contents, props changed) head/lib/clang/libllvmruntimedyld/ head/lib/clang/libllvmruntimedyld/Makefile (contents, props changed) head/tools/build/options/WITH_CLANG_EXTRAS (contents, props changed) head/usr.bin/clang/bugpoint/ head/usr.bin/clang/bugpoint/Makefile (contents, props changed) head/usr.bin/clang/bugpoint/bugpoint.1 (contents, props changed) head/usr.bin/clang/llc/ head/usr.bin/clang/llc/Makefile (contents, props changed) head/usr.bin/clang/llc/llc.1 (contents, props changed) head/usr.bin/clang/lli/ head/usr.bin/clang/lli/Makefile (contents, props changed) head/usr.bin/clang/lli/lli.1 (contents, props changed) head/usr.bin/clang/llvm-ar/ head/usr.bin/clang/llvm-ar/Makefile (contents, props changed) head/usr.bin/clang/llvm-ar/llvm-ar.1 (contents, props changed) head/usr.bin/clang/llvm-as/ head/usr.bin/clang/llvm-as/Makefile (contents, props changed) head/usr.bin/clang/llvm-as/llvm-as.1 (contents, props changed) head/usr.bin/clang/llvm-bcanalyzer/ head/usr.bin/clang/llvm-bcanalyzer/Makefile (contents, props changed) head/usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 (contents, props changed) head/usr.bin/clang/llvm-diff/ head/usr.bin/clang/llvm-diff/Makefile (contents, props changed) head/usr.bin/clang/llvm-diff/llvm-diff.1 (contents, props changed) head/usr.bin/clang/llvm-di
svn commit: r231058 - head/sys/net80211
Author: adrian Date: Mon Feb 6 00:26:29 2012 New Revision: 231058 URL: http://svn.freebsd.org/changeset/base/231058 Log: Update the mesh reason codes to match the latest 802.11s specification. Submitted by: Reviewed by: rpaulo Modified: head/sys/net80211/ieee80211.h Modified: head/sys/net80211/ieee80211.h == --- head/sys/net80211/ieee80211.h Sun Feb 5 23:56:22 2012 (r231057) +++ head/sys/net80211/ieee80211.h Mon Feb 6 00:26:29 2012 (r231058) @@ -927,19 +927,21 @@ enum { IEEE80211_REASON_SETUP_NEEDED = 38, /* 11e */ IEEE80211_REASON_TIMEOUT= 39, /* 11e */ - /* values not yet allocated by ANA */ - IEEE80211_REASON_PEER_LINK_CANCELED = 2,/* 11s */ - IEEE80211_REASON_MESH_MAX_PEERS = 3,/* 11s */ - IEEE80211_REASON_MESH_CPVIOLATION = 4,/* 11s */ - IEEE80211_REASON_MESH_CLOSE_RCVD= 5,/* 11s */ - IEEE80211_REASON_MESH_MAX_RETRIES = 6,/* 11s */ - IEEE80211_REASON_MESH_CONFIRM_TIMEOUT = 7,/* 11s */ - IEEE80211_REASON_MESH_INVALID_GTK = 8,/* 11s */ - IEEE80211_REASON_MESH_INCONS_PARAMS = 9,/* 11s */ - IEEE80211_REASON_MESH_INVALID_SECURITY = 10, /* 11s */ - IEEE80211_REASON_MESH_PERR_UNSPEC = 11, /* 11s */ - IEEE80211_REASON_MESH_PERR_NO_FI= 12, /* 11s */ - IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 13, /* 11s */ + IEEE80211_REASON_PEER_LINK_CANCELED = 52, /* 11s */ + IEEE80211_REASON_MESH_MAX_PEERS = 53, /* 11s */ + IEEE80211_REASON_MESH_CPVIOLATION = 54, /* 11s */ + IEEE80211_REASON_MESH_CLOSE_RCVD= 55, /* 11s */ + IEEE80211_REASON_MESH_MAX_RETRIES = 56, /* 11s */ + IEEE80211_REASON_MESH_CONFIRM_TIMEOUT = 57, /* 11s */ + IEEE80211_REASON_MESH_INVALID_GTK = 58, /* 11s */ + IEEE80211_REASON_MESH_INCONS_PARAMS = 59, /* 11s */ + IEEE80211_REASON_MESH_INVALID_SECURITY = 60, /* 11s */ + IEEE80211_REASON_MESH_PERR_NO_PROXY = 61, /* 11s */ + IEEE80211_REASON_MESH_PERR_NO_FI= 62, /* 11s */ + IEEE80211_REASON_MESH_PERR_DEST_UNREACH = 63, /* 11s */ + IEEE80211_REASON_MESH_MAC_ALRDY_EXISTS_MBSS = 64, /* 11s */ + IEEE80211_REASON_MESH_CHAN_SWITCH_REG = 65, /* 11s */ + IEEE80211_REASON_MESH_CHAN_SWITCH_UNSPEC = 66, /* 11s */ IEEE80211_STATUS_SUCCESS= 0, IEEE80211_STATUS_UNSPECIFIED= 1, ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r231044 - in head: lib/libc/powerpc lib/libc/powerpc/gen lib/libc/powerpc64 lib/libc/powerpc64/gen sys/powerpc/include
On Sun, 5 Feb 2012, Andreas Tobler wrote: Log: Replace the assembler macro WEAK_ALIAS with a new macro WEAK_REFERENCE which has the same API as __weak_reference(). Give 'x' in SYS.h a more meaningful name. Tested on 32- and 64-bit PowerMac. Reviewed by: bde Thanks. Bruce ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r231060 - head/sys/kern
Author: kevlo Date: Mon Feb 6 06:03:16 2012 New Revision: 231060 URL: http://svn.freebsd.org/changeset/base/231060 Log: - Use uint8_t for the variable x and spell the size of the variable as sizeof(x) - Capitalized comment - Parentheses around return value Requested by: bde Modified: head/sys/kern/subr_mchain.c Modified: head/sys/kern/subr_mchain.c == --- head/sys/kern/subr_mchain.c Mon Feb 6 04:23:37 2012(r231059) +++ head/sys/kern/subr_mchain.c Mon Feb 6 06:03:16 2012(r231060) @@ -62,7 +62,7 @@ mb_init(struct mbchain *mbp) m = m_gethdr(M_WAIT, MT_DATA); m->m_len = 0; mb_initm(mbp, m); - return 0; + return (0); } void @@ -89,13 +89,13 @@ mb_detach(struct mbchain *mbp) m = mbp->mb_top; mbp->mb_top = NULL; - return m; + return (m); } int mb_fixhdr(struct mbchain *mbp) { - return mbp->mb_top->m_pkthdr.len = m_fixhdr(mbp->mb_top); + return (mbp->mb_top->m_pkthdr.len = m_fixhdr(mbp->mb_top)); } /* @@ -124,70 +124,70 @@ mb_reserve(struct mbchain *mbp, int size mbp->mb_count += size; bpos = mtod(m, caddr_t) + m->m_len; m->m_len += size; - return bpos; + return (bpos); } int mb_put_padbyte(struct mbchain *mbp) { caddr_t dst; - char x = 0; + uint8_t x = 0; dst = mtod(mbp->mb_cur, caddr_t) + mbp->mb_cur->m_len; - /* only add padding if address is odd */ + /* Only add padding if address is odd */ if ((unsigned long)dst & 1) - return mb_put_mem(mbp, (caddr_t)&x, 1, MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); else - return 0; + return (0); } int mb_put_uint8(struct mbchain *mbp, uint8_t x) { - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint16be(struct mbchain *mbp, uint16_t x) { x = htobe16(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint16le(struct mbchain *mbp, uint16_t x) { x = htole16(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint32be(struct mbchain *mbp, uint32_t x) { x = htobe32(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_uint32le(struct mbchain *mbp, uint32_t x) { x = htole32(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_int64be(struct mbchain *mbp, int64_t x) { x = htobe64(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int mb_put_int64le(struct mbchain *mbp, int64_t x) { x = htole64(x); - return mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM); + return (mb_put_mem(mbp, (caddr_t)&x, sizeof(x), MB_MSYSTEM)); } int @@ -220,7 +220,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_ dstlen = mleft; error = mbp->mb_copy(mbp, source, dst, &srclen, &dstlen); if (error) - return error; + return (error); break; case MB_MINLINE: for (src = source, count = cplen; count; count--) @@ -232,7 +232,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_ case MB_MUSER: error = copyin(source, dst, cplen); if (error) - return error; + return (error); break; case MB_MZERO: bzero(dst, cplen); @@ -246,7 +246,7 @@ mb_put_mem(struct mbchain *mbp, c_caddr_ } mbp->mb_cur = m; mbp->mb_mleft = mleft; - return 0; + return (0); } int @@ -261,7 +261,7 @@ mb_put_mbuf(struct mbchain *mbp, struct } mbp->mb_mleft = M_TRAILINGSPACE(m); mbp->mb_cur = m; - return 0; + return (0); } /* @@ -277,7 +277,7 @@ mb_put_uio(struct mbchain *mbp, struct u while (size > 0 && uiop->uio_resid) { if (uiop->uio_iovcnt <= 0 || uiop->uio_iov == NULL) - return EFBIG; + return (EFBIG); left = uiop->uio_iov->iov_len; if (left == 0) { uiop->uio_iov++; @@ -288,7
Re: svn commit: r230869 - head/usr.sbin/daemon
On Sun, 5 Feb 2012 22:46:48 +0100 Pawel Jakub Dawidek wrote: PJD> On Sun, Feb 05, 2012 at 11:27:10PM +0200, Mikolaj Golub wrote: >> Ok, using hastd code as a reference :-) here is my implementation. PJD> - I'd not pass selected signals to the child. The parent can still be PJD> killed with a whole bunch of different signals that are not passed or PJD> cannot be caught or the child process handle them gracefully. PJD> Signals should be send to the PID from the pidfile anyway. If someone PJD> is sending signals to the parent he has no right to expect well PJD> behaviour from the parent. Well, sending a whole bunch of different signals to parent we might not expect right behavior, but why not to provide it for the "standard" ones? E.g. on shutdown init(8) will send SIGTERM and the daemon will gracefully exit terminating the child and cleaning up the pidfile. If the the child process does not handle SIGTERM gracefully I don't see much difference from having only this one process alive or two (with its monitoring daemon). The pidfile is seen in ps(1) output for the daemon process, which allows to identify the monitoring daemon with its child. Or we could change its proctitle to something like "daemon: cmdname[pid]", similar to what sshd does. So people would expect that terminating a daemon will terminate the process it monitors. PJD> - Now that we handle the pidfile fully in the parent, I'd move dropping PJD> provileges after fork(2) and pidfile_write(3). This way pidfiles will PJD> always be created with root privileges and we can forget about all the PJD> mess with pid directories, etc. PJD> - With the above you can wait for child to exit with simple wait(2). Yes, it looks like much simpler, see the attached patch. But I don't think I like it much as it still looks like a half measure to me. -- Mikolaj Golub Index: usr.sbin/daemon/daemon.c === --- usr.sbin/daemon/daemon.c (revision 231060) +++ usr.sbin/daemon/daemon.c (working copy) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include @@ -49,9 +50,9 @@ int main(int argc, char *argv[]) { struct pidfh *pfh = NULL; - int ch, nochdir, noclose, errcode; + int ch, nochdir, noclose, status; const char *pidfile, *user; - pid_t otherpid; + pid_t otherpid, pid; nochdir = noclose = 1; pidfile = user = NULL; @@ -79,43 +80,61 @@ main(int argc, char *argv[]) if (argc == 0) usage(); - if (user != NULL) - restrict_process(user); + if (pidfile == NULL) { + /* + * This is a simple case. Daemonize and exec. + */ + if (daemon(nochdir, noclose) == -1) + err(1, NULL); + if (user != NULL) + restrict_process(user); + + execvp(argv[0], argv); + + /* + * execvp() failed -- report the error. The child is + * now running, so the exit status doesn't matter. + */ + err(1, "%s", argv[0]); + } + /* * Try to open the pidfile before calling daemon(3), * to be able to report the error intelligently */ - if (pidfile) { - pfh = pidfile_open(pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { -errx(3, "process already running, pid: %d", -otherpid); - } - err(2, "pidfile ``%s''", pidfile); + pfh = pidfile_open(pidfile, 0600, &otherpid); + if (pfh == NULL) { + if (errno == EEXIST) { + errx(3, "process already running, pid: %d", + otherpid); } + err(2, "pidfile ``%s''", pidfile); } if (daemon(nochdir, noclose) == -1) err(1, NULL); - /* Now that we are the child, write out the pid */ - if (pidfile) + pid = fork(); + if (pid == -1) { + pidfile_remove(pfh); + err(1, "fork"); + } + if (pid == 0) { + /* Now that we are the child, write out the pid. */ pidfile_write(pfh); - execvp(argv[0], argv); + if (user != NULL) + restrict_process(user); - /* - * execvp() failed -- unlink pidfile if any, and - * report the error - */ - errcode = errno; /* Preserve errcode -- unlink may reset it */ - if (pidfile) - pidfile_remove(pfh); + execvp(argv[0], argv); - /* The child is now running, so the exit status doesn't matter. */ - errc(1, errcode, "%s", argv[0]); + /* execvp() failed. */ + err(1, "%s", argv[0]); + } + (void)wait(&status); + pidfile_remove(pfh); + exit(0); } static void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"