#include "platform.h"
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <unistr.h>
#include "gnunet_util_lib.h"
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__) |
#define | LOG_STRERROR_FILE(kind, syscall, filename) |
Functions | |
const struct GNUNET_OS_ProjectData * | GNUNET_OS_project_data_default (void) |
Return default project data used by 'libgnunetutil' for GNUnet. More... | |
const struct GNUNET_OS_ProjectData * | GNUNET_OS_project_data_get () |
void | GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd) |
Setup OS subsystem with project data. More... | |
static char * | get_path_from_PATH (const char *binary) |
Return the actual path to a file found in the current PATH environment variable. More... | |
static char * | get_path_from_GNUNET_PREFIX (void) |
Try to obtain the installation path using the "GNUNET_PREFIX" environment variable. More... | |
static char * | os_get_gnunet_path (void) |
get the path to GNUnet bin/ or lib/, preferring the lib/ path More... | |
static char * | os_get_exec_path () |
get the path to current app's bin/ 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... | |
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... | |
Variables | |
static const struct GNUNET_OS_ProjectData | default_pd |
Default project data used for installation path detection for GNUnet (core). More... | |
static const struct GNUNET_OS_ProjectData * | current_pd = &default_pd |
Which project data do we currently use for installation path detection? Never NULL. More... | |
static const struct GNUNET_OS_ProjectData * | gettextinit |
PD for which gettext has been initialized last. More... | |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__) |
Definition at line 46 of file os_installation.c.
#define LOG_STRERROR_FILE | ( | kind, | |
syscall, | |||
filename | |||
) |
Definition at line 49 of file os_installation.c.
|
static |
Return the actual path to a file found in the current PATH environment variable.
binary | the name of the file to find |
Definition at line 318 of file os_installation.c.
References end, getenv(), GNUNET_DISK_file_test(), GNUNET_free, GNUNET_malloc, GNUNET_strdup, GNUNET_YES, p, and PATH_SEPARATOR.
Referenced by GNUNET_OS_check_helper_binary(), and os_get_gnunet_path().
|
static |
Try to obtain the installation path using the "GNUNET_PREFIX" environment variable.
Definition at line 367 of file os_installation.c.
References current_pd, GNUNET_OS_ProjectData::env_varname, GNUNET_OS_ProjectData::env_varname_alt, getenv(), GNUNET_strdup, and p.
Referenced by os_get_gnunet_path().
|
static |
get the path to GNUnet bin/ or lib/, preferring the lib/ path
Definition at line 388 of file os_installation.c.
References _, GNUNET_OS_ProjectData::binary_name, current_pd, GNUNET_OS_ProjectData::env_varname, get_path_from_GNUNET_PREFIX(), get_path_from_PATH(), GNUNET_ERROR_TYPE_ERROR, LOG, GNUNET_OS_ProjectData::project_dirname, and ret.
Referenced by GNUNET_OS_installation_get_path().
|
static |
get the path to current app's bin/
Definition at line 428 of file os_installation.c.
References ret.
Referenced by GNUNET_OS_installation_get_path().
|
static |
Default project data used for installation path detection for GNUnet (core).
Definition at line 60 of file os_installation.c.
Referenced by GNUNET_OS_project_data_default().
|
static |
Which project data do we currently use for installation path detection? Never NULL.
Definition at line 81 of file os_installation.c.
Referenced by get_path_from_GNUNET_PREFIX(), GNUNET_OS_init(), GNUNET_OS_installation_get_path(), GNUNET_OS_project_data_get(), and os_get_gnunet_path().
|
static |
PD for which gettext has been initialized last.
Note that the gettext initialization done within GNUNET_PROGRAM_run2 is for the specific application.
Definition at line 88 of file os_installation.c.
Referenced by GNUNET_OS_init(), and GNUNET_OS_project_data_get().