authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-07 15:11:36+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-02-07 15:11:36+01:00
log8ad0732954df80f0f9a0248525c2bded7e82ba27
tree88e22b0a3f7d3a68c0659ee7d2e4655c068cb289
parent2d4954ad6345b4b52fc48ef11195068898627148
parentedee702a7fb48859d3bc58628617646439fc066f
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #22771 from chouquette/chouquette/glibc_guard

glibc: guard more function declarations

5 files changed, 34 insertions(+), 5 deletions(-)

lib/libc/include/generic-glibc/bits/spawn_ext.h+4-1
......@@ -35,6 +35,8 @@ extern int posix_spawnattr_setcgroup_np (posix_spawnattr_t *__attr,
3535 int __cgroup)
3636 __THROW __nonnull ((1));
3737
38// zig patch: check target glibc version
39#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 39) || __GLIBC__ > 2
3840/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
3941 Before running the process perform the actions described in FACTS. Return
4042 a PID file descriptor in PIDFD if process creation was successful and the
......@@ -61,7 +63,8 @@ extern int pidfd_spawnp (int *__restrict __pidfd,
6163 char *const __argv[__restrict_arr],
6264 char *const __envp[__restrict_arr])
6365 __nonnull ((1, 2, 5));
66#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 39) || __GLIBC__ > 2 */
6467
6568#endif /* __USE_MISC */
6669
67__END_DECLS
\ No newline at end of file
70__END_DECLS
lib/libc/include/generic-glibc/bits/statx-generic.h+6-1
......@@ -25,6 +25,9 @@
2525#include <bits/types/struct_statx_timestamp.h>
2626#include <bits/types/struct_statx.h>
2727
28// zig patch: check target glibc version
29#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
30
2831#ifndef STATX_TYPE
2932# define STATX_TYPE 0x0001U
3033# define STATX_MODE 0x0002U
......@@ -63,4 +66,6 @@ int statx (int __dirfd, const char *__restrict __path, int __flags,
6366 unsigned int __mask, struct statx *__restrict __buf)
6467 __THROW __nonnull ((2, 5));
6568
66__END_DECLS
\ No newline at end of file
69__END_DECLS
70
71#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2 */
lib/libc/include/generic-glibc/sys/mount.h+9-1
......@@ -235,6 +235,8 @@ struct mount_attr
235235#define FSPICK_NO_AUTOMOUNT 0x00000004
236236#define FSPICK_EMPTY_PATH 0x00000008
237237
238// zig patch: check target glibc version
239#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2
238240
239241#ifndef FSOPEN_CLOEXEC
240242/* The type of fsconfig call made. */
......@@ -268,6 +270,7 @@ enum fsconfig_command
268270#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
269271#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
270272
273#endif
271274
272275__BEGIN_DECLS
273276
......@@ -282,6 +285,9 @@ extern int umount (const char *__special_file) __THROW;
282285/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */
283286extern int umount2 (const char *__special_file, int __flags) __THROW;
284287
288// zig patch: check target glibc version
289#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2
290
285291/* Open the filesystem referenced by FS_NAME so it can be configured for
286292 mouting. */
287293extern int fsopen (const char *__fs_name, unsigned int __flags) __THROW;
......@@ -320,6 +326,8 @@ extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
320326 struct mount_attr *__uattr, size_t __usize)
321327 __THROW;
322328
329#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 */
330
323331__END_DECLS
324332
325#endif /* _SYS_MOUNT_H */
\ No newline at end of file
333#endif /* _SYS_MOUNT_H */
lib/libc/include/generic-glibc/sys/pidfd.h+11-1
......@@ -21,6 +21,9 @@
2121#include <fcntl.h>
2222#include <bits/types/siginfo_t.h>
2323
24// zig patch: check target glibc version
25#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2
26
2427#define PIDFD_NONBLOCK O_NONBLOCK
2528#define PIDFD_THREAD O_EXCL
2629
......@@ -45,8 +48,15 @@ extern int pidfd_getfd (int __pidfd, int __targetfd,
4548extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info,
4649 unsigned int __flags) __THROW;
4750
51#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 */
52
53// zig patch: check target glibc version
54#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 39) || __GLIBC__ > 2
55
4856/* Query the process ID (PID) from process descriptor FD. Return the PID
4957 or -1 in case of an error. */
5058extern pid_t pidfd_getpid (int __fd) __THROW;
5159
52#endif /* _PIDFD_H */
\ No newline at end of file
60#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 */
61
62#endif /* _PIDFD_H */
lib/libc/include/generic-glibc/unistd.h+4-1
......@@ -1203,6 +1203,8 @@ int getentropy (void *__buffer, size_t __length) __wur
12031203#endif
12041204
12051205#ifdef __USE_GNU
1206// zig patch: check target glibc version
1207# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2
12061208/* Close all file descriptors in the range FD up to MAX_FD. The flag FLAGS
12071209 are define by the CLOSE_RANGE prefix. This function behaves like close
12081210 on the range and gaps where the file descriptor is invalid or errors
......@@ -1210,6 +1212,7 @@ int getentropy (void *__buffer, size_t __length) __wur
12101212 successor or -1 for failure (and sets errno accordingly). */
12111213extern int close_range (unsigned int __fd, unsigned int __max_fd,
12121214 int __flags) __THROW;
1215# endif
12131216#endif
12141217
12151218/* Define some macros helping to catch buffer overflows. */
......@@ -1222,4 +1225,4 @@ extern int close_range (unsigned int __fd, unsigned int __max_fd,
12221225
12231226__END_DECLS
12241227
1225#endif /* unistd.h */
\ No newline at end of file
1228#endif /* unistd.h */