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,...@@ -35,6 +35,8 @@ extern int posix_spawnattr_setcgroup_np (posix_spawnattr_t *__attr,
35 int __cgroup)35 int __cgroup)
36 __THROW __nonnull ((1));36 __THROW __nonnull ((1));
3737
38// zig patch: check target glibc version
39#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 39) || __GLIBC__ > 2
38/* Spawn a new process executing PATH with the attributes describes in *ATTRP.40/* Spawn a new process executing PATH with the attributes describes in *ATTRP.
39 Before running the process perform the actions described in FACTS. Return41 Before running the process perform the actions described in FACTS. Return
40 a PID file descriptor in PIDFD if process creation was successful and the42 a PID file descriptor in PIDFD if process creation was successful and the
...@@ -61,7 +63,8 @@ extern int pidfd_spawnp (int *__restrict __pidfd,...@@ -61,7 +63,8 @@ extern int pidfd_spawnp (int *__restrict __pidfd,
61 char *const __argv[__restrict_arr],63 char *const __argv[__restrict_arr],
62 char *const __envp[__restrict_arr])64 char *const __envp[__restrict_arr])
63 __nonnull ((1, 2, 5));65 __nonnull ((1, 2, 5));
66#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 39) || __GLIBC__ > 2 */
6467
65#endif /* __USE_MISC */68#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 @@...@@ -25,6 +25,9 @@
25#include <bits/types/struct_statx_timestamp.h>25#include <bits/types/struct_statx_timestamp.h>
26#include <bits/types/struct_statx.h>26#include <bits/types/struct_statx.h>
2727
28// zig patch: check target glibc version
29#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
30
28#ifndef STATX_TYPE31#ifndef STATX_TYPE
29# define STATX_TYPE 0x0001U32# define STATX_TYPE 0x0001U
30# define STATX_MODE 0x0002U33# define STATX_MODE 0x0002U
...@@ -63,4 +66,6 @@ int statx (int __dirfd, const char *__restrict __path, int __flags,...@@ -63,4 +66,6 @@ int statx (int __dirfd, const char *__restrict __path, int __flags,
63 unsigned int __mask, struct statx *__restrict __buf)66 unsigned int __mask, struct statx *__restrict __buf)
64 __THROW __nonnull ((2, 5));67 __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...@@ -235,6 +235,8 @@ struct mount_attr
235#define FSPICK_NO_AUTOMOUNT 0x00000004235#define FSPICK_NO_AUTOMOUNT 0x00000004
236#define FSPICK_EMPTY_PATH 0x00000008236#define FSPICK_EMPTY_PATH 0x00000008
237237
238// zig patch: check target glibc version
239#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2
238240
239#ifndef FSOPEN_CLOEXEC241#ifndef FSOPEN_CLOEXEC
240/* The type of fsconfig call made. */242/* The type of fsconfig call made. */
...@@ -268,6 +270,7 @@ enum fsconfig_command...@@ -268,6 +270,7 @@ enum fsconfig_command
268#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */270#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
269#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */271#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
270272
273#endif
271274
272__BEGIN_DECLS275__BEGIN_DECLS
273276
...@@ -282,6 +285,9 @@ extern int umount (const char *__special_file) __THROW;...@@ -282,6 +285,9 @@ extern int umount (const char *__special_file) __THROW;
282/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */285/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */
283extern int umount2 (const char *__special_file, int __flags) __THROW;286extern 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
285/* Open the filesystem referenced by FS_NAME so it can be configured for291/* Open the filesystem referenced by FS_NAME so it can be configured for
286 mouting. */292 mouting. */
287extern int fsopen (const char *__fs_name, unsigned int __flags) __THROW;293extern 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,...@@ -320,6 +326,8 @@ extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags,
320 struct mount_attr *__uattr, size_t __usize)326 struct mount_attr *__uattr, size_t __usize)
321 __THROW;327 __THROW;
322328
329#endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 */
330
323__END_DECLS331__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 @@...@@ -21,6 +21,9 @@
21#include <fcntl.h>21#include <fcntl.h>
22#include <bits/types/siginfo_t.h>22#include <bits/types/siginfo_t.h>
2323
24// zig patch: check target glibc version
25#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2
26
24#define PIDFD_NONBLOCK O_NONBLOCK27#define PIDFD_NONBLOCK O_NONBLOCK
25#define PIDFD_THREAD O_EXCL28#define PIDFD_THREAD O_EXCL
2629
...@@ -45,8 +48,15 @@ extern int pidfd_getfd (int __pidfd, int __targetfd,...@@ -45,8 +48,15 @@ extern int pidfd_getfd (int __pidfd, int __targetfd,
45extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info,48extern int pidfd_send_signal (int __pidfd, int __sig, siginfo_t *__info,
46 unsigned int __flags) __THROW;49 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
48/* Query the process ID (PID) from process descriptor FD. Return the PID56/* Query the process ID (PID) from process descriptor FD. Return the PID
49 or -1 in case of an error. */57 or -1 in case of an error. */
50extern pid_t pidfd_getpid (int __fd) __THROW;58extern 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...@@ -1203,6 +1203,8 @@ int getentropy (void *__buffer, size_t __length) __wur
1203#endif1203#endif
12041204
1205#ifdef __USE_GNU1205#ifdef __USE_GNU
1206// zig patch: check target glibc version
1207# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || __GLIBC__ > 2
1206/* Close all file descriptors in the range FD up to MAX_FD. The flag FLAGS1208/* Close all file descriptors in the range FD up to MAX_FD. The flag FLAGS
1207 are define by the CLOSE_RANGE prefix. This function behaves like close1209 are define by the CLOSE_RANGE prefix. This function behaves like close
1208 on the range and gaps where the file descriptor is invalid or errors1210 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...@@ -1210,6 +1212,7 @@ int getentropy (void *__buffer, size_t __length) __wur
1210 successor or -1 for failure (and sets errno accordingly). */1212 successor or -1 for failure (and sets errno accordingly). */
1211extern int close_range (unsigned int __fd, unsigned int __max_fd,1213extern int close_range (unsigned int __fd, unsigned int __max_fd,
1212 int __flags) __THROW;1214 int __flags) __THROW;
1215# endif
1213#endif1216#endif
12141217
1215/* Define some macros helping to catch buffer overflows. */1218/* Define some macros helping to catch buffer overflows. */
...@@ -1222,4 +1225,4 @@ extern int close_range (unsigned int __fd, unsigned int __max_fd,...@@ -1222,4 +1225,4 @@ extern int close_range (unsigned int __fd, unsigned int __max_fd,
12221225
1223__END_DECLS1226__END_DECLS
12241227
1225#endif /* unistd.h */
\ No newline at end of file
1228#endif /* unistd.h */