GNUnet 0.26.2-45-gb0324da85
 
Loading...
Searching...
No Matches
gnunet_os_lib.h File Reference

Low level process routines. More...

#include "gnunet_disk_lib.h"
Include dependency graph for gnunet_os_lib.h:
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...
 
struct  GNUNET_ProcessOptionValue
 Possible options we can set for a process. More...
 

Macros

#define GNUNET_OS_get_hostname_max_length()   255
 Get maximum string length returned by gethostname()
 
#define GNUNET_PROCESS_OPTIONS_ARRAY_MAX_SIZE   32
 Maximum number of process options we can set in one pass.
 
#define GNUNET_process_option_end_()
 Terminate the list of the options.
 
#define GNUNET_process_option_set_environment(key, value)
 Set environment variable in child process.
 
#define GNUNET_process_option_inherit_fd(parent_fd, child_fd)
 Have child process inherit a file descriptor.
 
#define GNUNET_process_option_inherit_rpipe(rpipe, child_fd)
 Have child process inherit a pipe for reading.
 
#define GNUNET_process_option_inherit_wpipe(wpipe, child_fd)
 Have child process inherit a pipe for writing.
 
#define GNUNET_process_option_inherit_lsock(lsock)
 Pass listen socket to child systemd-style.
 
#define GNUNET_process_set_options(proc, ...)
 Set the requested options for the process.
 

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.
 
typedef void(* GNUNET_OS_LineProcessor) (void *cls, const char *line)
 Type of a function to process a line of output.
 

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...
 
enum  GNUNET_ProcessOption { GNUNET_PROCESS_OPTION_END = 0 , GNUNET_PROCESS_OPTION_SET_ENVIRONMENT = 1 , GNUNET_PROCESS_OPTION_INHERIT_FD = 2 , GNUNET_PROCESS_OPTION_INHERIT_LSOCK = 3 }
 Possible options we can set for a process. More...
 

Functions

const struct GNUNET_OS_ProjectDataGNUNET_OS_project_data_gnunet (void)
 Return default project data used by 'libgnunetutil' for GNUnet.
 
void GNUNET_OS_init (const char *package_name, const struct GNUNET_OS_ProjectData *pd)
 Setup OS subsystem for the given project data and package.
 
char * GNUNET_OS_installation_get_path (const struct GNUNET_OS_ProjectData *pd, 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.
 
char * GNUNET_OS_get_libexec_binary_path (const struct GNUNET_OS_ProjectData *pd, 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.
 
char * GNUNET_OS_get_suid_binary_path (const struct GNUNET_OS_ProjectData *pd, 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.
 
void GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, void *proc_cls)
 Enumerate all network interfaces.
 
void GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd)
 Stop/kill a command.
 
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.
 
struct GNUNET_ProcessGNUNET_process_create (enum GNUNET_OS_InheritStdioFlags std_inheritance)
 Create a process handle.
 
enum GNUNET_GenericReturnValue GNUNET_process_run_command_ap (struct GNUNET_Process *p, const char *filename, va_list va)
 Set the command and start a process.
 
enum GNUNET_GenericReturnValue GNUNET_process_run_command_argv (struct GNUNET_Process *p, const char *filename, const char **argv)
 Set the command and start a process.
 
enum GNUNET_GenericReturnValue GNUNET_process_run_command_va (struct GNUNET_Process *p, const char *filename,...)
 Set the command and start a process.
 
enum GNUNET_GenericReturnValue GNUNET_process_run_command (struct GNUNET_Process *p, const char *command)
 Set the command and start a process.
 
enum GNUNET_GenericReturnValue GNUNET_process_set_options_ (struct GNUNET_Process *proc, unsigned int num_options, const struct GNUNET_ProcessOptionValue options[])
 Set the requested options for the process.
 
enum GNUNET_GenericReturnValue GNUNET_process_wait (struct GNUNET_Process *proc, bool blocking, enum GNUNET_OS_ProcessStatusType *type, unsigned long *code)
 Wait for a process to terminate.
 
void GNUNET_process_destroy (struct GNUNET_Process *proc)
 Cleans up process structure contents (OS-dependent) and deallocates it.
 
pid_t GNUNET_process_get_pid (const struct GNUNET_Process *proc)
 Get the pid of the process in question.
 
enum GNUNET_GenericReturnValue GNUNET_process_kill (struct GNUNET_Process *proc, int sig)
 Sends a signal to the process.
 
struct GNUNET_ProcessGNUNET_process_current (void)
 Get process structure for current process.
 
void GNUNET_process_install_parent_control_handler (void)
 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.
 
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.
 
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.
 

Detailed Description

Low level process routines.

Definition in file gnunet_os_lib.h.