mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:34:57 +00:00
Kernel+LibC: Pass 64-bit integers in syscalls by value
Now that support for 32-bit x86 has been removed, we don't have to worry about the top half of `off_t`/`u64` values being chopped off when we try to pass them in registers. Therefore, we no longer need the workaround of pointers to stack-allocated values to syscalls. Note that this changes the system call ABI, so statically linked programs will have to be re-linked.
This commit is contained in:
parent
87f4b0f1c2
commit
286984750e
12 changed files with 22 additions and 37 deletions
|
@ -118,7 +118,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
|
|||
int posix_fallocate(int fd, off_t offset, off_t len)
|
||||
{
|
||||
// posix_fallocate does not set errno.
|
||||
return -static_cast<int>(syscall(SC_posix_fallocate, fd, &offset, &len));
|
||||
return -static_cast<int>(syscall(SC_posix_fallocate, fd, offset, len));
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html
|
||||
|
|
|
@ -22,7 +22,7 @@ int disown(pid_t pid)
|
|||
|
||||
int profiling_enable(pid_t pid, uint64_t event_mask)
|
||||
{
|
||||
int rc = syscall(SC_profiling_enable, pid, &event_mask);
|
||||
int rc = syscall(SC_profiling_enable, pid, event_mask);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ ssize_t pwritev(int fd, struct iovec const* iov, int iov_count, off_t offset)
|
|||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
int rc = syscall(SC_pwritev, fd, iov, iov_count, &offset);
|
||||
int rc = syscall(SC_pwritev, fd, iov, iov_count, offset);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,7 +392,7 @@ ssize_t pread(int fd, void* buf, size_t count, off_t offset)
|
|||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
int rc = syscall(SC_pread, fd, buf, count, &offset);
|
||||
int rc = syscall(SC_pread, fd, buf, count, offset);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
@ -897,7 +897,7 @@ char* getlogin()
|
|||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html
|
||||
int ftruncate(int fd, off_t length)
|
||||
{
|
||||
int rc = syscall(SC_ftruncate, fd, &length);
|
||||
int rc = syscall(SC_ftruncate, fd, length);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue