xref: /netbsd-src/external/gpl3/gdb/dist/sim/common/portability.c (revision 88241920d21b339bf319c0e979ffda80c49a2936)
1 /* Portability shims for missing OS support.
2    Copyright (C) 2021-2024 Free Software Foundation, Inc.
3    Contributed by Mike Frysinger.
4 
5 This file is part of the GNU Simulators.
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 /* This must come before any other includes.  */
21 #include "defs.h"
22 
23 #include <unistd.h>
24 
25 #include "portability.h"
26 
27 #ifndef HAVE_GETEGID
28 int getegid(void)
29 {
30   return 0;
31 }
32 #endif
33 
34 #ifndef HAVE_GETEUID
35 int geteuid(void)
36 {
37   return 0;
38 }
39 #endif
40 
41 #ifndef HAVE_GETGID
42 int getgid(void)
43 {
44   return 0;
45 }
46 #endif
47 
48 #ifndef HAVE_GETUID
49 int getuid(void)
50 {
51   return 0;
52 }
53 #endif
54 
55 #ifndef HAVE_SETGID
56 int setgid(int gid)
57 {
58   return -1;
59 }
60 #endif
61 
62 #ifndef HAVE_SETUID
63 int setuid(int uid)
64 {
65   return -1;
66 }
67 #endif
68