elf: Fix use-after-free in ldconfig [BZ #26779]
[glibc.git] / sysdeps / generic / startup.h
blob99509404eba3a97bef10797a5913439677c3eb5d
1 /* Generic definitions of functions used by static libc main startup.
2 Copyright (C) 2017-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 /* Targets should override this file if the default definitions below
20 will not work correctly very early before TLS is initialized. */
22 #include <unistd.h>
24 /* Use macro instead of inline function to avoid including <stdio.h>. */
25 #define _startup_fatal(message) __libc_fatal ((message))
27 static inline uid_t
28 startup_getuid (void)
30 return __getuid ();
33 static inline uid_t
34 startup_geteuid (void)
36 return __geteuid ();
39 static inline gid_t
40 startup_getgid (void)
42 return __getgid ();
45 static inline gid_t
46 startup_getegid (void)
48 return __getegid ();