Commit Graph

290004 Commits

Author SHA1 Message Date
rillig e6898815f6 lint: continue analysis of wrong type in abstract declaration
No functional change.
2021-09-13 06:11:51 +00:00
rillig c67e0c13ab lint: replace comment in new_style_function with equivalent code
No functional change.
2021-09-13 05:25:27 +00:00
rillig 6710905103 lint: eliminate local variable in new_style_function
No functional change.
2021-09-13 05:21:30 +00:00
dholland e66c058fbf Fix broken build with MKKERBEROS=no 2021-09-13 01:12:36 +00:00
rillig c3be846008 lint: track down wrong function type in abstract type 2021-09-12 17:30:53 +00:00
rillig 732fd0a332 lint: add more details to error about redeclaration
Message 27 is triggered by several conditions.  The one triggered by
register_vget in sbin/fsck_lfs/vnode.c needs more details than the
others.
2021-09-12 16:28:44 +00:00
rillig 9cc1de7aaf tests/lint: demonstrate parse error for function-type parameters
Seen in sbin/fsck_lfs/vnode.c(104), where lint wrongly complains:

	error: redeclaration of register_vget [27]
2021-09-12 16:08:14 +00:00
rillig 659f7da53b tests/lint: make documentation for lint2/msg_000 less ambiguous 2021-09-12 16:07:16 +00:00
rillig a77734b2e6 sys/bitops.h: fix __BITMAP_ZERO for non-GCC compilers
Running 'make -C sbin/cgdconfig lint' failed with:

cgdconfig.c(1253): error: left operand of '->' must be pointer to struct
    or union, not 'struct <unnamed>' [104]
2021-09-12 15:22:05 +00:00
rillig 0d4f628f26 tests/make: allow to only test selected variants
Testing all variants takes several minutes, so make it possible to test
a single or a few test variants separately.
2021-09-12 10:28:40 +00:00
rillig 6ed5d652f1 tests/make: make output of test job-output-null clearer
Having 5 times the word 'hello' in the output doesn't help at
understanding the test and how the output was produced.

Bash 5 sometimes makes this test fail by adding '2b' and '2c' to the
output.
2021-09-12 10:26:49 +00:00
rillig 004358f1ef lint: un-abbreviate rvused and rvdisc
No functional change.
2021-09-12 10:06:03 +00:00
rillig 9646fe36d1 make: error out if a pre-C99 platform defines bool in some cases
On NetBSD/amd64 9.99.88, when compiling make in C90 mode, make.h defined
its own boolean type as an alias for unsigned int.  Not plain int since
that would make the value of bit-fields -1 instead of 1.

This worked fine for all files except main.c, which includes
<sys/sysctl.h>, which in turn includes <stdbool.h> unconditionally, even
in C90 mode.  This meant that in main.c, sizeof(bool) was 1, while in
all other files it was 4.

This in turn led to a segmentation fault when ParseDependencySourceMain
tried to access opts.create.  Since parse.c assumed sizeof(bool) == 4,
it computed an offset outside of struct CmdOpts, which was defined in
main.c with sizeof(bool) == 1.

Rather than risking these segmentation faults, prevent building make on
platforms like these and suggest a proper workaround.
2021-09-12 09:51:14 +00:00
skrll 1d1583e21f comment whitespace 2021-09-12 09:05:01 +00:00
rillig ae40dd0430 make: fix build for DEBUG_HASH_LOOKUP 2021-09-12 08:36:14 +00:00
rillig 4c3b96d532 make: reduce number of relocations in Targ_PrintType
On x86_64, this saves 120 bytes of .text.

No functional change.
2021-09-12 08:32:23 +00:00
skrll 89a8066371 pmap_page_remove: simply and reduce the code size slightly. 2021-09-12 08:23:57 +00:00
rillig 2e8b3da821 make: fix lint warnings for strict bool mode
In strict bool mode, lint does not consider 'x & y' as having type bool,
if x and y have integer type, it only allows this for enums.

