xref: /netbsd-src/external/gpl3/gdb/dist/sim/common/portability.c (revision 88241920d21b339bf319c0e979ffda80c49a2936)
14b169a6bSchristos /* Portability shims for missing OS support.
2*88241920Schristos    Copyright (C) 2021-2024 Free Software Foundation, Inc.
34b169a6bSchristos    Contributed by Mike Frysinger.
44b169a6bSchristos 
54b169a6bSchristos This file is part of the GNU Simulators.
64b169a6bSchristos 
74b169a6bSchristos This program is free software; you can redistribute it and/or modify
84b169a6bSchristos it under the terms of the GNU General Public License as published by
94b169a6bSchristos the Free Software Foundation; either version 3 of the License, or
104b169a6bSchristos (at your option) any later version.
114b169a6bSchristos 
124b169a6bSchristos This program is distributed in the hope that it will be useful,
134b169a6bSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of
144b169a6bSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
154b169a6bSchristos GNU General Public License for more details.
164b169a6bSchristos 
174b169a6bSchristos You should have received a copy of the GNU General Public License
184b169a6bSchristos along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
194b169a6bSchristos 
204b169a6bSchristos /* This must come before any other includes.  */
214b169a6bSchristos #include "defs.h"
224b169a6bSchristos 
234b169a6bSchristos #include <unistd.h>
244b169a6bSchristos 
254b169a6bSchristos #include "portability.h"
264b169a6bSchristos 
274b169a6bSchristos #ifndef HAVE_GETEGID
284b169a6bSchristos int getegid(void)
294b169a6bSchristos {
304b169a6bSchristos   return 0;
314b169a6bSchristos }
324b169a6bSchristos #endif
334b169a6bSchristos 
344b169a6bSchristos #ifndef HAVE_GETEUID
354b169a6bSchristos int geteuid(void)
364b169a6bSchristos {
374b169a6bSchristos   return 0;
384b169a6bSchristos }
394b169a6bSchristos #endif
404b169a6bSchristos 
414b169a6bSchristos #ifndef HAVE_GETGID
424b169a6bSchristos int getgid(void)
434b169a6bSchristos {
444b169a6bSchristos   return 0;
454b169a6bSchristos }
464b169a6bSchristos #endif
474b169a6bSchristos 
484b169a6bSchristos #ifndef HAVE_GETUID
494b169a6bSchristos int getuid(void)
504b169a6bSchristos {
514b169a6bSchristos   return 0;
524b169a6bSchristos }
534b169a6bSchristos #endif
544b169a6bSchristos 
554b169a6bSchristos #ifndef HAVE_SETGID
564b169a6bSchristos int setgid(int gid)
574b169a6bSchristos {
584b169a6bSchristos   return -1;
594b169a6bSchristos }
604b169a6bSchristos #endif
614b169a6bSchristos 
624b169a6bSchristos #ifndef HAVE_SETUID
634b169a6bSchristos int setuid(int uid)
644b169a6bSchristos {
654b169a6bSchristos   return -1;
664b169a6bSchristos }
674b169a6bSchristos #endif
68