Add support for using time64 on big-endian machines.
[uclibc-ng.git] / libc / sysdeps / linux / common / openat.c
blob62451df4c59737ccdaf2a786a5c915d8a32576c2
1 /*
2 * openat() for uClibc
4 * Copyright (C) 2009 Analog Devices Inc.
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 */
9 #include <sys/syscall.h>
10 #include <fcntl.h>
11 #include <stdarg.h>
12 #include <cancel.h>
14 #ifdef __NR_openat
15 # define __NR___syscall_openat __NR_openat
16 static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode)
18 int __openat(int fd, const char *file, int o_flag, ...)
20 #ifdef __NEW_THREADS
21 int oldtype, result;
22 #endif
23 va_list ap;
24 mode_t mode;
26 va_start(ap, o_flag);
27 mode = va_arg(ap, int);
28 va_end(ap);
30 if (SINGLE_THREAD_P)
31 return __syscall_openat(fd, file, o_flag, mode);
33 #ifdef __NEW_THREADS
34 oldtype = LIBC_CANCEL_ASYNC ();
35 result = __syscall_openat(fd, file, o_flag, mode);
36 LIBC_CANCEL_RESET (oldtype);
37 return result;
38 #endif
41 strong_alias_untyped(__openat,openat)
42 libc_hidden_def(openat)
43 #else
44 /* should add emulation with open() and /proc/self/fd/ ... */
45 #endif