No functional change.
2021-09-12 08:03:48 +00:00
rillig b9d1479cd1 make: fix Targ_PrintType for pre-C99 compilers 2021-09-12 07:52:21 +00:00
rillig c53937813d make: make Targ_PrintType simpler
No functional change.
2021-09-12 07:50:45 +00:00
skrll 89017e0d45 More debug. 2021-09-12 07:14:50 +00:00
wiz b90ee919d5 Mark up NULL with Dv. 2021-09-12 06:53:08 +00:00
nat 31999006e0 Fix build for uniprocessor. 2021-09-12 03:58:52 +00:00
kre bc2fe2a15e Improve the formatting of the list of Built-in commands for those
commands with multiple synopsis lines (eg: trap).

But there really must be a better way to achieve this effect than
the way it is accomplished here, and I'm hoping some wizard who
understands mdoc much better than I do will revert this change and
do it using some inspired magic incantation instead.
2021-09-12 02:20:36 +00:00
kre 777df0a3cd Don't dereference NULL on "jobs -Z" (with no title given), instead
do setproctitle(NULL) (which is not the same thing at all).  Do the
same with jobs -Z '' as setting the title to "sh: " isn't useful.

Improve the way this is documented, and note that it is only done
this way because zsh did it first (ie: pass on the balme, doing this
in the jobs command is simply absurd.)
2021-09-12 01:30:41 +00:00
nia fc1c2345ce Bootloader banner changes 2021-09-11 22:34:17 +00:00
andvar 80f2027016 sysinst/partitions.h: fix typos comments, also fix same typos in other files. 2021-09-11 21:30:46 +00:00
christos a902e362a3 like zsh, have jobs -Z do setproctitle 2021-09-11 20:55:03 +00:00
christos 4e2a477813 Add jobs -Z (like in zsh(1)) to setproctitle(3). 2021-09-11 20:43:32 +00:00
andvar 207defd036 Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
2021-09-11 20:28:03 +00:00
rillig f64856e518 stdio.h: remove outdated comment for vscanf
When these functions where added to stdio.h 1.72 on 2008-08-04, the
conditional included _NETBSD_SOURCE.

The additional condition was removed in stdio.h 1.99 from 2020-03-20,
but the comment was not updated.
2021-09-11 20:05:33 +00:00
rillig 7f8984330e popen.3: move popenve from BUGS to HISTORY 2021-09-11 19:58:24 +00:00
mrg 6c78f051ad add 32.0GT/s to the list of pcie speeds (PCIe 5.x.) 2021-09-11 19:56:51 +00:00
rillig 0a201ba3c7 stdio.h: sync comment for struct __sFILE with reality
In stdio.h 1.1 from 1993-03-21, the struct had a member named _ub for
the ungetc buffer.  That member was repurposed in stdio.h 1.42 from
2001-12-07 in order to support wide characters.

Remove the reference to the 'WARNING above' since there is no such
warning and even when this comment was added in stdio.h 1.20 from
1998-02-02, there was none.
2021-09-11 19:05:06 +00:00
rillig 26b8655ee8 fseek.3: fix grammar 2021-09-11 18:46:22 +00:00
rillig fb6d4a2598 stdio.h: remove outdated comment about fpos_t
The 'fairly grotesque' from 1994-04-03 referred to the conditional
definition of the type fpos_t, using two different integer types that
both happened to be 64-bit.

When stdio was changed on 2012-01-22 to keep track of the mbstate, the
conditional type definition was removed and the comment no longer made
sense.
2021-09-11 18:38:25 +00:00
rillig bdb5d51c43 tests/stdio: normalize whitespace 2021-09-11 18:18:28 +00:00
rillig 16f5958b18 stdio.h: fix typo in comment 2021-09-11 16:58:38 +00:00
macallan 2659ceeb47 fix license copypasta
NFC
2021-09-11 16:29:18 +00:00
pgoyette 91ba062cc6 Build and install the if_run module. run(4) is not necessarily included
in all GENERIC kernels (as reported on libera IRC).
2021-09-11 16:10:37 +00:00
christos 70764037a3 Ignore failed closes (if for example a closed file descriptor is passed as
a starting point). This is how the kernel behaves.
2021-09-11 14:23:04 +00:00
christos 42a6419698 remove fake closefrom() 2021-09-11 14:22:12 +00:00
riastradh 1bde04c4b7 ksyms: Use pserialize(9) for kernel access to ksyms.
This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.
2021-09-11 10:09:55 +00:00
riastradh 1878261ab3 ksyms(4): Take a complete snapshot on each open.
- Snapshots are stored in pageable anonymous uvm objects.
- Snapshots are reference-counted so they can be reused across opens.
- Opening /dev/ksyms blocks module unload until snapshot is taken.
- Merely holding /dev/ksyms open does not block module unload.
- /dev/ksyms is now mmappable.

