33 printf(
"\tOpen existing file - ");
34 int fd = open(
"/applications/shell", O_RDONLY);
42 printf(
"FAIL - errno %d (%s)\n", errno, strerror(errno));
46 printf(
"\tOpen nonexistant file - ");
47 int fd2 = open(
"/applications/penis", O_RDONLY);
48 if (fd2 == -1 && errno == ENOENT)
55 printf(
"FAIL - errno %d (%s)\n", errno, strerror(errno));
59 printf(
"\tCreate file - ");
60 int fd3 = open(
"/file-doesnt-exist", O_RDWR | O_CREAT);
68 printf(
"FAIL - errno %d (%s)\n", errno, strerror(errno));
72 printf(
"\tRecycle descriptors - ");
73 int fd4 = open(
"/applications/bash", O_RDWR);
75 int fd5 = open(
"/applications/bash", O_RDWR);
83 printf(
"FAIL - %d, %d\n", fd4, fd5);
87 int hahaha = open(
"/applications/bash", O_RDWR);
92 printf(
"FAIL - fork failed\n");
99 int rofl = open(
"/applications/bash", O_RDWR);
101 printf(
"%d/%d\n", hahaha, rofl);
108 printf(
"Complete\n");
116 int main(
int argc,
char **argv)
118 printf(
"argc: %d, argv[0]: %s, &optind: %x\n", argc, argv[0], &optind);
121 "h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz") != -1)
125 printf(
"optind: %d\n", optind);
126 printf(
"Syscall test starting...\n");
128 if (test_open() == PASS)