Re: make process.ps_start an uptime instead of a realtime

2018-06-22 Thread Scott Cheloha
On Tue, Jun 05, 2018 at 03:57:48PM -0600, Todd C. Miller wrote: > On Tue, 05 Jun 2018 16:30:14 -0500, Scott Cheloha wrote: > > > Because the system clock can jump around, process start times > > should be recorded as offsets from boot and only converted to > >

ksh: count $MAILCHECK with monotonic clock

2018-06-24 Thread Scott Cheloha
is a hack so I added an explicit flag. ok? -- Scott Cheloha Index: bin/ksh/mail.c === RCS file: /cvs/src/bin/ksh/mail.c,v retrieving revision 1.23 diff -u -p -r1.23 mail.c --- bin/ksh/mail.c 9 Apr 2018 17:53:36 - 1.23

rpc: misc. time-related cleanup

2017-12-27 Thread Scott Cheloha
The timevals in clnt_tcp.c and clnt_udp.c are assigned and never used. The timevals in auth_unix.c are only used for the .tv_sec field, so we can just initialize .aup_time with time(3). ok? -- Scott Cheloha Index: lib/libc/rpc/auth_unix.c

authpf: use monotime for duration log

2018-01-06 Thread Scott Cheloha
, or if time_t is a floating-point type. At least, that's the impression I got when I read that POSIX allows time_t to be basically anything. AFAICT we typically cast it to long long. Thoughts? ok? -- Scott Cheloha Index: usr.sbin/authpf/authpf.c

cdio, ftp: use monotime for progress logging

2017-12-22 Thread Scott Cheloha
Hey, Use the monotonic clock when logging progress in cdio(1) and ftp(1). This keeps the progress log from blipping or stalling if the system time is changed, e.g., in the midst of a transfer or rip. ok? -- Scott Cheloha Index: usr.bin/cdio/mmc.c

arp, date, pom, pr: gettimeofday(2) -> time(3)

2017-12-22 Thread Scott Cheloha
: Operation not permitted is considerably more useful than this: date: adjtime Of some note is that pom(6) was one of the last programs in base calling gettimeofday(2) with a non-NULL timezone argument. ok? -- Scott Cheloha Index: bin/date/date.c

pom: use round(3), fmod(3)

2017-12-23 Thread Scott Cheloha
) with its documented and, in this case, equivalent behavior is much clearer. thoughts? ok? -- Scott Cheloha Index: games/pom/pom.c === RCS file: /cvs/src/games/pom/pom.c,v retrieving revision 1.26 diff -u -p -r1.26 pom.c --- games/pom/po

pom: consolidate printing

2017-12-24 Thread Scott Cheloha
Hey, Next up for pom(6): consolidate the printf(3) calls. The inline printing obfuscates what is otherwise a very simple classification algorithm. ok? -- Scott Cheloha Index: games/pom/pom.c === RCS file: /cvs/src/games/pom/pom.c

Re: mg: extract child status with WEXITSTATUS

2018-01-09 Thread Scott Cheloha
After discussing it with jca@ and trying a few variations I've settled on the attached diff. We indicate if sh(1) was signalled because we have that information at hand. Otherwise we report the exit status as we always have. ok? Index: grep.c

Re: mg: extract child status with WEXITSTATUS

2018-01-09 Thread Scott Cheloha
On Tue, Jan 09, 2018 at 10:05:22AM -0600, Scott Cheloha wrote: > After discussing it with jca@ and trying a few variations I've settled > on the attached diff. > > We indicate if sh(1) was signalled because we have that information at > hand. Otherwise we report the exit status as

init.8: getty sleep is 30 seconds, not 10

2018-01-16 Thread Scott Cheloha
Hi, The child in start_getty() sleeps 30 seconds (not 10) before continuing if getty exited too quickly in its prior attempt. ok? -- Scott Cheloha Index: sbin/init/init.8 === RCS file: /cvs/src/sbin/init/init.8,v retrieving

sleep(1): support longer naps

2018-01-25 Thread Scott Cheloha
not sure whether the larger range is actually an extension to the standard, and if so whether we need to mention it in the manpage, but I've included a diff here anyway just in case. If you have ideas about the wording I'd love to hear them. Thoughts? ok? -- Scott Cheloha Index: bin/sleep/sleep.1

sleep(1): better error messages

2018-02-03 Thread Scott Cheloha
with what other utilities do. ok? -- Scott Cheloha Index: bin/sleep/sleep.c === RCS file: /cvs/src/bin/sleep/sleep.c,v retrieving revision 1.25 diff -u -p -r1.25 sleep.c --- bin/sleep/sleep.c 2 Feb 2018 16:46:37 - 1.25

Re: sleep(1): support longer naps

2018-02-01 Thread Scott Cheloha
On Wed, Jan 31, 2018 at 07:25:58AM +, Jason McIntyre wrote: > On Wed, Jan 31, 2018 at 05:52:35AM +0100, Theo Buehler wrote: > > On Thu, Jan 25, 2018 at 09:35:33PM -0600, Scott Cheloha wrote: > > > [...] > > > > > > I'm not sure whether the l

