kernel: usercopy functions

This commit is contained in:
Matheus
2024-06-09 19:31:26 -03:00
parent 429f56aced
commit 50b4b45d00
53 changed files with 712 additions and 260 deletions
+12 -4
View File
@@ -14,14 +14,22 @@ syscallret_t syscall_sigaction(context_t *, int sig, sigaction_t *new, sigaction
sigaction_t newtmp, oldtmp;
if (new) {
newtmp = *new;
__assert(newtmp.flags & SA_RESTORER);
ret.errno = usercopy_fromuser(&newtmp, new, sizeof(sigaction_t));
if (ret.errno)
return ret;
if ((newtmp.flags & SA_RESTORER) == 0) {
ret.errno = EINVAL;
return ret;
}
}
signal_action(_cpu()->thread->proc, sig, new ? &newtmp : NULL, old ? &oldtmp : NULL);
if (old)
*old = oldtmp;
if (old && usercopy_touser(old, &oldtmp, sizeof(sigaction_t))) {
ret.errno = EFAULT;
return ret;
}
ret.errno = 0;
ret.ret = 0;