Re: locate/mklocatedb.sh: remove unused option
Bump. These scripts could use a little refreshing. On 22:34:57, 12.06.17, Michal Mazurek wrote: > This script has an option called -presort or -nosort, that appears to > never be used, so remove it. This makes the $sort* options unneeded, > remove them too. > > The script itself is used by updatedb and pkg_mklocatedb. > > Comments? OK? > > Index: usr.bin/locate/locate/mklocatedb.sh > === > RCS file: /cvs/src/usr.bin/locate/locate/mklocatedb.sh,v > retrieving revision 1.13 > diff -u -p -r1.13 mklocatedb.sh > --- usr.bin/locate/locate/mklocatedb.sh 18 Mar 2007 20:13:49 - > 1.13 > +++ usr.bin/locate/locate/mklocatedb.sh 12 Jun 2017 20:30:53 - > @@ -28,7 +28,7 @@ > # > # mklocatedb - build locate database > # > -# usage: mklocatedb [-presort] < filelist > database > +# usage: mklocatedb < filelist > database > # > # $Id: mklocatedb.sh,v 1.13 2007/03/18 20:13:49 otto Exp $ > > @@ -48,15 +48,6 @@ fi > # utilities to built locate database > : ${bigram=locate.bigram} > : ${code=locate.code} > -: ${sort=sort -H} > - > -sortopt="-u -T $TMPDIR" > -sortcmd="$sort" > - > -# Input already sorted > -case X"$1" in > - X-nosort|X-presort) sortcmd=cat; sortopt=;shift;; > -esac > > bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XX` || exit 1 > trap 'rm -f $bigrams' 0 1 2 3 5 10 15 > @@ -66,8 +57,8 @@ filelist=`mktemp ${TMPDIR=/tmp}/_filelis > } > trap 'rm -f $bigrams $filelist' 0 1 2 3 5 10 15 > > -if $sortcmd $sortopt > $filelist; then > -$bigram < $filelist | $sort -nr | > +if sort -HuT "$TMPDIR" > $filelist; then > + $bigram < $filelist | sort -Hnr | > awk -Ft 'BEGIN { ORS = "" } NR <= 128 { print $2 }' > > $bigrams && > $code $bigrams < $filelist > else > > -- > Michal Mazurek -- Michal Mazurek
crypt_checkpass.3: clarify cetrain points
I lost the old thread. tedu@ said that we musn't recommend a buffer size of 61 (current underlying code), but instead suggested using _PASSWORD_LEN or 128. _PASSWORD_LEN is used in /usr/src and /usr/ports. Index: lib/libc/crypt/crypt_checkpass.3 === RCS file: /cvs/src/lib/libc/crypt/crypt_checkpass.3,v retrieving revision 1.9 diff -u -p -r1.9 crypt_checkpass.3 --- lib/libc/crypt/crypt_checkpass.323 Jul 2015 22:20:02 - 1.9 +++ lib/libc/crypt/crypt_checkpass.319 Jun 2017 20:18:30 - @@ -58,17 +58,32 @@ The provided .Fa password is randomly salted and hashed and stored in .Fa hash . +.Fa hash +must already be allocated, and +.Fa hashsize +must contain its size, which depends on the underlying algorithm. +The constant +.Dv _PASSWORD_LEN +is recommended for that. The .Fa pref argument identifies the preferred hashing algorithm and parameters. +If set to +.Dv NULL +it defaults to +.Dq bcrypt,8 . Possible values are: .Bl -tag -width Ds -.It Dq bcrypt, +.It Dq bcrypt[,] The bcrypt algorithm, where the value of rounds can be between 4 and 31 and specifies the base 2 logarithm of the number of rounds. The special rounds value .Sq a automatically selects rounds based on system performance. +This is the default if rounds is omitted. +.Dq blowfish +can be used as an alias for +.Dq bcrypt . .El .Sh RETURN VALUES .Rv -std crypt_checkpass crypt_newhash @@ -89,7 +104,9 @@ to .Er EINVAL if .Fa pref -is unsupported. +is unsupported, or the value of +.Fa hashsize +is insufficient. .Sh SEE ALSO .Xr crypt 3 , .Xr login.conf 5 , -- Michal Mazurek
hack: fix paths, remove hack.sh
right -#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. -# 3. The name of the author may not be used to endorse or promote products -#derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED ``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 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. -# - -HACKDIR=/usr/games/lib/hackdir -HACK=$HACKDIR/hack -MAXNROFPLAYERS=4 - -cd $HACKDIR -case $1 in - -s*) - exec $HACK $@ - ;; - *) - exec $HACK $@ $MAXNROFPLAYERS - ;; -esac -- Michal Mazurek
Re: tcpdump: drop atalk support
Let's not support loading addresses from /etc/appletalk.names. There are two points to consider: * tcpdump uses just one file now (/etc/pf.os) which means we can probably simplify priv_getlines(), but let's not right now. * there is some lookup code left, but let's remove it later. removing is not as simple, as the hnametable[] array is used even when printing a numerical address. Comments? OK? Index: usr.sbin/tcpdump/print-atalk.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-atalk.c,v retrieving revision 1.31 diff -u -p -r1.31 print-atalk.c --- usr.sbin/tcpdump/print-atalk.c 28 Oct 2016 12:54:05 - 1.31 +++ usr.sbin/tcpdump/print-atalk.c 13 Jun 2017 19:32:10 - @@ -554,51 +554,13 @@ struct hnamemem { static struct hnamemem hnametable[HASHNAMESIZE]; -/* - * see if there's an AppleTalk number to name map file. - */ -static void -init_atalk(void) -{ - struct hnamemem *tp; - char nambuf[HOST_NAME_MAX+1 + 20]; - char line[BUFSIZ]; - int i1, i2, i3; - - priv_getlines(FTAB_APPLETALK); - while (priv_getline(line, sizeof(line)) > 0) { - if (line[0] == '\n' || line[0] == 0 || line[0] == '#') - continue; - if (sscanf(line, "%d.%d.%d %255s", , , , nambuf) == 4) - /* got a hostname. */ - i3 |= ((i1 << 8) | i2) << 8; - else if (sscanf(line, "%d.%d %255s", , , nambuf) == 3) - /* got a net name */ - i3 = (((i1 << 8) | i2) << 8) | 255; - else - continue; - - for (tp = [i3 & (HASHNAMESIZE-1)]; -tp->nxt; tp = tp->nxt) - ; - tp->addr = i3; - tp->nxt = newhnamemem(); - tp->name = savestr(nambuf); - } -} - static const char * ataddr_string(u_short atnet, u_char athost) { struct hnamemem *tp, *tp2; int i = (atnet << 8) | athost; char nambuf[HOST_NAME_MAX+1 + 20]; - static int first = 1; - if (first) { - first = 0; - init_atalk(); - } for (tp = [i & (HASHNAMESIZE-1)]; tp->nxt; tp = tp->nxt) if (tp->addr == i) return (tp->name); Index: usr.sbin/tcpdump/privsep.c === RCS file: /cvs/src/usr.sbin/tcpdump/privsep.c,v retrieving revision 1.44 diff -u -p -r1.44 privsep.c --- usr.sbin/tcpdump/privsep.c 23 Jan 2017 04:25:05 - 1.44 +++ usr.sbin/tcpdump/privsep.c 13 Jun 2017 19:32:10 - @@ -101,8 +101,7 @@ struct ftab { int count; }; -static struct ftab file_table[] = {{"/etc/appletalk.names", 1, 0}, - {PF_OSFP_FILE, 1, 0}}; +static struct ftab file_table[] = {{PF_OSFP_FILE, 1, 0}}; #define NUM_FILETAB (sizeof(file_table) / sizeof(struct ftab)) Index: usr.sbin/tcpdump/privsep.h === RCS file: /cvs/src/usr.sbin/tcpdump/privsep.h,v retrieving revision 1.8 diff -u -p -r1.8 privsep.h --- usr.sbin/tcpdump/privsep.h 14 Jul 2015 20:23:40 - 1.8 +++ usr.sbin/tcpdump/privsep.h 13 Jun 2017 19:32:10 - @@ -22,8 +22,7 @@ #define TCPDUMP_MAGIC 0xa1b2c3d4 /* file ids used by priv_getlines */ -#define FTAB_APPLETALK 0 -#define FTAB_PFOSFP1 +#define FTAB_PFOSFP 0 enum cmd_types { PRIV_OPEN_BPF, /* open a bpf descriptor */ -- Michal Mazurek
Re: htpasswd: use crypt_newhash instead of bcrypt API
On 15:31:50, 10.06.17, Ted Unangst wrote: > > @@ -58,17 +58,29 @@ The provided > > .Fa password > > is randomly salted and hashed and stored in > > .Fa hash . > > +.Fa hash > > +must already be allocated, and > > +.Fa hashsize > > +must contain its size, which cannot be less than 61 bytes. > > that's an implementation detail. if we're advising a limit, i think we > should say 128 or so. How come? Tracing the code of crypt_newhash() we end up in bcrypt_hashpass(), which has the following check: if (encryptedlen < BCRYPT_HASHSPACE) goto inval; BCRYPT_HASHSPACE is defined thus: libc/crypt/bcrypt.c:#define BCRYPT_HASHSPACE61 -- Michal Mazurek
Re: games/hunt: /usr/games/lib doesn't exist
As tb@ pointed out, /usr/man/man6 also doesn't exist. Let's remove the whole "Installation" section. OK? Index: games/hunt//README === RCS file: /cvs/src/games/hunt/README,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 README --- games/hunt//README 21 Jan 1999 05:33:37 - 1.1.1.1 +++ games/hunt//README 13 Jun 2017 16:27:43 - @@ -43,59 +43,6 @@ Words of Warning: hunt abusers. Hunt may also be addictive, and the withdrawal symptoms are not pretty :-) -Installation: - - 1. Edit file "Makefile" and make sure the options selected are - reasonable. There are four "make" variables that you - should check: GAME_PARAM, SYSCFLAGS, SYSLDFLAGS, and DEFS. - GAME_PARAM controls what features of the game will be - compiled in (e.g. reflecting walls). The optional features - are listed in comments above where GAME_PARAM is defined. - If you want to try them, just add the ones you want to the - GAME_PARAM definition. - - DEFS is where most system configuration is described. - If your system is 4.3BSD, Sun, Ultrix, Convex, HPUX - v6.0.1, or SGI, you're in luck. We provide the - appropriate definitions for these systems and you just - need to select one of them (e.g. if you have an Ultrix - system, just change the line - DEFS= $(GAME_PARAM) $(DEFS_43) - to - DEFS= $(GAME_PARAM) $(DEFS_ULTRIX) - ). If your system is *not* listed above, then you may - need to do some experiments. All of the options are - documented in the Makefile, be brave. - - SYSCFLAGS and SYSLDFLAGS are used for "unusual" systems - and you probably won't need to deal with it. An - example of an unusual system is the Silicon Graphics - IRIS, which keeps the network socket code in a BSD - emulation library that is in -lbsd. Edit these only if - you *know* your system is "different." - - 2. Edit file "Makefile" and look at the "install:" target. By - default, files are installed in /usr/games, - /usr/games/lib, and /usr/man/man6, which are "standard" - locations for games. If your system has a local games - directory, you'll need to change these. - 3. Edit file "pathname.c" and make sure the file names and port - numbers are reasonable. You can ignore the first set - of variables as they are used only for debugging - purposes. The second set is used in the installed - version of hunt. The important variables are "Driver" - (where the server is kept), "Test_port" (the Internet - UDP port number that new players should use to contact - the server), and "Stat_file" (where scoring statistics - and body counts are written). The only tricky variable - here is "Test_port". The default value is chosen so - that it is unlikely to conflict with other service port - numbers, but you can change it if you want to. - 4. Type "make install", which will compile and install the - programs and manual pages. Now you're almost ready to - go (see next section). There may be some warnings during - compilation. Ignore them. - Setting up the network: Hunt may be set up in one of three modes: standalone, inetd, or @@ -121,12 +68,12 @@ Setting up the network: server machine. THERE SHOULD ONLY BE ONE SERVER MACHINE! # start up the hunt daemon if present - if [ -f /usr/games/lib/huntd ]; then - /usr/games/lib/huntd -s & (echo -n ' huntd')>/dev/console + if [ -f /usr/games/huntd ]; then + /usr/games/huntd -s & (echo -n ' huntd')>/dev/console fi Also, you should start one up (on the off chance that you will - want to test this mess :-) by typing "/usr/games/lib/hunt -s". + want to test this mess :-) by typing "/usr/games/hunt -s". - @@ -140,7 +87,7 @@ Setting up the network: that variable, then you should put whatever value you used here as well. In /etc/inetd.conf, add the line - huntdgram udp waitnobody /usr/games/lib/huntdhuntd + huntdgram udp waitnobody /usr/games/huntdhuntd This works for 4.3BSD. I don't remember the configuration file format for 4.2BSD inetd. -- Michal Mazurek
Re: games/fortune: /usr/games/lib doesn't exist
On 18:50:26, 12.06.17, Jason McIntyre wrote: > On Mon, Jun 12, 2017 at 07:13:43PM +0200, Michal Mazurek wrote: > > Can't have outdated paths in fortunes. > > > > OK? > > > > Index: games/fortune//datfiles/fortunes2 > > === > > RCS file: /cvs/src/games/fortune/datfiles/fortunes2,v > > retrieving revision 1.46 > > diff -u -p -r1.46 fortunes2 > > --- games/fortune//datfiles/fortunes2 5 Nov 2016 07:56:25 - > > 1.46 > > +++ games/fortune//datfiles/fortunes2 12 Jun 2017 17:00:58 - > > @@ -10890,7 +10890,7 @@ Can't act. Slightly bald. Also dances. > > % > > Can't open /usr/fortunes. Lid stuck on cookie jar. > > % > > -Can't open /usr/games/lib/fortunes.dat. > > +Can't open /usr/share/games/fortune/fortunes.dat. > > the path in the fortune above doesn;t exist either. If it ever existed in the first place, I can't find any mention of it. -- Michal Mazurek
locate/mklocatedb.sh: remove unused option
This script has an option called -presort or -nosort, that appears to never be used, so remove it. This makes the $sort* options unneeded, remove them too. The script itself is used by updatedb and pkg_mklocatedb. Comments? OK? Index: usr.bin/locate/locate/mklocatedb.sh === RCS file: /cvs/src/usr.bin/locate/locate/mklocatedb.sh,v retrieving revision 1.13 diff -u -p -r1.13 mklocatedb.sh --- usr.bin/locate/locate/mklocatedb.sh 18 Mar 2007 20:13:49 - 1.13 +++ usr.bin/locate/locate/mklocatedb.sh 12 Jun 2017 20:30:53 - @@ -28,7 +28,7 @@ # # mklocatedb - build locate database # -# usage: mklocatedb [-presort] < filelist > database +# usage: mklocatedb < filelist > database # # $Id: mklocatedb.sh,v 1.13 2007/03/18 20:13:49 otto Exp $ @@ -48,15 +48,6 @@ fi # utilities to built locate database : ${bigram=locate.bigram} : ${code=locate.code} -: ${sort=sort -H} - -sortopt="-u -T $TMPDIR" -sortcmd="$sort" - -# Input already sorted -case X"$1" in - X-nosort|X-presort) sortcmd=cat; sortopt=;shift;; -esac bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XX` || exit 1 trap 'rm -f $bigrams' 0 1 2 3 5 10 15 @@ -66,8 +57,8 @@ filelist=`mktemp ${TMPDIR=/tmp}/_filelis } trap 'rm -f $bigrams $filelist' 0 1 2 3 5 10 15 -if $sortcmd $sortopt > $filelist; then -$bigram < $filelist | $sort -nr | +if sort -HuT "$TMPDIR" > $filelist; then +$bigram < $filelist | sort -Hnr | awk -Ft 'BEGIN { ORS = "" } NR <= 128 { print $2 }' > $bigrams && $code $bigrams < $filelist else -- Michal Mazurek
locate: remove /usr/libexec/locate.concatdb
This file never sets the $locate variable, which means it's broken. There are some non-trivial patches to this file, but that happened because the same diffs were applied to another script in those commits. This is broken since 1996. FreeBSD fixed it, but since nobody complained for 21 years, perhaps let's just remove it. OK? Index: usr.bin/locate/locate/Makefile === RCS file: /cvs/src/usr.bin/locate/locate/Makefile,v retrieving revision 1.11 diff -u -p -u -r1.11 Makefile --- usr.bin/locate/locate/Makefile 21 Nov 2015 19:35:20 - 1.11 +++ usr.bin/locate/locate/Makefile 12 Jun 2017 19:33:10 - @@ -7,7 +7,7 @@ PROG= locate SRCS= util.c locate.c CFLAGS+= -I${.CURDIR} MAN= locate.1locate.updatedb.8 -SCRIPTS= updatedb mklocatedb concatdb +SCRIPTS= updatedb mklocatedb beforeinstall: Index: usr.bin/locate/locate/concatdb.sh === RCS file: usr.bin/locate/locate/concatdb.sh diff -N usr.bin/locate/locate/concatdb.sh --- usr.bin/locate/locate/concatdb.sh 29 Jun 2003 21:59:28 - 1.10 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -1,73 +0,0 @@ -#!/bin/sh -# -# $OpenBSD: concatdb.sh,v 1.10 2003/06/29 21:59:28 millert Exp $ -# -# Copyright (c) September 1995 Wolfram Schneider <wo...@freebsd.org>. Berlin. -# 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. -# -# concatdb - concatenate locate databases -# -# usage: concatdb database1 ... databaseN > newdb -# -# Sequence of databases is important. -# -# $Id: concatdb.sh,v 1.10 2003/06/29 21:59:28 millert Exp $ - -# The directory containing locate subprograms -: ${LIBEXECDIR=/usr/libexec}; export LIBEXECDIR - -PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH - -umask 077 # protect temp files - -TMPDIR=${TMPDIR:-/tmp}; export TMPDIR; -if test X"$TMPDIR" = X -o ! -d "$TMPDIR"; then - TMPDIR=/tmp; export TMPDIR -fi - -# utilities to built locate database -: ${bigram=locate.bigram} -: ${code=locate.code} -: ${sort=sort -H} - - -case $# in -[01]) echo 'usage: concatdb databases1 ... databaseN > newdb' - exit 1 - ;; -esac - -bigrams=`mktemp ${TMPDIR=/tmp}/_bigrams.XX` || exit 1 - -trap 'rm -f $bigrams' 0 1 2 3 5 10 15 - -for db -do - $locate -d $db / -done | $bigram | $sort -nr | awk 'BEGIN { ORS = "" } NR <= 128 { print $2 }' > $bigrams - -for db -do - $locate -d $db / -done | $code $bigrams -- Michal Mazurek
games/fortune: /usr/games/lib doesn't exist
Can't have outdated paths in fortunes. OK? Index: games/fortune//datfiles/fortunes2 === RCS file: /cvs/src/games/fortune/datfiles/fortunes2,v retrieving revision 1.46 diff -u -p -r1.46 fortunes2 --- games/fortune//datfiles/fortunes2 5 Nov 2016 07:56:25 - 1.46 +++ games/fortune//datfiles/fortunes2 12 Jun 2017 17:00:58 - @@ -10890,7 +10890,7 @@ Can't act. Slightly bald. Also dances. % Can't open /usr/fortunes. Lid stuck on cookie jar. % -Can't open /usr/games/lib/fortunes.dat. +Can't open /usr/share/games/fortune/fortunes.dat. % Capitalism is the extraordinary belief that the nastiest of men, for the nastiest of reasons, will somehow work for the benefit of us all. @@ -17086,7 +17086,7 @@ HELP! Man trapped in a human body! HELP! MY TYPEWRITER IS BROKEN! -- E. E. CUMMINGS % -HELP I'm being held prisoner in /usr/games/lib! +HELP I'm being held prisoner in /usr/share/games! % Help stamp out Mickey-Mouse computer interfaces -- Menus are for Restaurants! % -- Michal Mazurek
games/hunt: /usr/games/lib doesn't exist
It's very important to keep this README up to date. OK? Index: games/hunt//README === RCS file: /cvs/src/games/hunt/README,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 README --- games/hunt//README 21 Jan 1999 05:33:37 - 1.1.1.1 +++ games/hunt//README 12 Jun 2017 17:06:20 - @@ -75,10 +75,10 @@ Installation: you *know* your system is "different." 2. Edit file "Makefile" and look at the "install:" target. By - default, files are installed in /usr/games, - /usr/games/lib, and /usr/man/man6, which are "standard" - locations for games. If your system has a local games - directory, you'll need to change these. + default, files are installed in /usr/games, and + /usr/man/man6, which are "standard" locations for games. + If your system has a local games directory, you'll need + to change these. 3. Edit file "pathname.c" and make sure the file names and port numbers are reasonable. You can ignore the first set of variables as they are used only for debugging @@ -121,12 +121,12 @@ Setting up the network: server machine. THERE SHOULD ONLY BE ONE SERVER MACHINE! # start up the hunt daemon if present - if [ -f /usr/games/lib/huntd ]; then - /usr/games/lib/huntd -s & (echo -n ' huntd')>/dev/console + if [ -f /usr/games/huntd ]; then + /usr/games/huntd -s & (echo -n ' huntd')>/dev/console fi Also, you should start one up (on the off chance that you will - want to test this mess :-) by typing "/usr/games/lib/hunt -s". + want to test this mess :-) by typing "/usr/games/hunt -s". - @@ -140,7 +140,7 @@ Setting up the network: that variable, then you should put whatever value you used here as well. In /etc/inetd.conf, add the line - huntdgram udp waitnobody /usr/games/lib/huntdhuntd + huntdgram udp waitnobody /usr/games/huntdhuntd This works for 4.3BSD. I don't remember the configuration file format for 4.2BSD inetd. -- Michal Mazurek
viocon.4: mention all ttyVI devices
There are 5 devices in /dev/. Is there any reason why just two are listed in the viocon.4 manpage? OK to mention them all? Index: share/man/man4/viocon.4 === RCS file: /cvs/src/share/man/man4/viocon.4,v retrieving revision 1.2 diff -u -p -r1.2 viocon.4 --- share/man/man4/viocon.4 21 Dec 2015 23:21:19 - 1.2 +++ share/man/man4/viocon.4 11 Jun 2017 19:40:29 - @@ -38,6 +38,9 @@ The multiport feature is not yet support .Bl -tag -width Pa -compact .It Pa /dev/ttyVI00 .It Pa /dev/ttyVI10 +.It Pa /dev/ttyVI20 +.It Pa /dev/ttyVI30 +.It Pa /dev/ttyVI40 .El .Sh SEE ALSO .Xr intro 4 , -- Michal Mazurek
Re: htpasswd: use crypt_newhash instead of bcrypt API
On 21:16:08, 6.06.17, Michal Mazurek wrote: > When talking about this with mulander@ it came out that the docs could > use a touch. > > The commit message for the diff that didn't update the docs was: > > permit "bcrypt" as an alias for "blowfish". this is, after all, what > 99% of the world calls it. > allow just "bcrypt" without params to mean auto-tune ("bcrypt,a"). > default remains 8 rounds (for now) > > Comments? OK? Discussion about the defaults aside, any comments on the doc change? OK? -- Michal Mazurek
Re: tcpdump: drop atalk support
ex number at the end of the line is the value of the -.Ar userdata -field in the request. -.Pp -Helios responds with 8 512-byte packets. -The -.Dq : Ns Ar n -following the -transaction ID gives the packet sequence number in the transaction -and the number in parentheses is the amount of data in the packet, -excluding the ATP header. -The -.Ql * -on packet 7 indicates that the EOM bit was set. -.Pp -Jssmag.209 then requests that packets 3 & 5 be retransmitted. -Helios resends them then jssmag.209 releases the transaction. -Finally, jssmag.209 initiates the next request. -The -.Ql * -on the request indicates that XO -.Pq exactly once -was -.Em not -set. .Ss IP Fragmentation Fragmented Internet datagrams are printed as .Bd -ragged -offset indent @@ -1901,12 +1765,6 @@ question section is printed rather than Some believe that inverse queries are themselves a bug and prefer to fix the program generating them rather than .Nm tcpdump . -.Pp -Apple Ethertalk DDP packets could be dumped as easily as KIP DDP packets -but aren't. -Even if we were inclined to do anything to promote the use of Ethertalk -(we aren't, LBL doesn't allow Ethertalk on any of its -networks so we'd have no way of testing this code). .Pp A packet trace that crosses a daylight saving time change will give skewed time stamps -- Michal Mazurek
Re: htpasswd: use crypt_newhash instead of bcrypt API
On 20:49:05, 6.06.17, Jason McIntyre wrote: > right now this man page suggests that people will use "bcrypt,a" > to "automatically suggest rounds based on system performance". is > that right? i'd have expected people to just use "bcrypt" (w/o > args). in fact, why have "a" at all? why not just have the default > as automatically selecting rounds, but you can optionally specify > an amount of rounds? > > sorry, i know that's not really the main concern of your diff. it just > seems a bit weird, and that reflects in the way you're having to word > this. Yes, the function seems a bit inconsistent, in that "bcrypt" means "bcrypt,a" but NULL means "bcrypt,8". awolk@ points out that the function is used in just a few places - src and some ports patches, so we should be able to change it. Judging by the commit message the author was aware of this discrepancy though, and marked is as "for now", so let's see what others say. -- Michal Mazurek
Re: htpasswd: use crypt_newhash instead of bcrypt API
When talking about this with mulander@ it came out that the docs could use a touch. The commit message for the diff that didn't update the docs was: permit "bcrypt" as an alias for "blowfish". this is, after all, what 99% of the world calls it. allow just "bcrypt" without params to mean auto-tune ("bcrypt,a"). default remains 8 rounds (for now) Comments? OK? Index: lib/libc/crypt/crypt_checkpass.3 === RCS file: /cvs/src/lib/libc/crypt/crypt_checkpass.3,v retrieving revision 1.9 diff -u -p -r1.9 crypt_checkpass.3 --- lib/libc/crypt/crypt_checkpass.323 Jul 2015 22:20:02 - 1.9 +++ lib/libc/crypt/crypt_checkpass.36 Jun 2017 19:06:59 - @@ -58,17 +58,29 @@ The provided .Fa password is randomly salted and hashed and stored in .Fa hash . +.Fa hash +must already be allocated, and +.Fa hashsize +must contain its size, which cannot be less than 61 bytes. The .Fa pref argument identifies the preferred hashing algorithm and parameters. +If set to +.Dv NULL +it defaults to +.Dq bcrypt,8 . Possible values are: .Bl -tag -width Ds -.It Dq bcrypt, +.It Dq bcrypt[,] The bcrypt algorithm, where the value of rounds can be between 4 and 31 and specifies the base 2 logarithm of the number of rounds. The special rounds value .Sq a automatically selects rounds based on system performance. +This is the default if rounds is omitted. +.Dq blowfish +can be used as an alias for +.Dq bcrypt . .El .Sh RETURN VALUES .Rv -std crypt_checkpass crypt_newhash @@ -89,7 +101,9 @@ to .Er EINVAL if .Fa pref -is unsupported. +is unsupported, or the value of +.Fa hashsize +is insufficient. .Sh SEE ALSO .Xr crypt 3 , .Xr login.conf 5 , -- Michal Mazurek
tcpdump: print-bgp.c: update error code 7
On 11:27:28, 30.05.17, Claudio Jeker wrote: > On a side note. The notification error code 7 seems to be wrong. > The capability error codes made it never into a standard and now > error code 7 if for enhanced route refresh. > > So I would replace bgpnotify_minor_cap with > static const char *bgpnotify_minor_err[] = { > NULL, "Invalid Message Length", > }; > > See also > https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml#route-refresh-error-subcodes In that case let's correct it. Index: usr.sbin/tcpdump/print-bgp.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v retrieving revision 1.22 diff -u -p -r1.22 print-bgp.c --- usr.sbin/tcpdump/print-bgp.c30 May 2017 09:40:08 - 1.22 +++ usr.sbin/tcpdump/print-bgp.c30 May 2017 09:45:44 - @@ -249,15 +249,15 @@ static const char *bgpnotify_minor_cease "Out of Resources", }; -static const char *bgpnotify_minor_cap[] = { - NULL, "Invalid Action Value", "Invalid Capability Length", - "Malformed Capability Value", "Unsupported Capability Code", +/* RFC 7313 */ +static const char *bgpnotify_minor_err[] = { + NULL, "Invalid Message Length", }; static const char **bgpnotify_minor[] = { NULL, bgpnotify_minor_msg, bgpnotify_minor_open, bgpnotify_minor_update, bgpnotify_minor_holdtime, bgpnotify_minor_fsm, bgpnotify_minor_cease, - bgpnotify_minor_cap, + bgpnotify_minor_err, }; static const int bgpnotify_minor_siz[] = { 0, @@ -267,7 +267,7 @@ static const int bgpnotify_minor_siz[] = sizeof(bgpnotify_minor_holdtime)/sizeof(bgpnotify_minor_holdtime[0]), sizeof(bgpnotify_minor_fsm)/sizeof(bgpnotify_minor_fsm[0]), sizeof(bgpnotify_minor_cease)/sizeof(bgpnotify_minor_cease[0]), - sizeof(bgpnotify_minor_cap)/sizeof(bgpnotify_minor_cap[0]), + sizeof(bgpnotify_minor_err)/sizeof(bgpnotify_minor_err[0]), }; static const char *bgpattr_origin[] = { -- Michal Mazurek
Re: tcpdump: enable some more bgp info
On 10:43:30, 30.05.17, Job Snijders wrote: > In the registry created by RFC 6608, the value "0" is the BGP Finite > State Machine Error subcode meaning "Unspecified Error". I think that > when a name is assigned to a value, the name should be printed (like > your patch does for subcode values 1, 2, and 3). > > If no name is known for the error subcode, just printing the number is > useful indeed. You are right. Index: usr.sbin/tcpdump/print-bgp.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v retrieving revision 1.21 diff -u -p -r1.21 print-bgp.c --- usr.sbin/tcpdump/print-bgp.c24 Apr 2017 20:35:35 - 1.21 +++ usr.sbin/tcpdump/print-bgp.c30 May 2017 09:00:49 - @@ -226,6 +226,16 @@ static const char *bgpnotify_minor_updat "Invalid Network Field", "Malformed AS_PATH", }; +static const char *bgpnotify_minor_holdtime[] = { + NULL, +}; + +/* RFC 6608 */ +static const char *bgpnotify_minor_fsm[] = { + "Unspecified Error", "In OpenSent State", "In OpenConfirm State", + "In Established State", +}; + /* RFC 4486 */ #define BGP_NOTIFY_MINOR_CEASE_MAXPRFX 1 /* draft-ietf-idr-shutdown-07 */ @@ -246,14 +256,16 @@ static const char *bgpnotify_minor_cap[] static const char **bgpnotify_minor[] = { NULL, bgpnotify_minor_msg, bgpnotify_minor_open, bgpnotify_minor_update, + bgpnotify_minor_holdtime, bgpnotify_minor_fsm, bgpnotify_minor_cease, + bgpnotify_minor_cap, }; static const int bgpnotify_minor_siz[] = { 0, sizeof(bgpnotify_minor_msg)/sizeof(bgpnotify_minor_msg[0]), sizeof(bgpnotify_minor_open)/sizeof(bgpnotify_minor_open[0]), sizeof(bgpnotify_minor_update)/sizeof(bgpnotify_minor_update[0]), - 0, - 0, + sizeof(bgpnotify_minor_holdtime)/sizeof(bgpnotify_minor_holdtime[0]), + sizeof(bgpnotify_minor_fsm)/sizeof(bgpnotify_minor_fsm[0]), sizeof(bgpnotify_minor_cease)/sizeof(bgpnotify_minor_cease[0]), sizeof(bgpnotify_minor_cap)/sizeof(bgpnotify_minor_cap[0]), }; -- Michal Mazurek
Re: tcpdump: drop atalk support
ying host techpit has laserwriter techpit registered on port 186. -.Pp -ATP packet formatting is demonstrated by the following example: -.Bd -unfilled -offset indent -jssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001 -helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae04 -jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001 -helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae04 -jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001 -jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002 -.Ed -.Pp -Jssmag.209 initiates transaction ID 12266 with host helios by requesting -up to 8 packets -.Sm off -.Pq the Dq <0\-7> . -.Sm on -The hex number at the end of the line is the value of the -.Ar userdata -field in the request. -.Pp -Helios responds with 8 512-byte packets. -The -.Dq : Ns Ar n -following the -transaction ID gives the packet sequence number in the transaction -and the number in parentheses is the amount of data in the packet, -excluding the ATP header. -The -.Ql * -on packet 7 indicates that the EOM bit was set. -.Pp -Jssmag.209 then requests that packets 3 & 5 be retransmitted. -Helios resends them then jssmag.209 releases the transaction. -Finally, jssmag.209 initiates the next request. -The -.Ql * -on the request indicates that XO -.Pq exactly once -was -.Em not -set. .Ss IP Fragmentation Fragmented Internet datagrams are printed as .Bd -ragged -offset indent @@ -1901,12 +1765,6 @@ question section is printed rather than Some believe that inverse queries are themselves a bug and prefer to fix the program generating them rather than .Nm tcpdump . -.Pp -Apple Ethertalk DDP packets could be dumped as easily as KIP DDP packets -but aren't. -Even if we were inclined to do anything to promote the use of Ethertalk -(we aren't, LBL doesn't allow Ethertalk on any of its -networks so we'd have no way of testing this code). .Pp A packet trace that crosses a daylight saving time change will give skewed time stamps -- Michal Mazurek
Re: tcpdump: enable some more bgp info
On 12:15:06, 29.05.17, Job Snijders wrote: > perhaps add a comment like /* RFC 6608 */ above the below: Right, it will make it more consistent. > > +static const char *bgpnotify_minor_fsm[] = { > > + NULL, "In OpenSent State", "In OpenConfirm State", > > + "In Established State", > > +}; > > and maybe s/NULL/"Unspecified Error"/ If it's NULL, then tcpdump will print out the number: if (p == NULL) { snprintf(buf, sizeof(buf), "#%d", minor); Index: usr.sbin/tcpdump/print-bgp.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v retrieving revision 1.21 diff -u -p -r1.21 print-bgp.c --- usr.sbin/tcpdump/print-bgp.c24 Apr 2017 20:35:35 - 1.21 +++ usr.sbin/tcpdump/print-bgp.c30 May 2017 08:12:17 - @@ -226,6 +226,16 @@ static const char *bgpnotify_minor_updat "Invalid Network Field", "Malformed AS_PATH", }; +static const char *bgpnotify_minor_holdtime[] = { + NULL, +}; + +/* RFC 6608 */ +static const char *bgpnotify_minor_fsm[] = { + NULL, "In OpenSent State", "In OpenConfirm State", + "In Established State", +}; + /* RFC 4486 */ #define BGP_NOTIFY_MINOR_CEASE_MAXPRFX 1 /* draft-ietf-idr-shutdown-07 */ @@ -246,14 +256,16 @@ static const char *bgpnotify_minor_cap[] static const char **bgpnotify_minor[] = { NULL, bgpnotify_minor_msg, bgpnotify_minor_open, bgpnotify_minor_update, + bgpnotify_minor_holdtime, bgpnotify_minor_fsm, bgpnotify_minor_cease, + bgpnotify_minor_cap, }; static const int bgpnotify_minor_siz[] = { 0, sizeof(bgpnotify_minor_msg)/sizeof(bgpnotify_minor_msg[0]), sizeof(bgpnotify_minor_open)/sizeof(bgpnotify_minor_open[0]), sizeof(bgpnotify_minor_update)/sizeof(bgpnotify_minor_update[0]), - 0, - 0, + sizeof(bgpnotify_minor_holdtime)/sizeof(bgpnotify_minor_holdtime[0]), + sizeof(bgpnotify_minor_fsm)/sizeof(bgpnotify_minor_fsm[0]), sizeof(bgpnotify_minor_cease)/sizeof(bgpnotify_minor_cease[0]), sizeof(bgpnotify_minor_cap)/sizeof(bgpnotify_minor_cap[0]), }; -- Michal Mazurek
tcpdump: fix some clang warnings
"plen" and "len" are of type "u_int" and never negative. Index: usr.sbin/tcpdump/print-bgp.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v retrieving revision 1.21 diff -u -p -r1.21 print-bgp.c --- usr.sbin/tcpdump/print-bgp.c24 Apr 2017 20:35:35 - 1.21 +++ usr.sbin/tcpdump/print-bgp.c29 May 2017 10:08:40 - @@ -356,7 +356,7 @@ decode_prefix4(const u_char *pd, char *b * enough bytes of address to contain this many bits */ plen = pd[0]; - if (plen < 0 || 32 < plen) + if (32 < plen) return -1; memset(, 0, sizeof(addr)); TCHECK2(pd[1], (plen + 7) / 8); @@ -385,7 +385,7 @@ decode_prefix6(const u_char *pd, char *b TCHECK(pd[0]); plen = pd[0]; - if (plen < 0 || 128 < plen) + if (128 < plen) return -1; memset(, 0, sizeof(addr)); Index: usr.sbin/tcpdump/print-wb.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-wb.c,v retrieving revision 1.9 diff -u -p -r1.9 print-wb.c --- usr.sbin/tcpdump/print-wb.c 16 Nov 2015 00:16:39 - 1.9 +++ usr.sbin/tcpdump/print-wb.c 29 May 2017 10:08:40 - @@ -180,7 +180,7 @@ wb_id(const struct pkt_id *id, u_int len printf(" wb-id:"); len -= sizeof(*id); - if (len < 0 || (u_char *)(id + 1) > snapend) + if ((u_char *)(id + 1) > snapend) return (-1); printf(" %u/%s:%u (max %u/%s:%u) ", @@ -336,7 +336,7 @@ wb_rrep(const struct pkt_rrep *rrep, u_i printf(" wb-rrep:"); len -= sizeof(*rrep); - if (len < 0 || (u_char *)(rrep + 1) > snapend) + if ((u_char *)(rrep + 1) > snapend) return (-1); printf(" for %s %s:%u<%u:%u>", @@ -357,7 +357,7 @@ wb_drawop(const struct pkt_dop *dop, u_i { printf(" wb-dop:"); len -= sizeof(*dop); - if (len < 0 || (u_char *)(dop + 1) > snapend) + if ((u_char *)(dop + 1) > snapend) return (-1); printf(" %s:%u<%u:%u>", @@ -382,7 +382,7 @@ wb_print(const void *hdr, u_int len) ph = (const struct pkt_hdr *)hdr; len -= sizeof(*ph); - if (len < 0 || (u_char *)(ph + 1) <= snapend) { + if ((u_char *)(ph + 1) <= snapend) { if (ph->ph_flags) printf("*"); switch (ph->ph_type) { -- Michal Mazurek
tcpdump: enable some more bgp info
The error information for bgp was commited in 2009 (bgpnotify_minor_cease, bgpnotify_minor_cap) but never enabled, so do that here. Also add FSM error codes. Index: print-bgp.c === RCS file: /cvs/src/usr.sbin/tcpdump/print-bgp.c,v retrieving revision 1.21 diff -u -p -r1.21 print-bgp.c --- print-bgp.c 24 Apr 2017 20:35:35 - 1.21 +++ print-bgp.c 29 May 2017 09:20:34 - @@ -226,6 +226,15 @@ static const char *bgpnotify_minor_updat "Invalid Network Field", "Malformed AS_PATH", }; +static const char *bgpnotify_minor_holdtime[] = { + NULL, +}; + +static const char *bgpnotify_minor_fsm[] = { + NULL, "In OpenSent State", "In OpenConfirm State", + "In Established State", +}; + /* RFC 4486 */ #define BGP_NOTIFY_MINOR_CEASE_MAXPRFX 1 /* draft-ietf-idr-shutdown-07 */ @@ -246,14 +255,16 @@ static const char *bgpnotify_minor_cap[] static const char **bgpnotify_minor[] = { NULL, bgpnotify_minor_msg, bgpnotify_minor_open, bgpnotify_minor_update, + bgpnotify_minor_holdtime, bgpnotify_minor_fsm, bgpnotify_minor_cease, + bgpnotify_minor_cap, }; static const int bgpnotify_minor_siz[] = { 0, sizeof(bgpnotify_minor_msg)/sizeof(bgpnotify_minor_msg[0]), sizeof(bgpnotify_minor_open)/sizeof(bgpnotify_minor_open[0]), sizeof(bgpnotify_minor_update)/sizeof(bgpnotify_minor_update[0]), - 0, - 0, + sizeof(bgpnotify_minor_holdtime)/sizeof(bgpnotify_minor_holdtime[0]), + sizeof(bgpnotify_minor_fsm)/sizeof(bgpnotify_minor_fsm[0]), sizeof(bgpnotify_minor_cease)/sizeof(bgpnotify_minor_cease[0]), sizeof(bgpnotify_minor_cap)/sizeof(bgpnotify_minor_cap[0]), }; -- Michal Mazurek
tcpdump: drop atalk support
resses are printed in the form -.Pp -.D1 Ar net . Ns Ar host . Ns Ar port -.Pp -For example: -.Bd -unfilled -offset indent -144.1.209.2 > icsd-net.112.220 -office.2 > icsd-net.112.220 -jssmag.149.235 > icsd-net.2 -.Ed -.Pp -If -.Pa /etc/atalk.names -doesn't exist or doesn't contain an entry for some AppleTalk -host/net number, addresses are printed in numeric form. -In the first example, NBP -.Pq DDP port 2 -on net 144.1 node 209 -is sending to whatever is listening on port 220 of net icsd-net node 112. -The second line is the same except the full name of the source node is known -.Pq Dq office . -The third line is a send from port 235 on -net jssmag node 149 to broadcast on the icsd-net NBP port. -The broadcast address -.Pq 255 -is indicated by a net name with no host number; -for this reason it is a good idea to keep node names and net names distinct in -.Pa /etc/atalk.names . -.Pp -NBP -.Pq name binding protocol -and ATP -.Pq AppleTalk transaction protocol -packets have their contents interpreted. -Other protocols just dump the protocol name -.Po -or number if no name is registered for the protocol -.Pc -and packet size. -.Pp -NBP packets are formatted like the following examples: -.Bd -unfilled -icsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*" -jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250 -techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186 -.Ed -.Pp -The first line is a name lookup request for laserwriters sent by -net icsdi-net host -112 and broadcast on net jssmag. -The nbp ID for the lookup is 190. -The second line shows a reply for this request -.Pq note that it has the same ID -from host jssmag.209 saying that it has a laserwriter -resource named RM1140 registered on port 250. -The third line is another reply to the same request -saying host techpit has laserwriter techpit registered on port 186. -.Pp -ATP packet formatting is demonstrated by the following example: -.Bd -unfilled -offset indent -jssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001 -helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae04 -jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001 -helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae04 -helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae04 -jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001 -jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002 -.Ed -.Pp -Jssmag.209 initiates transaction ID 12266 with host helios by requesting -up to 8 packets -.Sm off -.Pq the Dq <0\-7> . -.Sm on -The hex number at the end of the line is the value of the -.Ar userdata -field in the request. -.Pp -Helios responds with 8 512-byte packets. -The -.Dq : Ns Ar n -following the -transaction ID gives the packet sequence number in the transaction -and the number in parentheses is the amount of data in the packet, -excluding the ATP header. -The -.Ql * -on packet 7 indicates that the EOM bit was set. -.Pp -Jssmag.209 then requests that packets 3 & 5 be retransmitted. -Helios resends them then jssmag.209 releases the transaction. -Finally, jssmag.209 initiates the next request. -The -.Ql * -on the request indicates that XO -.Pq exactly once -was -.Em not -set. .Ss IP Fragmentation Fragmented Internet datagrams are printed as .Bd -ragged -offset indent @@ -1901,12 +1765,6 @@ question section is printed rather than Some believe that inverse queries are themselves a bug and prefer to fix the program generating them rather than .Nm tcpdump . -.Pp -Apple Ethertalk DDP packets could be dumped as easily as KIP DDP packets -but aren't. -Even if we were inclined to do anything to promote the use of Ethertalk -(we aren't, LBL doesn't allow Ethertalk on any of its -networks so we'd have no way of testing this code). .Pp A packet trace that crosses a daylight saving time change will give skewed time stamps -- Michal Mazurek
pfctl/parse.y: don't check np->port for NULL
Found with clang. The warning was: clang -O2 -pipe -Wall -Wmissing-prototypes -Wno-uninitialized -Wstrict-prototypes -I/usr/src/sbin/pfctl -Werror-implicit-function-declaration -c parse.c /usr/src/sbin/pfctl/parse.y:4599:52: warning: comparison of array 'np->port' not equal to a null pointer is always true [-Wtautological-pointer-compare] if (!rs->rdr->rport.b && rs->rdr->rport.t && np->port != NULL) { ^~~~ "np" is: struct node_port *np which is: struct node_port { u_int16_tport[2]; u_int8_t op; struct node_port*next; struct node_port*tail; }; Index: sbin/pfctl/parse.y === RCS file: /cvs/src/sbin/pfctl/parse.y,v retrieving revision 1.659 diff -u -p -r1.659 parse.y --- sbin/pfctl/parse.y 15 May 2017 11:23:25 - 1.659 +++ sbin/pfctl/parse.y 27 May 2017 17:46:24 - @@ -4596,7 +4596,7 @@ apply_redirspec(struct pf_pool *rpool, s rpool->proxy_port[0] = ntohs(rs->rdr->rport.a); if (isrdr) { - if (!rs->rdr->rport.b && rs->rdr->rport.t && np->port != NULL) { + if (!rs->rdr->rport.b && rs->rdr->rport.t) { rpool->proxy_port[1] = ntohs(rs->rdr->rport.a) + (ntohs(np->port[1]) - ntohs(np->port[0])); } else -- Michal Mazurek
tcpdump/pfctl_osfp.c: comment out pfctl_show_fingerprints()
Reduce differences between the two pfctl_osfp.c files. The pfctl_show_fingerprints() function has changed, the new one from pfctl uses pfctl_print_title(), which is defined in a different file (pfctl.c), not available in tcpdump. tcpdump doesn't use pfctl_show_fingerprints() anyway, so update the function to minimize the diff, and comment it out. Index: usr.sbin/tcpdump/pfctl_osfp.c === RCS file: /cvs/src/usr.sbin/tcpdump/pfctl_osfp.c,v retrieving revision 1.12 diff -u -p -r1.12 pfctl_osfp.c --- usr.sbin/tcpdump/pfctl_osfp.c 28 May 2017 07:40:12 - 1.12 +++ usr.sbin/tcpdump/pfctl_osfp.c 28 May 2017 08:23:37 - @@ -296,16 +296,29 @@ pfctl_load_fingerprints(int dev, int opt return (0); } +/* + * comment out pfctl_show_fingerprints() when syncing with + * pfctl/pfctl_osfp.c, as it's unused here and uses pfctl_print_title() + * which is not available in tcpdump +*/ +#if 0 /* List the fingerprints */ void pfctl_show_fingerprints(int opts) { - printf("Passive OS Fingerprints:\n"); - printf("\tClass\tVersion\tSubtype(subversion)\n"); - printf("\t-\t---\t---\n"); - sort_name_list(opts, ); - print_name_list(opts, , "\t"); + if (LIST_FIRST() != NULL) { + if (opts & PF_OPT_SHOWALL) { + pfctl_print_title("OS FINGERPRINTS:"); + printf("%u fingerprints loaded\n", fingerprint_count); + } else { + printf("Class\tVersion\tSubtype(subversion)\n"); + printf("-\t---\t---\n"); + sort_name_list(opts, ); + print_name_list(opts, , ""); + } + } } +#endif /* Lookup a fingerprint */ pf_osfp_t -- Michal Mazurek
tcpdump/pfctl_osfp.c: catch up 2
Reduce differences between the two pfctl_osfp.c files. Apply three commits from pfctl/pfctl_osfp.c, this time with binary change. Make sure that fingerprint_count gets reset to 0 correctly when we flush our list of fingerprints. second: Plug simple memory leak. ``Don't forget to free tcpopts when you are done.'' third: print_ioctl() is unused if not debugging. Found with clang, after marking the function "static". Use OSFP_DEBUG, in a similar fashion to OPT_DEBUG (pfctl_optimize.c). OK? Index: usr.sbin/tcpdump/pfctl_osfp.c === RCS file: /cvs/src/usr.sbin/tcpdump/pfctl_osfp.c,v retrieving revision 1.12 diff -u -p -r1.12 pfctl_osfp.c --- usr.sbin/tcpdump/pfctl_osfp.c 28 May 2017 07:40:12 - 1.12 +++ usr.sbin/tcpdump/pfctl_osfp.c 28 May 2017 08:07:36 - @@ -38,7 +38,8 @@ #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) -#if 0 +/* #define OSFP_DEBUG 1 */ +#ifdef OSFP_DEBUG # define DEBUG(fp, str, v...) \ fprintf(stderr, "%s:%s:%s " str "\n", (fp)->fp_os.fp_class_nm, \ (fp)->fp_os.fp_version_nm, (fp)->fp_os.fp_subtype_nm , ## v); @@ -73,7 +74,9 @@ intget_tcpopts(const char *, int, co pf_tcpopts_t *, int *, int *, int *, int *, int *, int *); voidimport_fingerprint(struct pf_osfp_ioctl *); +#ifdef OSFP_DEBUG const char *print_ioctl(struct pf_osfp_ioctl *); +#endif voidprint_name_list(int, struct name_list *, const char *); voidsort_name_list(int, struct name_list *); struct name_entry *lookup_name_list(struct name_list *, const char *); @@ -243,6 +246,7 @@ pfctl_file_fingerprints(int dev, int opt free(version); free(subtype); free(desc); + free(tcpopts); if (opts & PF_OPT_VERBOSE2) printf("Loaded %d passive OS fingerprints\n", @@ -267,9 +271,9 @@ pfctl_flush_my_fingerprints(struct name_ while ((nm = LIST_FIRST(list)) != NULL) { LIST_REMOVE(nm, nm_entry); pfctl_flush_my_fingerprints(>nm_sublist); - fingerprint_count--; free(nm); } + fingerprint_count = 0; class_count = 0; } @@ -980,6 +984,7 @@ get_field(u_char **line, size_t *len, in } +#ifdef OSFP_DEBUG const char * print_ioctl(struct pf_osfp_ioctl *fp) { @@ -1081,3 +1086,4 @@ print_ioctl(struct pf_osfp_ioctl *fp) return (buf); } +#endif -- Michal Mazurek
tcpdump/pfctl_osfp.c: catch up
Catch up with pfctl/pfctl_osfp.c, no binary change. Index: usr.sbin/tcpdump/pfctl_osfp.c === RCS file: /cvs/src/usr.sbin/tcpdump/pfctl_osfp.c,v retrieving revision 1.11 diff -u -p -r1.11 pfctl_osfp.c --- usr.sbin/tcpdump/pfctl_osfp.c 5 Dec 2015 19:27:17 - 1.11 +++ usr.sbin/tcpdump/pfctl_osfp.c 27 May 2017 19:22:33 - @@ -33,17 +33,10 @@ #include #include - #include "privsep.h" #include "pfctl_parser.h" -#ifndef MIN -# define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif /* MIN */ -#ifndef MAX -# define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#endif /* MAX */ - +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) #if 0 # define DEBUG(fp, str, v...) \ @@ -647,7 +640,7 @@ import_fingerprint(struct pf_osfp_ioctl nm_class = fingerprint_name_entry(, fp->fp_os.fp_class_nm); if (nm_class->nm_num == 0) { nm_class->nm_num = class; - class_count = MAX(class_count, class); + class_count = MAXIMUM(class_count, class); } nm_version = fingerprint_name_entry(_class->nm_sublist, @@ -655,7 +648,7 @@ import_fingerprint(struct pf_osfp_ioctl if (nm_version) { if (nm_version->nm_num == 0) { nm_version->nm_num = version; - nm_class->nm_sublist_num = MAX(nm_class->nm_sublist_num, + nm_class->nm_sublist_num = MAXIMUM(nm_class->nm_sublist_num, version); } nm_subtype = fingerprint_name_entry(_version->nm_sublist, @@ -664,7 +657,7 @@ import_fingerprint(struct pf_osfp_ioctl if (nm_subtype->nm_num == 0) { nm_subtype->nm_num = subtype; nm_version->nm_sublist_num = - MAX(nm_version->nm_sublist_num, subtype); + MAXIMUM(nm_version->nm_sublist_num, subtype); } } } @@ -754,7 +747,6 @@ sort_name_list(int opts, struct name_lis LIST_INSERT_AFTER(nmlast, nm, nm_entry); nmlast = nm; } - return; } /* parse the next integer in a formatted config file line */ @@ -823,7 +815,7 @@ get_int(u_char **line, size_t *len, int } for (; i < fieldlen; i++) { - if (field[i] < '0' || field[i] > '9') { + if (field[i] < '0' || field[i] > '9') { fprintf(stderr, "%s:%d non-digit character in %s\n", filename, lineno, name); return (1); @@ -959,7 +951,7 @@ get_tcpopts(const char *filename, int li return (0); } -/* rip the next field ouf of a formatted config file line */ +/* rip the next field out of a formatted config file line */ char * get_field(u_char **line, size_t *len, int *fieldlen) { -- Michal Mazurek
pfctl/pfctl_osfp.c: print_ioctl() used only in debug mode
print_ioctl() is unused if not debugging. Found with clang, after marking the function "static". Use OSFP_DEBUG, in a similar fashion to OPT_DEBUG (pfctl_optimize.c). OK? Index: sbin/pfctl/pfctl_osfp.c === RCS file: /cvs/src/sbin/pfctl/pfctl_osfp.c,v retrieving revision 1.23 diff -u -p -r1.23 pfctl_osfp.c --- sbin/pfctl/pfctl_osfp.c 10 Dec 2015 17:27:00 - 1.23 +++ sbin/pfctl/pfctl_osfp.c 27 May 2017 18:08:57 - @@ -39,7 +39,8 @@ #define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) -#if 0 +/* #define OSFP_DEBUG 1 */ +#ifdef OSFP_DEBUG # define DEBUG(fp, str, v...) \ fprintf(stderr, "%s:%s:%s " str "\n", (fp)->fp_os.fp_class_nm, \ (fp)->fp_os.fp_version_nm, (fp)->fp_os.fp_subtype_nm , ## v); @@ -74,7 +75,9 @@ intget_tcpopts(const char *, int, co pf_tcpopts_t *, int *, int *, int *, int *, int *, int *); voidimport_fingerprint(struct pf_osfp_ioctl *); +#ifdef OSFP_DEBUG const char *print_ioctl(struct pf_osfp_ioctl *); +#endif voidprint_name_list(int, struct name_list *, const char *); voidsort_name_list(int, struct name_list *); struct name_entry *lookup_name_list(struct name_list *, const char *); @@ -990,6 +993,7 @@ get_field(char **line, size_t *len, int } +#ifdef OSFP_DEBUG const char * print_ioctl(struct pf_osfp_ioctl *fp) { @@ -1091,3 +1095,4 @@ print_ioctl(struct pf_osfp_ioctl *fp) return (buf); } +#endif -- Michal Mazurek
pfctl/pfctl_osfp.c: mark functions as static
the next field out of a formatted config file line */ -char * +static char * get_field(char **line, size_t *len, int *fieldlen) { char *ret, *ptr = *line; @@ -989,8 +987,7 @@ get_field(char **line, size_t *len, int return (ret); } - -const char * +static const char * print_ioctl(struct pf_osfp_ioctl *fp) { static char buf[1024]; -- Michal Mazurek
Re: pf.conf.5: mention the inversion (!) operator
On 07:52:28, 19.05.17, Jason McIntyre wrote: > On Fri, May 19, 2017 at 08:34:54AM +0200, Michal Mazurek wrote: > > Now that it was commited, what remains is to convert tabs to spaces inside > > a > > literal block: > > > > morning. > > what's the reason for wanting this? Consistency is my only reason. -- Michal Mazurek
Re: pf.conf.5: mention the inversion (!) operator
Now that it was commited, what remains is to convert tabs to spaces inside a literal block: Index: share/man/man5/pf.conf.5 === RCS file: /cvs/src/share/man/man5/pf.conf.5,v retrieving revision 1.561 diff -u -p -r1.561 pf.conf.5 --- share/man/man5/pf.conf.518 May 2017 11:50:47 - 1.561 +++ share/man/man5/pf.conf.519 May 2017 06:32:05 - @@ -2668,7 +2668,7 @@ option = "set" ( [ "timeout" ( t [ "skip on" ifspec ] | [ "debug" ( "emerg" | "alert" | "crit" | "err" | "warning" | "notice" | "info" | "debug" ) ] | -[ "reassemble" ( "yes" | "no" ) [ "no-df" ] ] ) + [ "reassemble" ( "yes" | "no" ) [ "no-df" ] ] ) pf-rule= action [ ( "in" | "out" ) ] [ "log" [ "(" logopts ")"] ] [ "quick" ] @@ -2684,22 +2684,22 @@ filteropt = user | group | flags | ( "no" | "keep" | "modulate" | "synproxy" ) "state" [ "(" state-opts ")" ] | "scrub" "(" scrubopts ")" | "fragment" | "allow-opts" | "once" | -"divert-packet" "port" port | "divert-reply" | -"divert-to" host "port" port | + "divert-packet" "port" port | "divert-reply" | + "divert-to" host "port" port | "label" string | "tag" string | [ "!" ] "tagged" string | "set prio" ( number | "(" number [ [ "," ] number ] ")" ) | "set queue" ( string | "(" string [ [ "," ] string ] ")" ) | "rtable" number | "probability" number"%" | "prio" number | -"af-to" af "from" ( redirhost | "{" redirhost-list "}" ) -[ "to" ( redirhost | "{" redirhost-list "}" ) ] | -"binat-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] | -"rdr-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] | -"nat-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] [ "static-port" ] | -[ route ] | [ "set tos" tos ] | - [ [ "!" ] "received-on" ( interface-name | interface-group ) ] + "af-to" af "from" ( redirhost | "{" redirhost-list "}" ) + [ "to" ( redirhost | "{" redirhost-list "}" ) ] | + "binat-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] | + "rdr-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] | + "nat-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] [ "static-port" ] | + [ route ] | [ "set tos" tos ] | + [ [ "!" ] "received-on" ( interface-name | interface-group ) ] scrubopts = scrubopt [ [ "," ] scrubopts ] scrubopt = "no-df" | "min-ttl" number | "max-mss" number | -- Michal Mazurek
pf.conf.5: mention the inversion (!) operator
- mention the inversion operator for "some parameters" - mention the inversion operator for "received-on" to match "tagged" - don't wrap a short line - use spaces, not tabs inside a literal block - quote the inversion operator when describing BNF syntax (easy to miss): - "label" string | "tag" string | [ ! ] "tagged" string | + "label" string | "tag" string | [ "!" ] "tagged" string | Index: share/man/man5/pf.conf.5 === RCS file: /cvs/src/share/man/man5/pf.conf.5,v retrieving revision 1.558 diff -u -p -r1.558 pf.conf.5 --- share/man/man5/pf.conf.515 May 2017 11:24:37 - 1.558 +++ share/man/man5/pf.conf.515 May 2017 17:30:30 - @@ -131,6 +131,9 @@ matching attributes. Certain parameters can be expressed as lists, in which case .Xr pfctl 8 generates all needed rule combinations. +It's also possible to invert some parameters by specifying the +.Cm !\& +operator. .Pp By default .Xr pf 4 @@ -638,12 +641,17 @@ For example, the following rule will dro .It Cm prio Ar number Only match packets which have the given queueing priority assigned. .Pp -.It Cm received-on Ar interface +.It Oo Cm \&! Oc Ns Cm received-on Ar interface Only match packets which were received on the specified .Cm interface (or interface group). .Cm any will match any existing interface except loopback ones. +Inverse interface matching can also be done by specifying the +.Cm !\& +operator before the +.Cm received-on +keyword. .Pp .It Cm rtable Ar number Used to select an alternate routing table for the routing lookup. @@ -733,8 +741,7 @@ to specify that packets must already be tagged with the given .Ar string in order to match the rule. -Inverse tag matching can also be done -by specifying the +Inverse tag matching can also be done by specifying the .Cm !\& operator before the .Cm tagged @@ -2690,22 +2697,22 @@ filteropt = user | group | flags | ( "no" | "keep" | "modulate" | "synproxy" ) "state" [ "(" state-opts ")" ] | "scrub" "(" scrubopts ")" | "fragment" | "allow-opts" | "once" | -"divert-packet" "port" port | "divert-reply" | -"divert-to" host "port" port | - "label" string | "tag" string | [ ! ] "tagged" string | + "divert-packet" "port" port | "divert-reply" | + "divert-to" host "port" port | + "label" string | "tag" string | [ "!" ] "tagged" string | "set prio" ( number | "(" number [ [ "," ] number ] ")" ) | "set queue" ( string | "(" string [ [ "," ] string ] ")" ) | "rtable" number | "probability" number"%" | "prio" number | -"af-to" af "from" ( redirhost | "{" redirhost-list "}" ) -[ "to" ( redirhost | "{" redirhost-list "}" ) ] | -"binat-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] | -"rdr-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] | -"nat-to" ( redirhost | "{" redirhost-list "}" ) -[ portspec ] [ pooltype ] [ "static-port" ] | -[ route ] | [ "set tos" tos ] | -[ [ "!" ] "received-on" ( interface-name | interface-group ) ] + "af-to" af "from" ( redirhost | "{" redirhost-list "}" ) + [ "to" ( redirhost | "{" redirhost-list "}" ) ] | + "binat-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] | + "rdr-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] | + "nat-to" ( redirhost | "{" redirhost-list "}" ) + [ portspec ] [ pooltype ] [ "static-port" ] | + [ route ] | [ "set tos" tos ] | + [ [ "!" ] "received-on" ( interface-name | interface-group ) ] scrubopts = scrubopt [ [ "," ] scrubopts ] scrubopt = "no-df" | "min-ttl" number | "max-mss" number | -- Michal Mazurek
Re: sleep.1: "while true;" -> "while :;"
On 22:49:38, 20.12.16, Jason McIntyre wrote: > On Tue, Dec 20, 2016 at 10:58:40PM +0100, Michal Mazurek wrote: > > While there is nothing wrong with "while true", "while :" is better > > and used a lot more often in the source tree. > > > > OK? > > > > i'm not sure why "while :" is better in this example, but "while true" > is clearer, i think. allowing for differences in preference, is their a > good reason to change what's there? ":" is a builtin, and appears to be the proper idiom as evidenced by the source tree: $ grep -r 'while true' . | wc -l 11 $ grep -r 'while :' . | wc -l 156 -- Michal Mazurek
sleep.1: "while true;" -> "while :;"
While there is nothing wrong with "while true", "while :" is better and used a lot more often in the source tree. OK? Index: bin/sleep/sleep.1 === RCS file: /cvs/src/bin/sleep/sleep.1,v retrieving revision 1.22 diff -u -p -r1.22 sleep.1 --- bin/sleep/sleep.1 16 Aug 2016 18:51:25 - 1.22 +++ bin/sleep/sleep.1 20 Dec 2016 21:46:07 - @@ -94,7 +94,7 @@ job. .Pp To monitor the growth of a file without consuming too many resources: .Bd -literal -offset indent -while true; do +while :; do ls -l file sleep 5 done -- Michal Mazurek
loadfirmware.9: mention /mnt/etc/firmware
/mnt/etc/firmware is only mentioned in plus44.html. Mention it in loadfirmware(9). It was concluded that the FAQ is not a proper place to talk about this directory. Index: ./share/man/man9/loadfirmware.9 === RCS file: /cvs/src/share/man/man9/loadfirmware.9,v retrieving revision 1.4 diff -u -p -r1.4 loadfirmware.9 --- ./share/man/man9/loadfirmware.9 4 Jun 2013 19:27:08 - 1.4 +++ ./share/man/man9/loadfirmware.9 20 Dec 2016 21:37:42 - @@ -32,6 +32,10 @@ function loads a firmware from the file .Ar filename in the directory .Pa /etc/firmware . +In addition to that, if the kernel is a ramdisk kernel, the extra +directory +.Pa /mnt/etc/firmware +will also be used for the lookup. Memory for the firmware is allocated using .Xr malloc 9 with type -- Michal Mazurek
faq4.html: loading firmware during install
It might be worth explaining how to load firmware during a fresh install, and warn about the dangers of mounting over /mnt. This functionality was introduced in 4.4. While getting online for an install is not really necessary, I like to download my sets from the internet. Index: faq/faq4.html === RCS file: /cvs/www/faq/faq4.html,v retrieving revision 1.479 diff -u -p -r1.479 faq4.html --- faq/faq4.html 3 Sep 2016 13:53:40 - 1.479 +++ faq/faq4.html 9 Dec 2016 08:42:12 - @@ -42,6 +42,7 @@ Problems with signatures Customizing the install process Multibooting +Loading firmware @@ -954,6 +955,28 @@ Writing MBR at offset 0. To discard all unwritten changes, use exit instead. + +Loading firmware + +The ramdisk kernel will look for firmware in /mnt/etc/firmware. + + +For example, if you need to use the iwm driver, get the necessary firmware package from +http://firmware.openbsd.org/firmware/;>http://firmware.openbsd.org/firmware/, +extract it and put it on a USB drive in the etc/firmware directory. +Then, before starting the install script, drop to a shell, mount the drive in /mnt and reload the interface: + + +ifconfig iwm0 down +ifconfig iwm0 up + + +And then unmount the drive. + + +Be aware that the installer uses /mnt to copy the +distribution sets to disk, and thus loading the firmware must be +performed before it is started. -- Michal Mazurek
Re: ps.1 tweak
I realised the text actually means to say "terminal width - 1", not "terminal width: -1" How about this instead? Index: bin/ps/ps.1 === RCS file: /cvs/src/bin/ps/ps.1,v retrieving revision 1.109 diff -u -p -r1.109 ps.1 --- bin/ps/ps.1 23 Sep 2016 06:28:08 - 1.109 +++ bin/ps/ps.1 6 Oct 2016 19:35:12 - @@ -543,7 +543,7 @@ If set to a positive integer, output is formatted to the given width in columns. Otherwise, .Nm -defaults to the terminal width \(mi 1, +defaults to the terminal width minus 1, or 79 columns if none of .Dv stdout , .Dv stderr -- Michal Mazurek
ps.1 tweak
Don't place a space after the minus sign. Change from this: width in columns. Otherwise, ps defaults to the terminal width - 1, or 79 columns if none of stdout, stderr and stdin are a To this: width in columns. Otherwise, ps defaults to the terminal width -1, or 79 columns if none of stdout, stderr and stdin are a Index: bin/ps/ps.1 === RCS file: /cvs/src/bin/ps/ps.1,v retrieving revision 1.109 diff -u -p -r1.109 ps.1 --- bin/ps/ps.1 23 Sep 2016 06:28:08 - 1.109 +++ bin/ps/ps.1 6 Oct 2016 19:24:51 - @@ -543,7 +543,7 @@ If set to a positive integer, output is formatted to the given width in columns. Otherwise, .Nm -defaults to the terminal width \(mi 1, +defaults to the terminal width \(mi1, or 79 columns if none of .Dv stdout , .Dv stderr -- Michal Mazurek
STANDARDS in err.3
Mention that these functions aren't standard. OK? Index: lib/libc/gen/err.3 === RCS file: /cvs/src/lib/libc/gen/err.3,v retrieving revision 1.20 diff -u -p -r1.20 err.3 --- lib/libc/gen/err.3 23 Apr 2014 16:26:33 - 1.20 +++ lib/libc/gen/err.3 14 Sep 2016 07:28:26 - @@ -189,6 +189,10 @@ if ((fd = open(block_device, O_RDONLY, 0 .Xr perror 3 , .Xr printf 3 , .Xr strerror 3 +.Sh STANDARDS +These functions are +.Bx +extensions. .Sh HISTORY The functions .Fn err , -- Michal Mazurek
mount(8): remove unneeded headers
ok? Index: sbin/mount/getmntopts.c === RCS file: /cvs/src/sbin/mount/getmntopts.c,v retrieving revision 1.12 diff -u -p -r1.12 getmntopts.c --- sbin/mount/getmntopts.c 16 Jan 2015 06:39:59 - 1.12 +++ sbin/mount/getmntopts.c 7 Sep 2016 17:29:37 - @@ -31,11 +31,9 @@ */ #include -#include #include #include -#include #include #include #include Index: sbin/mount/mount.c === RCS file: /cvs/src/sbin/mount/mount.c,v retrieving revision 1.67 diff -u -p -r1.67 mount.c --- sbin/mount/mount.c 4 Sep 2016 19:45:27 - 1.67 +++ sbin/mount/mount.c 7 Sep 2016 17:29:37 - @@ -35,7 +35,6 @@ #include #include -#include #include #include @@ -48,7 +47,6 @@ #include #include #include -#include #include #include "pathnames.h" -- Michal Mazurek
mount(8): strlen + malloc + snprintf == asprintf
do what tb@ did for hexdump Index: sbin/mount/mount.c === RCS file: /cvs/src/sbin/mount/mount.c,v retrieving revision 1.66 diff -u -p -r1.66 mount.c --- sbin/mount/mount.c 26 Jun 2016 19:53:40 - 1.66 +++ sbin/mount/mount.c 4 Sep 2016 16:38:41 - @@ -685,19 +685,16 @@ maketypelist(char *fslist) char * catopt(char *s0, const char *s1) { - size_t i; char *cp; if (s0 && *s0) { - i = strlen(s0) + strlen(s1) + 1 + 1; - if ((cp = malloc(i)) == NULL) + if (asprintf(, "%s,%s", s0, s1) == -1) err(1, NULL); - (void)snprintf(cp, i, "%s,%s", s0, s1); } else cp = strdup(s1); free(s0); - return (cp); + return cp; } void -- Michal Mazurek
Re: Futexes for OpenBSD
VIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include +#include "thread_private.h" +#include "rthread.h" + +inline int +futex_lock(volatile _atomic_lock_t *val) +{ + int c; + + if ((c = __sync_val_compare_and_swap(val, 0, 1)) != 0) { + do { + if (c == 2 || __sync_val_compare_and_swap(val, 1, 2) != 0) { + futex(val, FUTEX_WAIT, 2, NULL, NULL, 0); + } + } while ((c = __sync_val_compare_and_swap(val, 0, 2)) != 0); + } + + return 0; +} + +inline int +futex_trylock(volatile _atomic_lock_t *val) +{ + if ((__sync_val_compare_and_swap(val, 0, 1)) != 0) + return 1; + + return 0; +} + +inline int +futex_unlock(volatile _atomic_lock_t *val) +{ + if (__sync_sub_and_fetch(val, 1) != 0) { + *val = 0; + futex(val, FUTEX_WAKE, 1, NULL, NULL, 0); + } + + return 0; +} Index: lib/librthread/rthread.c === RCS file: /cvs/src/lib/librthread/rthread.c,v retrieving revision 1.94 diff -u -p -r1.94 rthread.c --- lib/librthread/rthread.c4 Sep 2016 10:13:35 - 1.94 +++ lib/librthread/rthread.c4 Sep 2016 13:12:40 - @@ -89,20 +89,19 @@ struct pthread_attr _rthread_attr_defaul void _spinlock(volatile _atomic_lock_t *lock) { - while (_atomic_lock(lock)) - sched_yield(); + futex_lock(lock); } int _spinlocktry(volatile _atomic_lock_t *lock) { - return 0 == _atomic_lock(lock); + return 0 == futex_trylock(lock); } void _spinunlock(volatile _atomic_lock_t *lock) { - *lock = _ATOMIC_LOCK_UNLOCKED; + futex_unlock(lock); } static void Index: lib/librthread/rthread.h === RCS file: /cvs/src/lib/librthread/rthread.h,v retrieving revision 1.60 diff -u -p -r1.60 rthread.h --- lib/librthread/rthread.h4 Sep 2016 10:13:35 - 1.60 +++ lib/librthread/rthread.h4 Sep 2016 13:12:40 - @@ -215,3 +215,8 @@ int __thrsleep(const volatile void *, cl volatile void *, const int *); int__thrwakeup(const volatile void *, int n); int__thrsigdivert(sigset_t, siginfo_t *, const struct timespec *); + +/* futex.c */ +intfutex_lock(volatile _atomic_lock_t *); +intfutex_trylock(volatile _atomic_lock_t *); +intfutex_unlock(volatile _atomic_lock_t *); Index: lib/libc/Symbols.list === RCS file: /cvs/src/lib/libc/Symbols.list,v retrieving revision 1.50 diff -u -p -r1.50 Symbols.list --- lib/libc/Symbols.list 3 Sep 2016 16:25:03 - 1.50 +++ lib/libc/Symbols.list 4 Sep 2016 13:12:40 - @@ -272,6 +272,7 @@ fstatat fstatfs fsync ftruncate +futex futimens futimes getdents Index: lib/libc/sys/Makefile.inc === RCS file: /cvs/src/lib/libc/sys/Makefile.inc,v retrieving revision 1.146 diff -u -p -r1.146 Makefile.inc --- lib/libc/sys/Makefile.inc 4 Jul 2016 18:01:44 - 1.146 +++ lib/libc/sys/Makefile.inc 4 Sep 2016 13:12:41 - @@ -87,6 +87,7 @@ DASM= ${ASM:.o=.do} # syscalls that CANNOT FAIL. They can return whatever value they want, # they just never want to set errno. ASM_NOERR=__get_tcb.o __set_tcb.o __threxit.o __thrsleep.o __thrwakeup.o \ + futex.o \ getdtablecount.o getegid.o geteuid.o getgid.o getlogin_r.o \ getpgrp.o getpid.o getppid.o getrtable.o getthrid.o getuid.o \ issetugid.o \ -- Michal Mazurek
Remove tickets from librthreads
ock.c 3 Sep 2016 19:41:55 - @@ -37,7 +37,7 @@ pthread_spin_init(pthread_spinlock_t *lo if (l == NULL) return (ENOMEM); - l->lock = _SPINLOCK_UNLOCKED_ASSIGN; + l->lock = _SPINLOCK_UNLOCKED; *lock = l; return (0); } Index: lib/librthread/rthread_stack.c === RCS file: /cvs/src/lib/librthread/rthread_stack.c,v retrieving revision 1.15 diff -u -p -r1.15 rthread_stack.c --- lib/librthread/rthread_stack.c 1 Sep 2016 10:56:46 - 1.15 +++ lib/librthread/rthread_stack.c 3 Sep 2016 19:41:55 - @@ -18,7 +18,7 @@ * attributes for possible reuse. */ static SLIST_HEAD(, stack) def_stacks = SLIST_HEAD_INITIALIZER(head); -static struct _spinlock def_stacks_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t def_stacks_lock = _SPINLOCK_UNLOCKED; struct stack * _rthread_alloc_stack(pthread_t thread) @@ -134,4 +134,3 @@ _rthread_free_stack(struct stack *stack) free(stack); } } - Index: lib/librthread/rthread_sync.c === RCS file: /cvs/src/lib/librthread/rthread_sync.c,v retrieving revision 1.43 diff -u -p -r1.43 rthread_sync.c --- lib/librthread/rthread_sync.c 3 Sep 2016 16:44:20 - 1.43 +++ lib/librthread/rthread_sync.c 3 Sep 2016 19:41:55 - @@ -20,7 +20,6 @@ * Mutexes and conditions - synchronization functions. */ - #include #include #include @@ -32,7 +31,7 @@ #include "rthread.h" #include "cancel.h"/* in libc/include */ -static struct _spinlock static_init_lock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t static_init_lock = _SPINLOCK_UNLOCKED; /* * mutexen @@ -45,7 +44,7 @@ pthread_mutex_init(pthread_mutex_t *mute mutex = calloc(1, sizeof(*mutex)); if (!mutex) return (errno); - mutex->lock = _SPINLOCK_UNLOCKED_ASSIGN; + mutex->lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(>lockers); if (attr == NULL) { mutex->type = PTHREAD_MUTEX_DEFAULT; @@ -131,7 +130,7 @@ _rthread_mutex_lock(pthread_mutex_t *mut /* self-deadlock, possibly until timeout */ while (__thrsleep(self, CLOCK_REALTIME, abstime, - >lock.ticket, NULL) != EWOULDBLOCK) + >lock, NULL) != EWOULDBLOCK) _spinlock(>lock); return (ETIMEDOUT); } @@ -148,7 +147,7 @@ _rthread_mutex_lock(pthread_mutex_t *mut TAILQ_INSERT_TAIL(>lockers, self, waiting); while (mutex->owner != self) { ret = __thrsleep(self, CLOCK_REALTIME, abstime, - >lock.ticket, NULL); + >lock, NULL); _spinlock(>lock); assert(mutex->owner != NULL); if (ret == EWOULDBLOCK) { @@ -250,7 +249,7 @@ pthread_cond_init(pthread_cond_t *condp, cond = calloc(1, sizeof(*cond)); if (!cond) return (errno); - cond->lock = _SPINLOCK_UNLOCKED_ASSIGN; + cond->lock = _SPINLOCK_UNLOCKED; TAILQ_INIT(>waiters); if (attr == NULL) cond->clock = CLOCK_REALTIME; @@ -360,7 +359,7 @@ pthread_cond_timedwait(pthread_cond_t *c /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { error = __thrsleep(self, cond->clock, abstime, - >lock.ticket, >delayed_cancel); + >lock, >delayed_cancel); /* * If abstime == NULL, then we're definitely waiting @@ -509,7 +508,7 @@ pthread_cond_wait(pthread_cond_t *condp, /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { - error = __thrsleep(self, 0, NULL, >lock.ticket, + error = __thrsleep(self, 0, NULL, >lock, >delayed_cancel); /* Index: lib/librthread/rthread_tls.c === RCS file: /cvs/src/lib/librthread/rthread_tls.c,v retrieving revision 1.17 diff -u -p -r1.17 rthread_tls.c --- lib/librthread/rthread_tls.c2 Apr 2016 19:56:53 - 1.17 +++ lib/librthread/rthread_tls.c3 Sep 2016 19:41:55 - @@ -27,7 +27,7 @@ #include "rthread.h" static struct rthread_key rkeys[PTHREAD_KEYS_MAX]; -static struct _spinlock rkeyslock = _SPINLOCK_UNLOCKED; +static _atomic_lock_t rkeyslock = _SPINLOCK_UNLOCKED; int pthread_key_create(pthread_key_t *key, void (*destructor)(void*)) -- Michal Mazurek
__thrsleep.2 tweak
There are more valid values than just CLOCK_REALTIME and CLOCK_MONOTONIC. Index: lib/libc/sys/__thrsleep.2 === RCS file: /cvs/src/lib/libc/sys/__thrsleep.2,v retrieving revision 1.5 diff -u -p -r1.5 __thrsleep.2 --- lib/libc/sys/__thrsleep.2 20 Mar 2016 09:07:29 - 1.5 +++ lib/libc/sys/__thrsleep.2 3 Sep 2016 15:50:20 - @@ -151,10 +151,9 @@ argument pointed to a non-zero value. .It Bq Er EINVAL The .Fa clock_id -argument is neither -.Dv CLOCK_REALTIME -nor -.Dv CLOCK_MONOTONIC . +argument is not a valid +.Xr clock_gettime 2 +clock id. .El .Pp .Fn __thrwakeup -- Michal Mazurek
Remove _USING_TICKETS from librthreads
ead//rthread_sync.c 7 May 2016 19:05:22 - 1.42 +++ lib/librthread//rthread_sync.c 3 Sep 2016 15:32:42 - @@ -130,8 +130,7 @@ _rthread_mutex_lock(pthread_mutex_t *mut abort(); /* self-deadlock, possibly until timeout */ - while (__thrsleep(self, CLOCK_REALTIME | - _USING_TICKETS, abstime, + while (__thrsleep(self, CLOCK_REALTIME, abstime, >lock.ticket, NULL) != EWOULDBLOCK) _spinlock(>lock); return (ETIMEDOUT); @@ -148,8 +147,8 @@ _rthread_mutex_lock(pthread_mutex_t *mut /* add to the wait queue and block until at the head */ TAILQ_INSERT_TAIL(>lockers, self, waiting); while (mutex->owner != self) { - ret = __thrsleep(self, CLOCK_REALTIME | _USING_TICKETS, - abstime, >lock.ticket, NULL); + ret = __thrsleep(self, CLOCK_REALTIME, abstime, + >lock.ticket, NULL); _spinlock(>lock); assert(mutex->owner != NULL); if (ret == EWOULDBLOCK) { @@ -360,7 +359,7 @@ pthread_cond_timedwait(pthread_cond_t *c /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { - error = __thrsleep(self, cond->clock | _USING_TICKETS, abstime, + error = __thrsleep(self, cond->clock, abstime, >lock.ticket, >delayed_cancel); /* @@ -510,8 +509,8 @@ pthread_cond_wait(pthread_cond_t *condp, /* wait until we're the owner of the mutex again */ while (mutex->owner != self) { - error = __thrsleep(self, 0 | _USING_TICKETS, NULL, - >lock.ticket, >delayed_cancel); + error = __thrsleep(self, 0, NULL, >lock.ticket, + >delayed_cancel); /* * If we took a normal signal (not from -- Michal Mazurek
Mention the maximum packet size in ping6.8
The code says that the maximum packet size is 131024, but in reality it's 65527. Values greater than 65527 will cause ping6 to fail: $ ping6 -s 10 ::1 PING6 ::1 (::1): 10 data bytes ping6: sendmsg: Invalid argument ping6: wrote ::1 18 chars, ret=-1 Document the maximum as 65527, discussed with florian@. Also re-break lines so that the formatting of the identical text matches ping.8. Index: sbin/ping6/ping6.8 === RCS file: /cvs/src/sbin/ping6/ping6.8,v retrieving revision 1.62 diff -u -p -r1.62 ping6.8 --- sbin/ping6/ping6.8 3 Sep 2016 09:18:52 - 1.62 +++ sbin/ping6/ping6.8 3 Sep 2016 14:30:05 - @@ -181,12 +181,10 @@ when finished. .\"is a neighbor. .It Fl s Ar packetsize Specifies the number of data bytes to be sent. -The default is 56, which translates into 64 -ICMP -data bytes when combined -with the 8 bytes of -ICMP -header data. +The default is 56, +which translates into 64 ICMP data bytes +when combined with the 8 bytes of ICMP header data. +The maximum packet size is 65527. .It Fl V Ar rtable Set the routing table to be used for outgoing packets. .It Fl v -- Michal Mazurek
Re: thrsleep: remove ticket lock support
On 09:53:15, 3.09.16, Ted Unangst wrote: > please keep this line. Index: sys/kern/kern_synch.c === RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.133 diff -u -p -r1.133 kern_synch.c --- sys/kern/kern_synch.c 6 Jul 2016 15:53:01 - 1.133 +++ sys/kern/kern_synch.c 3 Sep 2016 14:06:32 - @@ -59,7 +59,7 @@ #endif intthrsleep(struct proc *, struct sys___thrsleep_args *); -intthrsleep_unlock(void *, int); +intthrsleep_unlock(void *); /* * We're only looking at 7 bits of the address; everything is @@ -454,26 +454,15 @@ sys_sched_yield(struct proc *p, void *v, } int -thrsleep_unlock(void *lock, int lockflags) +thrsleep_unlock(void *lock) { static _atomic_lock_t unlocked = _ATOMIC_LOCK_UNLOCKED; _atomic_lock_t *atomiclock = lock; - uint32_t *ticket = lock; - uint32_t ticketvalue; - int error; if (!lock) - return (0); + return 0; - if (lockflags) { - if ((error = copyin(ticket, , sizeof(ticketvalue - return (error); - ticketvalue++; - error = copyout(, ticket, sizeof(ticketvalue)); - } else { - error = copyout(, atomiclock, sizeof(unlocked)); - } - return (error); + return copyout(, atomiclock, sizeof(unlocked)); } static int globalsleepaddr; @@ -493,8 +482,7 @@ thrsleep(struct proc *p, struct sys___th void *lock = SCARG(uap, lock); uint64_t to_ticks = 0; int abort, error; - clockid_t clock_id = SCARG(uap, clock_id) & 0x7; - int lockflags = SCARG(uap, clock_id) & 0x8; + clockid_t clock_id = SCARG(uap, clock_id); if (ident == 0) return (EINVAL); @@ -510,7 +498,7 @@ thrsleep(struct proc *p, struct sys___th if (timespeccmp(tsp, , <)) { /* already passed: still do the unlock */ - if ((error = thrsleep_unlock(lock, lockflags))) + if ((error = thrsleep_unlock(lock))) return (error); return (EWOULDBLOCK); } @@ -524,9 +512,8 @@ thrsleep(struct proc *p, struct sys___th p->p_thrslpid = ident; - if ((error = thrsleep_unlock(lock, lockflags))) { + if ((error = thrsleep_unlock(lock))) goto out; - } if (SCARG(uap, abort) != NULL) { if ((error = copyin(SCARG(uap, abort), , Index: sys/sys/_time.h === RCS file: /cvs/src/sys/sys/_time.h,v retrieving revision 1.7 diff -u -p -r1.7 _time.h --- sys/sys/_time.h 16 Oct 2014 15:50:49 - 1.7 +++ sys/sys/_time.h 3 Sep 2016 14:06:32 - @@ -39,8 +39,6 @@ #define CLOCK_UPTIME 5 #if __BSD_VISIBLE -#define__CLOCK_USE_TICKET_LOCKS8 /* flag for __thrsleep() */ - /* * Per-process and per-thread clocks encode the PID or TID into the * high bits, with the type in the bottom bits -- Michal Mazurek
thrsleep: remove ticket lock support
The system call is only called from librthreads, and librthreads doesn't use tickets. There is a comment in librthreads that says: /* * tickets don't work yet? (or seem much slower, with lots of system time) * until then, keep the struct around to avoid excessive changes going * back and forth. */ It was added on 2013-06-01. This diff is just the kernel part. Index: sys/kern/kern_synch.c === RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.133 diff -u -p -r1.133 kern_synch.c --- sys/kern/kern_synch.c 6 Jul 2016 15:53:01 - 1.133 +++ sys/kern/kern_synch.c 3 Sep 2016 13:45:40 - @@ -59,7 +59,7 @@ #endif intthrsleep(struct proc *, struct sys___thrsleep_args *); -intthrsleep_unlock(void *, int); +intthrsleep_unlock(void *); /* * We're only looking at 7 bits of the address; everything is @@ -454,26 +454,15 @@ sys_sched_yield(struct proc *p, void *v, } int -thrsleep_unlock(void *lock, int lockflags) +thrsleep_unlock(void *lock) { static _atomic_lock_t unlocked = _ATOMIC_LOCK_UNLOCKED; _atomic_lock_t *atomiclock = lock; - uint32_t *ticket = lock; - uint32_t ticketvalue; - int error; if (!lock) - return (0); + return 0; - if (lockflags) { - if ((error = copyin(ticket, , sizeof(ticketvalue - return (error); - ticketvalue++; - error = copyout(, ticket, sizeof(ticketvalue)); - } else { - error = copyout(, atomiclock, sizeof(unlocked)); - } - return (error); + return copyout(, atomiclock, sizeof(unlocked)); } static int globalsleepaddr; @@ -493,15 +482,13 @@ thrsleep(struct proc *p, struct sys___th void *lock = SCARG(uap, lock); uint64_t to_ticks = 0; int abort, error; - clockid_t clock_id = SCARG(uap, clock_id) & 0x7; - int lockflags = SCARG(uap, clock_id) & 0x8; if (ident == 0) return (EINVAL); if (tsp != NULL) { struct timespec now; - if ((error = clock_gettime(p, clock_id, ))) + if ((error = clock_gettime(p, SCARG(uap, clock_id), ))) return (error); #ifdef KTRACE if (KTRPOINT(p, KTR_STRUCT)) @@ -510,7 +497,7 @@ thrsleep(struct proc *p, struct sys___th if (timespeccmp(tsp, , <)) { /* already passed: still do the unlock */ - if ((error = thrsleep_unlock(lock, lockflags))) + if ((error = thrsleep_unlock(lock))) return (error); return (EWOULDBLOCK); } @@ -524,9 +511,8 @@ thrsleep(struct proc *p, struct sys___th p->p_thrslpid = ident; - if ((error = thrsleep_unlock(lock, lockflags))) { + if ((error = thrsleep_unlock(lock))) goto out; - } if (SCARG(uap, abort) != NULL) { if ((error = copyin(SCARG(uap, abort), , Index: sys/sys/_time.h === RCS file: /cvs/src/sys/sys/_time.h,v retrieving revision 1.7 diff -u -p -r1.7 _time.h --- sys/sys/_time.h 16 Oct 2014 15:50:49 - 1.7 +++ sys/sys/_time.h 3 Sep 2016 13:45:40 - @@ -39,8 +39,6 @@ #define CLOCK_UPTIME 5 #if __BSD_VISIBLE -#define__CLOCK_USE_TICKET_LOCKS8 /* flag for __thrsleep() */ - /* * Per-process and per-thread clocks encode the PID or TID into the * high bits, with the type in the bottom bits -- Michal Mazurek
Remove mention of deprecated flags in ping6.8
I don't think the -s option is ever ignored now. OK? Index: sbin/ping6/ping6.8 === RCS file: /cvs/src/sbin/ping6/ping6.8,v retrieving revision 1.60 diff -u -p -r1.60 ping6.8 --- sbin/ping6/ping6.8 25 Oct 2015 14:43:48 - 1.60 +++ sbin/ping6/ping6.8 2 Sep 2016 18:13:18 - @@ -190,10 +190,6 @@ data bytes when combined with the 8 bytes of ICMP header data. -.Pp -This option is ignored if any of the flags -.Op Fl tWw -are specified. .It Fl V Ar rtable Set the routing table to be used for outgoing packets. .It Fl v -- Michal Mazurek
Mention the maximum packet size in ping.8
Index: sbin/ping/ping.8 === RCS file: /cvs/src/sbin/ping/ping.8,v retrieving revision 1.52 diff -u -p -r1.52 ping.8 --- sbin/ping/ping.824 Mar 2014 11:11:49 - 1.52 +++ sbin/ping/ping.82 Sep 2016 16:35:50 - @@ -176,6 +176,7 @@ Specifies the number of data bytes to be The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data. +The maximum packet size is 65467. .It Fl T Ar toskeyword Change IPv4 TOS value. .Ar toskeyword -- Michal Mazurek
Re: Better wording in ping error messages
On 12:12:11, 2.09.16, Ted Unangst wrote: > Michal Mazurek wrote: > > worms(6) does this more concisely: > > > > errx(1, "length (2-1024) is %s: %s", errstr, > > there's multiple schools of thought here, but i've always preferred somewhat > shorter error messages. we tell the user it's too small or too large already. > if they need to know the exact bounds, they should consult the manual. maybe > learn something else too. The reason for this diff was difficulty in determining the max packet size, which is 65467 and undocumented. You're saying this should instead go into the manual page? -- Michal Mazurek
Better wording in ping error messages
worms(6) does this more concisely: errx(1, "length (2-1024) is %s: %s", errstr, Index: ping.c === RCS file: /cvs/src/sbin/ping/ping.c,v retrieving revision 1.142 diff -u -p -r1.142 ping.c --- ping.c 30 Aug 2016 14:28:31 - 1.142 +++ ping.c 2 Sep 2016 16:01:53 - @@ -295,8 +295,9 @@ main(int argc, char *argv[]) case 's': /* size of packet to send */ datalen = strtonum(optarg, 0, MAXPAYLOAD, ); if (errstr) - errx(1, "packet size is %s: %s", errstr, - optarg); + errx(1, "packet size is %s: %s; provide a " + "value between 0 and %d inclusive", errstr, + optarg, MAXPAYLOAD); break; #ifndef SMALL case 'T': @@ -311,20 +312,25 @@ main(int argc, char *argv[]) else tos = strtonum(optarg, 0, 255, ); if (tos < 0 || tos > 255 || errstr || errno) - errx(1, "illegal tos value %s", optarg); + errx(1, "illegal tos value %s; provide a " + "value between 0 and 255 inclusive", + optarg); break; #endif /* SMALL */ case 't': options |= F_TTL; ttl = strtonum(optarg, 0, MAXTTL, ); if (errstr) - errx(1, "ttl value is %s: %s", errstr, optarg); + errx(1, "ttl value is %s: %s; provide a " + "value between 0 and %d inclusive", + errstr, optarg, MAXTTL); break; case 'V': rtableid = strtonum(optarg, 0, RT_TABLEID_MAX, ); if (errstr) - errx(1, "rtable value is %s: %s", errstr, - optarg); + errx(1, "rtable value is %s: %s; provide a " + "value between 0 and %d inclusive", errstr, + optarg, RT_TABLEID_MAX); if (setsockopt(s, SOL_SOCKET, SO_RTABLE, , sizeof(rtableid)) == -1) err(1, "setsockopt SO_RTABLE"); -- Michal Mazurek
Futexes for OpenBSD
ockflags))) + if ((error = thrsleep_unlock(p, lock, lockflags))) return (error); return (EWOULDBLOCK); } @@ -524,7 +526,7 @@ thrsleep(struct proc *p, struct sys___th p->p_thrslpid = ident; - if ((error = thrsleep_unlock(lock, lockflags))) { + if ((error = thrsleep_unlock(p, lock, lockflags))) { goto out; } Index: sys/kern/syscalls.c === RCS file: /cvs/src/sys/kern/syscalls.c,v retrieving revision 1.183 diff -u -p -r1.183 syscalls.c --- sys/kern/syscalls.c 27 Jun 2016 16:52:01 - 1.183 +++ sys/kern/syscalls.c 2 Sep 2016 13:09:54 - @@ -393,4 +393,5 @@ char *syscallnames[] = { "#328 (obsolete __tfork51)",/* 328 = obsolete __tfork51 */ "__set_tcb",/* 329 = __set_tcb */ "__get_tcb",/* 330 = __get_tcb */ + "futex",/* 331 = futex */ }; Index: sys/kern/syscalls.master === RCS file: /cvs/src/sys/kern/syscalls.master,v retrieving revision 1.173 diff -u -p -r1.173 syscalls.master --- sys/kern/syscalls.master27 Jun 2016 16:50:07 - 1.173 +++ sys/kern/syscalls.master2 Sep 2016 13:09:54 - @@ -563,3 +563,6 @@ 328OBSOL __tfork51 329STD NOLOCK { void sys___set_tcb(void *tcb); } 330STD NOLOCK { void *sys___get_tcb(void); } +331STD { void sys_futex(void *uaddr, int futex_op, int val, \ + const struct timespec *tp, int *uaddr2, \ + int val3); } Index: sys/sys/futex.h === RCS file: sys/sys/futex.h diff -N sys/sys/futex.h --- /dev/null 1 Jan 1970 00:00:00 - +++ sys/sys/futex.h 2 Sep 2016 13:09:59 - @@ -0,0 +1,17 @@ +/* $OpenBSD$ */ + +#ifndef _SYS_FUTEX_H_ +#define _SYS_FUTEX_H_ + +#include + +#defineFUTEX_WAIT 0 +#defineFUTEX_WAKE 1 + +#defineFUTEX_CLOCK_REALTIME256 + +__BEGIN_DECLS +intfutex(volatile void *, int, int, const struct timespec *, int *, int); +__END_DECLS + +#endif /* !_SYS_FUTEX_H_ */ Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.224 diff -u -p -r1.224 proc.h --- sys/sys/proc.h 27 Jun 2016 19:55:02 - 1.224 +++ sys/sys/proc.h 2 Sep 2016 13:10:00 - @@ -297,6 +297,7 @@ struct proc { int p_dupfd; /* Sideways return value from filedescopen. XXX */ longp_thrslpid; /* for thrsleep syscall */ + longp_futslpid; /* for futex syscall */ /* scheduling */ u_int p_estcpu;/* Time averaged value of p_cpticks. */ Index: sys/sys/syscall.h === RCS file: /cvs/src/sys/sys/syscall.h,v retrieving revision 1.182 diff -u -p -r1.182 syscall.h --- sys/sys/syscall.h 27 Jun 2016 16:52:01 - 1.182 +++ sys/sys/syscall.h 2 Sep 2016 13:10:01 - @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.182 2016/06/27 16:52:01 jsing Exp $ */ +/* $OpenBSD$ */ /* * System call numbers. @@ -702,4 +702,7 @@ /* syscall: "__get_tcb" ret: "void *" args: */ #defineSYS___get_tcb 330 -#defineSYS_MAXSYSCALL 331 +/* syscall: "futex" ret: "void" args: "void *" "int" "int" "const struct timespec *" "int *" "int" */ +#defineSYS_futex 331 + +#defineSYS_MAXSYSCALL 332 Index: sys/sys/syscallargs.h === RCS file: /cvs/src/sys/sys/syscallargs.h,v retrieving revision 1.185 diff -u -p -r1.185 syscallargs.h --- sys/sys/syscallargs.h 27 Jun 2016 16:52:01 - 1.185 +++ sys/sys/syscallargs.h 2 Sep 2016 13:10:02 - @@ -1,4 +1,4 @@ -/* $OpenBSD: syscallargs.h,v 1.185 2016/06/27 16:52:01 jsing Exp $ */ +/* $OpenBSD$ */ /* * System call argument lists. @@ -1098,6 +1098,15 @@ struct sys___set_tcb_args { syscallarg(void *) tcb; }; +struct sys_futex_args { + syscallarg(void *) uaddr; + syscallarg(int) futex_op; + syscallarg(int) val; + syscallarg(const struct timespec *) tp; + syscallarg(int *) uaddr2; + syscallarg(int) val3; +}; + /* * System call prototypes. */ @@ -1347,3 +1356,4 @@ int sys_symlinkat(struct proc *, void *, intsys_unlinkat(struct proc *, void *, register_t *); intsys___set_tcb(struct proc *, void *, register_t *); intsys___get_tcb(struct proc *, void *, register_t *); +intsys_futex(struct proc *, void *, register_t *); -- Michal Mazurek
sys_process.c: remove relebad
This was OKd but forgotten: https://marc.info/?l=openbsd-tech=146001680811549=2 relebad used to have more body: relebad: PRELE(t); return (error); But then PRELE(t); was removed. This diff gets rid of what remains of relebad. Index: sys/kern/sys_process.c === RCS file: /cvs/src/sys/kern/sys_process.c,v retrieving revision 1.69 diff -u -p -r1.69 sys_process.c --- sys/kern/sys_process.c 31 May 2016 22:34:53 - 1.69 +++ sys/kern/sys_process.c 1 Sep 2016 07:30:55 - @@ -454,7 +454,7 @@ sys_ptrace(struct proc *p, void *v, regi /* If the address parameter is not (int *)1, set the pc. */ if ((int *)SCARG(uap, addr) != (int *)1) if ((error = process_set_pc(t, SCARG(uap, addr))) != 0) - goto relebad; + return error; #ifdef PT_STEP /* @@ -462,7 +462,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, req == PT_STEP); if (error) - goto relebad; + return error; #endif goto sendsig; @@ -492,7 +492,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, 0); if (error) - goto relebad; + return error; #endif /* give process back to original parent or init */ @@ -522,9 +522,6 @@ sys_ptrace(struct proc *p, void *v, regi } return (0); - - relebad: - return (error); case PT_KILL: if (SCARG(uap, pid) < THREAD_PID_OFFSET && tr->ps_single) -- Michal Mazurek
remove MPSAFE from makesyscalls.sh
This was OKd but forgotten: http://openbsd-archive.7691.n7.nabble.com/remove-MPSAFE-from-makesyscalls-sh-td293382.html Index: sys/sys/systm.h === RCS file: /cvs/src/sys/sys/systm.h,v retrieving revision 1.113 diff -u -p -r1.113 systm.h --- sys/sys/systm.h 17 May 2016 23:28:03 - 1.113 +++ sys/sys/systm.h 1 Sep 2016 07:34:19 - @@ -112,8 +112,7 @@ extern struct sysent { /* system call t sy_call_t *sy_call; /* implementing function */ } sysent[]; -#define SY_MPSAFE 0x01 -#define SY_NOLOCK 0x02 +#define SY_NOLOCK 0x01 #if_BYTE_ORDER == _BIG_ENDIAN #define SCARG(p, k)((p)->k.be.datum) /* get arg from args pointer */ Index: sys/kern/makesyscalls.sh === RCS file: /cvs/src/sys/kern/makesyscalls.sh,v retrieving revision 1.11 diff -u -p -r1.11 makesyscalls.sh --- sys/kern/makesyscalls.sh27 Nov 2007 18:04:01 - 1.11 +++ sys/kern/makesyscalls.sh1 Sep 2016 07:34:19 - @@ -255,10 +255,6 @@ function parseline() { funcalias="" end=NF } - if ($f == "MPSAFE") { # allow MP-safe syscalls - sycall_flags = sprintf("SY_MPSAFE | %s", sycall_flags) - f++ - } if ($f == "NOLOCK") { # syscall does not need locks sycall_flags = sprintf("SY_NOLOCK | %s", sycall_flags) f++ -- Michal Mazurek
Remove last mention of nonexistent ktr_kuser().
Index: sys/sys/ktrace.h === RCS file: /cvs/src/sys/sys/ktrace.h,v retrieving revision 1.31 diff -u -p -r1.31 ktrace.h --- sys/sys/ktrace.h18 Jun 2016 17:39:44 - 1.31 +++ sys/sys/ktrace.h1 Sep 2016 07:26:30 - @@ -206,7 +206,6 @@ void ktrnamei(struct proc *, char *); void ktrpsig(struct proc *, int, sig_t, int, int, siginfo_t *); void ktrsyscall(struct proc *, register_t, size_t, register_t []); void ktrsysret(struct proc *, register_t, int, const register_t [2]); -void ktr_kuser(const char *, void *, size_t); int ktruser(struct proc *, const char *, const void *, size_t); void ktrexec(struct proc *, int, const char *, ssize_t); void ktrpledge(struct proc *, int, uint64_t, int); -- Michal Mazurek
Fix comment in sys/sem.h
It's _SYS_SEM_H_ not _SEM_H_: #ifndef _SYS_SEM_H_ #define _SYS_SEM_H_ Index: sys/sys/sem.h === RCS file: /cvs/src/sys/sys/sem.h,v retrieving revision 1.23 diff -u -p -r1.23 sem.h --- sys/sys/sem.h 23 Nov 2014 04:31:42 - 1.23 +++ sys/sys/sem.h 1 Sep 2016 07:22:26 - @@ -195,4 +195,4 @@ int semop(int, struct sembuf *, size_t); __END_DECLS #endif /* !_KERNEL */ -#endif /* !_SEM_H_ */ +#endif /* !_SYS_SEM_H_ */ -- Michal Mazurek
Array of TAILQs in kern_synch.c
There is what appears to be a sensless hash in kern_synch.c. It's an array of 128 TAILQs which are hashed according to the high bits of the wchan. It's possible to write a program that adds kern.maxthread entries to one of those TAILQs. Just running chrome with 11 tabs open adds 35 entries to one TAILQ, while leaving others empty. If it doesn't matter that a user program can make a TAILQ very long, then the hash is senseless (diff below). If it does matter, then it's broken, and a different data structure needs to be used. Currently RB trees require all element values to be unique, but a version of RB trees with non-unique element values is possible. Any thoughts? Index: sys/kern/kern_synch.c === RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.133 diff -u -p -r1.133 kern_synch.c --- sys/kern/kern_synch.c 6 Jul 2016 15:53:01 - 1.133 +++ sys/kern/kern_synch.c 31 Aug 2016 12:54:40 - @@ -61,22 +61,12 @@ intthrsleep(struct proc *, struct sys___thrsleep_args *); intthrsleep_unlock(void *, int); -/* - * We're only looking at 7 bits of the address; everything is - * aligned to 4, lots of things are aligned to greater powers - * of 2. Shift right by 8, i.e. drop the bottom 256 worth. - */ -#define TABLESIZE 128 -#define LOOKUP(x) (((long)(x) >> 8) & (TABLESIZE - 1)) -TAILQ_HEAD(slpque,proc) slpque[TABLESIZE]; +TAILQ_HEAD(slpque,proc) slpque; void sleep_queue_init(void) { - int i; - - for (i = 0; i < TABLESIZE; i++) - TAILQ_INIT([i]); + TAILQ_INIT(); } @@ -251,7 +241,7 @@ sleep_setup(struct sleep_state *sls, con p->p_wmesg = wmesg; p->p_slptime = 0; p->p_priority = prio & PRIMASK; - TAILQ_INSERT_TAIL([LOOKUP(ident)], p, p_runq); + TAILQ_INSERT_TAIL(, p, p_runq); } void @@ -385,7 +375,7 @@ unsleep(struct proc *p) SCHED_ASSERT_LOCKED(); if (p->p_wchan) { - TAILQ_REMOVE([LOOKUP(p->p_wchan)], p, p_runq); + TAILQ_REMOVE(, p, p_runq); p->p_wchan = NULL; } } @@ -396,14 +386,12 @@ unsleep(struct proc *p) void wakeup_n(const volatile void *ident, int n) { - struct slpque *qp; struct proc *p; struct proc *pnext; int s; SCHED_LOCK(s); - qp = [LOOKUP(ident)]; - for (p = TAILQ_FIRST(qp); p != NULL && n != 0; p = pnext) { + for (p = TAILQ_FIRST(); p != NULL && n != 0; p = pnext) { pnext = TAILQ_NEXT(p, p_runq); #ifdef DIAGNOSTIC if (p->p_stat != SSLEEP && p->p_stat != SSTOP) @@ -412,7 +400,7 @@ wakeup_n(const volatile void *ident, int if (p->p_wchan == ident) { --n; p->p_wchan = 0; - TAILQ_REMOVE(qp, p, p_runq); + TAILQ_REMOVE(, p, p_runq); if (p->p_stat == SSLEEP) setrunnable(p); } -- Michal Mazurek
Undefined behaviour in subr_hibernate.c
Section "J.2 Undefined behavior" of n1570 includes: * Pointers that do not point to the same aggregate or union (nor just beyond the same array object) are compared using relational operators (6.5.8). I think that's what's happening when using RB trees in subr_hibernate.c. subr_pool.c fixes this issue by casting the address to vaddr_t. Diff to do the same in subr_hibernate.c below. Index: sys/kern/subr_hibernate.c === RCS file: /cvs/src/sys/kern/subr_hibernate.c,v retrieving revision 1.116 diff -u -p -r1.116 subr_hibernate.c --- sys/kern/subr_hibernate.c 4 May 2015 02:18:05 - 1.116 +++ sys/kern/subr_hibernate.c 31 Aug 2016 08:35:53 - @@ -156,7 +156,10 @@ hibernate_sort_ranges(union hibernate_in static __inline int hibe_cmp(struct hiballoc_entry *l, struct hiballoc_entry *r) { - return l < r ? -1 : (l > r); + vaddr_t vl = (vaddr_t)l; + vaddr_t vr = (vaddr_t)r; + + return vl < vr ? -1 : (vl > vr); } RB_PROTOTYPE(hiballoc_addr, hiballoc_entry, hibe_entry, hibe_cmp) -- Michal Mazurek
check KTRPOINT() before calling ktrpledge()
Don't ktrace pledge if it is not enabled. Index: sys/kern/kern_pledge.c === RCS file: /cvs/src/sys/kern/kern_pledge.c,v retrieving revision 1.170 diff -u -p -r1.170 kern_pledge.c --- sys/kern/kern_pledge.c 7 Jun 2016 01:31:54 - 1.170 +++ sys/kern/kern_pledge.c 21 Jun 2016 06:32:41 - @@ -574,7 +574,8 @@ pledge_fail(struct proc *p, int error, u printf("%s(%d): syscall %d \"%s\"\n", p->p_comm, p->p_pid, p->p_pledge_syscall, codes); #ifdef KTRACE - ktrpledge(p, error, code, p->p_pledge_syscall); + if (KTRPOINT(p, KTR_PLEDGE)) + ktrpledge(p, error, code, p->p_pledge_syscall); #endif /* Send uncatchable SIGABRT for coredump */ memset(, 0, sizeof sa); -- Michal Mazurek
pledge in /usr/bin/ktrace
KTRFAC_PLEDGE on its own isn't very useful, but this change makes it possible to recreate the default string. Make the default in the manpage more obvious. Also ansify getpoints(). Index: usr.bin/ktrace/ktrace.1 === RCS file: /cvs/src/usr.bin/ktrace/ktrace.1,v retrieving revision 1.28 diff -u -p -r1.28 ktrace.1 --- usr.bin/ktrace/ktrace.1 6 Mar 2016 20:25:27 - 1.28 +++ usr.bin/ktrace/ktrace.1 15 Jun 2016 10:30:50 - @@ -111,15 +111,9 @@ Enable (disable) tracing on the indicate flag is permitted). .It Fl t Ar trstr The string argument represents the kernel trace points, one per letter. -The default flags are -.Cm c , -.Cm i , -.Cm n , -.Cm s , -.Cm t , -.Cm u , -and -.Cm x . +By default all flags except for +.Cm X +are enabled. The following table equates the letters with the tracepoints: .Pp .Bl -tag -width flag -offset indent -compact @@ -142,6 +136,10 @@ trace argument vector in .It Cm X trace environment in .Xr execve 2 +.It Cm p +trace +.Xr pledge 2 +failures .It Cm + trace the default points .El Index: usr.bin/ktrace/subr.c === RCS file: /cvs/src/usr.bin/ktrace/subr.c,v retrieving revision 1.12 diff -u -p -r1.12 subr.c --- usr.bin/ktrace/subr.c 6 Mar 2016 20:25:27 - 1.12 +++ usr.bin/ktrace/subr.c 15 Jun 2016 10:30:50 - @@ -43,8 +43,7 @@ #include "extern.h" int -getpoints(s) - const char *s; +getpoints(const char *s) { int facs = 0; @@ -73,6 +72,9 @@ getpoints(s) break; case 'X': facs |= KTRFAC_EXECENV; + break; + case 'p': + facs |= KTRFAC_PLEDGE; break; case '+': facs |= DEF_POINTS; -- Michal Mazurek
ktremul() no longer exists
It was removed in March, so remove the last mention of it. Index: share/man/man9/ktrace.9 === RCS file: /cvs/src/share/man/man9/ktrace.9,v retrieving revision 1.10 diff -u -p -r1.10 ktrace.9 --- share/man/man9/ktrace.9 12 Sep 2015 15:02:28 - 1.10 +++ share/man/man9/ktrace.9 15 Jun 2016 08:06:34 - @@ -27,7 +27,6 @@ .Dt KTRACE 9 .Os .Sh NAME -.Nm ktremul , .Nm ktrgenio , .Nm ktrnamei , .Nm ktrpsig , @@ -41,8 +40,6 @@ .In sys/ktrace.h .Fn KTRPOINT "struct proc *p" "int type" .Ft void -.Fn ktremul "struct proc *p" "char *emul" -.Ft void .Fn ktrgenio "struct proc *p" "int fd" "enum uio_rw rw" "struct iovec *iov" "int len" "int error" .Ft void .Fn ktrnamei "struct proc *p" "char *path" @@ -70,12 +67,6 @@ Possible values for the .Fa type argument are a mask of the KTRFAC_ values described in .Xr ktrace 2 . -.Pp -.Fn ktremul -should be called every time emulation for the execution environment -is changed and thus the name of which is given in the -.Fa name -argument. .Pp .Fn ktrgenio should be called for each generic input/output transaction that is -- Michal Mazurek
documentation: valid KTRPOINT() arguments
The documentation (man KTRPOINT) says: KTRPOINT(struct proc *p, int type); ... The KTRPOINT() macro should be used before calling any of the other tracing functions to verify that tracing for that particular type of events has been enabled. Possible values for the type argument are a mask of the KTRFAC_ values described in ktrace(2). But the kernel uses KTR_, not KTRFAC_ values: /usr/src/sys$ grep -rI KTRPOINT.*KTR_ . | wc -l 62 /usr/src/sys$ grep -rI KTRPOINT.*KTRFAC_ . | wc -l 0 The difference between the two is such: #define KTR_STRUCT 8 #define KTRFAC_STRUCT (1<<KTR_STRUCT) And the macro itself: #define KTRPOINT(p, type) \ ((p)->p_p->ps_traceflag & (1<<(type)) && ((p)->p_flag & P_INKTR) == 0) Maybe I misunderstood what a "mask of the KTRFAC_ values" means, but I think this is a valid fix: Index: ktrace.9 === RCS file: /cvs/src/share/man/man9/ktrace.9,v retrieving revision 1.10 diff -u -p -r1.10 ktrace.9 --- ktrace.912 Sep 2015 15:02:28 - 1.10 +++ ktrace.915 Jun 2016 07:52:27 - @@ -66,9 +66,8 @@ The .Fn KTRPOINT macro should be used before calling any of the other tracing functions to verify that tracing for that particular type of events has been enabled. -Possible values for the .Fa type -argument are a mask of the KTRFAC_ values described in +must be a KTR_ value matching the respective KTRFAC_ value described in .Xr ktrace 2 . .Pp .Fn ktremul -- Michal Mazurek
Re: tidy strstr.3
On 19:55:48, 11.05.16, Ingo Schwarze wrote: > Hi, > > Michal Mazurek wrote on Wed, May 11, 2016 at 10:41:03AM +0200: > > > * add explicit RETURN VALUES section > > * add an EXAMPLES section, from NetBSD and FreeBSD > > * mention memmem(3) > > Committed without the EXAMPLES. I agree with tedu@ that this > example is trivial and doesn't add value. The same for wcsstr: Index: lib/libc/string/wcsstr.3 === RCS file: /cvs/src/lib/libc/string/wcsstr.3,v retrieving revision 1.3 diff -u -p -r1.3 wcsstr.3 --- lib/libc/string/wcsstr.35 Jun 2013 03:39:23 - 1.3 +++ lib/libc/string/wcsstr.312 May 2016 06:10:36 - @@ -48,7 +48,7 @@ function locates the first occurrence of .Fa little in the wide string .Fa big . -.Pp +.Sh RETURN VALUES If .Fa little is an empty wide string, @@ -64,6 +64,7 @@ otherwise a pointer to the first wide ch .Fa little is returned. .Sh SEE ALSO +.Xr memmem 3 , .Xr strstr 3 , .Xr wcschr 3 , .Xr wcscspn 3 , -- Michal Mazurek
Re: Allow top(1) to search arguments (again)
As discussed off list, "if (!term)" is redundant, as the caller does the check. Also fix whitespace in some unrelated places. Index: usr.bin/top/display.c === RCS file: /cvs/src/usr.bin/top/display.c,v retrieving revision 1.50 diff -u -p -r1.50 display.c --- usr.bin/top/display.c 26 Oct 2015 12:44:22 - 1.50 +++ usr.bin/top/display.c 11 May 2016 12:23:23 - @@ -516,7 +516,7 @@ void i_header(char *text) { if (header_status == Yes && (screen_length > y_header - || !smart_terminal)) { + || !smart_terminal)) { if (!smart_terminal) { putn(); if (fputs(text, stdout) == EOF) Index: usr.bin/top/machine.c === RCS file: /cvs/src/usr.bin/top/machine.c,v retrieving revision 1.86 diff -u -p -r1.86 machine.c --- usr.bin/top/machine.c 11 May 2016 08:11:27 - 1.86 +++ usr.bin/top/machine.c 11 May 2016 12:23:23 - @@ -390,29 +390,25 @@ cmd_matches(struct kinfo_proc *proc, cha extern int show_args; char**args = NULL; - if (!term) { - /* No command filter set */ + /* Filter set, process name needs to contain term */ + if (strstr(proc->p_comm, term)) return 1; - } else { - /* Filter set, process name needs to contain term */ - if (strstr(proc->p_comm, term)) - return 1; - /* If showing arguments, search those as well */ - if (show_args) { - args = get_proc_args(proc); + /* If showing arguments, search those as well */ + if (show_args) { + args = get_proc_args(proc); - if (args == NULL) { - /* Failed to get args, so can't search them */ - return 0; - } + if (args == NULL) { + /* Failed to get args, so can't search them */ + return 0; + } - while (*args != NULL) { - if (strstr(*args, term)) - return 1; - args++; - } + while (*args != NULL) { + if (strstr(*args, term)) + return 1; + args++; } } + return 0; } Index: usr.bin/top/screen.c === RCS file: /cvs/src/usr.bin/top/screen.c,v retrieving revision 1.20 diff -u -p -r1.20 screen.c --- usr.bin/top/screen.c5 Feb 2010 10:21:10 - 1.20 +++ usr.bin/top/screen.c11 May 2016 12:23:23 - @@ -116,11 +116,11 @@ init_termcap(int interactive) else screen_width -= 1; -/* get necessary capabilities */ -if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) { -smart_terminal = No; -return; -} + /* get necessary capabilities */ + if (tgetstr("cl", NULL) == NULL || tgetstr("cm", NULL) == NULL) { + smart_terminal = No; + return; + } /* get the actual screen size with an ioctl, if needed */ /* Index: usr.bin/top/top.h === RCS file: /cvs/src/usr.bin/top/top.h,v retrieving revision 1.15 diff -u -p -r1.15 top.h --- usr.bin/top/top.h 21 Sep 2013 14:15:19 - 1.15 +++ usr.bin/top/top.h 11 May 2016 12:23:23 - @@ -61,8 +61,8 @@ struct errs { /* structure for a system-call error */ -int err; /* value of errno (that is, the actual error) */ -char *arg; /* argument that caused the error */ + int err;/* value of errno (that is, the actual error) */ + char *arg; /* argument that caused the error */ }; extern struct errs errs[]; -- Michal Mazurek
tidy strstr.3
* add explicit RETURN VALUES section * add an EXAMPLES section, from NetBSD and FreeBSD * mention memmem(3) Index: lib/libc/string/strstr.3 === RCS file: /cvs/src/lib/libc/string/strstr.3,v retrieving revision 1.12 diff -u -p -r1.12 strstr.3 --- lib/libc/string/strstr.35 Jun 2013 03:39:23 - 1.12 +++ lib/libc/string/strstr.311 May 2016 08:35:56 - @@ -56,7 +56,7 @@ The function is similar to .Fn strstr but ignores the case of both strings. -.Pp +.Sh RETURN VALUES If .Fa little is an empty string, @@ -71,8 +71,23 @@ is returned; otherwise a pointer to the first character of the first occurrence of .Fa little is returned. +.Sh EXAMPLES +The following sets the pointer +.Va ptr +to the +.Qq Li Bar Baz +portion of +.Va largestring : +.Bd -literal -offset indent +const char *largestring = "Foo Bar Baz"; +const char *smallstring = "Bar"; +char *ptr; + +ptr = strstr(largestring, smallstring); +.Ed .Sh SEE ALSO .Xr memchr 3 , +.Xr memmem 3 , .Xr strchr 3 , .Xr strcspn 3 , .Xr strpbrk 3 , -- Michal Mazurek
vm.conf.5 - number of sections
It seems that there are only two sections. It looks like this mistake was introduced when copying a different .conf.5 file to use as a template. Index: usr.sbin/vmd/vm.conf.5 === RCS file: /cvs/src/usr.sbin/vmd/vm.conf.5,v retrieving revision 1.4 diff -u -p -r1.4 vm.conf.5 --- usr.sbin/vmd/vm.conf.5 7 Dec 2015 13:30:06 - 1.4 +++ usr.sbin/vmd/vm.conf.5 4 May 2016 12:16:23 - @@ -31,7 +31,7 @@ The VMM subsystem is responsible for cre executing VMs. .Sh SECTIONS .Nm -is divided into three main sections: +is divided into two main sections: .Bl -tag -width .It Sy Macros User-defined variables may be defined and used later, simplifying the -- Michal Mazurek
Re: document NOLOCK in syscalls.master
On 10:30:02, 7.04.16, Martin Natano wrote: > > * mention INDIR and NOLOCK in 'Fields'. > > How about something like "one of the types listed below, or one of the > compatibility options defined in syscalls.conf" instead? That's a better idea, included below but s/listed/described/. > > * sort the list of types in 'Fields'. > > * sort the list of types in 'types'. > > I think the order was more logical before (most used type first). I wanted to verify this statement: perl -ne 's/^(\d+\s+)// && s/\s+[{a-z4].*$// && print' kern/syscalls.master | perl -pse 's/\s+/\n/g' | sort | uniq -c | sort -nr 211 STD 59 OBSOL 31 UNIMPL 19 NOLOCK 2 INDIR It seems NODEF and NOARGS are never used, is this right? > > * place a dot ('.') at the end of each sentence. > > Bike-shedding: Those are not full sentences, but only fragments. There > doesn't have to be a dot at the end. I think it's better to have consistency, dot or not. Attached is a version without the unfortunate dots. On 14:57:02, 6.04.16, Mike Belopuhov wrote: > "NOLOCK the syscall doesn't grab any locks whatsoever" > is a poor description IMO. It should say it doesn't grab the > KERNEL_LOCK or biglock or something like that. "Any > locks whatsoever" is incorrect as there might be mutexes, > rwlocks, etc. How about this: NOLOCK don't acquire the kernel lock when calling this syscall. Index: sys/kern/syscalls.master === RCS file: /cvs/src/sys/kern/syscalls.master,v retrieving revision 1.169 diff -u -p -r1.169 syscalls.master --- sys/kern/syscalls.master30 Mar 2016 07:49:11 - 1.169 +++ sys/kern/syscalls.master2 May 2016 10:31:12 - @@ -8,17 +8,18 @@ ; ; Fields: number type [type-dependent ...] ; number system call number, must be in order -; typeone of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of -; the compatibility options defined in syscalls.conf. +; typeone of the types described below, or one of the compatibility +; options defined in syscalls.conf ; ; types: -; STD always included +; INDIR included, but don't define the syscall args structure, +; and allow it to be "really" varargs +; NOARGS included, but don't define the syscall args structure +; NODEF included, but don't define the syscall number +; NOLOCK don't acquire the kernel lock when calling this syscall ; OBSOL obsolete, not included in system +; STD always included ; UNIMPL unimplemented, not included in system -; NODEF included, but don't define the syscall number -; NOARGS included, but don't define the syscall args structure -; INDIR included, but don't define the syscall args structure, -; and allow it to be "really" varargs. ; ; The compat options are defined in the syscalls.conf file, and the ; compat option name is prefixed to the syscall name. Other than -- Michal Mazurek
Re: remove MPSAFE from makesyscalls.sh
On 10:22:58, 7.04.16, Martin Natano wrote: > On Wed, Apr 06, 2016 at 03:42:20PM +0200, Michal Mazurek wrote: > > MPSAFE is never used, and doesn't look like it's even supported (no > > matching SY_MPSAFE anywhere). > > SY_MPSAFE seems to be unused since it's introduction in 2007 and it > doesn't have any effect; ok natano@, if no one comes up with a reason to > keep this. Nearly a month later, nobody did come up with a reason to keep it. > > Index: sys/kern/makesyscalls.sh > > === > > RCS file: /cvs/src/sys/kern/makesyscalls.sh,v > > retrieving revision 1.11 > > diff -u -p -r1.11 makesyscalls.sh > > --- sys/kern/makesyscalls.sh27 Nov 2007 18:04:01 - 1.11 > > +++ sys/kern/makesyscalls.sh6 Apr 2016 12:53:28 - > > @@ -255,10 +255,6 @@ function parseline() { > > funcalias="" > > end=NF > > } > > - if ($f == "MPSAFE") { # allow MP-safe syscalls > > - sycall_flags = sprintf("SY_MPSAFE | %s", sycall_flags) > > - f++ > > - } > > if ($f == "NOLOCK") { # syscall does not need locks > > sycall_flags = sprintf("SY_NOLOCK | %s", sycall_flags) > > f++ > > Index: sys/sys/systm.h > > === > > RCS file: /cvs/src/sys/sys/systm.h,v > > retrieving revision 1.111 > > diff -u -p -r1.111 systm.h > > --- sys/sys/systm.h 24 Mar 2016 08:57:51 - 1.111 > > +++ sys/sys/systm.h 6 Apr 2016 12:53:28 - > > @@ -112,8 +112,7 @@ extern struct sysent { /* system call t > > sy_call_t *sy_call; /* implementing function */ > > } sysent[]; > > > > -#define SY_MPSAFE 0x01 > > -#define SY_NOLOCK 0x02 > > +#define SY_NOLOCK 0x01 > > > > #if_BYTE_ORDER == _BIG_ENDIAN > > #define SCARG(p, k)((p)->k.be.datum) /* get arg from args > > pointer */ > > > > -- > > Michal Mazurek > > > -- Michal Mazurek
Re: sys_process.c: remove relebad
On 10:13:06, 7.04.16, Martin Natano wrote: > On Wed, Apr 06, 2016 at 09:47:35AM +0200, Michal Mazurek wrote: > > relebad used to have more body: > > relebad: > > PRELE(t); > > return (error); > > But then PRELE(t); was removed. This diff gets rid of what remains of > > relebad. > > Looks good to me. I was told parens in 'return' are now to be eliminated, here is an updated diff: Index: sys_process.c === RCS file: /cvs/src/sys/kern/sys_process.c,v retrieving revision 1.68 diff -u -p -r1.68 sys_process.c --- sys_process.c 24 Sep 2015 20:35:18 - 1.68 +++ sys_process.c 9 Apr 2016 13:59:18 - @@ -454,7 +454,7 @@ sys_ptrace(struct proc *p, void *v, regi /* If the address parameter is not (int *)1, set the pc. */ if ((int *)SCARG(uap, addr) != (int *)1) if ((error = process_set_pc(t, SCARG(uap, addr))) != 0) - goto relebad; + return error; #ifdef PT_STEP /* @@ -462,7 +462,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, req == PT_STEP); if (error) - goto relebad; + return error; #endif goto sendsig; @@ -492,7 +492,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, 0); if (error) - goto relebad; + return error; #endif /* give process back to original parent or init */ @@ -522,9 +522,6 @@ sys_ptrace(struct proc *p, void *v, regi } return (0); - - relebad: - return (error); case PT_KILL: if (SCARG(uap, pid) < THREAD_PID_OFFSET && tr->ps_single) -- Michal Mazurek
tidy syscall_mi.h
Depending on the NOLOCK flag, the KERNEL_LOCK will, or will not be acquired before calling pledge_syscall(). I therefore conclude that KERNEL_LOCK is not needed to call pledge_syscall(). Also remove the goto. The code is simple enough to avoid it easily. I think this complexity was caused by some reshuffling during tame/pledge deployment. Index: sys/sys/syscall_mi.h === RCS file: /cvs/src/sys/sys/syscall_mi.h,v retrieving revision 1.15 diff -u -p -r1.15 syscall_mi.h --- sys/sys/syscall_mi.h3 Nov 2015 16:14:14 - 1.15 +++ sys/sys/syscall_mi.h7 Apr 2016 11:01:08 - @@ -69,29 +69,24 @@ mi_syscall(struct proc *p, register_t co } #endif - if (lock) - KERNEL_LOCK(); pledged = (p->p_p->ps_flags & PS_PLEDGE); if (pledged && (error = pledge_syscall(p, code, ))) { - if (!lock) - KERNEL_LOCK(); + KERNEL_LOCK(); error = pledge_fail(p, error, tval); KERNEL_UNLOCK(); return (error); } #if NSYSTRACE > 0 if (ISSET(p->p_flag, P_SYSTRACE)) { - if (!lock) - KERNEL_LOCK(); + KERNEL_LOCK(); error = systrace_redirect(code, p, argp, retval); - lock = 1; - goto done; + KERNEL_UNLOCK(); + return (error); } #endif + if (lock) + KERNEL_LOCK(); error = (*callp->sy_call)(p, argp, retval); -#if NSYSTRACE > 0 -done: -#endif if (lock) KERNEL_UNLOCK(); -- Michal Mazurek
remove MPSAFE from makesyscalls.sh
MPSAFE is never used, and doesn't look like it's even supported (no matching SY_MPSAFE anywhere). Index: sys/kern/makesyscalls.sh === RCS file: /cvs/src/sys/kern/makesyscalls.sh,v retrieving revision 1.11 diff -u -p -r1.11 makesyscalls.sh --- sys/kern/makesyscalls.sh27 Nov 2007 18:04:01 - 1.11 +++ sys/kern/makesyscalls.sh6 Apr 2016 12:53:28 - @@ -255,10 +255,6 @@ function parseline() { funcalias="" end=NF } - if ($f == "MPSAFE") { # allow MP-safe syscalls - sycall_flags = sprintf("SY_MPSAFE | %s", sycall_flags) - f++ - } if ($f == "NOLOCK") { # syscall does not need locks sycall_flags = sprintf("SY_NOLOCK | %s", sycall_flags) f++ Index: sys/sys/systm.h === RCS file: /cvs/src/sys/sys/systm.h,v retrieving revision 1.111 diff -u -p -r1.111 systm.h --- sys/sys/systm.h 24 Mar 2016 08:57:51 - 1.111 +++ sys/sys/systm.h 6 Apr 2016 12:53:28 - @@ -112,8 +112,7 @@ extern struct sysent { /* system call t sy_call_t *sy_call; /* implementing function */ } sysent[]; -#define SY_MPSAFE 0x01 -#define SY_NOLOCK 0x02 +#define SY_NOLOCK 0x01 #if_BYTE_ORDER == _BIG_ENDIAN #define SCARG(p, k)((p)->k.be.datum) /* get arg from args pointer */ -- Michal Mazurek
document NOLOCK in syscalls.master
* document NOLOCK - copy and paste from the commit message. * keep MPSAFE undocumented, as it is never used. * mention INDIR and NOLOCK in 'Fields'. * sort the list of types in 'Fields'. * sort the list of types in 'types'. * place a dot ('.') at the end of each sentence. Index: sys/kern/syscalls.master === RCS file: /cvs/src/sys/kern/syscalls.master,v retrieving revision 1.169 diff -u -p -r1.169 syscalls.master --- sys/kern/syscalls.master30 Mar 2016 07:49:11 - 1.169 +++ sys/kern/syscalls.master6 Apr 2016 12:40:27 - @@ -7,18 +7,19 @@ ; (See syscalls.conf to see what it is processed into.) ; ; Fields: number type [type-dependent ...] -; number system call number, must be in order -; typeone of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of -; the compatibility options defined in syscalls.conf. +; number system call number, must be in order. +; typeone of INDIR, NOARGS, NODEF, NOLOCK, OBSOL, STD, UNIMPL, or +; one of the compatibility options defined in syscalls.conf. ; ; types: -; STD always included -; OBSOL obsolete, not included in system -; UNIMPL unimplemented, not included in system -; NODEF included, but don't define the syscall number -; NOARGS included, but don't define the syscall args structure ; INDIR included, but don't define the syscall args structure, ; and allow it to be "really" varargs. +; NOARGS included, but don't define the syscall args structure. +; NODEF included, but don't define the syscall number. +; NOLOCK the syscall doesn't grab any locks whatsoever. +; OBSOL obsolete, not included in system. +; STD always included. +; UNIMPL unimplemented, not included in system. ; ; The compat options are defined in the syscalls.conf file, and the ; compat option name is prefixed to the syscall name. Other than -- Michal Mazurek
sys_process.c: remove relebad
relebad used to have more body: relebad: PRELE(t); return (error); But then PRELE(t); was removed. This diff gets rid of what remains of relebad. Index: sys/kern/sys_process.c === RCS file: /cvs/src/sys/kern/sys_process.c,v retrieving revision 1.68 diff -u -p -r1.68 sys_process.c --- sys/kern/sys_process.c 24 Sep 2015 20:35:18 - 1.68 +++ sys/kern/sys_process.c 4 Mar 2016 17:51:14 - @@ -454,7 +454,7 @@ sys_ptrace(struct proc *p, void *v, regi /* If the address parameter is not (int *)1, set the pc. */ if ((int *)SCARG(uap, addr) != (int *)1) if ((error = process_set_pc(t, SCARG(uap, addr))) != 0) - goto relebad; + return (error); #ifdef PT_STEP /* @@ -462,7 +462,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, req == PT_STEP); if (error) - goto relebad; + return (error); #endif goto sendsig; @@ -492,7 +492,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, 0); if (error) - goto relebad; + return (error); #endif /* give process back to original parent or init */ @@ -522,9 +522,6 @@ sys_ptrace(struct proc *p, void *v, regi } return (0); - - relebad: - return (error); case PT_KILL: if (SCARG(uap, pid) < THREAD_PID_OFFSET && tr->ps_single) -- Michal Mazurek
ps: remove emul support
It's all "native". Index: bin/ps/extern.h === RCS file: /cvs/src/bin/ps/extern.h,v retrieving revision 1.19 diff -u -p -r1.19 extern.h --- bin/ps/extern.h 10 Jan 2016 14:04:16 - 1.19 +++ bin/ps/extern.h 26 Mar 2016 07:37:47 - @@ -47,7 +47,6 @@ __BEGIN_DECLS voidcommand(const struct kinfo_proc *, VARENT *); voidcputime(const struct kinfo_proc *, VARENT *); int donlist(void); -voidemulname(const struct kinfo_proc *, VARENT *); double getpcpu(const struct kinfo_proc *); double getpmem(const struct kinfo_proc *); voidgname(const struct kinfo_proc *, VARENT *); Index: bin/ps/keyword.c === RCS file: /cvs/src/bin/ps/keyword.c,v retrieving revision 1.43 diff -u -p -r1.43 keyword.c --- bin/ps/keyword.c30 Dec 2015 14:59:10 - 1.43 +++ bin/ps/keyword.c26 Mar 2016 07:37:47 - @@ -100,7 +100,6 @@ VAR var[] = { {"cputime", "", "time"}, {"cwd", "CWD", NULL, LJUST, curwd, CWDLEN}, {"dsiz", "DSIZ", NULL, 0, dsize, 4}, - {"emul", "EMUL", NULL, LJUST, emulname, KI_EMULNAMELEN - 1}, {"etime", "ELAPSED", "start"}, {"f", "F", NULL, 0, pvar, 7, 0, POFF(p_flag), INT32, "x"}, {"flags", "", "f"}, Index: bin/ps/print.c === RCS file: /cvs/src/bin/ps/print.c,v retrieving revision 1.66 diff -u -p -r1.66 print.c --- bin/ps/print.c 10 Jan 2016 14:04:16 - 1.66 +++ bin/ps/print.c 26 Mar 2016 07:37:47 - @@ -672,13 +672,3 @@ pvar(const struct kinfo_proc *kp, VARENT else printval((char *)kp + v->off, v); } - -void -emulname(const struct kinfo_proc *kp, VARENT *ve) -{ - VAR *v; - - v = ve->var; - - (void)printf("%-*s", (int)v->width, kp->p_emul); -} Index: bin/ps/ps.1 === RCS file: /cvs/src/bin/ps/ps.1,v retrieving revision 1.104 diff -u -p -r1.104 ps.1 --- bin/ps/ps.1 17 Mar 2016 07:18:33 - 1.104 +++ bin/ps/ps.1 26 Mar 2016 07:37:47 - @@ -209,8 +209,6 @@ CPU ID (zero on single processor systems Current working directory. .It Cm dsiz Data size, in Kilobytes. -.It Cm emul -Name of system call emulation environment. .It Cm flags Alias: .Cm f . -- Michal Mazurek
Re: New scheduler for OpenBSD
On 09:22:18, 18.03.16, Chris Cappuccio wrote: > These are really rough observations. This box spawns lots of dirty > perl processes and also lots of fping processes for monitoring. The next step I had planned was related to juggling processes between cpus. Right now that code is untouched, other than removing a line related to priority. One idea is to compare the deadline of the last element on every queue, and balance based on that. Maybe this will improve this use case? The original diff contains commented out code (grep for CPU_INFO_ITERATOR) that prints out the queues every second. When running tests with it I sometimes observe one cpu is 0.5-1 second behind another, so I think this is a good next step for this scheduler. BFS has one shared queue for all CPUs, maybe there is a very good reason for that, we'll see. I'd like to thank everyone for all the feedback. -- Michal Mazurek
Re: New scheduler for OpenBSD
On 14:57:40, 15.03.16, Alexandre Ratchov wrote: > On Sat, Mar 12, 2016 at 05:36:21PM +0100, Michal Mazurek wrote: > > > > p_usrpri and p_priority will go away, so userland utilities like 'ps' > > will need to be changed. > > > > AFAIU, this would hurt interactive programs (audio, players, games, > etc). Currently i/o bound processes wake up with increased > priority and steal the cpu from cpu-bound processes. Removing > p_priority would break this mechanism. No, with the new scheduler a process gets assigned a 'deadline' - the value of an arbitrary monotonically increasing timer. If it runs out of ticks it gets a new deadline. The process with the smallest deadline gets to run. If a process goes to sleep, and then after a while wakes up, it will have a smaller deadline than the processes that were allwed to keep running (and thus kept getting new deadlines). It will therefore preempt other tasks. -- Michal Mazurek
Re: hexdump(1) - unneeded headers
This was sent during the freeze. On 14:13:40, 8.02.16, Michal Mazurek wrote: > These headers appear to be unneeded: > > Index: conv.c > === > RCS file: /cvs/src/usr.bin/hexdump/conv.c,v > retrieving revision 1.10 > diff -u -p -r1.10 conv.c > --- conv.c19 Apr 2014 09:28:20 - 1.10 > +++ conv.c8 Feb 2016 12:59:43 - > @@ -30,10 +30,8 @@ > * SUCH DAMAGE. > */ > > -#include > - > -#include > #include > +#include > > #include "hexdump.h" > > Index: display.c > === > RCS file: /cvs/src/usr.bin/hexdump/display.c,v > retrieving revision 1.21 > diff -u -p -r1.21 display.c > --- display.c 16 Jan 2015 06:40:08 - 1.21 > +++ display.c 8 Feb 2016 12:59:43 - > @@ -34,11 +34,9 @@ > > #include > #include > -#include > #include > #include > #include > -#include > > #include "hexdump.h" > > Index: hexdump.c > === > RCS file: /cvs/src/usr.bin/hexdump/hexdump.c,v > retrieving revision 1.19 > diff -u -p -r1.19 hexdump.c > --- hexdump.c 9 Oct 2015 01:37:07 - 1.19 > +++ hexdump.c 8 Feb 2016 12:59:43 - > @@ -31,10 +31,10 @@ > */ > > #include > -#include > #include > -#include > #include > +#include > + > #include "hexdump.h" > > #define MINIMUM(a, b)(((a) < (b)) ? (a) : (b)) > Index: hexsyntax.c > === > RCS file: /cvs/src/usr.bin/hexdump/hexsyntax.c,v > retrieving revision 1.12 > diff -u -p -r1.12 hexsyntax.c > --- hexsyntax.c 6 May 2011 15:46:29 - 1.12 > +++ hexsyntax.c 8 Feb 2016 12:59:43 - > @@ -30,13 +30,10 @@ > * SUCH DAMAGE. > */ > > -#include > - > #include > #include > #include > #include > -#include > #include > > #include "hexdump.h" > Index: odsyntax.c > === > RCS file: /cvs/src/usr.bin/hexdump/odsyntax.c,v > retrieving revision 1.26 > diff -u -p -r1.26 odsyntax.c > --- odsyntax.c16 Sep 2015 08:47:26 - 1.26 > +++ odsyntax.c8 Feb 2016 12:59:43 - > @@ -30,8 +30,6 @@ > * SUCH DAMAGE. > */ > > -#include > - > #include > #include > #include > Index: parse.c > === > RCS file: /cvs/src/usr.bin/hexdump/parse.c,v > retrieving revision 1.17 > diff -u -p -r1.17 parse.c > --- parse.c 27 Oct 2009 23:59:39 - 1.17 > +++ parse.c 8 Feb 2016 12:59:43 - > @@ -30,13 +30,8 @@ > * SUCH DAMAGE. > */ > > -#include > -#include > - > #include > #include > -#include > -#include > #include > #include > #include > > -- > Michal Mazurek -- Michal Mazurek
Re: hexdump(1) - tidy declarations
This was sent during the freeze. On 15:04:28, 8.02.16, Michal Mazurek wrote: > Move some declarations out of hexdump.h > Mark some declarations as __dead or static > Remove a commented out declaration > Convert some spaces to tabs > > Index: display.c > === > RCS file: /cvs/src/usr.bin/hexdump/display.c,v > retrieving revision 1.21 > diff -u -p -r1.21 display.c > --- display.c 16 Jan 2015 06:40:08 - 1.21 > +++ display.c 8 Feb 2016 13:56:10 - > @@ -49,7 +49,10 @@ enum _vflag vflag = FIRST; > static off_t address;/* address/offset in stream */ > static off_t eaddress; /* end address */ > > -static __inline void print(PR *, u_char *); > +static void bpad(PR *); > +static void doskip(const char *, int); > +static __inline void print(PR *, u_char *); > +static u_char*get(void); > > void > display(void) > @@ -196,7 +199,7 @@ print(PR *pr, u_char *bp) > } > } > > -void > +static void > bpad(PR *pr) > { > static const char *spec = " -0+#"; > @@ -216,7 +219,7 @@ bpad(PR *pr) > > static char **_argv; > > -u_char * > +static u_char * > get(void) > { > static int ateof = 1; > @@ -319,7 +322,7 @@ next(char **argv) > /* NOTREACHED */ > } > > -void > +static void > doskip(const char *fname, int statok) > { > off_t cnt; > Index: hexdump.h > === > RCS file: /cvs/src/usr.bin/hexdump/hexdump.h,v > retrieving revision 1.10 > diff -u -p -r1.10 hexdump.h > --- hexdump.h 19 Apr 2014 09:28:20 - 1.10 > +++ hexdump.h 8 Feb 2016 13:56:10 - > @@ -78,30 +78,19 @@ extern int exitval; /* final exit > valu > extern FS *fshead; /* head of format strings list */ > extern long length; /* max bytes to read */ > extern off_t skip; /* bytes to skip */ > -extern char *iobuf;/* stdio I/O buffer */ > -extern size_t iobufsiz;/* size of stdio I/O buffer */ > +extern char *iobuf; /* stdio I/O buffer */ > +extern size_t iobufsiz; /* size of stdio I/O buffer */ > extern enum _vflag vflag; > > void add(const char *); > void addfile(char *); > -void badcnt(char *); > -void badconv(char *); > -void badfmt(const char *); > -void badsfmt(void); > -void bpad(PR *); > void conv_c(PR *, u_char *); > void conv_u(PR *, u_char *); > void display(void); > -void doskip(const char *, int); > -/*voiderr(const char *, ...);*/ > void *emalloc(int); > -void escape(char *); > -u_char *get(void); > void newsyntax(int, char ***); > int next(char **); > void nomem(void); > void oldsyntax(int, char ***); > void rewrite(FS *); > int size(FS *); > -void usage(void); > -void oldusage(void); > Index: hexsyntax.c > === > RCS file: /cvs/src/usr.bin/hexdump/hexsyntax.c,v > retrieving revision 1.12 > diff -u -p -r1.12 hexsyntax.c > --- hexsyntax.c 6 May 2011 15:46:29 - 1.12 > +++ hexsyntax.c 8 Feb 2016 13:56:10 - > @@ -43,6 +43,8 @@ > > off_t skip; /* bytes to skip */ > > +static __dead voidusage(void); > + > void > newsyntax(int argc, char ***argvp) > { > @@ -121,7 +123,7 @@ newsyntax(int argc, char ***argvp) > *argvp += optind; > } > > -void > +static __dead void > usage(void) > { > extern char *__progname; > Index: odsyntax.c > === > RCS file: /cvs/src/usr.bin/hexdump/odsyntax.c,v > retrieving revision 1.26 > diff -u -p -r1.26 odsyntax.c > --- odsyntax.c16 Sep 2015 08:47:26 - 1.26 > +++ odsyntax.c8 Feb 2016 13:56:10 - > @@ -44,10 +44,10 @@ > > int odmode; > > -static void odoffset(int, char ***); > -static void posixtypes(char *); > -static void odadd(const char *); > - > +static void odadd(const char *); > +static void odoffset(int, char ***); > +static __dead voidoldusage(void); > +static void posixtypes(char *); > > /* > * formats used for -t > @@ -293,7 +293,7 @@ posixtypes(char *type_string) > } > } > > -void > +static __dead void > oldusage(void) > { > extern char *__progname; > Index: parse.c >
Re: New scheduler for OpenBSD
On 16:35:49, 13.03.16, Martin Pieuchot wrote: > On 12/03/16(Sat) 17:36, Michal Mazurek wrote: > > [...] > > Some notes: > > > > Chrome is still not very usable. > > Are you wanting to improve the browser experience on OpenBSD? If that's > your goal then I'd suggest you to start by analysing how the browsers > behave. My personal analysis makes me believe that librthread is what > needs some love. It seems you were right, see my other email. > > p_usrpri and p_priority will go away, so userland utilities like 'ps' > > will need to be changed. > > So what's your plan for process priorities? > ... > "improve performance" does not say much. For which workload on which > machine? There's maybe room for improvement in this area, but you > really need more than "building a kernel" as test bed. Replace them with "deadlines", to achieve "fair" scheduling. This should provide superior scheduling for interactive applications. We'll see :) > > - if (--ci->ci_schedstate.spc_rrticks <= 0) > > + if (p && (--(p->p_rrticks) <= 0)) > > roundrobin(ci); > > That's an interesting change. Why did you decide to move a per-CPU > counter to a per-process one? Can you explain the effect it will have? > Or even better can you measure its effect on different workloads? That's the supposedly genious idea behind BFS. An interactive process can yield, and let batch processes do their work. Then when it's time to process cursor movement, it will come back with the best priority, but with used up p_rrticks to prevent abuse. We'll see... Perhaps it should be operated on as an element of the ci_schedstate structure, similar to how spc_curpriority is a copy of p_piority now, and copied to/from proc during context switches? I don't know yet. > > - SCHED_ASSERT_LOCKED(); > > + nanouptime(); > > + niffies = now.tv_sec * (1000 * 1000 * 1000) + now.tv_nsec; > > Can you explain how you chose this period of time and what it is > supposed to represent? These are niffies, like jiffies but nanoseconds. A high precision monotinically increasing counter. The value itself isn't really important. Some multipliers for 'nice' offsets will need to be chosen though. > > @@ -509,56 +457,8 @@ setrunnable(struct proc *p) > > p->p_stat = SRUN; > > p->p_cpu = sched_choosecpu(p); > > setrunqueue(p); > > - if (p->p_slptime > 1) > > - updatepri(p); > > What's happening to p_slptime? It's not needed for the new scheduler. The 4BSD scheduler does stuff to the priorities based on how many seconds a process has been sleeping. -- Michal Mazurek
Re: New scheduler for OpenBSD
On 04:41:05, 13.03.16, Juan Francisco Cantero Hurtado wrote: > Here are the commands: > ... > ffmpeg > ... Thank you for this. ffmpeg runs differently from gcc or make - it creates a lot of threads. I can verify that it is indeed slower. Instead of spending 2 seconds in 'system' it takes 30 or 40 seconds on the new scheduler. After some tests I realised that ffmpeg, when running on the present BSD scheduler, will call sys_sched_yield() 321,068 times. When running on the new scheduler, it will call sys_sched_yield() 2,507,894 times - nearly ten times that. The bulk of the calls are made from this function: lib/librthread/rthread.c: void _spinlock(volatile struct _spinlock *lock) { while (_atomic_lock(>ticket)) sched_yield(); } To verify I replaced sched_yield() with usleep(): void _spinlock(volatile struct _spinlock *lock) { while (_atomic_lock(>ticket)) usleep(1); } The number of calls to yield() dropped to 4,576. I had a look how the Linux BFS scheduler solves this problem, and I saw this: /** * yield - yield the current processor to other threads. * * Do not ever use this function, there's a 99% chance you're doing it wrong. * * The scheduler is at all times free to pick the calling task as the most * eligible task to run, if removing the yield() call from your code breaks * it, its already broken. * * Typical broken usage is: * * while (!event) * yield(); * * where one assumes that yield() will let 'the other' process run that will * make event true. If the current task is a SCHED_FIFO task that will never * happen. Never use yield() as a progress guarantee!! * * If you want to use yield() to wait for something, use wait_event(). * If you want to use yield() to be 'nice' for others, use cond_resched(). * If you still want to use yield(), do not! */ void __sched yield(void) { set_current_state(TASK_RUNNING); sys_sched_yield(); } EXPORT_SYMBOL(yield); This is where I get stuck, I don't know how to replace the call to sched_yield(), or whether it is a good idea to do so. Any advice? -- Michal Mazurek
queue.3, tree.3 - SEE ALSO
Refer to tree.3 from queue.3, and the other way around. Index: share/man/man3/queue.3 === RCS file: /cvs/src/share/man/man3/queue.3,v retrieving revision 1.63 diff -u -p -r1.63 queue.3 --- share/man/man3/queue.3 19 Nov 2015 13:38:07 - 1.63 +++ share/man/man3/queue.3 13 Mar 2016 09:57:24 - @@ -918,6 +918,8 @@ while ((np = TAILQ_FIRST())) { } .Ed +.Sh SEE ALSO +.Xr tree 3 .Sh NOTES It is an error to assume the next and previous fields are preserved after an element has been removed from a list or queue. Index: share/man/man3/tree.3 === RCS file: /cvs/src/share/man/man3/tree.3,v retrieving revision 1.27 diff -u -p -r1.27 tree.3 --- share/man/man3/tree.3 10 Nov 2015 23:48:17 - 1.27 +++ share/man/man3/tree.3 13 Mar 2016 09:57:24 - @@ -549,6 +549,8 @@ main() return (0); } .Ed +.Sh SEE ALSO +.Xr queue 3 .Sh NOTES Trying to free a tree in the following way is a common error: .Bd -literal -offset indent -- Michal Mazurek
New scheduler for OpenBSD
oc(struct proc *p, u_char pri) * sched state, which we currently do not do. */ ci = (p->p_cpu != NULL) ? p->p_cpu : curcpu(); - if (pri < ci->ci_schedstate.spc_curpriority) + if (ci->ci_curproc && p->p_deadline < ci->ci_curproc->p_deadline) need_resched(ci); } @@ -509,56 +457,8 @@ setrunnable(struct proc *p) p->p_stat = SRUN; p->p_cpu = sched_choosecpu(p); setrunqueue(p); - if (p->p_slptime > 1) - updatepri(p); p->p_slptime = 0; resched_proc(p, p->p_priority); -} - -/* - * Compute the priority of a process when running in user mode. - * Arrange to reschedule if the resulting priority is better - * than that of the current process. - */ -void -resetpriority(struct proc *p) -{ - unsigned int newpriority; - - SCHED_ASSERT_LOCKED(); - - newpriority = PUSER + p->p_estcpu + - NICE_WEIGHT * (p->p_p->ps_nice - NZERO); - newpriority = min(newpriority, MAXPRI); - p->p_usrpri = newpriority; - resched_proc(p, p->p_usrpri); -} - -/* - * We adjust the priority of the current process. The priority of a process - * gets worse as it accumulates CPU time. The cpu usage estimator (p_estcpu) - * is increased here. The formula for computing priorities (in kern_synch.c) - * will compute a different value each time p_estcpu increases. This can - * cause a switch, but unless the priority crosses a PPQ boundary the actual - * queue will not change. The cpu usage estimator ramps up quite quickly - * when the process is running (linearly), and decays away exponentially, at - * a rate which is proportionally slower when the system is busy. The basic - * principle is that the system will 90% forget that the process used a lot - * of CPU time in 5 * loadav seconds. This causes the system to favor - * processes which haven't run much recently, and to round-robin among other - * processes. - */ -void -schedclock(struct proc *p) -{ - int s; - - SCHED_LOCK(s); - p->p_estcpu = ESTCPULIM(p->p_estcpu + 1); - resetpriority(p); - if (p->p_priority >= PUSER) - p->p_priority = p->p_usrpri; - SCHED_UNLOCK(s); } void (*cpu_setperf)(int); Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.217 diff -u -p -r1.217 proc.h --- sys/sys/proc.h 9 Mar 2016 13:38:50 - 1.217 +++ sys/sys/proc.h 12 Mar 2016 15:48:37 - @@ -44,6 +44,7 @@ #include/* For struct selinfo */ #include /* For LOGIN_NAME_MAX */ #include +#include #include/* For struct timeout */ #include /* For struct klist */ #include /* For struct mutex */ @@ -267,6 +268,7 @@ struct process { struct proc { TAILQ_ENTRY(proc) p_runq; + RB_ENTRY(proc) p_runq2; LIST_ENTRY(proc) p_list;/* List of all threads. */ struct process *p_p; /* The process of this thread. */ @@ -320,6 +322,8 @@ struct proc { /* The following fields are all copied upon creation in fork. */ #definep_startcopy p_sigmask + u_int64_t p_deadline; + int p_rrticks; sigset_t p_sigmask; /* Current signal mask. */ u_char p_priority; /* Process priority. */ @@ -488,6 +492,7 @@ voidfixjobc(struct process *, struct pg intinferior(struct process *, struct process *); void leavepgrp(struct process *); void preempt(struct proc *); +void sched_deadline(struct proc *); void pgdelete(struct pgrp *); void procinit(void); void resetpriority(struct proc *); @@ -570,4 +575,3 @@ struct cpu_info *cpuset_first(struct cpu #endif /* _KERNEL */ #endif /* !_SYS_PROC_H_ */ - Index: sys/sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.40 diff -u -p -r1.40 sched.h --- sys/sys/sched.h 9 Mar 2016 13:38:50 - 1.40 +++ sys/sys/sched.h 12 Mar 2016 15:48:37 - @@ -70,6 +70,7 @@ #define_SYS_SCHED_H_ #include +#include /* * Posix defines a which may want to include @@ -99,6 +100,7 @@ struct schedstate_percpu { u_int spc_schedticks; /* ticks for schedclock() */ u_int64_t spc_cp_time[CPUSTATES]; /* CPU state statistics */ u_char spc_curpriority; /* usrpri of curproc */ + u_int64_t spc_curdeadline; int spc_rrticks;/* ticks until roundrobin() */ int spc_pscnt; /* prof/stat counter */ int spc_psdiv; /* prof/stat divisor */ @@ -109,6 +111,8 @@ struct schedstate_percpu { TAILQ_HEAD(prochead, proc) spc_qs[SCHED_NQS]; volatile uint32_t spc_whichqs; + + RB_HEAD(prochead2, proc) spc_rq; #ifdef notyet struct proc *spc_reaper;/* dead proc reaper */ -- Michal Mazurek
scheduler: abstract away spc_whichqs
spc_whichqs is an implementation specific variable of the bsd scheduler. Abstract it away, easing potential future rewrite. This gets rid of curcpu_is_idle() that's used only once, and replaces it with a more general cpu_is_idle(curcpu()). As far as I can tell no binary change. Index: sys/arch/amd64/amd64/cpu.c === RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v retrieving revision 1.95 diff -u -p -r1.95 cpu.c --- sys/arch/amd64/amd64/cpu.c 3 Feb 2016 03:25:07 - 1.95 +++ sys/arch/amd64/amd64/cpu.c 11 Mar 2016 15:19:41 - @@ -253,7 +253,7 @@ cpu_idle_mwait_cycle(void) panic("idle with interrupts blocked!"); /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -267,7 +267,7 @@ cpu_idle_mwait_cycle(void) * the check in sched_idle() and here. */ atomic_setbits_int(>ci_mwait, MWAIT_IDLING | MWAIT_ONLY); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { monitor(>ci_mwait, 0, 0); if ((ci->ci_mwait & MWAIT_IDLING) == MWAIT_IDLING) mwait(0, 0); Index: sys/arch/i386/i386/cpu.c === RCS file: /cvs/src/sys/arch/i386/i386/cpu.c,v retrieving revision 1.72 diff -u -p -r1.72 cpu.c --- sys/arch/i386/i386/cpu.c7 Mar 2016 05:32:46 - 1.72 +++ sys/arch/i386/i386/cpu.c11 Mar 2016 15:19:41 - @@ -755,7 +755,7 @@ cpu_idle_mwait_cycle(void) panic("idle with interrupts blocked!"); /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -769,7 +769,7 @@ cpu_idle_mwait_cycle(void) * the check in sched_idle() and here. */ atomic_setbits_int(>ci_mwait, MWAIT_IDLING | MWAIT_ONLY); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { monitor(>ci_mwait, 0, 0); if ((ci->ci_mwait & MWAIT_IDLING) == MWAIT_IDLING) mwait(0, 0); Index: sys/dev/acpi/acpicpu.c === RCS file: /cvs/src/sys/dev/acpi/acpicpu.c,v retrieving revision 1.72 diff -u -p -r1.72 acpicpu.c --- sys/dev/acpi/acpicpu.c 29 Dec 2015 04:46:28 - 1.72 +++ sys/dev/acpi/acpicpu.c 11 Mar 2016 15:19:42 - @@ -1188,7 +1188,7 @@ acpicpu_idle(void) #endif /* something already queued? */ - if (ci->ci_schedstate.spc_whichqs != 0) + if (!cpu_is_idle(ci)) return; /* @@ -1204,7 +1204,7 @@ acpicpu_idle(void) hints = (unsigned)best->address; microuptime(); atomic_setbits_int(>ci_mwait, MWAIT_IDLING); - if (ci->ci_schedstate.spc_whichqs == 0) { + if (cpu_is_idle(ci)) { /* intel errata AAI65: cflush before monitor */ if (ci->ci_cflushsz != 0) { membar_sync(); Index: sys/kern/kern_sched.c === RCS file: /cvs/src/sys/kern/kern_sched.c,v retrieving revision 1.41 diff -u -p -r1.41 kern_sched.c --- sys/kern/kern_sched.c 23 Dec 2015 14:51:17 - 1.41 +++ sys/kern/kern_sched.c 11 Mar 2016 15:19:42 - @@ -148,7 +148,7 @@ sched_idle(void *v) KASSERT(curproc == spc->spc_idleproc); while (1) { - while (!curcpu_is_idle()) { + while (!cpu_is_idle(curcpu())) { struct proc *dead; SCHED_LOCK(s); Index: sys/sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.40 diff -u -p -r1.40 sched.h --- sys/sys/sched.h 9 Mar 2016 13:38:50 - 1.40 +++ sys/sys/sched.h 11 Mar 2016 15:19:42 - @@ -163,7 +163,7 @@ void sched_start_secondary_cpus(void); void sched_stop_secondary_cpus(void); #endif -#define curcpu_is_idle() (curcpu()->ci_schedstate.spc_whichqs == 0) +#define cpu_is_idle(ci)((ci)->ci_schedstate.spc_whichqs == 0) void sched_init_runqueues(void); void setrunqueue(struct proc *); -- Michal Mazurek
Re: update comment about p_usrpri
On 09:42:32, 9.03.16, Michal Mazurek wrote: > On 22:47:08, 8.03.16, Martin Pieuchot wrote: > > On 08/03/16(Tue) 10:01, Michal Mazurek wrote: > > > p_cpu exists, but p_usrpri isn't based on it. > > > > Michal I lost track of all your comment fixes. One of the accepted > > rules when we read code is that comments are always lying. So I doubt > > anyone will object fixing them. > > > > Could you send a single diff with all your non-committed fixes? Sorry, I forgot one: Index: sys/sys/sysctl.h === RCS file: /cvs/src/sys/sys/sysctl.h,v retrieving revision 1.158 diff -u -p -r1.158 sysctl.h --- sys/sys/sysctl.h29 Feb 2016 19:44:07 - 1.158 +++ sys/sys/sysctl.h9 Mar 2016 15:41:04 - @@ -377,7 +377,7 @@ struct kinfo_proc { int8_t p_stat; /* CHAR: S* process status (from LWP). */ u_int8_t p_priority;/* U_CHAR: Process priority. */ - u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_cpu and ps_nice. */ + u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_estcpu and ps_nice. */ u_int8_t p_nice;/* U_CHAR: Process "nice" value. */ u_int16_t p_xstat; /* U_SHORT: Exit status for wait; also stop signal. */ -- Michal Mazurek
Re: update comment about p_usrpri
On 22:47:08, 8.03.16, Martin Pieuchot wrote: > On 08/03/16(Tue) 10:01, Michal Mazurek wrote: > > p_cpu exists, but p_usrpri isn't based on it. > > Michal I lost track of all your comment fixes. One of the accepted > rules when we read code is that comments are always lying. So I doubt > anyone will object fixing them. > > Could you send a single diff with all your non-committed fixes? Here is what I have. Index: sys/sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.39 diff -u -p -r1.39 sched.h --- sys/sys/sched.h 13 Sep 2015 11:15:11 - 1.39 +++ sys/sys/sched.h 9 Mar 2016 08:34:19 - @@ -139,7 +139,6 @@ void schedclock(struct proc *); struct cpu_info; void roundrobin(struct cpu_info *); void scheduler_start(void); -void updatepri(struct proc *); void userret(struct proc *p); void sched_init_cpu(struct cpu_info *); Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.216 diff -u -p -r1.216 proc.h --- sys/sys/proc.h 6 Mar 2016 05:20:26 - 1.216 +++ sys/sys/proc.h 9 Mar 2016 08:34:19 - @@ -323,7 +323,7 @@ struct proc { sigset_t p_sigmask; /* Current signal mask. */ u_char p_priority; /* Process priority. */ - u_char p_usrpri; /* User-priority based on p_cpu and ps_nice. */ + u_char p_usrpri; /* User-priority based on p_estcpu and ps_nice. */ charp_comm[MAXCOMLEN+1]; int p_pledge_syscall; /* Cache of current syscall */ Index: sys/kern/kern_synch.c === RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.128 diff -u -p -r1.128 kern_synch.c --- sys/kern/kern_synch.c 1 Feb 2016 23:34:31 - 1.128 +++ sys/kern/kern_synch.c 9 Mar 2016 08:34:19 - @@ -59,7 +59,7 @@ #endif intthrsleep(struct proc *, struct sys___thrsleep_args *); - +intthrsleep_unlock(void *, int); /* * We're only looking at 7 bits of the address; everything is @@ -436,7 +436,6 @@ sys_sched_yield(struct proc *p, void *v, return (0); } -int thrsleep_unlock(void *, int); int thrsleep_unlock(void *lock, int lockflags) { Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c9 Mar 2016 08:34:19 - @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +voidschedcpu(void *); +voidupdatepri(struct proc *); void scheduler_start(void) @@ -70,10 +71,9 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. -* We setup the timeouts here and kick schedcpu and roundrobin once to -* make them do their job. +* We setup the timeout here and kick schedcpu once to make it do +* its job. */ - timeout_set(_to, schedcpu, _to); rrticks_init = hz / 10; @@ -218,9 +218,7 @@ schedcpu(void *arg) LIST_FOREACH(p, , p_list) { /* -* Increment time in/out of memory and sleep time -* (if sleeping). We ignore overflow; with 16-bit int's -* (remember them?) overflow takes 45 days. +* Increment sleep time (if sleeping). We ignore overflow. */ if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; @@ -233,7 +231,7 @@ schedcpu(void *arg) continue; SCHED_LOCK(s); /* -* p_pctcpu is only for ps. +* p_pctcpu is only for diagnostic tools such as ps. */ #if(FSHIFT >= CCPU_SHIFT) p->p_pctcpu += (phz == 100)? @@ -550,7 +548,6 @@ resetpriority(struct proc *p) * processes which haven't run much recently, and to round-robin among other * processes. */ - void schedclock(struct proc *p) { @@ -715,4 +712,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - Index: sys/kern/kern_sig.c === RCS file: /cvs/src/sys/kern/kern_sig.c,v retrieving revision 1.192 diff -u -p -r1.192 kern_sig.c --- sys/kern/kern_sig.c 9 Jan 2016 06:13:43 - 1.192 +++ sys/kern/kern_sig.c 9 Mar 2016 08:34:19 - @@ -896,7 +896,7 @@ ptsignal(struct proc *p, int signum, enu panic("psignal signal number"); #endif - /* Ignore signal if we a
update comment about p_usrpri
p_cpu exists, but p_usrpri isn't based on it. Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.216 diff -u -p -r1.216 proc.h --- sys/sys/proc.h 6 Mar 2016 05:20:26 - 1.216 +++ sys/sys/proc.h 8 Mar 2016 08:52:58 - @@ -323,7 +323,7 @@ struct proc { sigset_t p_sigmask; /* Current signal mask. */ u_char p_priority; /* Process priority. */ - u_char p_usrpri; /* User-priority based on p_cpu and ps_nice. */ + u_char p_usrpri; /* User-priority based on p_estcpu and ps_nice. */ charp_comm[MAXCOMLEN+1]; int p_pledge_syscall; /* Cache of current syscall */ Index: sys/sys/sysctl.h === RCS file: /cvs/src/sys/sys/sysctl.h,v retrieving revision 1.158 diff -u -p -r1.158 sysctl.h --- sys/sys/sysctl.h29 Feb 2016 19:44:07 - 1.158 +++ sys/sys/sysctl.h8 Mar 2016 08:52:58 - @@ -377,7 +377,7 @@ struct kinfo_proc { int8_t p_stat; /* CHAR: S* process status (from LWP). */ u_int8_t p_priority;/* U_CHAR: Process priority. */ - u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_cpu and ps_nice. */ + u_int8_t p_usrpri; /* U_CHAR: User-priority based on p_estcpu and ps_nice. */ u_int8_t p_nice;/* U_CHAR: Process "nice" value. */ u_int16_t p_xstat; /* U_SHORT: Exit status for wait; also stop signal. */ -- Michal Mazurek
sched_bsd.c: update comment about p_pctcpu
It's also used in top, systat, and tty status (^T). Index: sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sched_bsd.c 8 Nov 2015 20:45:57 - 1.42 +++ sched_bsd.c 7 Mar 2016 17:44:30 - @@ -233,7 +233,7 @@ schedcpu(void *arg) continue; SCHED_LOCK(s); /* -* p_pctcpu is only for ps. +* p_pctcpu is only for diagnostic tools such as ps. */ #if(FSHIFT >= CCPU_SHIFT) p->p_pctcpu += (phz == 100)? -- Michal Mazurek
sched_bsd.c: update comment
Some time ago p_swptime was removed: - p->p_swtime++; if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; But the comment still mentions it. What type p_swtime had and how someone concluded it overflows in 45 days I do not know. p_slptime is a u_int, so if incremented once a second an overflow will occur every 136 years. Also add a declaration for updatepri() and remove a trailing empty line. Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c7 Mar 2016 17:15:27 - @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +voidschedcpu(void *); +voidupdatepri(struct proc *); void scheduler_start(void) @@ -218,9 +219,7 @@ schedcpu(void *arg) LIST_FOREACH(p, , p_list) { /* -* Increment time in/out of memory and sleep time -* (if sleeping). We ignore overflow; with 16-bit int's -* (remember them?) overflow takes 45 days. +* Increment sleep time (if sleeping). We ignore overflow. */ if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; @@ -715,4 +714,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - -- Michal Mazurek
Re: proc.h: update PID_MAX after sys/compat is gone
On 11:32:04, 5.03.16, Philip Guenther wrote: > On Sat, Mar 5, 2016 at 8:10 AM, Michal Mazurek <akf...@jasminek.net> wrote: > > sys/compat is gone. I don't know if PID_MAX can or should be increased, > > but I don't think the comment is now useful. > > I think we can go a bit further now and include PID_MAX to 9 (to > keep it in 5 columns). > > ok? > > Philip Guenther > > Index: proc.h > === > RCS file: /data/src/openbsd/src/sys/sys/proc.h,v > retrieving revision 1.214 > diff -u -p -r1.214 proc.h > --- proc.h 4 Mar 2016 14:08:55 - 1.214 > +++ proc.h 5 Mar 2016 19:30:27 - > @@ -409,9 +409,9 @@ struct uidinfo *uid_find(uid_t); > /* > * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, > * as it is used to represent "no process group". > - * We set PID_MAX to (SHRT_MAX - 1) so we don't break sys/compat. > + * We set PID_MAX to 9 to keep it in 5 columns in ps > */ > -#definePID_MAX 32766 > +#definePID_MAX 9 > #defineNO_PID (PID_MAX+1) > > #define SESS_LEADER(pr)((pr)->ps_session->s_leader == (pr)) > intro.2 needs updating as well: Index: lib/libc/sys/intro.2 === RCS file: /cvs/src/lib/libc/sys/intro.2,v retrieving revision 1.62 diff -u -p -r1.62 intro.2 --- lib/libc/sys/intro.21 Dec 2015 01:34:16 - 1.62 +++ lib/libc/sys/intro.26 Mar 2016 14:56:19 - @@ -434,7 +434,7 @@ and root directory and current working d .It Process ID Each active process in the system is uniquely identified by a non-negative integer called a process ID. -The range of this ID is from 1 to 32766. +The range of this ID is from 1 to 99999. .It Parent Process ID A new process is created by a currently active process; (see .Xr fork 2 ) . -- Michal Mazurek
proc.h: update PID_MAX after sys/compat is gone
sys/compat is gone. I don't know if PID_MAX can or should be increased, but I don't think the comment is now useful. Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.214 diff -u -p -r1.214 proc.h --- sys/sys/proc.h 4 Mar 2016 14:08:55 - 1.214 +++ sys/sys/proc.h 5 Mar 2016 16:05:06 - @@ -409,7 +409,7 @@ struct uidinfo *uid_find(uid_t); /* * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, * as it is used to represent "no process group". - * We set PID_MAX to (SHRT_MAX - 1) so we don't break sys/compat. + * We set PID_MAX to (SHRT_MAX - 1) for historical reasons. */ #definePID_MAX 32766 #defineNO_PID (PID_MAX+1) -- Michal Mazurek
Re: sched_bsd.c update comment
On 16:20:11, 1.03.16, Michal Mazurek wrote: > > Index: sys/kern/sched_bsd.c > === > RCS file: /cvs/src/sys/kern/sched_bsd.c,v > retrieving revision 1.42 > diff -u -p -r1.42 sched_bsd.c > --- sys/kern/sched_bsd.c 8 Nov 2015 20:45:57 - 1.42 > +++ sys/kern/sched_bsd.c 1 Mar 2016 15:19:24 - > @@ -70,8 +70,8 @@ scheduler_start(void) > /* >* We avoid polluting the global namespace by keeping the scheduler >* timeouts static in this function. > - * We setup the timeouts here and kick schedcpu and roundrobin once to > - * make them do their job. > + * We setup the timeouts here and kick schedcpu once to make it do > + * its job. >*/ > > timeout_set(_to, schedcpu, _to); The reason I'm proposing this change is because there used to be a call to roundrobin() in this function before, but then it went away: @@ -93,16 +81,9 @@ scheduler_start(void) * make them do their job. */ -#ifndef __HAVE_CPUINFO - timeout_set(_to, roundrobin, _to); -#endif timeout_set(_to, schedcpu, _to); -#ifdef __HAVE_CPUINFO rrticks_init = hz / 10; -#else - roundrobin(_to); -#endif schedcpu(_to); } Move a function declaration and remove an endline from the very end of the file while here: Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c5 Mar 2016 09:01:56 - @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +voidschedcpu(void *); +voidupdatepri(struct proc *); void scheduler_start(void) @@ -70,8 +71,8 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. -* We setup the timeouts here and kick schedcpu and roundrobin once to -* make them do their job. +* We setup the timeouts here and kick schedcpu once to make it do +* its job. */ timeout_set(_to, schedcpu, _to); @@ -715,4 +716,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - Index: sys/sys/sched.h === RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.39 diff -u -p -r1.39 sched.h --- sys/sys/sched.h 13 Sep 2015 11:15:11 - 1.39 +++ sys/sys/sched.h 5 Mar 2016 09:01:56 - @@ -139,7 +139,6 @@ void schedclock(struct proc *); struct cpu_info; void roundrobin(struct cpu_info *); void scheduler_start(void); -void updatepri(struct proc *); void userret(struct proc *p); void sched_init_cpu(struct cpu_info *); -- Michal Mazurek
ptrace.2: document PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT
PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT are undocumented, I don't believe it's by design. The only place these are used is gnu/usr.bin/binutils/gdb/obsd-nat.c Index: ptrace.2 === RCS file: /cvs/src/lib/libc/sys/ptrace.2,v retrieving revision 1.35 diff -u -p -r1.35 ptrace.2 --- ptrace.21 Dec 2015 07:50:03 - 1.35 +++ ptrace.25 Mar 2016 08:02:24 - @@ -301,6 +301,28 @@ The .Fa data argument should be set to .Li sizeof(struct ptrace_state) . +.It Dv PT_GET_THREAD_FIRST +This request reads the thread ID of the traced process' first thread into the +.Dq Li struct ptrace_thread_state +pointed to by +.Fa addr . +The +.Fa data +argument should be set to +.Li sizeof(struct ptrace_thread_state) . +.It Dv PT_GET_THREAD_NEXT +This request is just like +.Dv PT_GET_THREAD_FIRST , +except it returns the thread ID of the subsequent thread. +The +.Dq Li struct ptrace_thread_state +pointed to by +.Fa addr +must be initialized by a previous +.Dv PT_GET_THREAD_FIRST +or +.Dv PT_GET_THREAD_NEXT +request. .El .Pp Additionally, machine-specific requests can exist. -- Michal Mazurek
sys_process.c: remove relebad
relebad used to have more body: relebad: PRELE(t); return (error); But then PRELE(t); was removed. This diff gets rid of what remains of relebad. Index: sys/kern/sys_process.c === RCS file: /cvs/src/sys/kern/sys_process.c,v retrieving revision 1.68 diff -u -p -r1.68 sys_process.c --- sys/kern/sys_process.c 24 Sep 2015 20:35:18 - 1.68 +++ sys/kern/sys_process.c 4 Mar 2016 17:51:14 - @@ -454,7 +454,7 @@ sys_ptrace(struct proc *p, void *v, regi /* If the address parameter is not (int *)1, set the pc. */ if ((int *)SCARG(uap, addr) != (int *)1) if ((error = process_set_pc(t, SCARG(uap, addr))) != 0) - goto relebad; + return (error); #ifdef PT_STEP /* @@ -462,7 +462,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, req == PT_STEP); if (error) - goto relebad; + return (error); #endif goto sendsig; @@ -492,7 +492,7 @@ sys_ptrace(struct proc *p, void *v, regi */ error = process_sstep(t, 0); if (error) - goto relebad; + return (error); #endif /* give process back to original parent or init */ @@ -522,9 +522,6 @@ sys_ptrace(struct proc *p, void *v, regi } return (0); - - relebad: - return (error); case PT_KILL: if (SCARG(uap, pid) < THREAD_PID_OFFSET && tr->ps_single) -- Michal Mazurek
proc.h: fix comment
After looking at dowait4() I believe this is a typo. Change space to a tab while here. Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.213 diff -u -p -r1.213 proc.h --- sys/sys/proc.h 6 Dec 2015 17:50:21 - 1.213 +++ sys/sys/proc.h 4 Mar 2016 13:57:54 - @@ -245,7 +245,7 @@ struct process { #definePS_ISPWAIT 0x0080 /* Is parent of PPWAIT child. */ #definePS_PROFIL 0x0100 /* Has started profiling. */ #definePS_TRACED 0x0200 /* Being ptraced. */ -#definePS_WAITED 0x0400 /* Stopped proc has waited for. */ +#definePS_WAITED 0x0400 /* Stopped proc was waited for. */ #definePS_COREDUMP 0x0800 /* Busy coredumping */ #definePS_SINGLEEXIT 0x1000 /* Other threads must die. */ #definePS_SINGLEUNWIND 0x2000 /* Other threads must unwind. */ @@ -255,7 +255,7 @@ struct process { #definePS_EMBRYO 0x0002 /* New process, not yet fledged */ #definePS_ZOMBIE 0x0004 /* Dead and ready to be waited for */ #definePS_NOBROADCASTKILL 0x0008 /* Process excluded from kill -1. */ -#define PS_PLEDGE 0x0010 /* Has called pledge(2) */ +#definePS_PLEDGE 0x0010 /* Has called pledge(2) */ #definePS_BITS \ ("\20" "\01CONTROLT" "\02EXEC" "\03INEXEC" "\04EXITING" "\05SUGID" \ -- Michal Mazurek
kern_proc.c: fix comment
The argument was changed from 'proc *p' to 'process *pr' in 2010. Index: sys/kern/kern_proc.c === RCS file: /cvs/src/sys/kern/kern_proc.c,v retrieving revision 1.65 diff -u -p -r1.65 kern_proc.c --- sys/kern/kern_proc.c11 Sep 2015 08:27:39 - 1.65 +++ sys/kern/kern_proc.c4 Mar 2016 12:36:26 - @@ -150,7 +150,7 @@ chgproccnt(uid_t uid, int diff) } /* - * Is p an inferior of parent? + * Is pr an inferior of parent? */ int inferior(struct process *pr, struct process *parent) -- Michal Mazurek
kern_exit.c: move declarations from proc.h
These functions appear to only be used in kern_exit. Index: sys/kern/kern_exit.c === RCS file: /cvs/src/sys/kern/kern_exit.c,v retrieving revision 1.154 diff -u -p -r1.154 kern_exit.c --- sys/kern/kern_exit.c9 Oct 2015 01:10:27 - 1.154 +++ sys/kern/kern_exit.c3 Mar 2016 10:08:09 - @@ -73,6 +73,10 @@ #include +voidproc_finish_wait(struct proc *, struct proc *); +voidproc_free(struct proc *); +voidprocess_zap(struct process *); + /* * exit -- * Death of process. Index: sys/sys/proc.h === RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.213 diff -u -p -r1.213 proc.h --- sys/sys/proc.h 6 Dec 2015 17:50:21 - 1.213 +++ sys/sys/proc.h 3 Mar 2016 10:08:09 - @@ -531,9 +531,6 @@ int single_thread_check(struct proc *, i void child_return(void *); intproc_cansugid(struct proc *); -void proc_finish_wait(struct proc *, struct proc *); -void process_zap(struct process *); -void proc_free(struct proc *); struct sleep_state { int sls_s; -- Michal Mazurek
kern_sched.c: unused functions
/* New process, not yet fledged */ #definePS_ZOMBIE 0x0004 /* Dead and ready to be waited for */ #definePS_NOBROADCASTKILL 0x0008 /* Process excluded from kill -1. */ -#define PS_PLEDGE 0x0010 /* Has called pledge(2) */ +#definePS_PLEDGE 0x0010 /* Has called pledge(2) */ #definePS_BITS \ ("\20" "\01CONTROLT" "\02EXEC" "\03INEXEC" "\04EXITING" "\05SUGID" \ @@ -380,12 +380,12 @@ struct proc { #defineP_WEXIT 0x2000 /* Working on exiting. */ #defineP_OWEUPC0x8000 /* Owe proc an addupc() at next ast. */ #defineP_SUSPSINGLE0x0008 /* Need to stop for single threading. */ -#define P_SYSTRACE 0x0040 /* Process system call tracing active*/ -#define P_CONTINUED0x0080 /* Proc has continued from a stopped state. */ +#defineP_SYSTRACE 0x0040 /* Process system call tracing active*/ +#defineP_CONTINUED 0x0080 /* Proc has continued from a stopped state. */ #defineP_THREAD0x0400 /* Only a thread, not a real process */ #defineP_SUSPSIG 0x0800 /* Stopped from signal. */ #defineP_SOFTDEP 0x1000 /* Stuck processing softdep worklist */ -#define P_CPUPEG 0x4000 /* Do not move to another cpu. */ +#defineP_CPUPEG0x4000 /* Do not move to another cpu. */ #defineP_BITS \ ("\20" "\01INKTR" "\02PROFPEND" "\03ALRMPEND" "\04SIGSUSPEND" \ @@ -414,7 +414,7 @@ struct uidinfo *uid_find(uid_t); #definePID_MAX 32766 #defineNO_PID (PID_MAX+1) -#define SESS_LEADER(pr)((pr)->ps_session->s_leader == (pr)) +#defineSESS_LEADER(pr) ((pr)->ps_session->s_leader == (pr)) #defineSESSHOLD(s) ((s)->s_count++) #defineSESSRELE(s) do { \ if (--(s)->s_count == 0)\ @@ -558,19 +558,8 @@ struct cpuset { int cs_set[CPUSET_SSIZE]; }; -void cpuset_init_cpu(struct cpu_info *); - -void cpuset_clear(struct cpuset *); -void cpuset_add(struct cpuset *, struct cpu_info *); -void cpuset_del(struct cpuset *, struct cpu_info *); -int cpuset_isset(struct cpuset *, struct cpu_info *); -void cpuset_add_all(struct cpuset *); -void cpuset_copy(struct cpuset *, struct cpuset *); -void cpuset_union(struct cpuset *, struct cpuset *, struct cpuset *); -void cpuset_intersection(struct cpuset *t, struct cpuset *, struct cpuset *); -void cpuset_complement(struct cpuset *, struct cpuset *, struct cpuset *); -struct cpu_info *cpuset_first(struct cpuset *); +void cpuset_add(struct cpuset *, struct cpu_info *); +int cpuset_isset(struct cpuset *, struct cpu_info *); #endif /* _KERNEL */ #endif /* !_SYS_PROC_H_ */ - -- Michal Mazurek
cpu.h: parens in macros
I noticed these macros, I think they should have more parenthesis. I don't know how to test this though. Index: sys/arch/alpha/include/cpu.h === RCS file: /cvs/src/sys/arch/alpha/include/cpu.h,v retrieving revision 1.55 diff -u -p -r1.55 cpu.h --- sys/arch/alpha/include/cpu.h2 Jul 2015 01:33:59 - 1.55 +++ sys/arch/alpha/include/cpu.h1 Mar 2016 18:57:50 - @@ -320,7 +320,7 @@ do { \ #define signotify(p) aston(p) #endif -#defineaston(p)(p)->p_md.md_astpending = 1 +#defineaston(p)((p)->p_md.md_astpending = 1) #endif /* _KERNEL */ /* Index: sys/arch/mips64/include/cpu.h === RCS file: /cvs/src/sys/arch/mips64/include/cpu.h,v retrieving revision 1.108 diff -u -p -r1.108 cpu.h --- sys/arch/mips64/include/cpu.h 5 Jan 2016 05:27:54 - 1.108 +++ sys/arch/mips64/include/cpu.h 1 Mar 2016 18:57:50 - @@ -318,12 +318,12 @@ void cp0_calibrate(struct cpu_info *); * process as soon as possible. */ #ifdef MULTIPROCESSOR -#definesignotify(p)(aston(p), cpu_unidle(p->p_cpu)) +#definesignotify(p)(aston(p), cpu_unidle((p)->p_cpu)) #else #definesignotify(p)aston(p) #endif -#defineaston(p)p->p_md.md_astpending = 1 +#defineaston(p)((p)->p_md.md_astpending = 1) #ifdef CPU_R8000 #definemips_sync() __asm__ volatile ("lw $0, 0(%0)" :: \ -- Michal Mazurek
sched_bsd.c update comment
Index: sys/kern/sched_bsd.c === RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c8 Nov 2015 20:45:57 - 1.42 +++ sys/kern/sched_bsd.c1 Mar 2016 15:19:24 - @@ -70,8 +70,8 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. -* We setup the timeouts here and kick schedcpu and roundrobin once to -* make them do their job. +* We setup the timeouts here and kick schedcpu once to make it do +* its job. */ timeout_set(_to, schedcpu, _to); -- Michal Mazurek