OSDN Git Service

2007-07-09 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libgfortran / intrinsics / getXid.c
1 /* Wrapper for the unix get{g,p,u}id functions.
2    Copyright (C) 2004 Free Software Foundation, Inc.
3
4 This file is part of the GNU Fortran 95 runtime library (libgfortran).
5
6 Libgfortran is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file.  (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
18 executable.)
19
20 Libgfortran is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public
26 License along with libgfortran; see the file COPYING.  If not,
27 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
28 Boston, MA 02110-1301, USA.  */
29
30 #include "config.h"
31
32 #if HAVE_UNISTD_H
33 #include <unistd.h>
34 #endif
35
36 #include "libgfortran.h"
37
38 #ifdef __MINGW32__
39 #define HAVE_GETPID 1
40 #include <process.h>
41 #endif
42
43 #ifdef HAVE_GETGID
44 extern GFC_INTEGER_4 PREFIX(getgid) (void);
45 export_proto_np(PREFIX(getgid));
46
47 GFC_INTEGER_4
48 PREFIX(getgid) (void)
49 {
50   return getgid ();
51 }
52 #endif
53
54 #ifdef HAVE_GETPID
55 extern GFC_INTEGER_4 PREFIX(getpid) (void);
56 export_proto_np(PREFIX(getpid));
57
58 GFC_INTEGER_4
59 PREFIX(getpid) (void)
60 {
61   return getpid ();
62 }
63 #endif
64
65 #ifdef HAVE_GETUID
66 extern GFC_INTEGER_4 PREFIX(getuid) (void);
67 export_proto_np(PREFIX(getuid));
68
69 GFC_INTEGER_4
70 PREFIX(getuid) (void)
71 {
72   return getuid ();
73 }
74 #endif