1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00
serenity/Userland/Libraries/LibC/sys
Daniel Bertalan f95a11a7da LibC: Don't delete null check in gettimeofday
The `nonnull` attribute may delete null checks in the generated code, as
per the [GCC documentation]:

> The compiler may also perform optimizations based on the knowledge
> that nonnul parameters cannot be null. This can currently not be
> disabled other than by removing the nonnull attribute.

Disassembling the function as compiled by GCC, we can see that there is
no branch based on if `tv` is null.  This means that `gettimeofday`
would produce UB if passed a null parameter, even if we wanted to
predictably return an error.  Clang refuses to compile this due to a
`pointer-bool-conversion` warning.

In this commit, `settimeofday` is changed as well to match
`gettimeofday`'s null argument handling.

[GCC documentation]:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute
2021-08-12 21:10:44 +02:00
..
arch HackStudio: Enable building HackStudio on x86_64 2021-08-02 00:57:06 +02:00
cdefs.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
file.cpp LibC: Implement flock(2) using fcntl's F_SETLK 2021-07-20 17:44:30 +04:30
file.h LibC: Implement flock(2) using fcntl's F_SETLK 2021-07-20 17:44:30 +04:30
internals.h LibC: Don't use C++ attribute syntax in C-visible headers 2021-07-03 01:56:31 +04:30
ioctl.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ioctl_numbers.h Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
kcov.h Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
mman.cpp LibC: Fix negation overflow UB in sys/mman.cpp 2021-08-08 10:55:36 +02:00
mman.h LibC: Stub mlock in sys/mman 2021-07-30 20:49:56 +02:00
param.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
prctl.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
prctl.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
prctl_numbers.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ptrace.cpp Everywhere: Remove empty line after function body opening curly brace 2021-04-25 20:20:00 +02:00
ptrace.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
resource.h LibC: Add definition for the rlim_t type 2021-05-09 17:21:38 +01:00
select.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
select.h LibC: Make sure the definition for struct timeval is available 2021-06-16 20:08:13 +02:00
socket.cpp Kernel+Userspace: Implement the accept4() system call 2021-05-17 13:32:19 +02:00
socket.h Kernel+LibC: Add linger to sys/sockets.h 2021-07-29 19:35:03 +01:00
stat.h Kernel+LibC: Add fstatat 2021-05-14 23:32:10 +02:00
statvfs.cpp LibC: Add functions for the new statvfs syscalls 2021-05-19 21:33:29 +02:00
statvfs.h LibC: Add functions for the new statvfs syscalls 2021-05-19 21:33:29 +02:00
sysmacros.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
time.h LibC: Don't delete null check in gettimeofday 2021-08-12 21:10:44 +02:00
times.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ttydefaults.h LibC: Use \010 for erasing instead of \0177 2021-05-23 19:32:31 +02:00
types.h Kernel+LibC: Use 64 bit values for ino_t 2021-08-12 20:57:32 +02:00
uio.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
uio.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
un.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
utsname.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
wait.cpp LibC: Do not include errno.h inside unistd.h 2021-05-14 22:24:02 +02:00
wait.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00