Kernel/LibC: Implement alarm() and setitimer()

This makes vim able to start!
This commit is contained in:
2024-08-01 21:09:31 +03:00
parent da3b30cd94
commit a33b63d066
6 changed files with 139 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <unistd.h>
char** environ;
@@ -514,3 +515,14 @@ int access(const char* path, int amode)
{
return syscall(SYS_ACCESS, path, amode);
}
unsigned alarm(unsigned seconds)
{
itimerval value, ovalue;
value.it_value.tv_sec = seconds;
value.it_value.tv_usec = 0;
value.it_interval.tv_sec = 0;
value.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &value, &ovalue);
return ovalue.it_value.tv_sec;
}