9 /* This depends on O_RDONLY == 0, O_WRONLY == 1, O_RDWR == 2 */
12 FILE *fopen(const char *file, const char *mode)
23 flags = O_WRONLY|O_CREAT|O_TRUNC;
26 flags = O_WRONLY|O_CREAT|O_APPEND;
35 flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR;
38 /* Note: __create_file(-1) == NULL, so this is safe */
39 return __create_file(open(file, flags, 0666));