init(8): check GETTY_SPACING against monotonic clock

2018-01-29 Thread Scott Cheloha
there isn't any reason to continue retrieving the current time in the parent process if we're doing the comparison in the child process, so I've moved the system call into that block. ok? -- Scott Cheloha Index: sbin/init/init.c === RCS

leave(1): schedule absolute alarm for start of minute

2018-02-06 Thread Scott Cheloha
that refactors that function to obviate it. ok? -- Scott Cheloha Index: usr.bin/leave/leave.c === RCS file: /cvs/src/usr.bin/leave/leave.c,v retrieving revision 1.17 diff -u -p -r1.17 leave.c --- usr.bin/leave/leave.c 9 Oct 2015 01:37

shutdown(8): fprintf(stderr -> warnx

2018-02-03 Thread Scott Cheloha
ok? -- Scott Cheloha Index: sbin/shutdown/shutdown.c === RCS file: /cvs/src/sbin/shutdown/shutdown.c,v retrieving revision 1.46 diff -u -p -r1.46 shutdown.c --- sbin/shutdown/shutdown.c3 Apr 2017 20:59:19 - 1.46

hostapd: normalize microsecond limit when parsing

2018-02-12 Thread Scott Cheloha
Hi, I'm unfamiliar with this code, but assigning the microsecond value without normalizing it for the timeval looks off. -- Scott Cheloha Index: usr.sbin/hostapd/parse.y === RCS file: /cvs/src/usr.sbin/hostapd/parse.y,v retrieving

date: atoll - > strtonum

2018-02-12 Thread Scott Cheloha
ok? Index: bin/date/date.c === RCS file: /cvs/src/bin/date/date.c,v retrieving revision 1.51 diff -u -p -r1.51 date.c --- bin/date/date.c 23 Dec 2017 20:58:14 - 1.51 +++ bin/date/date.c 12 Feb 2018 16:29:24 - @@

sasyncd: schedule events against monotonic clock

2018-02-12 Thread Scott Cheloha
So that events fire punctually even if the system clock is changed. ok? -- Scott Cheloha Index: usr.sbin/sasyncd/sasyncd.c === RCS file: /cvs/src/usr.sbin/sasyncd/sasyncd.c,v retrieving revision 1.27 diff -u -p -r1.27 sasyncd.c

iostat: cap wait/interval at 100 million seconds

2018-02-09 Thread Scott Cheloha
new syntax is in use, so we should call it that in the error message for the '-w' flag. ok? -- Scott Cheloha Index: usr.sbin/iostat/iostat.c === RCS file: /cvs/src/usr.sbin/iostat/iostat.c,v retrieving revision 1.39 diff -

Re: iostat: cap wait/interval at 100 million seconds

2018-02-09 Thread Scott Cheloha
On Sat, Feb 10, 2018 at 01:12:59PM +1300, Theo Buehler wrote: > On Fri, Feb 09, 2018 at 05:41:34PM -0600, Scott Cheloha wrote: > > Hi, > > > > nanosleep(2) won't take more than 100 million seconds at a time, > > so we ought to cap interval when we read it in. Otherwise

sleep(1): cleanup and style(9)

2018-02-14 Thread Scott Cheloha
-known practice, no need to explain ok? -- Scott Cheloha Index: bin/sleep/sleep.c === RCS file: /cvs/src/bin/sleep/sleep.c,v retrieving revision 1.26 diff -u -p -r1.26 sleep.c --- bin/sleep/sleep.c 4 Feb 2018 02:18:15 -

hostapd: account for subseconds when checking rule rates

2018-02-14 Thread Scott Cheloha
al = 1; /* true */ t_now.tv_sec - frame->f_last.tv_sec >= frame->f_rate_intval /* and yet ... */ struct timeval t_diff; timersub(_now, >f_last, _diff); /* also true */ t_diff.tv_sec < frame->f_rate_intval ok? -- Scott

Re: vmd: drive i8253 with monotonic clock

2018-02-18 Thread Scott Cheloha
On Sun, Feb 18, 2018 at 02:44:43PM -0800, Mike Larkin wrote: > On Sun, Feb 18, 2018 at 12:00:01PM -0600, Scott Cheloha wrote: > > Hi, > > > > Is it bad if the olatch counts up if the host's wall clock > > is set backward? Or if the olatch makes a big j

Re: shutdown: fork+exec for wall(1) broadcasts

2018-02-22 Thread Scott Cheloha
On Thu, Feb 22, 2018 at 02:13:16PM -0700, Todd C. Miller wrote: > On Thu, 22 Feb 2018 15:06:04 -0600, Scott Cheloha wrote: > > > Could that difference effect the behavior of the program in practice? > > I don't think so. > > > [...] > > > > So unless

Re: shutdown: fork+exec for wall(1) broadcasts

2018-02-22 Thread Scott Cheloha
On Thu, Feb 22, 2018 at 01:09:02PM -0700, Todd C. Miller wrote: > On Thu, 22 Feb 2018 13:50:13 -0600, Scott Cheloha wrote: > > > I think setjmping from a signal handler to put a time limit on > > pclose is too magical, especially when the alternative doesn't > >

shutdown: fork+exec for wall(1) broadcasts

2018-02-22 Thread Scott Cheloha
/fork/execle, * fprintf -> dprintf, fwrite -> write, and * Strip SA_RESTART from SIGALRM's sigaction so we EINTR out of our wait(2) after 30 seconds. We wait (instead of waitpid) to pick up any stragglers from prior calls to timewarn() that we had to leave behind. ok? -- Scott C

shutdown: simplify countdown loop()

2018-02-24 Thread Scott Cheloha
is a time_t, so there's just less type friction. It also makes things simpler for some later diffs I have planned. But so, int -> time_t, hence sleep -> nanosleep. ok? -- Scott Cheloha Index: sbin/shutdown/shutdown.c === RCS file: /c

vmd: drive i8253 with monotonic clock

2018-02-18 Thread Scott Cheloha
into a loop, and (b) use the timespecsub macro from sys/time.h, to make the code briefer. Anyone down to test? -- Scott Cheloha Index: usr.sbin/vmd/i8253.c === RCS file: /cvs/src/usr.sbin/vmd/i8253.c,v retrieving revision 1.17 diff -u

Re: shutdown: simplify countdown loop()

2018-02-25 Thread Scott Cheloha
On Sun, Feb 25, 2018 at 10:42:04AM +0100, Theo Buehler wrote: > On Sat, Feb 24, 2018 at 06:25:44PM -0600, Scott Cheloha wrote: > > [...] > > > > If we treat tlist[] like an array instead of a list, we can > > eliminate a lot of special cases and duplicate calls in shutd

Re: mktemp: Clarify error message

2017-12-26 Thread Scott Cheloha
ains two possible error cases in a single go. This necessitates more thinking on the part of the user. Why not just acknowledge the two errors differently? $ mktemp test.X mktemp: insufficient number of Xs in template: test.X $ mktemp test.XXC mktemp: invalid template suffix: test.X

ports.7: double distfile fetch size: 20 -> 40

2017-12-26 Thread Scott Cheloha
of the largest working directories, I'll incorporate those too and commit it. -- Scott Cheloha Index: share/man/man7/ports.7 === RCS file: /cvs/src/share/man/man7/ports.7,v retrieving revision 1.115 diff -u -p -r1.115 ports.7 --- share/man/man7

mg: extract child status with WEXITSTATUS

2018-01-01 Thread Scott Cheloha
Hey, In the mg(1) *compile* buffer, currently you get incorrect output like: Command exited abnormally with code 256 at [...] Using the W* macros in corrects this: Command exited abnormally with code 1 at [...] ok? -- Scott Cheloha Index: usr.bin/mg/grep.c

Re: mg: extract child status with WEXITSTATUS

2018-01-02 Thread Scott Cheloha
On Mon, Jan 01, 2018 at 09:07:25PM -0700, Todd C. Miller wrote: > On Mon, 01 Jan 2018 19:54:07 -0600, Scott Cheloha wrote: > > > Hey, > > > > In the mg(1) *compile* buffer, currently you get incorrect > > output like: > > > > Command exited abnor

Re: ports.7: double distfile fetch size: 20 -> 40

2017-12-26 Thread Scott Cheloha
On Wed, Dec 27, 2017 at 04:12:49AM +0100, Marc Espie wrote: > On Tue, Dec 26, 2017 at 05:51:51PM +0100, Jeremie Courreges-Anglas wrote: > > On Tue, Dec 26 2017, Scott Cheloha <scottchel...@gmail.com> wrote: > > > Hey, > > > > > > I just did a full p

Re: [PATCH] jot(1): negative and overflowing reps

2018-08-01 Thread Scott Cheloha
On Tue, Jul 31, 2018 at 05:38:20PM -0500, Kris Katterjohn wrote: > On Wed, Aug 01, 2018 at 12:24:59AM +0200, Theo Buehler wrote: > > ok tb if anyone wants to commit. > > Cool, thanks for looking at this. > > > > + errx(1, "Bad reps value, %s: %s", errstr, > > > > A

Re: reduce pledge(2) on worms(6)

2018-08-05 Thread Scott Cheloha
> On Aug 5, 2018, at 3:18 PM, Ricardo Mestre wrote: > > Hi, > > After all ncurses initialization pledge(2) can be reduced only to > stdio/tty operations on worms(6). > > OK? And here I thought you were only doing pledge-tightening on the unimportant stuff in /usr/sbin :) ok cheloha@

nologin(8): write -> dprintf

2018-08-15 Thread Scott Cheloha
Use dprintf for the DEFAULT_MESG string instead of the more awkward write+strlen combo. ok? -- Scott Cheloha Index: sbin/nologin/nologin.c === RCS file: /cvs/src/sbin/nologin/nologin.c,v retrieving revision 1.7 diff -u -p -r1.7

Re: md5: convert from fgetln(3) to getline(3)

2018-08-14 Thread Scott Cheloha
On Tue, Aug 14, 2018 at 03:34:53PM +0300, Lauri Tirkkonen wrote: > Similar to previous diffs for join(1) and paste(1). No intended > functional change. I agree with the direction. Comments inline. > diff --git a/bin/md5/md5.c b/bin/md5/md5.c > index 84adbcf0989..a8f18262a92 100644 > ---

Re: md5: convert from fgetln(3) to getline(3)

2018-08-14 Thread Scott Cheloha
On Tue, Aug 14, 2018 at 08:55:14PM +0300, Lauri Tirkkonen wrote: > Hi, > > On Tue, Aug 14 2018 12:08:54 -0500, Scott Cheloha wrote: > > > + len = (size_t)linelen; > > > + if (line[len - 1] == '\n') > > > + line[len - 1] = '\0

Re: md5: convert from fgetln(3) to getline(3)

2018-08-14 Thread Scott Cheloha
This patch is ok cheloha@ and I can commit if someone else is ok, too. On Tue, Aug 14, 2018 at 10:47:07PM +0300, Lauri Tirkkonen wrote: > [...] > > diff --git a/bin/md5/md5.c b/bin/md5/md5.c > index 84adbcf0989..1abf28cfa16 100644 > --- a/bin/md5/md5.c > +++ b/bin/md5/md5.c > @@ -549,11 +549,11

frag6_slowtimo: push netlock into frag6_freef

2018-08-16 Thread Scott Cheloha
can do here is push it into frag6_freef() where you only need it once per mbuf chain. -- Discussed with bluhm/kn and tested by kn. Everything in the frag6 regress tests pass. Thoughts? ok? -- Scott Cheloha Index: sys/netinet6/frag6.c

Re: openssl s_time: refactor benchmark loops

2018-08-11 Thread Scott Cheloha
On Sat, Aug 11, 2018 at 11:22:09PM +0900, Kinichiro Inoguchi wrote: > Hi, > > I saw that 2 loops are almost identical, and I think diff tidy up these 2 > loops > in 1 function. > > I found these 2 lines were not in original code. > > > + shutdown(SSL_get_fd(scon), SHUT_RDWR); > > +

openssl s_time: plug SSL leak in doConnection

2018-08-13 Thread Scott Cheloha
tb@ spotted this one. If BIO_new fails we leak scon, so SSL_free it in that case. ok? -- Scott Cheloha Index: usr.bin/openssl/s_time.c === RCS file: /cvs/src/usr.bin/openssl/s_time.c,v retrieving revision 1.25 diff -u -p -r1.25

openssl s_time: refactor benchmark loops

2018-08-09 Thread Scott Cheloha
when moving and merging things so it's obvious to the reader that the behavior is completely unchanged. There's cleanup and minor bugfixing I'd like to do, but that belongs in a separate diff to keep this review easy. Thoughts & feedback? ok? -- Scott Cheloha Index: usr.bin/openssl/

openssl s_time: don't fail by default in -new case

2018-08-13 Thread Scott Cheloha
This is a fun one. When you run openssl s_time -connect host:port -new it exits with status 1, even if nothing fails, because we 'goto end' without setting ret = 0 in the -new case. Present since the SSLeay 0.8.1b import into the OpenSSL tree [1]. A seasoned bug. :) ok? -- Scott

