summaryrefslogtreecommitdiff
path: root/user/ulib.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-02-16 10:20:27 +0800
committerMole Shang <[email protected]>2024-02-16 10:20:27 +0800
commita98c56a811142e5ede3332a7a444cca45f628769 (patch)
treec93ff7090da7b6ef911932be283818c2f6a03784 /user/ulib.c
parent0d65be5d1d880afafbf08c2adb605cf9f72216e2 (diff)
parent99015f3a985b2fd051606636743a2a2969b216e8 (diff)
downloadxv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.gz
xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.tar.bz2
xv6-labs-a98c56a811142e5ede3332a7a444cca45f628769.zip
Merge branch 'lock' into thread
Conflicts: .gitignore Makefile conf/lab.mk
Diffstat (limited to 'user/ulib.c')
-rw-r--r--user/ulib.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/user/ulib.c b/user/ulib.c
index c7b66c4..871adc9 100644
--- a/user/ulib.c
+++ b/user/ulib.c
@@ -1,8 +1,13 @@
#include "kernel/types.h"
#include "kernel/stat.h"
#include "kernel/fcntl.h"
+#ifdef LAB_PGTBL
+#include "kernel/riscv.h"
+#include "kernel/memlayout.h"
+#endif
#include "user/user.h"
+
//
// wrapper so that it's OK if main() does not call exit().
//
@@ -145,3 +150,12 @@ memcpy(void *dst, const void *src, uint n)
{
return memmove(dst, src, n);
}
+
+#ifdef LAB_PGTBL
+int
+ugetpid(void)
+{
+ struct usyscall *u = (struct usyscall *)USYSCALL;
+ return u->pid;
+}
+#endif