fix recursive dependencies that might be caused by using conditional dependencies
[openwrt/openwrt.git] / toolchain / uClibc / patches / 160-add_openat_and_friends.patch
1 Index: uClibc-0.9.29/libc/sysdeps/linux/common/openat.c
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ uClibc-0.9.29/libc/sysdeps/linux/common/openat.c 2008-10-27 12:59:25.000000000 +0100
5 @@ -0,0 +1,44 @@
6 +/* vi: set sw=4 ts=4: */
7 +/*
8 + * openat() for uClibc
9 + *
10 + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
11 + *
12 + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
13 + */
14 +
15 +#include <sys/syscall.h>
16 +#include <stdlib.h>
17 +#include <stdarg.h>
18 +#include <fcntl.h>
19 +#include <string.h>
20 +#include <sys/param.h>
21 +#include <linux/version.h>
22 +
23 +extern __typeof(openat) __libc_openat;
24 +
25 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,52)
26 +#define __NR___syscall_openat __NR_openat
27 +static inline _syscall4(int, __syscall_openat, int, fd, const char *, file,
28 + int, flags, __kernel_mode_t, mode);
29 +
30 +libc_hidden_proto(__libc_openat)
31 +int __libc_openat(int fd, const char *file, int oflag, ...)
32 +{
33 + mode_t mode = 0;
34 +
35 + if (oflag & O_CREAT) {
36 + va_list arg;
37 + va_start (arg, oflag);
38 + mode = va_arg (arg, mode_t);
39 + va_end (arg);
40 + }
41 +
42 + return __syscall_openat(fd, file, oflag, mode);
43 +}
44 +libc_hidden_def(__libc_openat)
45 +
46 +libc_hidden_proto(openat)
47 +weak_alias(__libc_openat,openat)
48 +libc_hidden_weak(openat)
49 +#endif
50 Index: uClibc-0.9.29/include/fcntl.h
51 ===================================================================
52 --- uClibc-0.9.29.orig/include/fcntl.h 2008-10-27 12:52:04.000000000 +0100
53 +++ uClibc-0.9.29/include/fcntl.h 2008-10-27 13:08:11.000000000 +0100
54 @@ -56,7 +56,7 @@
55 # define SEEK_END 2 /* Seek from end of file. */
56 #endif /* XPG */
57
58 -#if 0 /*def __USE_GNU*/
59 +#ifdef __USE_GNU
60 # define AT_FDCWD -100 /* Special value used to indicate
61 openat should use the current
62 working directory. */
63 @@ -103,7 +103,7 @@
64 extern int open64 (__const char *__file, int __oflag, ...) __nonnull ((1));
65 #endif
66
67 -#if 0 /*def __USE_GNU*/
68 +#ifdef __USE_GNU
69 /* Similar to OPEN but a relative path name is interpreted relative to
70 the directory for which FD is a descriptor.
71