tools/bison: update to 3.8.1
[openwrt/openwrt.git] / tools / fakeroot / patches / 300-glibc-2.33-compatibility.patch
1 --- a/libfakeroot.c
2 +++ b/libfakeroot.c
3 @@ -90,6 +90,16 @@
4 #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
5 #endif
6
7 +#ifndef _STAT_VER
8 + #if defined (__aarch64__)
9 + #define _STAT_VER 0
10 + #elif defined (__x86_64__)
11 + #define _STAT_VER 1
12 + #else
13 + #define _STAT_VER 3
14 + #endif
15 +#endif
16 +
17 /*
18 These INT_* (which stands for internal) macros should always be used when
19 the fakeroot library owns the storage of the stat variable.
20 @@ -1358,6 +1368,54 @@ int renameat(int olddir_fd, const char *
21 #endif /* HAVE_FSTATAT */
22
23
24 +#if defined(__GLIBC__) && __GLIBC_PREREQ(2,33)
25 +/* Glibc 2.33 exports symbols for these functions in the shared lib */
26 + int lstat(const char *file_name, struct stat *statbuf) {
27 + return WRAP_LSTAT LSTAT_ARG(_STAT_VER, file_name, statbuf);
28 + }
29 + int stat(const char *file_name, struct stat *st) {
30 + return WRAP_STAT STAT_ARG(_STAT_VER, file_name, st);
31 + }
32 + int fstat(int fd, struct stat *st) {
33 + return WRAP_FSTAT FSTAT_ARG(_STAT_VER, fd, st);
34 + }
35 +
36 + #ifdef HAVE_FSTATAT
37 + int fstatat(int dir_fd, const char *path, struct stat *st, int flags) {
38 + return WRAP_FSTATAT FSTATAT_ARG(_STAT_VER, dir_fd, path, st, flags);
39 + }
40 + #endif
41 +
42 + #ifdef STAT64_SUPPORT
43 + int lstat64(const char *file_name, struct stat64 *st) {
44 + return WRAP_LSTAT64 LSTAT64_ARG(_STAT_VER, file_name, st);
45 + }
46 + int stat64(const char *file_name, struct stat64 *st) {
47 + return WRAP_STAT64 STAT64_ARG(_STAT_VER, file_name, st);
48 + }
49 + int fstat64(int fd, struct stat64 *st) {
50 + return WRAP_FSTAT64 FSTAT64_ARG(_STAT_VER, fd, st);
51 + }
52 +
53 + #ifdef HAVE_FSTATAT
54 + int fstatat64(int dir_fd, const char *path, struct stat64 *st, int flags) {
55 + return WRAP_FSTATAT64 FSTATAT64_ARG(_STAT_VER, dir_fd, path, st, flags);
56 + }
57 + #endif
58 + #endif
59 +
60 + int mknod(const char *pathname, mode_t mode, dev_t dev) {
61 + return WRAP_MKNOD MKNOD_ARG(_STAT_VER, pathname, mode, &dev);
62 + }
63 +
64 + #if defined(HAVE_FSTATAT) && defined(HAVE_MKNODAT)
65 + int mknodat(int dir_fd, const char *pathname, mode_t mode, dev_t dev) {
66 + return WRAP_MKNODAT MKNODAT_ARG(_STAT_VER, dir_fd, pathname, mode, &dev);
67 + }
68 + #endif
69 +#endif /* GLIBC_PREREQ */
70 +
71 +
72 #ifdef FAKEROOT_FAKENET
73 pid_t fork(void)
74 {
75 @@ -2024,11 +2082,7 @@ FTSENT *fts_read(FTS *ftsp) {
76 || r->fts_info == FTS_NS || r->fts_info == FTS_NSOK))
77 r->fts_statp = NULL; /* Otherwise fts_statp may be a random pointer */
78 if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
79 -# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
80 - SEND_GET_STAT64(r->fts_statp, _STAT_VER);
81 -# else
82 SEND_GET_STAT(r->fts_statp, _STAT_VER);
83 -# endif
84 }
85
86 return r;
87 @@ -2047,11 +2101,7 @@ FTSENT *fts_children(FTS *ftsp, int opti
88 first=next_fts_children(ftsp, options);
89 for(r = first; r; r = r->fts_link) {
90 if(r && r->fts_statp) { /* Should we bother checking fts_info here? */
91 -# if defined(STAT64_SUPPORT) && !defined(__APPLE__)
92 - SEND_GET_STAT64(r->fts_statp, _STAT_VER);
93 -# else
94 SEND_GET_STAT(r->fts_statp, _STAT_VER);
95 -# endif
96 }
97 }
98
99 @@ -2483,7 +2533,7 @@ int statx (int dirfd, const char *path,
100
101 #ifdef LIBFAKEROOT_DEBUGGING
102 if (fakeroot_debug) {
103 - fprintf(stderr, "statx fd %d\n", fd);
104 + fprintf(stderr, "statx fd %d\n", dirfd);
105 }
106 #endif /* LIBFAKEROOT_DEBUGGING */
107 r=INT_NEXT_FSTATAT(dirfd, path, &st, flags);
108 --- a/configure.ac
109 +++ b/configure.ac
110 @@ -184,13 +184,13 @@ AC_MSG_CHECKING([for type of arg of __xm
111 ]], [[
112 int __xmknod ( int ver,
113 const char *pathname ,
114 - mode_t mode , dev_t dev);
115 + mode_t mode , dev_t *dev);
116 ]])],[
117 - AC_DEFINE(XMKNOD_FRTH_ARG,)
118 - AC_MSG_RESULT([no extra *])
119 - ],[
120 AC_DEFINE(XMKNOD_FRTH_ARG,[*])
121 AC_MSG_RESULT([needs *])
122 + ],[
123 + AC_DEFINE(XMKNOD_FRTH_ARG,)
124 + AC_MSG_RESULT([no extra *])
125
126 ])
127
128 @@ -211,13 +211,13 @@ AC_MSG_CHECKING([for type of arg of __xm
129 int __xmknodat ( int ver,
130 int dirfd,
131 const char *pathname ,
132 - mode_t mode , dev_t dev);
133 + mode_t mode , dev_t *dev);
134 ]])],[
135 - AC_DEFINE(XMKNODAT_FIFTH_ARG,)
136 - AC_MSG_RESULT([no extra *])
137 - ],[
138 AC_DEFINE(XMKNODAT_FIFTH_ARG,[*])
139 AC_MSG_RESULT([needs *])
140 + ],[
141 + AC_DEFINE(XMKNODAT_FIFTH_ARG,)
142 + AC_MSG_RESULT([no extra *])
143
144 ])
145