getXid.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Wrapper for the unix get{g,p,u}id functions.
  2. Copyright (C) 2004-2015 Free Software Foundation, Inc.
  3. This file is part of the GNU Fortran 95 runtime library (libgfortran).
  4. Libgfortran is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public
  6. License as published by the Free Software Foundation; either
  7. version 3 of the License, or (at your option) any later version.
  8. Libgfortran is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. Under Section 7 of GPL version 3, you are granted additional
  13. permissions described in the GCC Runtime Library Exception, version
  14. 3.1, as published by the Free Software Foundation.
  15. You should have received a copy of the GNU General Public License and
  16. a copy of the GCC Runtime Library Exception along with this program;
  17. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. #include "libgfortran.h"
  20. #if HAVE_UNISTD_H
  21. #include <unistd.h>
  22. #endif
  23. #ifdef __MINGW32__
  24. #define HAVE_GETPID 1
  25. #include <process.h>
  26. #endif
  27. #ifdef HAVE_GETGID
  28. extern GFC_INTEGER_4 PREFIX(getgid) (void);
  29. export_proto_np(PREFIX(getgid));
  30. GFC_INTEGER_4
  31. PREFIX(getgid) (void)
  32. {
  33. return getgid ();
  34. }
  35. #endif
  36. #ifdef HAVE_GETPID
  37. extern GFC_INTEGER_4 PREFIX(getpid) (void);
  38. export_proto_np(PREFIX(getpid));
  39. GFC_INTEGER_4
  40. PREFIX(getpid) (void)
  41. {
  42. return getpid ();
  43. }
  44. #endif
  45. #ifdef HAVE_GETUID
  46. extern GFC_INTEGER_4 PREFIX(getuid) (void);
  47. export_proto_np(PREFIX(getuid));
  48. GFC_INTEGER_4
  49. PREFIX(getuid) (void)
  50. {
  51. return getuid ();
  52. }
  53. #endif