Re: usr/bin/ktrace: replace snprintf(3)/write(2) with #define and write(2)

2017-06-11 Thread Ted Unangst
Adam Wolk wrote: > Hi tech@, > > Using the GREATSCOTT[1] pattern to output in the ktrace signal handler, > dropping the need for an snprintf and the 8k stack buffer. > > Brought to attention by BlackFrog on #openbsd-daily > > Feedback, OK's? so mistake in the original: sizeof() includes the

Re: usr/bin/ktrace: replace snprintf(3)/write(2) with #define and write(2)

2017-06-11 Thread Adam Wolk
On Sun, Jun 11, 2017 at 11:10:30AM -0600, Theo de Raadt wrote: > + write(STDERR_FILENO, NO_KTRACE, sizeof(NO_KTRACE)); > > Naw, I dislike that sizeof. > > You can use dprintf, it is signal-safe in OpenBSD as long as the format > string doesn't contain floating-point strings. Attaching

Re: usr/bin/ktrace: replace snprintf(3)/write(2) with #define and write(2)

2017-06-11 Thread Theo de Raadt
+ write(STDERR_FILENO, NO_KTRACE, sizeof(NO_KTRACE)); Naw, I dislike that sizeof. You can use dprintf, it is signal-safe in OpenBSD as long as the format string doesn't contain floating-point strings.

usr/bin/ktrace: replace snprintf(3)/write(2) with #define and write(2)

2017-06-11 Thread Adam Wolk
Hi tech@, Using the GREATSCOTT[1] pattern to output in the ktrace signal handler, dropping the need for an snprintf and the 8k stack buffer. Brought to attention by BlackFrog on #openbsd-daily Feedback, OK's? Regards, Adam [1] - https://marc.info/?l=openbsd-tech=149613049920485=2 Index: