summaryrefslogtreecommitdiffstats
path: root/usr/klibc/openat.c
blob: 8e5baa0c59aed0b31425f092e41eb0beb6517ade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * openat.c
 *
 * On 32-bit platforms we need to pass O_LARGEFILE to the openat()
 * system call, to indicate that we're 64-bit safe.
 */

#define _KLIBC_IN_OPEN_C
#include <unistd.h>
#include <fcntl.h>
#include <bitsize.h>

#if _BITSIZE == 32 && !defined(__i386__) && !defined(__m68k__) && defined(__NR_openat)

extern int __openat(int, const char *, int, mode_t);

int openat(int dirfd, const char *pathname, int flags, mode_t mode)
{
	return __openat(dirfd, pathname, flags | O_LARGEFILE, mode);
}

#endif