feat(syscall): add x86_64 raw syscall layer, errno, internal ABI headers

This commit is contained in:
2026-09-03 17:10:27 -04:00
parent 6854c7771d
commit c5a77c61fa
9 changed files with 1139 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "errno.h"
#include "syscall.h"
/*
* Translate a raw syscall result into the C convention: return the value on
* success, or store the negated errno and return -1 on error. The -4095
* bound is the kernel's MAX_ERRNO: any result at or below -4096 is a
* legitimate value, not an error code.
*/
int
syscall_ret(long r)
{
if (r < 0 && r > -4096)
{
errno = (int)-r;
return -1;
}
return (int)r;
}