summaryrefslogtreecommitdiff
path: root/user/sleep.c
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2024-01-17 11:33:39 +0800
committerMole Shang <[email protected]>2024-01-17 11:33:39 +0800
commitdaa90a639a35e9f99747c92bb28946ac414615bd (patch)
treecc119f4e037015b2fdff2b4ed8d989b8db66e3b0 /user/sleep.c
parentc424f997808269559f7968c812860fd1f1974a13 (diff)
downloadxv6-labs-util.tar.gz
xv6-labs-util.tar.bz2
xv6-labs-util.zip
lab util: finishutil
Diffstat (limited to 'user/sleep.c')
-rw-r--r--user/sleep.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/user/sleep.c b/user/sleep.c
new file mode 100644
index 0000000..961f558
--- /dev/null
+++ b/user/sleep.c
@@ -0,0 +1,22 @@
+#include "kernel/types.h"
+#include "user/user.h"
+
+int
+main(int argc, char* argv[])
+{
+ uint sec = 0;
+
+ if (argc <= 1) {
+ fprintf(2, "usage: sleep [time (ticks)]\n");
+ exit(1);
+ }
+ sec = atoi(argv[1]);
+
+ sleep(sec);
+
+ if (argc <= 2) {
+ exit(0);
+ }
+
+ exit(0);
+}