#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_gnunet (void) |
Return default project data used by 'libgnunetutil' for GNUnet. More... | |
void | GNUNET_OS_init (const char *package_name, const struct GNUNET_OS_ProjectData *pd) |
Setup OS subsystem for the given project data and package. 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 (const struct GNUNET_OS_ProjectData *pd) |
Try to obtain the installation path using the "GNUNET_PREFIX" environment variable. More... | |
static char * | os_get_gnunet_path (const struct GNUNET_OS_ProjectData *pd) |
get the path to GNUnet bin/ or lib/, preferring the lib/ path More... | |
static char * | os_get_exec_path (const struct GNUNET_OS_ProjectData *pd) |
get the path to current app's bin/ More... | |
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. More... | |
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. More... | |
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. 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... | |
#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 295 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.
pd | project data to use to determine paths |
Definition at line 353 of file os_installation.c.
References 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
pd | project data to use to determine paths |
Definition at line 375 of file os_installation.c.
References GNUNET_OS_ProjectData::binary_name, 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/
pd | project data to use to determine paths |
Definition at line 416 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_gnunet().