![]() |
![]() |
![]() |
Gksu PolicyKit Reference Manual | |
---|---|---|---|---|
GksuProcessPrivate; GksuProcess; GType gksu_process_get_type (void); #define GKSU_TYPE_PROCESS #define GKSU_PROCESS (object) #define GKSU_PROCESS_GET_CLASS (object) GksuProcess* gksu_process_new (const gchar *working_directory, const gchar **arguments); gboolean gksu_process_spawn_async_with_pipes (GksuProcess *process, gint *standard_input, gint *standard_output, gint *standard_error, GError **error); gboolean gksu_process_spawn_async (GksuProcess *process, GError **error); gboolean gksu_process_spawn_sync (GksuProcess *process, gint *status, GError **error);
#define GKSU_PROCESS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GKSU_TYPE_PROCESS, GksuProcess))
|
#define GKSU_PROCESS_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), GKSU_TYPE_PROCESS, GksuProcessClass))
|
GksuProcess* gksu_process_new (const gchar *working_directory, const gchar **arguments);
This function creates a new GksuProcess object, which can be used
to launch a process as the root user (uid 0). The process is
started with the given directory path as its working directory. The
arguments
array must have the command to be executed at its first
position, followed by the command's arguments; it must also contain
a NULL
at its last position.
|
directory path |
|
NULL -terminated array of strings
|
Returns : |
a new instance of GksuProcess |
gboolean gksu_process_spawn_async_with_pipes (GksuProcess *process, gint *standard_input, gint *standard_output, gint *standard_error, GError **error);
Creates the process with the information stored in the
GksuProcess. If you pass the pointers to integers to the
standard_input
, standard_output
and standard_error
parameters
they will be set to the corresponding file descriptors of the
child; the child standard I/O channels will be essentially disabled
for the ones to which NULL
is given.
This function return immediately after the process has been created. You need to connect to the GksuProcess::exited signal to know that the process has ended and get its exit status.
Notice that some caveats exist in how the input and output are handled. Gksu PolicyKit uses a D-Bus service to do the actual running of the program, and all the input must be sent to and all the output must be received from this service, through D-Bus. The library handles this, but it needs a glib main loop for that. This means that if you keep the mainloop from running by using a loop to read the standard output, for example, you may end up not having anything to read.
|
|
|
return location for file descriptor to write to child's
stdin, or NULL
|
|
return location for file descriptor to write to child's
stdout, or NULL
|
|
return location for file descriptor to write to child's
stderr, or NULL
|
|
return location for a GError |
Returns : |
FALSE if error is set, TRUE if all went well
|
gboolean gksu_process_spawn_async (GksuProcess *process, GError **error);
Creates the process with the information stored in the GksuProcess. This function will only return after the child process has finished.
Notice that, internally, this function runs the main loop, so even though this function will not return, idles, IO watches, timeouts, and event handlers may be called while the child is not yet finished.
|
|
|
return location for a GError |
Returns : |
FALSE if error is set, TRUE if all went well
|
gboolean gksu_process_spawn_sync (GksuProcess *process, gint *status, GError **error);
|
|
|
|
|
|
Returns : |
"exited"
signalvoid user_function (GksuProcess *gksuprocess, gint arg1, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |