Merge branch '1175-source-names' into 'master'
[glib.git] / glib / gspawn-private.h
blob16f816c893be472f36b77465199f251701f79fbd
1 /* gspawn.c - Process launching
3 * Copyright 2000 Red Hat, Inc.
4 * g_execvpe implementation based on GNU libc execvp:
5 * Copyright 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library 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 GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #include "config.h"
23 #include <errno.h>
25 #include "gspawn.h"
27 static inline gint
28 _g_spawn_exec_err_to_g_error (gint en)
30 switch (en)
32 #ifdef EACCES
33 case EACCES:
34 return G_SPAWN_ERROR_ACCES;
35 #endif
37 #ifdef EPERM
38 case EPERM:
39 return G_SPAWN_ERROR_PERM;
40 #endif
42 #ifdef E2BIG
43 case E2BIG:
44 return G_SPAWN_ERROR_TOO_BIG;
45 #endif
47 #ifdef ENOEXEC
48 case ENOEXEC:
49 return G_SPAWN_ERROR_NOEXEC;
50 #endif
52 #ifdef ENAMETOOLONG
53 case ENAMETOOLONG:
54 return G_SPAWN_ERROR_NAMETOOLONG;
55 #endif
57 #ifdef ENOENT
58 case ENOENT:
59 return G_SPAWN_ERROR_NOENT;
60 #endif
62 #ifdef ENOMEM
63 case ENOMEM:
64 return G_SPAWN_ERROR_NOMEM;
65 #endif
67 #ifdef ENOTDIR
68 case ENOTDIR:
69 return G_SPAWN_ERROR_NOTDIR;
70 #endif
72 #ifdef ELOOP
73 case ELOOP:
74 return G_SPAWN_ERROR_LOOP;
75 #endif
77 #ifdef ETXTBUSY
78 case ETXTBUSY:
79 return G_SPAWN_ERROR_TXTBUSY;
80 #endif
82 #ifdef EIO
83 case EIO:
84 return G_SPAWN_ERROR_IO;
85 #endif
87 #ifdef ENFILE
88 case ENFILE:
89 return G_SPAWN_ERROR_NFILE;
90 #endif
92 #ifdef EMFILE
93 case EMFILE:
94 return G_SPAWN_ERROR_MFILE;
95 #endif
97 #ifdef EINVAL
98 case EINVAL:
99 return G_SPAWN_ERROR_INVAL;
100 #endif
102 #ifdef EISDIR
103 case EISDIR:
104 return G_SPAWN_ERROR_ISDIR;
105 #endif
107 #ifdef ELIBBAD
108 case ELIBBAD:
109 return G_SPAWN_ERROR_LIBBAD;
110 #endif
112 default:
113 return G_SPAWN_ERROR_FAILED;