Commit Graph

4035 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
a089c17d32 linux(4): Fix "set but not used" warnings
No functional changes.

Sponsored By:	EPSRC
2021-11-29 16:45:16 +00:00
Mateusz Guzik
7e1d3eefd4 vfs: remove the unused thread argument from NDINIT*
See b4a58fbf64 ("vfs: remove cn_thread")

Bump __FreeBSD_version to 1400043.
2021-11-25 22:50:42 +00:00
Mateusz Guzik
c40fee6f7d vfs: drop the always curthread argument from kern_alternate_path 2021-11-25 22:50:42 +00:00
Mateusz Guzik
af4051d250 linux: remove the always curthread argument from lconvpath 2021-11-25 22:50:42 +00:00
Bjoern A. Zeeb
943df073a3 LinuxKPI: USB return possible error from suspend/resume
USB suspend/resume cannot fail so we never returned the error which
resulted in a -Wunused-but-set-variable warning.
Initialize the return variable and return a possible error possibly
triggering a printf upstream to at least have a trace of the problem.
This also fixes the warning.

Suggested by:	hselasky
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D33107
2021-11-24 21:32:38 +00:00
Bjoern A. Zeeb
7043359ce3 LinuxKPI: fix -Wunused-but-set-variable warnings
Handle write-only variables by removing the unused return value from void
functions or removing the unused variables entirely.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D33107
2021-11-24 21:32:38 +00:00
Mateusz Guzik
ae3d955404 linprocfs: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-24 21:18:36 +00:00
Mateusz Guzik
74a0e24f07 linux: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-24 21:16:03 +00:00
Mateusz Guzik
1caaf55585 32-bit compat: plug a set-but-not-unused var in freebsd32_copy_msg_out
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-24 16:25:50 +00:00
Brooks Davis
b92f4ae58a freebsd32: regen
There there are two changes here. First, ofreebsd32_sigreturn
is declared to take a struct osigcontext rather than a struct
ia32_sigcontext3. This type is incorrect, but harmlessly so.
Second, the name of the unimplemented ogetkerninfo changes in
freebsd32_syscallnames.
2021-11-22 22:36:58 +00:00
Brooks Davis
be67ea40c5 freebsd32: generate from sys/kern/syscalls.master
This avoids the need to keep a freebsd32-specific syscalls.master
in sync with the default ABI.  As evidenced by the number of commits
required to sync the two, it is extremely easy for them to get out
of sync due to misunderstandings and user errors.

Reviewed by:	kevans, kib
2021-11-22 22:36:58 +00:00
Brooks Davis
30bc335a05 freebsd32: regen 2021-11-22 22:36:57 +00:00
Brooks Davis
faa67c2b20 freebsd32: generate splits of 64-bit arguments
This eliminates the need for ifdefs in syscalls.master and contains the
largest set of diff to generated files on the way to switching to using
the default ABI's syscalls.master.

Reviewed by:	kevans
2021-11-22 22:36:57 +00:00
Brooks Davis
6b7c23a026 syscalls: regen 2021-11-22 22:36:57 +00:00
Brooks Davis
97fdcfcaf7 freebsd32: remove unnecessicary headers
Reviewed by:	kib
2021-11-22 22:36:56 +00:00
Brooks Davis
bcd07aaa4e freebsd32: regen 2021-11-22 22:36:56 +00:00
Brooks Davis
6eefabd4ca syscalls: improve nstat, nfstat, nlstat
Optionally return errors when truncating dev_t, ino_t, and nlink_t.
In the interest of code reuse, use freebsd11_cvtstat() to perform the
truncation and error handling and then convert the resulting struct
freebsd11_stat to struct nstat.

Add missing freebsd32 compat syscalls. These syscalls require
translation because struct nstat contains four instances of struct
timespec which in turn contains a time_t and a long.

Reviewed by:	kib
2021-11-22 22:36:56 +00:00
Brooks Davis
8460d3e9e6 freebsd32: regen 2021-11-22 22:36:55 +00:00
Brooks Davis
151ddfec6f freebsd32: add _'s to _umtx_(un)lock
This aligns with the default ABI's configuration.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
b2be098e52 freebsd32: enable orecvfrom
It requires no translation, just a correct decleration.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
2d691434d5 freebsd32: declare ogetsockname correctly
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
6f5eb383bd freebsd32: sync some osig* audit flags with default ABI
Discussed with:	rwatson

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
802280ada8 freebsd32: sctp syscalls take struct iovec32
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
06759303ec freebsd32: aio_cancel takes a struct aiocb32
Strictly speaking, it takes a virtual address and doesn't touch the
object directly, but this is consistant with other aio_*() syscalls.

Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
e11f2743ff freebsd32: [gs]etgroups take an int gidsetsize
Reviewed by:	kib
2021-11-22 22:36:55 +00:00
Brooks Davis
e54a870e35 freebsd32: make semsys take int arguments
This matches the default ABI.

Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Brooks Davis
1eacca4397 freebsd32: make fcntl's arg argument int32_t
It's a long in the default ABI so this is consistant with other caes.

Reviewed by:	kib
2021-11-22 22:36:54 +00:00
Bjoern A. Zeeb
ae2268efd5 LinuxKPI: make bcd.h use libkern
Rather than having code to re-define bcd2bin() for the LinuxKPI
make sure libkern.h is always included before the LinuxKPI version.
Then only re-define our local LinuxKPI implementation.  [1]

From the argument truncating wrapper call the libkern version.
If we change our libkern implementation in the future we can save
us the remainder of the hassle. [2]  Given I need this to MFC,
which I am not sure we can with libkern, commit this intermediate
step.

