diff options
author | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2023-06-09 20:46:47 -0300 |
---|---|---|
committer | Anna (navi) Figueiredo Gomes <navi@vlhl.dev> | 2023-10-19 10:56:54 +0200 |
commit | 5a1cd9545164d978ded996ac6d673fd6d480a2fe (patch) | |
tree | 1002f7bdfb5b823aa8cdbe4502ebcb61bba97e7e /src/librc/rc.h.in | |
parent | b8613baa85965cbdf5fbe262b9464d5c0d98614f (diff) |
openrc: rework pathing functions
this simplifies the allocation of path string. also fixes some memory
leaks from the ealier commit
also changes the log path for users to XDG_CACHE_HOME, default
~/.cache/openrc
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/librc/rc.h.in')
-rw-r--r-- | src/librc/rc.h.in | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in index d177ee4b..f35c9110 100644 --- a/src/librc/rc.h.in +++ b/src/librc/rc.h.in @@ -34,42 +34,38 @@ extern "C" { #else #define RC_SVCDIR RC_LIBEXECDIR "/init.d" #endif -#define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels" -#define RC_INITDIR RC_SYSCONFDIR "/init.d" -#define RC_CONFDIR RC_SYSCONFDIR "/conf.d" +#define RC_RUNLEVELDIR_FOLDER "/runlevels" +#define RC_RUNLEVELDIR RC_SYSCONFDIR RC_RUNLEVELDIR_FOLDER +#define RC_INITDIR_FOLDER "/init.d" +#define RC_INITDIR RC_SYSCONFDIR RC_INITDIR_FOLDER +#define RC_CONFDIR_FOLDER "/conf.d" +#define RC_CONFDIR RC_SYSCONFDIR RC_CONFDIR_FOLDER #define RC_PLUGINDIR RC_LIBDIR "/plugins" -#define RC_INIT_FIFO RC_SVCDIR"/init.ctl" +#define RC_INIT_FIFO RC_SVCDIR"/init.ctl" #define RC_PROFILE_ENV RC_SYSCONFDIR "/profile.env" #define RC_SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist" #define RC_USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist" -#define RC_CONF RC_SYSCONFDIR "/rc.conf" -#define RC_CONF_D RC_SYSCONFDIR "/rc.conf.d" -#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc" +#define RC_CONF_FILE "/rc.conf" +#define RC_CONF RC_SYSCONFDIR RC_CONF_FILE +#define RC_CONF_D_FOLDER "/rc.conf.d" +#define RC_CONF_D RC_SYSCONFDIR RC_CONF_D_FOLDER +#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc" #ifdef RC_USER_SERVICES #define RC_SYS_USER_INITDIR RC_INITDIR "/user.d" #define RC_SYS_USER_CONFDIR RC_CONFDIR "/user.d" -#define RC_USER_INITDIR_FOLDER "/init.d" -#define RC_USER_CONFDIR_FOLDER "/conf.d" -#define RC_USER_RUNLEVELS_FOLDER "/runlevels" -#define RC_USER_RUNTIME_FOLDER "/openrc" +#define RC_USER_CONF_FOLDER "/openrc" - -#define RC_USER_CONF "/rc.conf" -#define RC_USER_CONF_D "/rc.conf.d" +/*! @name Reserved runlevel names */ +#define RC_LEVEL_USERNONE "none" /*! Is openrc being ran in usermode? * @return true if yes, otherwise false */ bool rc_is_user(void); void rc_set_user(void); - -const char *rc_user_home(void); -char *rc_user_sysconfdir(void); -char *rc_user_svcdir(void); -char *rc_user_datadir(void); #endif #define RC_PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" @@ -340,6 +336,18 @@ RC_STRINGLIST *rc_services_scheduled(const char *); * @return true if all daemons started are still running, otherwise false */ bool rc_service_daemons_crashed(const char *); +/*! Returns the system config directory, in either system or user mode + * @return allocated path string */ +char *rc_sysconfdir(void); + +/*! Returns the services directory, in either system or user mode + * @return allocated path string */ +char *rc_svcdir(void); + +/*! Returns the cache directory, in either system or user mode + * @return allocated path string */ +char *rc_cachedir(void); + /*! @name System types * OpenRC can support some special sub system types, normally virtualization. * Some services cannot work in these systems, or we do something else. */ |