CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Tue Feb 9 05:53:14 UTC 2021 Modified Files: src/sys/dev/audio: audio.c Log Message: Change the lock conditions to call audio_unlink(). This can remove a different copy of audio_exlock_enter() in audio_unlink() and can use normal one. Also, in audiodetach(), this can set the exlock at more natual order (before calling audio_unlink()). No noticeable functional changes are intended. Thanks for comments, riastradh@. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.88 src/sys/dev/audio/audio.c:1.89 --- src/sys/dev/audio/audio.c:1.88 Fri Jan 15 05:34:49 2021 +++ src/sys/dev/audio/audio.c Tue Feb 9 05:53:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.88 2021/01/15 05:34:49 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.89 2021/02/09 05:53:14 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.88 2021/01/15 05:34:49 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.89 2021/02/09 05:53:14 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -1334,9 +1334,10 @@ audiodetach(device_t self, int flags) * that hold sc, and any new calls with files that were for sc will * fail. Thus, we now have exclusive access to the softc. */ + sc->sc_exlock = 1; /* - * Nuke all open instances. + * Clean up all open instances. * Here, we no longer need any locks to traverse sc_files. */ while ((file = SLIST_FIRST(&sc->sc_files)) != NULL) { @@ -1359,7 +1360,6 @@ audiodetach(device_t self, int flags) pmf_device_deregister(self); /* Free resources */ - sc->sc_exlock = 1; if (sc->sc_pmixer) { audio_mixer_destroy(sc, sc->sc_pmixer); kmem_free(sc->sc_pmixer, sizeof(*sc->sc_pmixer)); @@ -2396,6 +2396,7 @@ bad: int audio_close(struct audio_softc *sc, audio_file_t *file) { + int error; /* Protect entering new fileops to this file */ atomic_store_relaxed(&file->dying, true); @@ -2410,12 +2411,27 @@ audio_close(struct audio_softc *sc, audi mutex_exit(sc->sc_lock); } - return audio_unlink(sc, file); + error = audio_exlock_enter(sc); + if (error) { + /* + * If EIO, this sc is about to detach. In this case, even if + * we don't do subsequent _unlink(), audiodetach() will do it. + */ + if (error == EIO) + return error; + + /* XXX This should not happen but what should I do ? */ + panic("%s: can't acquire exlock: errno=%d", __func__, error); + } + error = audio_unlink(sc, file); + audio_exlock_exit(sc); + + return error; } /* * Unlink this file, but not freeing memory here. - * Must be called without sc_lock nor sc_exlock held. + * Must be called with sc_exlock held and without sc_lock held. */ int audio_unlink(struct audio_softc *sc, audio_file_t *file) @@ -2432,25 +2448,6 @@ audio_unlink(struct audio_softc *sc, aud "sc->sc_popens=%d, sc->sc_ropens=%d", sc->sc_popens, sc->sc_ropens); - /* - * Acquire exlock to protect counters. - * audio_exlock_enter() cannot be used here because we have to go - * forward even if sc_dying is set. - */ - while (__predict_false(sc->sc_exlock != 0)) { - error = cv_timedwait_sig(&sc->sc_exlockcv, sc->sc_lock, - mstohz(AUDIO_TIMEOUT)); - /* XXX what should I do on error? */ - if (error == EWOULDBLOCK) { - mutex_exit(sc->sc_lock); - audio_printf(sc, - "%s: cv_timedwait_sig failed: errno=%d\n", - __func__, error); - return error; - } - } - sc->sc_exlock = 1; - device_active(sc->sc_dev, DVA_SYSTEM); mutex_enter(sc->sc_intr_lock); @@ -2517,7 +2514,6 @@ audio_unlink(struct audio_softc *sc, aud kauth_cred_free(sc->sc_cred); TRACE(3, "done"); - audio_exlock_exit(sc); return 0; }
CVS commit: src/lib/libc/sys
Module Name:src Committed By: dholland Date: Tue Feb 9 01:12:01 UTC 2021 Modified Files: src/lib/libc/sys: poll.2 Log Message: Document in poll(2) that poll first appeared in NetBSD in NetBSD 1.3. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/lib/libc/sys/poll.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/poll.2 diff -u src/lib/libc/sys/poll.2:1.35 src/lib/libc/sys/poll.2:1.36 --- src/lib/libc/sys/poll.2:1.35 Tue Feb 9 01:01:31 2021 +++ src/lib/libc/sys/poll.2 Tue Feb 9 01:12:01 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: poll.2,v 1.35 2021/02/09 01:01:31 dholland Exp $ +.\" $NetBSD: poll.2,v 1.36 2021/02/09 01:12:01 dholland Exp $ .\" .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -272,7 +272,9 @@ file descriptor resource limit. The .Fn poll function appeared in -.At V.3 . +.At V.3 , +and was added to NetBSD in +.Nx 1.3 . The .Fn pollts function first appeared in
CVS commit: src/lib/libc/sys
Module Name:src Committed By: dholland Date: Tue Feb 9 01:01:31 UTC 2021 Modified Files: src/lib/libc/sys: poll.2 Log Message: typo in previous. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libc/sys/poll.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/poll.2 diff -u src/lib/libc/sys/poll.2:1.34 src/lib/libc/sys/poll.2:1.35 --- src/lib/libc/sys/poll.2:1.34 Tue Feb 9 00:50:47 2021 +++ src/lib/libc/sys/poll.2 Tue Feb 9 01:01:31 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: poll.2,v 1.34 2021/02/09 00:50:47 dholland Exp $ +.\" $NetBSD: poll.2,v 1.35 2021/02/09 01:01:31 dholland Exp $ .\" .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -85,7 +85,7 @@ wait for any file descriptor to become r If .Fa timeout is INFTIM (\-1), then -.Pn poll +.Fn poll blocks indefinitely. If .Fa timeout
CVS commit: src/lib/libc/sys
Module Name:src Committed By: dholland Date: Tue Feb 9 00:50:48 UTC 2021 Modified Files: src/lib/libc/sys: poll.2 Log Message: Rework the text of poll(2) for clarity. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/libc/sys/poll.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/poll.2 diff -u src/lib/libc/sys/poll.2:1.33 src/lib/libc/sys/poll.2:1.34 --- src/lib/libc/sys/poll.2:1.33 Sun Feb 7 18:22:51 2021 +++ src/lib/libc/sys/poll.2 Tue Feb 9 00:50:47 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: poll.2,v 1.33 2021/02/07 18:22:51 rillig Exp $ +.\" $NetBSD: poll.2,v 1.34 2021/02/09 00:50:47 dholland Exp $ .\" .\" Copyright (c) 1998, 2005, 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 25, 2020 +.Dd February 8, 2021 .Dt POLL 2 .Os .Sh NAME @@ -56,95 +56,27 @@ and .Fn ppoll examine a set of file descriptors to see if some of them are ready for I/O. +For each object inspected, the caller provides a list of conditions +(called ``events'') to check for, and the kernel returns a list of +conditions that are true. +The intent, as with +.Xr select 2 , +is to check for whether I/O is possible before performing any, so as +to permit a top-level event loop to process input from many sources +(and output to many destinations) +without blocking on any of them and thus becoming stuck. +.Ss Arguments The .Fa fds -argument is a pointer to an array of pollfd structures as defined in +argument is a pointer to an array of pollfd structures, one per file +to inspect, as defined in .In poll.h (shown below). The .Fa nfds -argument determines the size of the +argument gives the size of the .Fa fds array. -.Bd -literal -struct pollfd { -intfd; /* file descriptor */ -short events; /* events to look for */ -short revents; /* events returned */ -}; -.Ed -.Pp -The fields of -.Fa struct pollfd -are as follows: -.Bl -tag -width XXXrevents -.It fd -File descriptor to poll. -If the value in -.Em fd -is negative, the file descriptor is ignored and -.Em revents -is set to 0. -.It events -Events to poll for. -(See below.) -.It revents -Events which may occur. -(See below.) -.El -.Pp -The event bitmasks in -.Fa events -and -.Fa revents -have the following bits: -.Bl -tag -width XXXPOLLWRNORM -.It POLLIN -Data other than high priority data may be read without blocking. -.It POLLRDNORM -Normal data may be read without blocking. -.It POLLRDBAND -Data with a non-zero priority may be read without blocking. -.It POLLPRI -High priority data may be read without blocking. -.It POLLOUT -Normal data may be written without blocking. -.It POLLWRNORM -Equivalent to -POLLOUT. -.It POLLWRBAND -Data with a non-zero priority may be written without blocking. -.It POLLERR -An exceptional condition has occurred on the device or socket. -This flag is always checked, even if not present in the -.Fa events -bitmask. -.It POLLHUP -The device or socket has been disconnected. -This flag is always -checked, even if not present in the -.Fa events -bitmask. -Note that -POLLHUP -and -POLLOUT -should never be present in the -.Fa revents -bitmask at the same time. -If the remote end of a socket is closed, -.Fn poll -returns a -POLLIN -event, rather than a -POLLHUP. -.It POLLNVAL -The file descriptor is not open. -This flag is always checked, even -if not present in the -.Fa events -bitmask. -.El .Pp If .Fa timeout @@ -152,14 +84,16 @@ is neither zero nor INFTIM (\-1), it spe wait for any file descriptor to become ready, in milliseconds. If .Fa timeout -is INFTIM (\-1), the poll blocks indefinitely. +is INFTIM (\-1), then +.Pn poll +blocks indefinitely. If .Fa timeout is zero, then .Fn poll will return without blocking. .Pp -If +Similarly, if .Fa ts is a non-null pointer, it references a timespec structure which specifies a maximum interval to wait for any file descriptor to become ready. @@ -169,7 +103,7 @@ is a null pointer, .Fn pollts and .Fn ppoll -blocks indefinitely. +block indefinitely. If .Fa ts is a non-null pointer, referencing a zero-valued timespec structure, then @@ -184,11 +118,97 @@ is a non-null pointer, then the .Fn pollts and .Fn ppoll -function shall replace the signal mask of the caller by the set of +functions replace the signal mask of the caller by the set of signals pointed to by .Fa sigmask -before examining the descriptors, and shall restore the signal mask -of the caller before returning. +while the call is in progress, and restore the caller's original +signal mask before returning. +.Pp +The +.Vt pollfd +structure: +.Bd -literal +struct pollfd { +intfd; /* file descriptor */ +short events; /* events to look for */ +short revents; /* events re
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 23:54:03 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_conf.l testlang_parse.y Log Message: tests/libcurses: fix off-by-one error in line numbers in diagnostics I had broken this in testlang_parse.y 1.22 from 2021-02-07, when I extracted the common 'eol' from the statements. Extracting 'eol' had the effect that the action for the statement was run before the line number increased. Now the line numbers in the diagnostics are the same again as before. For lines that end with a backslash, the reported line number is the one from the last of these lines, not the first one, also as before. This feature is not used by any of the current tests though. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libcurses/director/testlang_conf.l cvs rdiff -u -r1.42 -r1.43 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_conf.l diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.17 src/tests/lib/libcurses/director/testlang_conf.l:1.18 --- src/tests/lib/libcurses/director/testlang_conf.l:1.17 Mon Feb 8 19:15:20 2021 +++ src/tests/lib/libcurses/director/testlang_conf.l Mon Feb 8 23:54:03 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_conf.l,v 1.17 2021/02/08 19:15:20 rillig Exp $ */ +/* $NetBSD: testlang_conf.l,v 1.18 2021/02/08 23:54:03 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -212,7 +212,7 @@ include BEGIN(incl); cur_file = strdup(inc_file); if (cur_file == NULL) err(2, "Cannot allocate new include file string"); - line = 0; + line = 1; BEGIN(INITIAL); } Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.42 src/tests/lib/libcurses/director/testlang_parse.y:1.43 --- src/tests/lib/libcurses/director/testlang_parse.y:1.42 Mon Feb 8 20:55:42 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 23:54:03 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.42 2021/02/08 20:55:42 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.43 2021/02/08 23:54:03 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -60,7 +60,7 @@ extern char *cur_file; /* from director int yylex(void); -size_t line; +size_t line = 1; static int input_delay; @@ -1433,7 +1433,7 @@ init_parse_variables(int initial) } free(command.args); } else { - line = 0; + line = 1; input_delay = 0; vars = NULL; nvars = 0;
CVS commit: src/tests/lib/libc/arch/sparc64
Module Name:src Committed By: joerg Date: Mon Feb 8 23:50:25 UTC 2021 Modified Files: src/tests/lib/libc/arch/sparc64: return_one.S Log Message: Don't define a label twice. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/arch/sparc64/return_one.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/arch/sparc64/return_one.S diff -u src/tests/lib/libc/arch/sparc64/return_one.S:1.2 src/tests/lib/libc/arch/sparc64/return_one.S:1.3 --- src/tests/lib/libc/arch/sparc64/return_one.S:1.2 Sat Dec 31 11:51:20 2016 +++ src/tests/lib/libc/arch/sparc64/return_one.S Mon Feb 8 23:50:25 2021 @@ -1,11 +1,10 @@ -/* $NetBSD: return_one.S,v 1.2 2016/12/31 11:51:20 martin Exp $ */ +/* $NetBSD: return_one.S,v 1.3 2021/02/08 23:50:25 joerg Exp $ */ #include .global return_one_end ENTRY(return_one) -return_one: retl mov 1, %o0 return_one_end:
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 20:55:42 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: use consistent indentation for grammar rules To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.41 src/tests/lib/libcurses/director/testlang_parse.y:1.42 --- src/tests/lib/libcurses/director/testlang_parse.y:1.41 Mon Feb 8 20:39:33 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 20:55:42 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.41 2021/02/08 20:39:33 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.42 2021/02/08 20:55:42 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -333,14 +333,30 @@ result : returns | reference ; -returns : numeric { assign_rets(data_number, $1); } - | LPAREN expr RPAREN { assign_rets(data_number, $2); } - | STRING { assign_rets(data_string, $1); } - | BYTE { assign_rets(data_byte, (void *) $1); } - | ERR_RET { assign_rets(data_err, NULL); } - | OK_RET { assign_rets(data_ok, NULL); } - | NULL_RET { assign_rets(data_null, NULL); } - | NON_NULL { assign_rets(data_nonnull, NULL); } +returns : numeric { + assign_rets(data_number, $1); + } + | LPAREN expr RPAREN { + assign_rets(data_number, $2); + } + | STRING { + assign_rets(data_string, $1); + } + | BYTE { + assign_rets(data_byte, (void *) $1); + } + | ERR_RET { + assign_rets(data_err, NULL); + } + | OK_RET { + assign_rets(data_ok, NULL); + } + | NULL_RET { + assign_rets(data_null, NULL); + } + | NON_NULL { + assign_rets(data_nonnull, NULL); + } | var ;
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 20:39:33 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: extract functions 'input' and 'noinput' from grammar To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.40 src/tests/lib/libcurses/director/testlang_parse.y:1.41 --- src/tests/lib/libcurses/director/testlang_parse.y:1.40 Mon Feb 8 20:26:46 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 20:39:33 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.40 2021/02/08 20:26:46 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.41 2021/02/08 20:39:33 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -140,6 +140,8 @@ static void compare_streams(const char * static void do_function_call(size_t); static void check(void); static void delay_millis(const char *); +static void do_input(const char *); +static void do_noinput(void); static void save_slave_output(bool); static void validate_type(data_enum_t, ct_data_t *, int); static void set_var(data_enum_t, const char *, void *); @@ -301,27 +303,14 @@ delay : DELAY numeric { ; input : INPUT STRING { - if (input_str != NULL) { - warnx("%s:%zu: Discarding unused input string", cur_file, line); - free(input_str); - } - - if ((input_str = malloc(strlen($2) + 1)) == NULL) - err(2, "Cannot allocate memory for input string"); - - strlcpy(input_str, $2, strlen($2) + 1); -} - ; - + do_input($2); + } + ; noinput : NOINPUT { - if (input_str != NULL) { - warnx("%s:%zu: Discarding unused input string", cur_file, line); - free(input_str); - } - - no_input = true; -} + do_noinput(); + } + ; compare : COMPARE PATH { compare_streams($2, true); @@ -1378,6 +1367,31 @@ delay_millis(const char *millis) init_parse_variables(0); } +static void +do_input(const char *s) +{ + if (input_str != NULL) { + warnx("%s:%zu: Discarding unused input string", cur_file, line); + free(input_str); + } + + if ((input_str = malloc(strlen(s) + 1)) == NULL) + err(2, "Cannot allocate memory for input string"); + + strlcpy(input_str, s, strlen(s) + 1); +} + +static void +do_noinput(void) +{ + if (input_str != NULL) { + warnx("%s:%zu: Discarding unused input string", cur_file, line); + free(input_str); + } + + no_input = true; +} + /* * Initialise the command structure - if initial is non-zero then just set * everything to sane values otherwise free any memory that was allocated
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 20:26:46 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: indent grammar functions consistently To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.39 src/tests/lib/libcurses/director/testlang_parse.y:1.40 --- src/tests/lib/libcurses/director/testlang_parse.y:1.39 Mon Feb 8 20:09:45 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 20:26:46 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.39 2021/02/08 20:09:45 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.40 2021/02/08 20:26:46 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -553,7 +553,8 @@ perform_delay(struct timespec *ts) /* * Add to temporary vals array */ -static wchar_t *add_to_vals(data_enum_t argtype, void *arg) +static wchar_t * +add_to_vals(data_enum_t argtype, void *arg) { wchar_t *retval = NULL; int have_malloced; @@ -867,8 +868,8 @@ find_var_index(const char *var_name) * Check the given function name in the given table of names, return 1 if * there is a match. */ -static int check_function_table(char *function, const char *table[], -int nfunctions) +static int +check_function_table(char *function, const char *table[], int nfunctions) { int i;
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 20:09:45 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: declare %type in grammar It looks as if the original author just didn't know how to declare the type of non-terminals. The explicit types in the '$' expressions were all consistent. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.38 src/tests/lib/libcurses/director/testlang_parse.y:1.39 --- src/tests/lib/libcurses/director/testlang_parse.y:1.38 Mon Feb 8 19:35:21 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 20:09:45 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.38 2021/02/08 19:35:21 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.39 2021/02/08 20:09:45 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -195,6 +195,9 @@ extern saved_data_t saved_output; %token COMMA %token CALL2 CALL3 CALL4 +%type attributes expr +%type array_elements array_element + %nonassoc OR %% @@ -223,7 +226,7 @@ assign : ASSIGN VARNAME numeric { set_var(data_number, $2, $3); } | ASSIGN VARNAME LPAREN expr RPAREN { - set_var(data_number, $2, $4); + set_var(data_number, $2, $4); } | ASSIGN VARNAME STRING { set_var(data_string, $2, $3); @@ -234,7 +237,7 @@ assign : ASSIGN VARNAME numeric { ; cchar : CCHAR VARNAME attributes char_vals { - set_cchar($2, $3); + set_cchar($2, $3); } ; @@ -245,10 +248,10 @@ wchar : WCHAR VARNAME char_vals { attributes : numeric | LPAREN expr RPAREN { - $$ = $2; + $$ = $2; } | VARIABLE { - $$ = get_numeric_var($1); + $$ = get_numeric_var($1); } ; @@ -342,7 +345,7 @@ result : returns ; returns : numeric { assign_rets(data_number, $1); } - | LPAREN expr RPAREN { assign_rets(data_number, $2); } + | LPAREN expr RPAREN { assign_rets(data_number, $2); } | STRING { assign_rets(data_string, $1); } | BYTE { assign_rets(data_byte, (void *) $1); } | ERR_RET { assign_rets(data_err, NULL); } @@ -378,17 +381,16 @@ array_elements : array_element ; array_element : numeric { - $$ = add_to_vals(data_number, $1); + $$ = add_to_vals(data_number, $1); } | VARIABLE { - $$ = add_to_vals(data_number, - get_numeric_var($1)); + $$ = add_to_vals(data_number, get_numeric_var($1)); } | BYTE { - $$ = add_to_vals(data_byte, (void *) $1); + $$ = add_to_vals(data_byte, (void *) $1); } | STRING { - $$ = add_to_vals(data_string, (void *) $1); + $$ = add_to_vals(data_string, (void *) $1); } | numeric MULTIPLIER numeric { unsigned long i; @@ -396,7 +398,7 @@ array_element : numeric { acount = strtoul($3, NULL, 10); for (i = 0; i < acount; i++) { -$$ = add_to_vals(data_number, $1); +$$ = add_to_vals(data_number, $1); } } | VARIABLE MULTIPLIER numeric { @@ -406,7 +408,7 @@ array_element : numeric { acount = strtoul($3, NULL, 10); val = get_numeric_var($1); for (i = 0; i < acount; i++) { -$$ = add_to_vals(data_number, val); +$$ = add_to_vals(data_number, val); } } | BYTE MULTIPLIER numeric { @@ -414,7 +416,7 @@ array_element : numeric { acount = strtoul($3, NULL, 10); for (i = 0; i < acount; i++) { -$$ = add_to_vals(data_byte, (void *) $1); +$$ = add_to_vals(data_byte, (void *) $1); } } | STRING MULTIPLIER numeric { @@ -422,18 +424,17 @@ array_element : numeric { acount = strtoul($3, NULL, 10); for (i = 0; i < acount; i++) { -$$ = add_to_vals(data_string, -(void *) $1); +$$ = add_to_vals(data_string, (void *) $1); } } ; expr : numeric | VARIABLE { - $$ = get_numeric_var($1); + $$ = get_numeric_var($1); } | expr OR expr { - $$ = numeric_or($1, $3); + $$ = numeric_or($1, $3); } ; @@ -442,7 +443,7 @@ args : /* empty */ ; arg : LPAREN expr RPAREN { - assign_arg(data_static, $2); + assign_arg(data_static, $2); } | numeric { assign_arg(data_static, $1);
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 19:35:22 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: extract function 'delay_millis' from the grammar To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.37 src/tests/lib/libcurses/director/testlang_parse.y:1.38 --- src/tests/lib/libcurses/director/testlang_parse.y:1.37 Mon Feb 8 19:28:08 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 19:35:21 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.37 2021/02/08 19:28:08 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.38 2021/02/08 19:35:21 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -139,6 +139,7 @@ static void write_func_and_args(void); static void compare_streams(const char *, bool); static void do_function_call(size_t); static void check(void); +static void delay_millis(const char *); static void save_slave_output(bool); static void validate_type(data_enum_t, ct_data_t *, int); static void set_var(data_enum_t, const char *, void *); @@ -292,32 +293,9 @@ check : CHECK var returns { ; delay : DELAY numeric { - /* set the inter-character delay */ - if (sscanf($2, "%d", &input_delay) == 0) - err(1, "%s:%zu: Delay specification %s must be an int", - cur_file, line, $2); - if (verbose) { - fprintf(stderr, "Set input delay to %d ms\n", input_delay); - } - - if (input_delay < DELAY_MIN) - input_delay = DELAY_MIN; - /* - * Fill in the timespec structure now ready for use later. - * The delay is specified in milliseconds so convert to timespec - * values - */ - delay_spec.tv_sec = input_delay / 1000; - delay_spec.tv_nsec = (input_delay - 1000 * delay_spec.tv_sec) * 1000; - if (verbose) { - fprintf(stderr, "set delay to %jd.%jd\n", - (intmax_t)delay_spec.tv_sec, - (intmax_t)delay_spec.tv_nsec); - } - - init_parse_variables(0); - } - ; + delay_millis($2); + } + ; input : INPUT STRING { if (input_str != NULL) { @@ -1369,6 +1347,35 @@ check(void) init_parse_variables(0); } +static void +delay_millis(const char *millis) +{ + /* set the inter-character delay */ + if (sscanf(millis, "%d", &input_delay) == 0) + err(1, "%s:%zu: Delay specification %s must be an int", + cur_file, line, millis); + if (verbose) { + fprintf(stderr, "Set input delay to %d ms\n", input_delay); + } + + if (input_delay < DELAY_MIN) + input_delay = DELAY_MIN; + /* + * Fill in the timespec structure now ready for use later. + * The delay is specified in milliseconds so convert to timespec + * values + */ + delay_spec.tv_sec = input_delay / 1000; + delay_spec.tv_nsec = (input_delay - 1000 * delay_spec.tv_sec) * 1000; + if (verbose) { + fprintf(stderr, "set delay to %jd.%jd\n", + (intmax_t)delay_spec.tv_sec, + (intmax_t)delay_spec.tv_nsec); + } + + init_parse_variables(0); +} + /* * Initialise the command structure - if initial is non-zero then just set * everything to sane values otherwise free any memory that was allocated
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 19:28:08 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: move function 'check' out of the grammar section This removes the inconsistent indentation. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.36 src/tests/lib/libcurses/director/testlang_parse.y:1.37 --- src/tests/lib/libcurses/director/testlang_parse.y:1.36 Mon Feb 8 19:15:20 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 19:28:08 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.36 2021/02/08 19:15:20 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.37 2021/02/08 19:28:08 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -138,6 +138,7 @@ static void read_cmd_pipe(ct_data_t *); static void write_func_and_args(void); static void compare_streams(const char *, bool); static void do_function_call(size_t); +static void check(void); static void save_slave_output(bool); static void validate_type(data_enum_t, ct_data_t *, int); static void set_var(data_enum_t, const char *, void *); @@ -286,96 +287,9 @@ call4 : CALL4 result result result resu ; check : CHECK var returns { - ct_data_t retvar; - var_t *vptr; - - if (command.returns[0].data_index == -1) - err(1, "%s:%zu: Undefined variable in check statement", - cur_file, line); - - if (command.returns[1].data_type == data_var) { - vptr = &vars[command.returns[1].data_index]; - command.returns[1].data_type = vptr->type; - command.returns[1].data_len = vptr->len; - if (vptr->type != data_cchar) - command.returns[1].data_value = vptr->value; - else - command.returns[1].data_value = &vptr->cchar; - } - - if (verbose) { - fprintf(stderr, "Checking contents of variable %s for %s\n", - vars[command.returns[0].data_index].name, - enum_names[command.returns[1].data_type]); - } - - /* - * Check if var and return have same data types - */ - if (((command.returns[1].data_type == data_byte) && - (vars[command.returns[0].data_index].type != data_byte))) - err(1, "Var type %s (%d) does not match return type %s (%d)", - enum_names[vars[command.returns[0].data_index].type], - vars[command.returns[0].data_index].type, - enum_names[command.returns[1].data_type], - command.returns[1].data_type); - - switch (command.returns[1].data_type) { - case data_err: - case data_ok: - validate_type(vars[command.returns[0].data_index].type, - &command.returns[1], 0); - break; - - case data_null: - validate_variable(0, data_string, "NULL", - command.returns[0].data_index, 0); - break; - - case data_nonnull: - validate_variable(0, data_string, "NULL", - command.returns[0].data_index, 1); - break; - - case data_string: - case data_number: - if (verbose) { - fprintf(stderr, " %s == returned %s\n", - (const char *)command.returns[1].data_value, - (const char *) - vars[command.returns[0].data_index].value); + check(); } - validate_variable(0, data_string, - command.returns[1].data_value, - command.returns[0].data_index, 0); - break; - - case data_byte: - vptr = &vars[command.returns[0].data_index]; - retvar.data_len = vptr->len; - retvar.data_type = vptr->type; - retvar.data_value = vptr->value; - validate_byte(&retvar, &command.returns[1], 0); - break; - - case data_cchar: - validate_cchar(&vars[command.returns[0].data_index].cchar, - (cchar_t *) command.returns[1].data_value, 0); - break; - - case data_wchar: - validate_wchar((wchar_t *) vars[command.returns[0].data_index].value, - (wchar_t *) command.returns[1].data_value, 0); - break; - - default: - err(1, "%s:%zu: Malformed check statement", cur_file, line); - break; - } - - init_parse_variables(0); -} - ; + ; delay : DELAY numeric { /* set the inter-character delay */ @@ -1362,6 +1276,99 @@ write_func_and_args(void) write_cmd_pipe(NULL); /* signal end of arguments */ } +static void +check(void) +{ + ct_data_t retvar; + var_t *vptr; + + if (command.returns[0].data_index == -1) + err(1, "%s:%zu: Undefined variable in check statement", + cur_file, line); + + if (command.returns[1].data_type == data_var) { + vptr = &vars[command.returns[1].data_index]; + command.returns[1].data_type = vptr->type; + command.returns[1].data_len = vptr->len; + if (vptr->type != data_cchar) + command.returns[1].data_value = vptr->value; + else + command.returns[1].data_value = &vptr->cchar; + } + + if (verbose) { + fprintf(stderr, "Checking contents of variable %s for %s\n", + vars[command.returns[0].data_index].name, + enum_names[command.returns[1].data_type]
CVS commit: src/tests/lib/libcurses
Module Name:src Committed By: rillig Date: Mon Feb 8 19:15:21 UTC 2021 Modified Files: src/tests/lib/libcurses/director: director.c director.h returns.h testlang_conf.l testlang_parse.y src/tests/lib/libcurses/slave: command_table.h commands.c curses_commands.c curses_commands.h slave.c slave.h Log Message: tests/libcurses: fix typo in license text To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/lib/libcurses/director/director.c \ src/tests/lib/libcurses/director/testlang_conf.l cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/director/director.h cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/director/returns.h cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libcurses/director/testlang_parse.y cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/slave/command_table.h \ src/tests/lib/libcurses/slave/curses_commands.h \ src/tests/lib/libcurses/slave/slave.h cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libcurses/slave/commands.c cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libcurses/slave/curses_commands.c cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libcurses/slave/slave.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/director.c diff -u src/tests/lib/libcurses/director/director.c:1.16 src/tests/lib/libcurses/director/director.c:1.17 --- src/tests/lib/libcurses/director/director.c:1.16 Mon Feb 8 19:04:37 2021 +++ src/tests/lib/libcurses/director/director.c Mon Feb 8 19:15:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: director.c,v 1.16 2021/02/08 19:04:37 rillig Exp $ */ +/* $NetBSD: director.c,v 1.17 2021/02/08 19:15:20 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -13,7 +13,7 @@ * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * 2. The name of the author may not be used to endorse or promote products - *derived from this software withough specific prior written permission + *derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Index: src/tests/lib/libcurses/director/testlang_conf.l diff -u src/tests/lib/libcurses/director/testlang_conf.l:1.16 src/tests/lib/libcurses/director/testlang_conf.l:1.17 --- src/tests/lib/libcurses/director/testlang_conf.l:1.16 Sun Feb 7 20:40:05 2021 +++ src/tests/lib/libcurses/director/testlang_conf.l Mon Feb 8 19:15:20 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_conf.l,v 1.16 2021/02/07 20:40:05 rillig Exp $ */ +/* $NetBSD: testlang_conf.l,v 1.17 2021/02/08 19:15:20 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -14,7 +14,7 @@ * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * 2. The name of the author may not be used to endorse or promote products - *derived from this software withough specific prior written permission + *derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Index: src/tests/lib/libcurses/director/director.h diff -u src/tests/lib/libcurses/director/director.h:1.1 src/tests/lib/libcurses/director/director.h:1.2 --- src/tests/lib/libcurses/director/director.h:1.1 Sat Oct 24 04:46:17 2020 +++ src/tests/lib/libcurses/director/director.h Mon Feb 8 19:15:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: director.h,v 1.1 2020/10/24 04:46:17 blymn Exp $ */ +/* $NetBSD: director.h,v 1.2 2021/02/08 19:15:20 rillig Exp $ */ /*- * Copyright 2020 Naman Jain , this code was @@ -14,7 +14,7 @@ * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * 2. The name of the author may not be used to endorse or promote products - *derived from this software withough specific prior written permission + *derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES Index: src/tests/lib/libcurses/director/returns.h diff -u src/tests/lib/libcurses/director/returns.h:1.4 src/tests/lib/libcurses/director/returns.h:1.5 --- src/tests/lib/libcurses/director/returns.h:1.4 Sun Feb 7 19:28:07 2021 +++ src/tests/lib/libcurses/director/returns.h Mon Feb 8 19:15:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: returns.h,v 1.4 2021/02/07 19:28:07 rillig Exp $ */ +/* $NetBSD: returns.h,v 1.5 2021/02/08 19:15:20 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -13,7 +13,7 @@ * 1. Redistributions of source code mus
CVS commit: src/distrib/evbarm/installimage
Module Name:src Committed By: martin Date: Mon Feb 8 19:11:41 UTC 2021 Modified Files: src/distrib/evbarm/installimage: Makefile Log Message: Use the same naming scheme for install images as we use for the ISO images. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/evbarm/installimage/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/evbarm/installimage/Makefile diff -u src/distrib/evbarm/installimage/Makefile:1.7 src/distrib/evbarm/installimage/Makefile:1.8 --- src/distrib/evbarm/installimage/Makefile:1.7 Mon Nov 16 11:38:29 2020 +++ src/distrib/evbarm/installimage/Makefile Mon Feb 8 19:11:41 2021 @@ -1,8 +1,8 @@ -# $NetBSD: Makefile,v 1.7 2020/11/16 11:38:29 rin Exp $ +# $NetBSD: Makefile,v 1.8 2021/02/08 19:11:41 martin Exp $ .include -INSTIMGBASE= NetBSD-${DISTRIBVER}-${MACHINE_ARCH}-install # gives ${IMGBASE}.img +INSTIMGBASE= NetBSD-${DISTRIBVER}-evbarm-${MACHINE_ARCH}-install # gives ${IMGBASE}.img INSTIMAGEMB?= 1550 # for all installation binaries
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 19:09:59 UTC 2021 Modified Files: src/tests/lib/libcurses/director: testlang_parse.y Log Message: tests/libcurses: remove unused token DRAIN There is a special function named 'DRAIN', but not a statement. The function name does not need its own token. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/tests/lib/libcurses/director/testlang_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/testlang_parse.y diff -u src/tests/lib/libcurses/director/testlang_parse.y:1.34 src/tests/lib/libcurses/director/testlang_parse.y:1.35 --- src/tests/lib/libcurses/director/testlang_parse.y:1.34 Sun Feb 7 21:33:27 2021 +++ src/tests/lib/libcurses/director/testlang_parse.y Mon Feb 8 19:09:59 2021 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: testlang_parse.y,v 1.34 2021/02/07 21:33:27 rillig Exp $ */ +/* $NetBSD: testlang_parse.y,v 1.35 2021/02/08 19:09:59 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -191,7 +191,7 @@ extern saved_data_t saved_output; %token WCHAR %token EOL CALL CHECK NOINPUT OR MULTIPLIER LPAREN RPAREN LBRACK RBRACK %token COMMA -%token CALL2 CALL3 CALL4 DRAIN +%token CALL2 CALL3 CALL4 %nonassoc OR
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 19:04:37 UTC 2021 Modified Files: src/tests/lib/libcurses/director: director.c Log Message: tests/libcurses: fix sentinel for execl For systems where NULL is defined as a simple 0 or 0L. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libcurses/director/director.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/director.c diff -u src/tests/lib/libcurses/director/director.c:1.15 src/tests/lib/libcurses/director/director.c:1.16 --- src/tests/lib/libcurses/director/director.c:1.15 Mon Feb 8 19:00:22 2021 +++ src/tests/lib/libcurses/director/director.c Mon Feb 8 19:04:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: director.c,v 1.15 2021/02/08 19:00:22 rillig Exp $ */ +/* $NetBSD: director.c,v 1.16 2021/02/08 19:04:37 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -273,7 +273,7 @@ main(int argc, char *argv[]) if (asprintf(&arg4, "%d", slvpipe[1]) < 0) err(1, "arg4 conversion failed"); - if (execl(slave, slave, arg1, arg2, arg3, arg4, NULL) < 0) + if (execl(slave, slave, arg1, arg2, arg3, arg4, (char *)0) < 0) err(1, "Exec of slave %s failed", slave); /* NOT REACHED */
CVS commit: src/tests/lib/libcurses/director
Module Name:src Committed By: rillig Date: Mon Feb 8 19:00:22 UTC 2021 Modified Files: src/tests/lib/libcurses/director: director.c Log Message: tests/libcurses: on errors, print nonprintable characters as well To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/director/director.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libcurses/director/director.c diff -u src/tests/lib/libcurses/director/director.c:1.14 src/tests/lib/libcurses/director/director.c:1.15 --- src/tests/lib/libcurses/director/director.c:1.14 Sun Feb 7 13:56:23 2021 +++ src/tests/lib/libcurses/director/director.c Mon Feb 8 19:00:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: director.c,v 1.14 2021/02/07 13:56:23 rillig Exp $ */ +/* $NetBSD: director.c,v 1.15 2021/02/08 19:00:22 rillig Exp $ */ /*- * Copyright 2009 Brett Lymn @@ -84,8 +84,11 @@ slave_died(int param) if (saved_output.count > 0) { fprintf(stderr, "output from slave: "); for (count = 0; count < saved_output.count; count ++) { - if (isprint((unsigned char)saved_output.data[count])) - fprintf(stderr, "%c", saved_output.data[count]); + unsigned char b = saved_output.data[count]; + if (isprint(b)) +fprintf(stderr, "%c", b); + else +fprintf(stderr, "\\x%02x", b); } fprintf(stderr, "\n"); }
CVS commit: src/sys/kern
Module Name:src Committed By: wiz Date: Mon Feb 8 09:31:05 UTC 2021 Modified Files: src/sys/kern: subr_pcq.c Log Message: Fix typo in comment. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_pcq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/subr_pcq.c diff -u src/sys/kern/subr_pcq.c:1.12 src/sys/kern/subr_pcq.c:1.13 --- src/sys/kern/subr_pcq.c:1.12 Tue Jan 12 19:36:39 2021 +++ src/sys/kern/subr_pcq.c Mon Feb 8 09:31:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pcq.c,v 1.12 2021/01/12 19:36:39 skrll Exp $ */ +/* $NetBSD: subr_pcq.c,v 1.13 2021/02/08 09:31:05 wiz Exp $ */ /*- * Copyright (c) 2009, 2019 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.12 2021/01/12 19:36:39 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pcq.c,v 1.13 2021/02/08 09:31:05 wiz Exp $"); #include #include @@ -124,7 +124,7 @@ pcq_put(pcq_t *pcq, void *item) /* * Synchronization activity to wake up the consumer will ensure * that the update to pcq_items[] is visible before the wakeup - * arrives. So, we do not need an additonal memory barrier here. + * arrives. So, we do not need an additional memory barrier here. */ return true; }