Suggested by:	Johannes Berg (johannes sipsolutions.net) [1]
Suggested by:	ian [2]
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	548ada00e5
Differential Revision: https://reviews.freebsd.org/D32695
2021-11-18 23:10:34 +00:00
Brooks Davis
fea4a9aff1 fspacectl: remove unneeded freebsd32 wrapper
fspacectl(2) does not require special handling on freebsd32. The
presence of off_t in a struct does not cause it's size to change
between the native ABI and the 32-bit ABI supported by freebsd32
because off_t is always int64_t on BSD systems.  Further, byte
order only requires handling for paired argument or return registers.

(32-byte alignment of 64-bit objects on i386 can require special
handling, but that situtation does not apply here.)

Reviewed by:	kib, khng, emaste, delphij
Differential Revision:	https://reviews.freebsd.org/D32994
2021-11-18 01:02:06 +00:00
John Baldwin
8b2ce7a3bb linux_name_to_handle_at: Support AT_EMPTY_PATH.
Reviewed by:	kib
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D33050
2021-11-17 15:51:18 -08:00
John Baldwin
a8d885296a linux_linkat: Don't invert AT_* flags.
Reviewed by:	kib
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D33048
2021-11-17 15:51:06 -08:00
Brooks Davis
572be9c8ae freebsd32: sync some audit types with default ABI
Reviewed by:	kevans
2021-11-17 20:12:27 +00:00
Brooks Davis
67fb0300ae freebsd32: sync return types with default ABI
This consists of int -> ssize_t where required and one int -> mode_t.
As a rule, return types are informative rather than functional as the
actual return is in a register.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
265a4b8341 freebsd32: semid_t -> int32_t
semid_t is historically an intptr_t so it should be an int32_t.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
1a7a780bf4 freebsd32: update unimplemented syscall comments
These were out of sync with sys/kern/syscalls.master

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
aef154d3f2 freebsd32: use __socklen_t consistently
Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
738ec2ed66 freebsd32: tag RESERVED syscalls
This reduces diffs when generating freebsd32 files from the default
ABI's syscalls.master.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
a016320dfb freebsd32: rename 32-bit compat pads to _pad
Some 32-bit architectures pass 64-bit values in aligned
register pairs (a0,a1), (a2,a3) etc.  In freebsd32 we add these pads
explicitly from compat code.  We also sometimes add pads in the default
ABI.  Differentiate the two by making the freebsd32 ones int _pad.
In a future commit the 32-bit ones will be automatically generated.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
158dcd7395 freebsd32: have sigqueue take a void *
This matches the default ABI and we work around issues with
union sigval by extracting the bottom 32-bits in a manual handler.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
2b9d052d3e freebsd32: fix getfsstat sign extension bugs
Add freebsd32 versions of getfsstat and freebsd11_getfsstat so that
bufsize is properly sign-extended if a negative value is passed.
Reject negative values before passing to kern_getfsstat as a size_t.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
f19e3fd206 freebsd32: signed long corrections
Syscalls that take signed longs need to treat the 32-bit versions as
signed int so that sign extension happens correctly.  Improve
decleration quality and add a few minimal syscall implementations.

Reviewed by:	kevans
2021-11-17 20:12:26 +00:00
Brooks Davis
d257e57d18 freebsd32: add missing pads to preadv and pwritev
Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
f089a2f3d1 freebsd32: add stubs for ofreebsd32_(send|recv)msg
The upcoming change to generate freebsd32 generated files from
sys/kern/syscalls.master doesn't have a way to handle disabling
this one without disabling the non-COMPAT counterpart so just add
a stub for now.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
e02f64d9b8 freebsd32: add real abort2
Previously, the code would copy twice as many pointers as specified
and print pairs of them a single 64-bit pointer.

abort2 doesn't return so make the return type void

freebsd32_abort2 is in it's own file with a 2-clause BSD license
based on a discussion with Wojciech many years ago.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
e3e811a3f8 freebsd32: add feed foward clock syscalls
These are required when supporting i386 because time_t is 32-bit which
reduces struct bintime to 12-bytes when combined with the fact that 64-bit
integers only requiring 32-bit alignment on i386.  Reusing the default
ABI version resulted in 4-byte overreads or overwrites to userspace.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
7bd795650f freebsd32: enable trivial syscalls
These syscalls require no translation.  They were simply missing
from compat/freebsd32/syscalls.master.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
91301e6ea5 freebsd32: don't implement kldsym
Previously we fell back to sys_kldsym, but because we'd always
mismatch on the version field we'd return EINVAL.  A freebsd32
implementation is impossible with the current ABI as there simply
isn't space to store a kernel virtual address in a uint32_t.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
25fec55b86 freebsd32: remove freebsd11_freebsd32_getdents
It's exactly the same as freebsd11_getdents.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
1de34945f4 freebsd32: remove redundent osig*() implementations
ofreebsd32_sigprocmask, ofreebsd32_sigblock, ofreebsd32_sigsetmask,
and ofreebsd32_sigsuspend were all duplicates of the default ABI
versions and there are no type concerns as all arguments are the
same.

Reviewed by:	kevans
2021-11-17 20:12:25 +00:00
Brooks Davis
dbb47e9264 freebsd32: remove freebsd32_recvfrom
The freebsd32_recvfrom() serves no purpose as no arguments require
translation.  The prototype was mis-declared and the implementation
contained (relatively harmless) errors.

Reviewed by:	kevans
2021-11-17 20:12:24 +00:00