LibC: Cleanup syscall macros

This commit is contained in:
2026-05-16 16:58:49 +03:00
parent dc1d7e3fae
commit 40dd29b876
2 changed files with 6 additions and 5 deletions

View File

@@ -612,16 +612,17 @@ long syscall(long syscall, ...);
#include <kernel/API/Syscall.h> #include <kernel/API/Syscall.h>
#include <errno.h> #include <errno.h>
#define _syscall(...) ({ \ #define _syscall(...) ({ \
long _ret = -ERESTART; \ long _ret; \
while (_ret == -ERESTART) \ do { \
_ret = _kas_syscall(__VA_ARGS__); \ _ret = _kas_syscall(__VA_ARGS__); \
if (_ret < 0) { \ } while (__builtin_expect(_ret == -ERESTART, 0)); \
if (__builtin_expect(_ret < 0, 0)) { \
errno = -_ret; \ errno = -_ret; \
_ret = -1; \ _ret = -1; \
} \ } \
_ret; \ _ret; \
}) })
#define syscall _syscall #define syscall(...) _syscall(__VA_ARGS__)
#endif #endif
extern char** environ; extern char** environ;

View File

@@ -270,7 +270,7 @@ long syscall(long syscall, ...)
return _syscall(syscall, arg1, arg2, arg3, arg4, arg5); return _syscall(syscall, arg1, arg2, arg3, arg4, arg5);
} }
#define syscall _syscall #define syscall(...) _syscall(__VA_ARGS__)
int close(int fd) int close(int fd)
{ {