| // Test that fork fails gracefully. | |
| // Tiny executable so that the limit can be filling the proc table. | |
| 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(); | |
| } | |
Xet Storage Details
- Size:
- 764 Bytes
- Xet hash:
- e41ab9ac0ad2629da0851c39d1155a6d00244bd1662152c977fb4eb7dd3d26fe
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.