This lays the groundwork for other features like user services, or
a different root prefix, by allowing us to change where openrc looks up
for files at runtime.
getline(3) got standardized in posix 2008 and is common place on all
libc implementations now a days, and rc_getline is tagged for removal
for ages now.
rc_getline is an implementation from when getline wasn't available on
most libcs, and is planned for removal, however much of of the code
relies on it's behaviour of removing new lines at the end of strings.
To avoid duplicating the new line removal logic in a dozen places, we
introduce a new helper function xgetline, which just wraps around
getline but removes the new line at the end.
This change removes the ROOTPREFIX build setting.
If your OS expects to have / mounted earlier in the boot process than
/usr, you will need to pass the appropriate directory settings to "meson
setup" as part of the build process, for example:
$ meson setup \
--bindir /bin --libdir /lib64 --libexecdir /lib --sbindir /sbin \
build
also, move plugins to ```libdir/rc/plugins``` which is the standard
location for plugins accessed via dlopen.
The current code for mark_service comments that a service marking itself
should make openrc-run skip marking it based on the exit code, but
openrc-run does not respect the signal.
Currently the code uses the total size of the buffer as the bounds for
looping \0 separated fields, which leads to reading uninitialized data
and possibly overrun the buffer during regexec.
Observed on musl while matching /proc/cpuinfo.
For linux systems, libcap is a lightweight dependency. Also, making it
optional requires that service scripts be written to deal with the
possibility that capabilities are not supported.
This fixes#739.
X-Gemtoo-Bug: https://bugs.gentoo.org/939543
containers on linux might require filesystems to be mounted with
different propagation than the kernel default of 'private':
by setting 'shared' in fstab for / options, one can now make the
fs hierarchy shared.
Note we use 'rshared' to make other existing mounts shared as well
because the setting is contagious and it seemed more logical to
behave as if the setting was set on / immediately (and thus inherited
by other mounts)
This fixes#525.
Linux does not provide a way to set scheduling parameters for a process,
only for threads, so musl sched_setscheduler() is only a stub and the
glibc implementation does "the wrong thing".
Use pthread_setschedparam everywhere so we don't depend on any
implementation specific behavior.
ref: https://www.openwall.com/lists/musl/2016/03/01/5
fixes: https://github.com/OpenRC/openrc/issues/689
The stop schedule code calls syslog, so we need to open a syslog
connection so the process name will get properly logged on musl, and we
can ensure the pid gets logged and the right facility is used.
Get rid of the alarm/setjmp/longjmp.
Trust that the kernel will not block with O_NDELAY.
Use write() instead of stdio.
Bug: https://bugs.gentoo.org/923326
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
- Remove 'pkgconfig' subdir
- use meson 'pkgconfig' module to generate and install appropriate
.pc files when required.
- add `rc_path` variable to installed pkgconfig files
Signed-off-by: Matt Jolly <kangie@gentoo.org>
Bash completion has two official completion directories:
- completionsdir, a lazy loading mechanism
- compatdir, an eager loading mechanism
Modern style is to use lazy loading if possible. It is modern
technology, speeds up your shell by deferring loads, and is generally
recommended for applications to prefer by default. It requires you name
your completion script using the same name as the command to complete.
Every distro prefers you do this, but only because bash-completion
itself does.
The openrc-service-script completion doesn't provide a completion for a
command called openrc-service-script. It cannot use the lazy loading
mechanism and emits a warning in Gentoo's policy lints as a result.
Installing to the completionsdir is therefore a useless no-op. Better to
install nothing.
The compatdir is the correct location for completions that cannot be
lazy loaded and must be loaded at shell startup in order to correctly
register themselves for a globbed list of commands that can only be
ascertained dynamically at shell startup. The alternative is to have
every command that can be globbed install a symlink to
openrc-service-script, and install openrc-service-script to a third
location.