blob: 6dd5a8c8c18fccd0935933f3eb58b7ceb431ef72 [file] [log] [blame]
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
extern int __open(const char*, int, int);
#define O_CREAT_PORTABLE 00000100
#if O_CREAT_PORTABLE==O_CREAT
#error Bad build environment
#endif
static inline int mips_change_flags(int flags) {
if (flags & O_CREAT_PORTABLE) {
flags &= ~O_CREAT_PORTABLE;
flags |= O_CREAT;
}
return flags;
}
int open(const char *pathname, int flags, ...) {
mode_t mode = 0;
flags = mips_change_flags(flags);
flags |= O_LARGEFILE;
if (flags & O_CREAT) {
va_list args;
va_start(args, flags);
mode = (mode_t) va_arg(args, int);
va_end(args);
}
return __open(pathname, flags, mode);
}