This slightly changes the behaviour of fstat(2) on /dev/ksyms -- it
is a little more useful now!  In particular, st_size is the size of
the symbol table.  Some other fields which were not very useful to
begin with -- st_dev, st_ino, st_mode, st_nlink, st_*time,
st_blksize, st_blocks -- are now different, and independent of the
file system on which the device node resides.

Discussed in

https://mail-index.netbsd.org/source-changes-d/2021/08/17/msg013425.html

This is option (3), adapted to make the ksyms snapshots pageable,
after options (1) and (2) posed practical problems.
2021-09-11 10:09:31 +00:00
riastradh bad22de4cf sys/kern: Avoid fp->f_offset without the object (here, vnode) lock. 2021-09-11 10:09:13 +00:00
riastradh 1f941f7217 sys/kern: Allow custom fileops to specify fo_seek method.
Previously only vnodes allowed lseek/pread[v]/pwrite[v], which meant
converting a regular device to a cloning device doesn't always work.

Semantics is:

(*fp->f_ops->fo_seek)(fp, delta, whence, newoffp, flags)

1. Compute a new offset according to whence + delta -- that is, if
   whence is SEEK_CUR, add delta to fp->f_offset; if whence is
   SEEK_END, add delta to end of file; if whence is SEEK_CUR, use delta
   as is.

2. If newoffp is nonnull, return the new offset in *newoffp.

3. If flags & FOF_UPDATE_OFFSET, set fp->f_offset to the new offset.

Access to fp->f_offset, and *newoffp if newoffp = &fp->f_offset, must
happen under the object lock (e.g., vnode lock), in order to
synchronize fp->f_offset reads and writes.

This change has the side effect that every call to VOP_SEEK happens
under the vnode lock now, when previously it didn't.  However, from a
review of all the VOP_SEEK implementations, it does not appear that
any file system even examines the vnode, let alone locks it.  So I
think this is safe -- and essentially the only reasonable way to do
things, given that it is used to validate a change from oldoff to
newoff, and oldoff becomes stale the moment we unlock the vnode.

No kernel bump because this reuses a spare entry in struct fileops,
and it is safe for the entry to be null, so all existing fileops will
continue to work as before (rejecting seek).
2021-09-11 10:08:55 +00:00
rillig 3c9047a5a9 make: eliminate a few common subexpressions
This commit contains only changes that don't increase the code size on
x86_64.  Replacing the remaining instance of ModChain_ShouldEval would
either increase the code size or make the code harder to understand.

No functional change.
2021-09-11 09:16:14 +00:00
rillig d27ba004df stdio.h: fix typo in comment 2021-09-11 08:34:24 +00:00
rillig d539a31d62 librumphijack: fix typo for NetBSD < 5.99.7 2021-09-11 08:32:11 +00:00
jmcneill be7a1694bf GIC: Support SPI affinity routing before secondary CPUs have hatched.
Instead of reading MPIDR from CPU init to determine a routing target, trust
system configuration data (Devicetree or ACPI) to properly fill in ci_cpuid.
This allows for SPI affinity routing to work before secondary CPUs are
hatched; previously, one of two things would happen:

a) If 1ofN distribution is supported, the SPI could be distributed to any
   participating PE.
b) If 1ofN distribution is not supported, the SPI would not be forwarded
   and would stay pending.
2021-09-11 01:49:11 +00:00