syscalls: setpriority

This commit is contained in:
Matheus
2026-05-28 23:52:07 -03:00
parent b3312444bf
commit 762552ed5f
4 changed files with 62 additions and 18 deletions
+27 -16
View File
@@ -388,7 +388,7 @@ index ba9a520..b958ef3 100644
.section .note.GNU-stack,"",%progbits
-
diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
index 3b04372..028fa48 100644
index 3b04372..e5741d1 100644
--- mlibc-clean/sysdeps/astral/generic/generic.cpp
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -1,7 +1,9 @@
@@ -818,8 +818,20 @@ index 3b04372..028fa48 100644
int Sysdeps<Readv>::operator()(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) {
long r;
int error = syscall(SYSCALL_READV, &r, fd, (uint64_t)iovs, iovc);
@@ -444,6 +827,12 @@ namespace mlibc {
return ret;
@@ -86,6 +469,11 @@ namespace mlibc {
return e;
}
+ int Sysdeps<SetPriority>::operator()(int which, id_t who, int prio) {
+ long ret;
+ return syscall(SYSCALL_SETPRIORITY, &ret, which, who, prio);
+ }
+
int Sysdeps<Shutdown>::operator()(int sockfd, int how) {
long ret;
return syscall(SYSCALL_SHUTDOWN, &ret, sockfd, how);
@@ -487,8 +875,15 @@ namespace mlibc {
return err;
}
+ int Sysdeps<ThreadSetname>::operator()(void *tcb, const char *name) {
@@ -828,18 +840,13 @@ index 3b04372..028fa48 100644
+ return 0;
+ }
+
#ifndef MLIBC_BUILDING_RTLD
[[noreturn]] void Sysdeps<ThreadExit>::operator()() {
@@ -489,6 +878,7 @@ namespace mlibc {
int Sysdeps<SetSockopt>::operator()(int fd, int layer, int number, const void *buffer, socklen_t size) {
long ret;
+ mlibc::infoLogger() << "setsockopt: fd " << fd << " layer " << layer << " number " << number << frg::endlog;
return syscall(SYSCALL_SETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, size);
}
@@ -511,6 +901,11 @@ namespace mlibc {
@@ -511,6 +906,11 @@ namespace mlibc {
return err;
}
@@ -851,7 +858,7 @@ index 3b04372..028fa48 100644
int Sysdeps<Renameat>::operator()(int olddirfd, const char *old_path, int newdirfd, const char *new_path) {
long ret;
return syscall(SYSCALL_RENAMEAT, &ret, olddirfd, (uint64_t)old_path, newdirfd, (uint64_t)new_path);
@@ -562,6 +957,16 @@ namespace mlibc {
@@ -562,6 +962,16 @@ namespace mlibc {
return sysdep<Ioctl>(fd, TCSETS, (void *)attr, &res);
}
@@ -868,7 +875,7 @@ index 3b04372..028fa48 100644
int Sysdeps<Poll>::operator()(struct pollfd *fds, nfds_t count, int timeout, int *num_events) {
long ret;
long error = syscall(SYSCALL_POLL, &ret, (uint64_t)fds, count, timeout);
@@ -932,4 +1337,13 @@ namespace mlibc {
@@ -932,4 +1342,13 @@ namespace mlibc {
*nanos = ts.tv_nsec;
return err;
}
@@ -905,10 +912,10 @@ index 7e4f2a1..ecc2677 100644
#ifdef __cplusplus
extern "C" {
diff --git mlibc-clean/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
index a6c4067..f1e0b65 100644
index a6c4067..fd38197 100644
--- mlibc-clean/sysdeps/astral/include/astral/syscall.h
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
@@ -103,6 +103,11 @@
@@ -103,6 +103,12 @@
#define SYSCALL_SYSINFO 96
#define SYSCALL_WRITEV 97
#define SYSCALL_READV 98
@@ -917,11 +924,12 @@ index a6c4067..f1e0b65 100644
+#define SYSCALL_FSTATVFSAT 101
+#define SYSCALL_GETSOCKOPT 102
+#define SYSCALL_CLOCK_GETRES 103
+#define SYSCALL_SETPRIORITY 104
#ifndef __MLIBC_ABI_ONLY
diff --git mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp
index ce91084..5e96961 100644
index ce91084..0fffdf3 100644
--- mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp
+++ mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp
@@ -7,8 +7,30 @@ namespace mlibc {
@@ -980,14 +988,17 @@ index ce91084..5e96961 100644
Poll,
Ppoll,
Pselect,
@@ -135,6 +161,7 @@ struct AstralSysdepTags :
@@ -135,7 +161,9 @@ struct AstralSysdepTags :
VmUnmap,
Isatty,
ClockGet,
- PrepareStack
+ ClockGetres,
PrepareStack
+ PrepareStack,
+ SetPriority
{};
template<typename Tag>
diff --git mlibc-clean/sysdeps/linux/generic/sysdeps.cpp mlibc-workdir/sysdeps/linux/generic/sysdeps.cpp
index a07ed53..1474470 100644
--- mlibc-clean/sysdeps/linux/generic/sysdeps.cpp