secondary cache feature in vm.
[minix.git] / lib / libc / posix / _open.c
blob39ba74f06dc8cc70029b48e112f9a10f085a125c
1 #include <lib.h>
2 #define open _open
3 #include <fcntl.h>
4 #include <stdarg.h>
5 #include <string.h>
7 #if _ANSI
8 PUBLIC int open(const char *name, int flags, ...)
9 #else
10 PUBLIC int open(const char *name, int flags)
11 #endif
13 va_list argp;
14 message m;
16 va_start(argp, flags);
17 if (flags & O_CREAT) {
18 m.m1_i1 = strlen(name) + 1;
19 m.m1_i2 = flags;
20 /* Since it's a vararg parameter that is smaller than
21 * an int, the mode was passed as an int.
23 m.m1_i3 = va_arg(argp, int);
24 m.m1_p1 = (char *) name;
25 } else {
26 _loadname(name, &m);
27 m.m3_i2 = flags;
29 va_end(argp);
30 return (_syscall(FS, OPEN, &m));