summaryrefslogtreecommitdiff
path: root/forktest.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-06-11 09:57:14 -0400
committerRobert Morris <[email protected]>2019-06-11 09:57:14 -0400
commit5753553213df8f9de851adb68377db43faecb91f (patch)
tree3b629ff54897fca414146677532cb459a2ed11ba /forktest.c
parent91ba81110acd3163f7de3580b677eece0c57f5e7 (diff)
downloadxv6-labs-5753553213df8f9de851adb68377db43faecb91f.tar.gz
xv6-labs-5753553213df8f9de851adb68377db43faecb91f.tar.bz2
xv6-labs-5753553213df8f9de851adb68377db43faecb91f.zip
separate source into kernel/ user/ mkfs/
Diffstat (limited to 'forktest.c')
-rw-r--r--forktest.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/forktest.c b/forktest.c
deleted file mode 100644
index 8bc984d..0000000
--- a/forktest.c
+++ /dev/null
@@ -1,56 +0,0 @@
-// Test that fork fails gracefully.
-// Tiny executable so that the limit can be filling the proc table.
-
-#include "types.h"
-#include "stat.h"
-#include "user.h"
-
-#define N 1000
-
-void
-printf(int fd, const char *s, ...)
-{
- write(fd, s, strlen(s));
-}
-
-void
-forktest(void)
-{
- int n, pid;
-
- printf(1, "fork test\n");
-
- for(n=0; n<N; n++){
- pid = fork();
- if(pid < 0)
- break;
- if(pid == 0)
- exit();
- }
-
- if(n == N){
- printf(1, "fork claimed to work N times!\n", N);
- exit();
- }
-
- for(; n > 0; n--){
- if(wait() < 0){
- printf(1, "wait stopped early\n");
- exit();
- }
- }
-
- if(wait() != -1){
- printf(1, "wait got too many\n");
- exit();
- }
-
- printf(1, "fork test OK\n");
-}
-
-int
-main(void)
-{
- forktest();
- exit();
-}