nologin(8): unveil(2)

2018-08-14 Thread Scott Cheloha
nologin(8) caught my eye for a different reason, but before doing anything else we ought to unveil(2) it. ok? -- Scott Cheloha Index: sbin/nologin/nologin.c === RCS file: /cvs/src/sbin/nologin/nologin.c,v retrieving revision 1.6

Re: ac(8) can segfault in two different ways

2018-08-18 Thread Scott Cheloha
On Sat, Aug 18, 2018 at 04:15:09PM +0100, Ricardo Mestre wrote: > Hi, > > [...] > > 1) $ ac -w ./ac.c > Segmentation fault (core dumped) > > This one will happen if the structure is big enough to write memory > out-of-bounds through strlcpy(3) inside update_user(). The easiest way to > check >

poll.2: don't encourage use as sleep

2018-08-17 Thread Scott Cheloha
and potentially confusing to a reader of such code: ok? -- Scott Cheloha Index: lib/libc/sys/poll.2 === RCS file: /cvs/src/lib/libc/sys/poll.2,v retrieving revision 1.35 diff -u -p -r1.35 poll.2 --- lib/libc/sys/poll.2 14 Feb 2017 17:51:14

openssl s_time: merge duplicate GET & SSL_shutdown code

2018-08-20 Thread Scott Cheloha
These two chunks of benchmark() are almost identical. We can merge them into the end of doConnection() with no change in behavior. We need to drop a shadow `i' when we do this. While we're at it we can move retval's declaration to the beginning of the function. As doConnection is now doing

openssl s_time: use monotonic timer for test timeout

2018-08-21 Thread Scott Cheloha
The timeout should be based on a monotonic clock. The wrapper function for the app_timer_* interfaces obfuscates things, so delete it. totalTimer should be set, not added to: the code doesn't increment it every iteration. ok? P.S. huh, there's an FPE if nConn == 0. Index: s_time.c

Re: md5: convert from fgetln(3) to getline(3)

2018-08-23 Thread Scott Cheloha
On Tue, Aug 14, 2018 at 03:11:47PM -0500, Scott Cheloha wrote: > This patch is ok cheloha@ and I can commit if someone else > is ok, too. 1 week bump. Anyone else ok? > On Tue, Aug 14, 2018 at 10:47:07PM +0300, Lauri Tirkkonen wrote: > > [...] > > > > diff --git a/bi

init(8): remove special SIGSYS handling

2018-08-24 Thread Scott Cheloha
The badsys() function has been here since import. Its comment indicates that SIGSYS might arrive if the system doesn't support sysctl, which is not applicable to us anymore, if ever. The only legitimate case I can think of here, now, is the desire to support dropping an old init(8) onto a new

Re: init(8): remove special SIGSYS handling

2018-08-24 Thread Scott Cheloha
On Fri, Aug 24, 2018 at 10:02:21AM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > The badsys() function has been here since import. Its comment > > indicates that SIGSYS might arrive if the system doesn't support > > sysctl, which is not applicabl

Re: init(8): remove special SIGSYS handling

2018-08-24 Thread Scott Cheloha
On Fri, Aug 24, 2018 at 10:21:08AM -0600, Theo de Raadt wrote: > Scott Cheloha wrote: > > > [...] > > > > I'm hunting this code because it mentions "no sysctl" as its raison > > d'etre, which is definitely not a reason for keeping it. > > It

openssl s_time: different tally marks for different TLS versions

2018-08-28 Thread Scott Cheloha
Two diffs here. First, move the tally mark printing out of the benchmark loop. Second, print '0' for TLS 1.0, '1' for TLS 1.1, etc. This breaks stdout compatibility with OpenSSL s_time, and prior versions of s_time in general, because 't' was used for TLS 1.0 (behavior change) and '2' was used

Re: openssl s_time: plug SSL leak in doConnection

2018-08-17 Thread Scott Cheloha
On Fri, Aug 17, 2018 at 04:43:03PM -0500, Scott Cheloha wrote: > On Mon, Aug 13, 2018 at 07:20:38PM +0200, Theo Buehler wrote: > > On Mon, Aug 13, 2018 at 07:01:25PM +0200, Jeremie Courreges-Anglas wrote: > > > On Mon, Aug 13 2018, Scott Cheloha wrote: > >

Re: openssl s_time: plug SSL leak in doConnection

2018-08-17 Thread Scott Cheloha
On Mon, Aug 13, 2018 at 07:20:38PM +0200, Theo Buehler wrote: > On Mon, Aug 13, 2018 at 07:01:25PM +0200, Jeremie Courreges-Anglas wrote: > > On Mon, Aug 13 2018, Scott Cheloha wrote: > > > tb@ spotted this one. > > > > > > If BIO_new fails we le

Re: ac(8) can segfault in two different ways

2018-08-19 Thread Scott Cheloha
On Sun, Aug 19, 2018 at 09:40:43AM +0100, Ricardo Mestre wrote: > > With your suggestion now it doesn't segfault anymore, but it still outputs > crazy stuff, do we really want this? Also -p still shows contents of the file > as per below: > > 0 serial@skoll:/usr/src/usr.sbin/ac$ obj/ac -w ./ac.c

Re: ac(8) can segfault in two different ways

2018-08-19 Thread Scott Cheloha
Sorry, I made a mistake in review here: On Sun, Aug 19, 2018 at 11:26:22PM -0500, Scott Cheloha wrote: > On Sun, Aug 19, 2018 at 09:40:43AM +0100, Ricardo Mestre wrote: > > > > [...] > > @@ -446,7 +451,8 @@ ac(FILE *fp) > > */ > >

openssl s_time: drop SSLv2, SSLv3 APIs and symbols

2018-08-27 Thread Scott Cheloha
If I understand correctly it is now impossible for the openssl(1) tool to open an SSLv2 or SSLv3 session with the host. We can also switch SSLv23_client_method to TLS_client_method to set a good example. ok? Index: s_time.c === RCS

openssl s_time: check for SSL_write failure

2018-08-22 Thread Scott Cheloha
Check for failure. Also reuse retval for the buffer length in lieu of strlen. ok? Index: s_time.c === RCS file: /cvs/src/usr.bin/openssl/s_time.c,v retrieving revision 1.29 diff -u -p -r1.29 s_time.c --- s_time.c22 Aug 2018

dd(1): don't cast malloc(3) size to u_int

2018-07-20 Thread Scott Cheloha
Hi, tobias@ spotted this one a few months ago when reviewing a different diff of mine. Casting the size given to malloc(3) here causes it to wrap if our block sizes are large enough, and then dd(1) misbehaves, at least on 64-bit platforms: # dd bs=$(((1 << 31) + 1)) cbs=$((1 << 31)) conv=ascii

dd(1): plug operand leak

2018-07-24 Thread Scott Cheloha
for the if/of operands and free the argument copy after processing each operand. While here, I think setting oper equal to a copy of itself is misleading, so just strdup *argv directly. ok? -- Scott Cheloha Index: bin/dd/args.c === RCS

Re: clock(): why is CLOCKS_PER_SEC 100 and not 1,000,000?

2018-07-05 Thread Scott Cheloha
> On Jul 5, 2018, at 6:51 AM, Paul Irofti wrote: > > Hi, > > POSIX requires that CLOCKS_PER_SEC be 1,000,000[0,1]. > > Any reason we have it set to 100? > > Paul > > [0] -- http://pubs.opengroup.org/onlinepubs/009695399/functions/clock.html > [1] --

Re: pthread_create: fix segfault when attr is NULL

2018-07-06 Thread Scott Cheloha
On Fri, Jul 06, 2018 at 03:07:12PM +0200, Mark Kettenis wrote: > > Date: Fri, 6 Jul 2018 15:36:07 +0300 > > From: Paul Irofti > > > > > POSIX currently says: > > > > > > The behavior is undefined if the value specified by the attr > > > argument to pthread_create() does not refer to an

openssl s_time, speed: rename timer operations

2018-07-13 Thread Scott Cheloha
ne I will switch to the new names. ok? -- Scott Cheloha Index: usr.bin/openssl/apps.h === RCS file: /cvs/src/usr.bin/openssl/apps.h,v retrieving revision 1.20 diff -u -p -r1.20 apps.h --- usr.bin/openssl/apps.h 5 Dec 201

hexdump, od: improve handling, checks for length & skip

2018-03-09 Thread Scott Cheloha
when introducing the possibility of an octal input because it signals a sort of default and we've already said that lengths are decimal by default. It's cleaner to introduce octal inputs in a new sentence. Thoughts? -- Scott Cheloha

Re: vmd: drive i8253 with monotonic clock

2018-03-09 Thread Scott Cheloha
On Sun, Feb 18, 2018 at 09:34:50PM -0800, Mike Larkin wrote: > On Sun, Feb 18, 2018 at 07:42:10PM -0600, Scott Cheloha wrote: > > On Sun, Feb 18, 2018 at 02:44:43PM -0800, Mike Larkin wrote: > > > On Sun, Feb 18, 2018 at 12:00:01PM -0600, Scott Cheloha wrote: > > > &g

Re: vmd: drive i8253 with monotonic clock

2018-04-06 Thread Scott Cheloha
1 month bump. > On Mar 9, 2018, at 2:31 PM, Scott Cheloha <scottchel...@gmail.com> wrote: > >> On Sun, Feb 18, 2018 at 09:34:50PM -0800, Mike Larkin wrote: >>> On Sun, Feb 18, 2018 at 07:42:10PM -0600, Scott Cheloha wrote: >>>> On Sun, Feb 18, 2018

video(1): don't use optarg as format string

2018-04-09 Thread Scott Cheloha
Always nifty: $ video -f '%d%d%d' video: 31668978116843009-2139062144: No such file or directory So, use strlcpy and check for truncation. ok? -- Scott Cheloha Index: app/video/video.c === RCS file: /cvs/xenocara/app/video

Re: ksh: fix buffer overflow in u64ton

2018-04-12 Thread Scott Cheloha
On Mon, Apr 09, 2018 at 08:56:28PM +0200, Tobias Stoeckmann wrote: > As tb@ pointed out, u64ton can overflow on ULONG_MAX. It could also > happen on systems with 64 bit int and INT_MIN, although we don't have > such a system supported by our code base. > > You can reach the u64ton function by

ksh: count $SECONDS with monotonic clock

2018-04-13 Thread Scott Cheloha
So that $SECONDS advances uniformly, independent of the system clock. ok? -- Scott Cheloha P.S. Similar change forthcoming for $MAILCHECK. Index: bin/ksh/var.c === RCS file: /cvs/src/bin/ksh/var.c,v retrieving revision 1.67 diff

video(1): measure with mono clock (tester wanted)

2018-04-06 Thread Scott Cheloha
So that your stats stay correct if the system clock is changed. This is simple enough to suggest that it's correct at a glance, but I have no hardware to test this with. Can anyone confirm that this works? -- Scott Cheloha Index: app/video/video.c

dd(1): overhaul operand parsing

2018-03-30 Thread Scott Cheloha
mpler. My thinking is that we should probably not allow something like the following: bs="+64" which looks like it could be an error in someone's script. ... but this might be too strict. Thoughts? -- Scott Cheloha [1] This seems to have happened when Keith M

Re: dd(1): snprintf+writev -> dprintf

2018-03-31 Thread Scott Cheloha
On Sat, Mar 31, 2018 at 01:04:43PM -0600, Theo de Raadt wrote: > The only worry about converting from iov to dprintf could be some > atomicity requirement. I don't really see that in play here, I think > the iov uses was simply for convenience. No other 'signalling interrupts' > seem to be in

Re: dd(1): snprintf+writev -> dprintf

2018-04-01 Thread Scott Cheloha
ignal(SIGINFO, summaryx); signal(SIGINT, terminate); it seems more correct to explicitly disallow preemption of a handler by itself via a distinct signal than to implicitly prevent any of the consequences of said preemption by

Re: dd(1): snprintf+writev -> dprintf

2018-04-02 Thread Scott Cheloha
On Mon, Apr 02, 2018 at 05:47:56AM -0600, Todd C. Miller wrote: > On Sat, 31 Mar 2018 13:41:00 -0600, "Theo de Raadt" wrote: > > > Let's see. SIGINFO starts. Imagine if the buffering is small (I > > don't think it is). If it was small, there could be multiple writes > > to the sequence.

shutdown(8): include timezone in deadline estimates

2018-03-30 Thread Scott Cheloha
ime before printing the estimated shutdown time everywhere. It's possible for the system wall clock to change after a shutdown is scheduled, which would make subsequent warning broadcasts inaccurate and might mislead the users on the system. ok? -- Scott Cheloha Index: sbin/shutdown/

Re: dd(1): overhaul operand parsing

2018-03-31 Thread Scott Cheloha
Updated diff with changes from tobias@: This patch now removes (u_int) casts from input/output buffer allocation in dd.c, which was incorrect beforehand anyway, but with the other changes here was manifesting as a segfault for combinations of cbs and ibs/obs that overflowed u_int. -- Scott

dd(1): snprintf+writev -> dprintf

2018-03-31 Thread Scott Cheloha
Simpler. ok? -- Scott Cheloha Index: bin/dd/misc.c === RCS file: /cvs/src/bin/dd/misc.c,v retrieving revision 1.22 diff -u -p -r1.22 misc.c --- bin/dd/misc.c 24 Oct 2017 14:21:10 - 1.22 +++ bin/dd/misc.c 31 Mar

shutdown(8): disallow "++minutes"

2018-03-16 Thread Scott Cheloha
offset in minutes is LLONG_MAX / 60 - use errstr to say what was wrong with timearg, as we do elsewhere with strtonum(3). ok? -- Scott Cheloha Index: sbin/shutdown/shutdown.c === RCS file: /cvs/src/sbin/shutdown/shutdown.c,v

cmp(1): stricter checking for skip1 and skip2

2018-03-01 Thread Scott Cheloha
sflag in special.c. I can separate the fatal()/fatalx() changes from the strtoll-checking changes, but I wanted to propose them together here because it makes the strtoll-checking briefer. ok? -- Scott Cheloha Index: usr.bin/cmp/cmp.c

times(3): return monotonically increasing values

2018-02-26 Thread Scott Cheloha
ther library function page and reword things to look like other library function pages (did my best). Attached changes ok? Input on the manpage restructuring/rewording? -- Scott Cheloha [1] It's this, right? https://standards.ieee.org/findstds/standard/1003.1-1988.html Index: lib/libc

Re: times(3): return monotonically increasing values

2018-02-28 Thread Scott Cheloha
On Tue, Feb 27, 2018 at 11:38:07AM -0700, Todd C. Miller wrote: > On Mon, 26 Feb 2018 19:12:20 -0600, Scott Cheloha wrote: > > > Reading the latest POSIX description for times(3): > > > > > Upon successful completion, times() shall return the elapsed > > &

Re: times(3): return monotonically increasing values

2018-02-28 Thread Scott Cheloha
On Tue, Feb 27, 2018 at 07:15:03AM +, Jason McIntyre wrote: > On Mon, Feb 26, 2018 at 07:12:20PM -0600, Scott Cheloha wrote: > > [...] > > > [...] > > > > I don't have access to 1003.1-1988 [1] (the most recent standard > > cited in times.3

Re: times(3): return monotonically increasing values

2018-02-28 Thread Scott Cheloha
On Wed, Feb 28, 2018 at 08:58:41AM -0700, Todd C. Miller wrote: > On Wed, 28 Feb 2018 09:46:30 -0600, Scott Cheloha wrote: > > > I want to avoid giving the reader even the slightest impression that > > the return value from times(3) can be used for anything but real-time > &

Re: top cpu stats are wrong with hyper threading

2018-10-15 Thread Scott Cheloha
On Fri, Oct 05, 2018 at 04:27:17PM +0200, Moritz Buhl wrote: > > Due to the SMT stuff the output of top showed the first few cpus instead > of the ones that are actually active. > > To reproduce the bad output: > Use a machine with hyper therading, top should show half the cpus, of > which every

ipsec: use monotonic clock for SA creation/lookup timestamp

2018-10-21 Thread Scott Cheloha
So the comparison is always meaningful. These are never copied out of the kernel so we can change the timestamp clock without issue. ok? Index: netinet/ip_ipsp.c === RCS file: /cvs/src/sys/netinet/ip_ipsp.c,v retrieving revision

Re: multicast.4: drop unneeded (void *) casts

2018-10-19 Thread Scott Cheloha
On Thu, Oct 18, 2018 at 05:38:42PM -0900, Philip Guenther wrote: > On Thu, Oct 18, 2018 at 4:00 PM wrote: > > > getsockopt(2) and setsockopt(2) take a void pointer for the third > > parameter so there is no need for any of these casts. > > > > Yep. > > > > I can do other style(9)-type cleanup

igmp_slowtimo: drop NETLOCK

2018-10-19 Thread Scott Cheloha
Hi, If we introduce a mutex for the igmp module we can drop the NETLOCK from igmp_slowtimo(). The router_info list, rti_head, and its entries are only ever accessed within the igmp module. The mutex also needs to protect igmp_timers_are_running. This is largely a monkey-see-monkey-do imitation

igmp, router_info: use queue(3)

2018-10-17 Thread Scott Cheloha
For consistency. While here, clean up two malloc calls. The hand-rolled list queue(3) is replacing here is singly linked but used an extra pointer in rti_delete() to get O(n) deletion. I kept the O(n) deletion by using LIST. If the extra space needed for LIST is unacceptable I can use SLIST

Re: xidle: use strtonum(3), zap NOTREACHED

2018-11-11 Thread Scott Cheloha
On Sun, Nov 11, 2018 at 12:24:51PM +0100, Klemens Nanni wrote: > On Sat, Nov 03, 2018 at 08:41:22PM +0100, Klemens Nanni wrote: > > Simpler and without ugly `goto fail'. `value.addr` is typed XPointer > > which is just a char pointer. > > > > Zap linter hints while here. > Bump. Comments

