1/* prctl - Linux specific syscall.
2 Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#include <sysdep.h>
20#include <stdarg.h>
21#include <sys/prctl.h>
22
23/* Unconditionally read all potential arguments. This may pass
24 garbage values to the kernel, but avoids the need for teaching
25 glibc the argument counts of individual options (including ones
26 that are added to the kernel in the future). */
27
28int
29__prctl (int option, ...)
30{
31 va_list arg;
32 va_start (arg, option);
33 unsigned long int arg2 = va_arg (arg, unsigned long int);
34 unsigned long int arg3 = va_arg (arg, unsigned long int);
35 unsigned long int arg4 = va_arg (arg, unsigned long int);
36 unsigned long int arg5 = va_arg (arg, unsigned long int);
37 va_end (arg);
38 return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5);
39}
40
41libc_hidden_def (__prctl)
42weak_alias (__prctl, prctl)
43#if __TIMESIZE != 64
44weak_alias (__prctl, __prctl_time64)
45#endif
46

source code of glibc/sysdeps/unix/sysv/linux/prctl.c