GNUnet 0.21.1
gnunet_os_lib.h File Reference

Low level process routines. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GNUNET_OS_ProjectData
 Project-specific data used to help the OS subsystem find installation paths. More...
 

Macros

#define GNUNET_OS_get_hostname_max_length()   255
 Get maximum string length returned by gethostname() More...
 

Typedefs

typedef enum GNUNET_GenericReturnValue(* GNUNET_OS_NetworkInterfaceProcessor) (void *cls, const char *name, int isDefault, const struct sockaddr *addr, const struct sockaddr *broadcast_addr, const struct sockaddr *netmask, socklen_t addrlen)
 Callback function invoked for each interface found. More...
 
typedef void(* GNUNET_OS_LineProcessor) (void *cls, const char *line)
 Type of a function to process a line of output. More...
 

Enumerations

enum  GNUNET_OS_InheritStdioFlags {
  GNUNET_OS_INHERIT_STD_NONE = 0 , GNUNET_OS_INHERIT_STD_IN = 1 , GNUNET_OS_INHERIT_STD_OUT = 2 , GNUNET_OS_INHERIT_STD_ERR = 4 ,
  GNUNET_OS_INHERIT_STD_OUT_AND_ERR = 6 , GNUNET_OS_INHERIT_STD_ALL = 7 , GNUNET_OS_USE_PIPE_CONTROL = 8
}
 Flags that determine which of the standard streams should be inherited by the child process. More...
 
enum  GNUNET_OS_InstallationPathKind {
  GNUNET_OS_IPK_PREFIX , GNUNET_OS_IPK_BINDIR , GNUNET_OS_IPK_LIBDIR , GNUNET_OS_IPK_DATADIR ,
  GNUNET_OS_IPK_LOCALEDIR , GNUNET_OS_IPK_SELF_PREFIX , GNUNET_OS_IPK_ICONDIR , GNUNET_OS_IPK_DOCDIR ,
  GNUNET_OS_IPK_LIBEXECDIR
}
 Possible installation paths to request. More...
 
enum  GNUNET_OS_ProcessStatusType {
  GNUNET_OS_PROCESS_UNKNOWN , GNUNET_OS_PROCESS_RUNNING , GNUNET_OS_PROCESS_STOPPED , GNUNET_OS_PROCESS_EXITED ,
  GNUNET_OS_PROCESS_SIGNALED
}
 Process status types. More...
 

Functions

const struct GNUNET_OS_ProjectDataGNUNET_OS_project_data_default (void)
 Return default project data used by 'libgnunetutil' for GNUnet. More...
 
const struct GNUNET_OS_ProjectDataGNUNET_OS_project_data_get (void)
 
void GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd)
 Setup OS subsystem with project data. More...
 
char * GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
 Get the path to a specific GNUnet installation directory or, with GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation directory. More...
 
char * GNUNET_OS_get_libexec_binary_path (const char *progname)
 Given the name of a gnunet-helper, gnunet-service or gnunet-daemon binary, try to prefix it with the libexec/-directory to get the full path. More...
 
char * GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *progname)
 Given the name of a helper, service or daemon binary construct the full path to the binary using the SUID_BINARY_PATH in the PATHS section of the configuration. More...
 
void GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, void *proc_cls)
 Enumerate all network interfaces. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_process_current (void)
 Get process structure for current process. More...
 
int GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
 Sends a signal to the process. More...
 
void GNUNET_OS_process_destroy (struct GNUNET_OS_Process *proc)
 Cleans up process structure contents (OS-dependent) and deallocates it. More...
 
pid_t GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc)
 Get the pid of the process in question. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_start_process_vap (enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, char *const argv[])
 Start a process. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename,...)
 Start a process. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_start_process_va (enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *pipe_stdin, struct GNUNET_DISK_PipeHandle *pipe_stdout, struct GNUNET_DISK_PipeHandle *pipe_stderr, const char *filename, va_list va)
 Start a process. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_start_process_v (enum GNUNET_OS_InheritStdioFlags std_inheritance, const int *lsocks, const char *filename, char *const argv[])
 Start a process. More...
 
struct GNUNET_OS_ProcessGNUNET_OS_start_process_s (enum GNUNET_OS_InheritStdioFlags std_inheritance, const int *lsocks, const char *filename,...)
 Start a process. More...
 
void GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd)
 Stop/kill a command. More...
 
struct GNUNET_OS_CommandHandleGNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, void *proc_cls, struct GNUNET_TIME_Relative timeout, const char *binary,...)
 Run the given command line and call the given function for each line of the output. More...
 
enum GNUNET_GenericReturnValue GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type, unsigned long *code)
 Retrieve the status of a process. More...
 
enum GNUNET_GenericReturnValue GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc)
 Wait for a process to terminate. More...
 
enum GNUNET_GenericReturnValue GNUNET_OS_process_wait_status (struct GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type, unsigned long *code)
 Retrieve the status of a process, waiting on it if dead. More...
 
void GNUNET_OS_install_parent_control_handler (void *cls)
 Connects this process to its parent via pipe; essentially, the parent control handler will read signal numbers from the GNUNET_OS_CONTROL_PIPE (as given in an environment variable) and raise those signals. More...
 
enum GNUNET_GenericReturnValue GNUNET_OS_check_helper_binary (const char *binary, bool check_suid, const char *params)
 Check whether an executable exists and possibly if the suid bit is set on the file. More...
 

Detailed Description

Low level process routines.

Definition in file gnunet_os_lib.h.