Re: /usr/share/calendar/calendar.christian - two entries for "First Sunday of Advent (4th Sunday before Christmas)"

2018-11-13 Thread Scott Cheloha
On Mon, Nov 12, 2018 at 07:00:31AM +, Jason McIntyre wrote: > On Sun, Nov 11, 2018 at 11:03:35PM +, Raf Czlonka wrote: > > It's that magical time of the year again :^) > > > > Anyone? > > > > R. > > > > morning. > > [...] unfortunately calendar doesn;t handle such dates well. This

Re: user land system spinning time

2018-10-09 Thread Scott Cheloha
On Mon, Oct 08, 2018 at 09:44:35PM +0200, Alexander Bluhm wrote: > Hi, > > On May 14 we did split kernel spinning time from system time. Goal > was to see what the kernel is doing. > > I just realized that user land time accounting has also changed. > The commit changed system time of a process

Re: Use regex search by default in apropos(1)?

2018-11-17 Thread Scott Cheloha
On Sun, Nov 18, 2018 at 02:14:07AM +0100, Ingo Schwarze wrote: > > currently, when you call apropos(1) in the default mode without > explicitly specifying '=' for substring search or '~' for regular > expression search, page names and one-line descriptions are > searched case-insensitively for

Re: nanosleep(2): don't tsleep(9) if timeout is empty

2018-12-27 Thread Scott Cheloha
> On Dec 26, 2018, at 6:51 AM, Mark Kettenis wrote: > >> Date: Tue, 25 Dec 2018 23:11:45 -0500 >> From: Scott Cheloha >> >> On Tue, Dec 25, 2018 at 11:24:54PM +0100, Mark Kettenis wrote: >>> >>> [...] >>> >>> Time to beat y

Re: replacing timeout_add() with timeout_add_msec()

2019-01-21 Thread Scott Cheloha
On Mon, Jan 21, 2019 at 04:59:38AM +0100, Claudio Jeker wrote: > On Sat, Jan 12, 2019 at 10:40:35PM -0600, Amit Kulkarni wrote: > > > [...] > > > > Thanks for the feedback Claudio and Mark! > > > > Here is a new diff based on your suggestions, [...] > > > > diff --git

Re: replacing timeout_add() with timeout_add_msec()

2019-01-21 Thread Scott Cheloha
On Mon, Jan 21, 2019 at 09:05:19PM -0500, Ted Unangst wrote: > Scott Cheloha wrote: > > > > diff --git sys/arch/sparc64/dev/fd.c sys/arch/sparc64/dev/fd.c > > > > index 8d548062f83..654d8c95524 100644 > > > > --- sys/arch/sparc64/dev/fd.c > > > &g

<    1   2   3   4   5   6   7   8   9   10   >