summaryrefslogtreecommitdiff
path: root/lib/libc/fcntl/openat.c
blob: bb34d6006bf261c91e5f11268355aae838edf37f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <fcntl.h>
#include <stdarg.h>
#include <syscall.h>

int openat(int fd, const char *path, int oflag, ...)
{
	mode_t mode = 0;

	if (oflag & O_CREAT) {
		va_list ap;
		va_start(ap, oflag);
		mode = va_arg(ap, mode_t);
		va_end(ap);
	}

	return syscall(openat, fd, path, oflag, mode);
}