6 extern char *_p9translate(char*);
9 p9create(char *xpath, int mode, ulong perm)
11 int fd, cexec, umode, rclose;
14 if((path = _p9translate(xpath)) == nil)
18 rclose = mode&ORCLOSE;
19 mode &= ~(ORCLOSE|OCEXEC);
21 /* XXX should get mode mask right? */
25 werrstr("bad mode in directory create");
28 if(mkdir(path, perm&0777) < 0)
30 fd = open(path, O_RDONLY);
32 umode = (mode&3)|O_CREAT|O_TRUNC;
39 werrstr("unsupported mode in create");
42 fd = open(path, umode, perm);
47 fcntl(fd, F_SETFL, FD_CLOEXEC);