summaryrefslogtreecommitdiff
path: root/src/user/lib
diff options
context:
space:
mode:
authordzwdz2023-06-10 16:26:46 +0200
committerdzwdz2023-06-10 16:26:46 +0200
commitb09263bd64b3408cbd109dacc4b7618d22b02248 (patch)
treee461c86fdf229670451f657ef83dd1e2ac802bba /src/user/lib
parent112eafe13c3628cad6e692179c064dbbc3be2d8b (diff)
kernel: implement getpid, getppid
Diffstat (limited to 'src/user/lib')
-rw-r--r--src/user/lib/syscall.c8
-rw-r--r--src/user/lib/unistd.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/src/user/lib/syscall.c b/src/user/lib/syscall.c
index f7eaddb..3e8473c 100644
--- a/src/user/lib/syscall.c
+++ b/src/user/lib/syscall.c
@@ -82,6 +82,14 @@ void _sys_intr_set(void __user *ip) {
return (void)_syscall(_SYS_INTR_SET, (long)ip, 0, 0, 0, 0);
}
+uint32_t _sys_getpid(void) {
+ return (uint32_t)_syscall(_SYS_GETPID, 0, 0, 0, 0, 0);
+}
+
+uint32_t _sys_getppid(void) {
+ return (uint32_t)_syscall(_SYS_GETPPID, 0, 0, 0, 0, 0);
+}
+
long _sys_execbuf(void __user *buf, size_t len) {
return _syscall(_SYS_EXECBUF, (long)buf, (long)len, 0, 0, 0);
}
diff --git a/src/user/lib/unistd.c b/src/user/lib/unistd.c
index 28164e6..d6f24f8 100644
--- a/src/user/lib/unistd.c
+++ b/src/user/lib/unistd.c
@@ -185,11 +185,11 @@ pid_t getpgrp(void) {
}
pid_t getpid(void) {
- __libc_panic("unimplemented");
+ return _sys_getpid();
}
pid_t getppid(void) {
- __libc_panic("unimplemented");
+ return _sys_getppid();
}
int getgroups(int size, gid_t list[]) {