00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __G_SPAWN_H__
00023 #define __G_SPAWN_H__
00024
00025 #include <_ansi.h>
00026 #include <glib/gerror.h>
00027
00028 G_BEGIN_DECLS
00029
00030
00031 #define G_SPAWN_ERROR g_spawn_error_quark ()
00032
00033 typedef enum
00034 {
00035 G_SPAWN_ERROR_FORK,
00036 G_SPAWN_ERROR_READ,
00037 G_SPAWN_ERROR_CHDIR,
00038 G_SPAWN_ERROR_ACCES,
00039 G_SPAWN_ERROR_PERM,
00040 G_SPAWN_ERROR_2BIG,
00041 G_SPAWN_ERROR_NOEXEC,
00042 G_SPAWN_ERROR_NAMETOOLONG,
00043 G_SPAWN_ERROR_NOENT,
00044 G_SPAWN_ERROR_NOMEM,
00045 G_SPAWN_ERROR_NOTDIR,
00046 G_SPAWN_ERROR_LOOP,
00047 G_SPAWN_ERROR_TXTBUSY,
00048 G_SPAWN_ERROR_IO,
00049 G_SPAWN_ERROR_NFILE,
00050 G_SPAWN_ERROR_MFILE,
00051 G_SPAWN_ERROR_INVAL,
00052 G_SPAWN_ERROR_ISDIR,
00053 G_SPAWN_ERROR_LIBBAD,
00054 G_SPAWN_ERROR_FAILED
00055
00056
00057 } GSpawnError;
00058
00059 typedef void (* GSpawnChildSetupFunc) (gpointer user_data);
00060
00061 typedef enum
00062 {
00063 G_SPAWN_LEAVE_DESCRIPTORS_OPEN = 1 << 0,
00064 G_SPAWN_DO_NOT_REAP_CHILD = 1 << 1,
00065
00066 G_SPAWN_SEARCH_PATH = 1 << 2,
00067
00068 G_SPAWN_STDOUT_TO_DEV_NULL = 1 << 3,
00069 G_SPAWN_STDERR_TO_DEV_NULL = 1 << 4,
00070 G_SPAWN_CHILD_INHERITS_STDIN = 1 << 5,
00071 G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
00072 } GSpawnFlags;
00073
00074 IMPORT_C GQuark g_spawn_error_quark (void);
00075
00076 #ifdef G_OS_WIN32
00077 #define g_spawn_async g_spawn_async_utf8
00078 #define g_spawn_async_with_pipes g_spawn_async_with_pipes_utf8
00079 #define g_spawn_sync g_spawn_sync_utf8
00080 #define g_spawn_command_line_sync g_spawn_command_line_sync_utf8
00081 #define g_spawn_command_line_async g_spawn_command_line_async_utf8
00082 #endif
00083
00084 IMPORT_C gboolean g_spawn_async (const gchar *working_directory,
00085 gchar **argv,
00086 gchar **envp,
00087 GSpawnFlags flags,
00088 GSpawnChildSetupFunc child_setup,
00089 gpointer user_data,
00090 GPid *child_pid,
00091 GError **error);
00092
00093
00094
00095
00096
00097 IMPORT_C gboolean g_spawn_async_with_pipes (const gchar *working_directory,
00098 gchar **argv,
00099 gchar **envp,
00100 GSpawnFlags flags,
00101 GSpawnChildSetupFunc child_setup,
00102 gpointer user_data,
00103 GPid *child_pid,
00104 gint *standard_input,
00105 gint *standard_output,
00106 gint *standard_error,
00107 GError **error);
00108
00109
00110
00111
00112
00113
00114 IMPORT_C gboolean g_spawn_sync (const gchar *working_directory,
00115 gchar **argv,
00116 gchar **envp,
00117 GSpawnFlags flags,
00118 GSpawnChildSetupFunc child_setup,
00119 gpointer user_data,
00120 gchar **standard_output,
00121 gchar **standard_error,
00122 gint *exit_status,
00123 GError **error);
00124
00125 IMPORT_C gboolean g_spawn_command_line_sync (const gchar *command_line,
00126 gchar **standard_output,
00127 gchar **standard_error,
00128 gint *exit_status,
00129 GError **error);
00130 IMPORT_C gboolean g_spawn_command_line_async (const gchar *command_line,
00131 GError **error);
00132
00133 IMPORT_C void g_spawn_close_pid (GPid pid);
00134
00135
00136 G_END_DECLS
00137
00138 #endif
00139
00140