Compare commits

...

49 Commits

Author SHA1 Message Date
William Hubbs
4a9c450ec2 update change log 2015-02-04 22:03:26 -06:00
William Hubbs
bb4c14999c Add nfsclient to netmount use dependencies
X-Gentoo-Bug: 537996
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=537996
2015-02-04 21:59:50 -06:00
William Hubbs
252422dcf0 start openrc-0.13.9 2015-02-04 21:59:14 -06:00
William Hubbs
a3a64ac94e update ChangeLog 2015-01-18 09:45:32 -06:00
William Hubbs
1a2f45a4c5 tmpfiles.dev: pass --boot to tmpfiles.sh so kmod works properly 2015-01-18 09:32:49 -06:00
William Hubbs
34b55f31b3 start work on 0.13.8 2015-01-18 09:31:53 -06:00
William Hubbs
e0c746e938 Create ChangeLog 2015-01-15 09:51:12 -06:00
William Hubbs
50329eee7a Add description for cgroup_cleanup
X-Gentoo-Bug: 535184
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=535184
2015-01-13 01:07:02 -06:00
Doug Freed
fb81028121 fix double free of pidfile
This fixes a double free of the pidfile variable. For discussion of this
issue, see the bug.

X-Gentoo-Bug: 531600
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531600
2015-01-13 01:07:02 -06:00
William Hubbs
50e99aa30a Do not call the shell to evaluate CHANGELOG_LIMIT
The git log command understands dates such as "1 year ago", so there is
no need to use the date command.
2015-01-13 01:07:02 -06:00
William Hubbs
b177b79242 Add target to create ChangeLog
This was added by request because some users are requesting a ChangeLog.

This fixes #29.
2015-01-13 01:07:02 -06:00
William Hubbs
7009f66872 start working on 0.13.7 2015-01-13 00:45:19 -06:00
William Hubbs
2eb0ea9afb Make sysfs behave like netmount and localmount
sysfs now mounts all related sysfs file systems and returns success,
like netmount and localmount.

Also, we now check to make sure the cgroups are not mounted before we
mount them.

X-Gentoo-Bug: 530138
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=530138
2014-11-23 21:59:01 -06:00
William Hubbs
534031fc7a Start work on 0.13.6 2014-11-23 21:57:44 -06:00
William Hubbs
6b85d4288c devfs: optionally add missing symbolic links
If symbolic links for /dev/{fd,stdin,stdout,stderr,core} do not exist
once /dev is mounted, we should create them.
2014-11-20 11:07:14 -06:00
William Hubbs
dec899b946 Start work on 0.13.5 2014-11-20 11:06:03 -06:00
William Hubbs
c9f6e2a6c8 netmount: unmount nfs file systems 2014-11-06 14:44:01 -06:00
William Hubbs
e1a4aef3e5 start work on 0.13.4 2014-11-06 14:43:02 -06:00
Alexander Vershilov
cb2c45a3c0 Fix incorrect handling of chroot option.
Fixes #28.

X-Gentoo-Bug: #527370
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=527370
2014-11-01 18:32:26 -05:00
William Hubbs
d92eca3988 Start work on 0.13.3 2014-11-01 18:31:20 -05:00
Johan Bergström
5bdd08e0e7 Pass ncurses cflags to build
Fixes #25
Note from William Hubbs:
The original patch overwrote CFLAGS. I modified this patch to add the
ncurses cflags to CPPFLAGS instead of overwriting CFLAGS.
2014-10-26 13:32:46 -05:00
William Hubbs
8a68dc899e Fix compile errors created by bundling queue.h 2014-10-24 10:59:16 -05:00
Anthony G. Basile
2d1e255285 helpers.h, start-stop-daemon.c: remove uneeded macros
TAILQ_CONCAT, TAILQ_FOREACH_SAFE and LIST_FOREACH_SAFE are defined
in our bundled queue.h and are no longer required.
2014-10-24 10:59:16 -05:00
Anthony G. Basile
6f9fd30edb Bundle <sys/queue.h> from NetBSD
We are bundling this to allow building on musl-based systems since musl
does not include <sys/queue.h>.
2014-10-24 10:59:16 -05:00
William Hubbs
e0c32c23dc Fix all tests for GNU/kFreeBSD
It is necessary to check for both the kernel and c library because
__FreeBSD_kernel is also defined on native FreeBSD [1].

[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/
2014-10-24 10:59:16 -05:00
Gabriele Giacone
4777035d53 Fix rc_svcdir for GNU/Hurd 2014-10-24 10:59:16 -05:00
Svante Signell
f049b535b3 fix defines for GNU/Hurd 2014-10-24 10:59:16 -05:00
Svante Signell
4ba30c5a1b add missing files for GNU/Hurd 2014-10-24 10:59:15 -05:00
Gabriele Giacone
91734d20be Fix rc_svcdir for GNU/kFreeBSD 2014-10-24 10:59:15 -05:00
Gabriele Giacone
b4194fef43 Add missing files for GNU/kFreeBSD 2014-10-24 10:59:15 -05:00
Svante Signell
5f23128f30 Fix GNU/kFreeBSD port
Check for __FreeBSD_kernel instead of __GLIBC__ in source files.

note from William Hubbs:
I was told this is a better check for GNU/kFreeBSD than checking the
C  library the source is being compiled against.
GNU/kFreeBSD than checking which library we are using.
2014-10-24 10:59:15 -05:00
Anthony G. Basile
a634534167 einfo.h, rc.h.in: simplify __BEGIN_DECLS logic
There is no need to redefine __BEGIN_DECLS and __END_DECLS.
We simplify the logic here and avoid undefining these macros.
2014-10-24 10:59:15 -05:00
Anthony G. Basile
f77006b58e einfo.h, rc.h.in: ensure __BEGIN_DECLS is defined
Some Standard C Libraries, like musl, don't define __BEGIN_DECLS
or __END_DECLS.  We add some ifdef magic to ensure these are
available.
2014-10-24 10:59:15 -05:00
William Hubbs
ef22f78a48 Update news file wrt chroot variable 2014-10-20 16:03:27 -05:00
Alexander Vershilov
735dc45c39 librc:look for the pid file in a chroot if defined
X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
2014-10-20 16:03:27 -05:00
William Hubbs
0d3fdd3769 runscript.sh: add chroot support
This adds support for a chroot variable which will be passed to the
start-stop-daemon --chroot switch to runscript.sh when starting a
daemon. This also needs to be saved so it can be used in locating the
pid file when stopping the daemon.

X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
2014-10-20 16:03:27 -05:00
William Hubbs
5a1a94b2cc Add NEWS file 2014-10-20 16:03:27 -05:00
William Hubbs
a76e5a827c add back nfs and nfs4 file systems
Fix gentoo bug #427996 correctly.
We should attempt to mount the file systems, but not try to start the
daemons. The previous fix removed mounting the file systems as well as
starting the daemons.

X-Gentoo-Bug: 508574
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=508574
2014-10-20 16:03:27 -05:00
William Hubbs
b964de8287 man: Document start_inactive and in_background_fake 2014-10-16 11:42:38 -05:00
William Hubbs
2c1051ad3f typo fix 2014-10-16 11:32:48 -05:00
Roy Marples
a2187e897e Use exception-based approach for cgroup/ulimit setup
Note from William Hubbs:
I spoke with Roy about this, and he pointed out that user-defined
functions may need the limits applied, so it is better to go with a
method that uses exceptions to determine which functions apply the
limits.

X-Gentoo-Bug: 522408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=522408
2014-10-16 11:09:36 -05:00
Rick Farina (ZeroChaos)
e8043fe378 localmount: unmount aufs branches 2014-10-13 15:41:03 -05:00
William Hubbs
082fd53d9e runscript: move verbose mode setting near debug setting 2014-10-13 15:40:54 -05:00
Joe M
61fd8b2996 savecache: check permissions on the correct directory 2014-10-13 15:39:56 -05:00
Andrew Gregory
43d727dc3f tmpfiles.sh: add support for C action
Recursively copies files or directories.  Added by systemd in 849958d1.
2014-10-13 15:39:36 -05:00
Andrew Gregory
b8e52583ca tmpfiles.sh: add support for + modifier
systemd added support for b+, c+, p+, and L+ in 2e78fa79 and 1554afae to
remove the target path if it already exists.
2014-10-13 15:39:22 -05:00
William Hubbs
1a7af5bbde Start work on 0.13.2 2014-10-13 15:39:12 -05:00
William Hubbs
785b61e872 cgroups: fix cgroup subsystem mounting
Originally, we aborted all of the cgroup setup if /sys/fs/cgroup/openrc
was already mounted. This  caused an issue in lxc containers, so we
should always allow the subsystems to be mounted.

X-Gentoo-Bug: 520606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=520606
2014-08-22 14:19:03 -05:00
William Hubbs
54ed42503f start work on 0.13.1 2014-08-22 14:18:33 -05:00
51 changed files with 2302 additions and 151 deletions

990
ChangeLog Normal file
View File

@@ -0,0 +1,990 @@
commit bb4c14999c569781c7289269949b205955f376bb
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Tue Feb 3 10:53:48 2015 -0600
Add nfsclient to netmount use dependencies
X-Gentoo-Bug: 537996
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=537996
commit 252422dcf0c408742cdb039a8a7eb1732ea15b78
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Feb 4 21:59:14 2015 -0600
start openrc-0.13.9
commit a3a64ac94eaadb38dcb78f8c88437d8a1335fa07
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Jan 18 09:45:32 2015 -0600
update ChangeLog
commit 1a2f45a4c540c5ff29b8615e7241c60f36637608
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Jan 18 09:12:58 2015 -0600
tmpfiles.dev: pass --boot to tmpfiles.sh so kmod works properly
commit 34b55f31b357af37b999bc3e619c332fc5be1938
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Jan 18 09:31:53 2015 -0600
start work on 0.13.8
commit e0c746e938f7f22dc270cd0802ccfd2803ca7a8c
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Jan 15 09:34:01 2015 -0600
Create ChangeLog
commit 50329eee7a126dd1e961d8fb823e5f35f515a143
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Jan 12 14:37:10 2015 -0600
Add description for cgroup_cleanup
X-Gentoo-Bug: 535184
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=535184
commit fb81028121471c32bbcc88a61956baa7264ff090
Author: Doug Freed <dwfreed@mtu.edu>
Date: Mon Jan 12 09:10:29 2015 -0600
fix double free of pidfile
This fixes a double free of the pidfile variable. For discussion of this
issue, see the bug.
X-Gentoo-Bug: 531600
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=531600
commit 50e99aa30aee155865842e0a198fda473b647096
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Dec 8 09:47:42 2014 -0600
Do not call the shell to evaluate CHANGELOG_LIMIT
The git log command understands dates such as "1 year ago", so there is
no need to use the date command.
commit b177b7924250058d1ad9f8d758dcf8182099341d
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Dec 7 17:16:48 2014 -0600
Add target to create ChangeLog
This was added by request because some users are requesting a ChangeLog.
This fixes #29.
commit 7009f6687289753e6b8207c32c1294fbe48b65c2
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Tue Jan 13 00:45:19 2015 -0600
start working on 0.13.7
commit 2eb0ea9afbba584fc4c5ee0feefa9ae6a3d3278d
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Nov 23 10:28:21 2014 -0600
Make sysfs behave like netmount and localmount
sysfs now mounts all related sysfs file systems and returns success,
like netmount and localmount.
Also, we now check to make sure the cgroups are not mounted before we
mount them.
X-Gentoo-Bug: 530138
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=530138
commit 534031fc7ac3795cc42ea6f54b7ee1c304ee53de
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Nov 23 21:57:44 2014 -0600
Start work on 0.13.6
commit 6b85d4288c9409f8870396b8026862463e732bf8
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Nov 20 10:55:53 2014 -0600
devfs: optionally add missing symbolic links
If symbolic links for /dev/{fd,stdin,stdout,stderr,core} do not exist
once /dev is mounted, we should create them.
commit dec899b946281c7c12829f3300d533f40e468c20
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Nov 20 11:06:03 2014 -0600
Start work on 0.13.5
commit c9f6e2a6c8ca4e258f1b577010586668759b361a
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Nov 6 14:38:17 2014 -0600
netmount: unmount nfs file systems
commit e1a4aef3e551371a83a38eb1a275f10b0e9e165e
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Nov 6 14:43:02 2014 -0600
start work on 0.13.4
commit cb2c45a3c092de617fa037089599e624a758aea9
Author: Alexander Vershilov <alexander.vershilov@gmail.com>
Date: Wed Oct 29 23:16:35 2014 +0300
Fix incorrect handling of chroot option.
Fixes #28.
X-Gentoo-Bug: #527370
X-Gentoo-Bug-Url: https://bugs.gentoo.org/show_bug.cgi?id=527370
commit d92eca3988a1756e12c22c99a5e17f525ebffc6c
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Nov 1 18:31:20 2014 -0500
Start work on 0.13.3
commit 5bdd08e0e74bb071e775c706cf88b7bd7c48a572
Author: Johan Bergström <bugs@bergstroem.nu>
Date: Thu Oct 23 09:59:57 2014 +1100
Pass ncurses cflags to build
Fixes #25
Note from William Hubbs:
The original patch overwrote CFLAGS. I modified this patch to add the
ncurses cflags to CPPFLAGS instead of overwriting CFLAGS.
commit 8a68dc899e93ff925fac8417148cebbdaa975849
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Oct 24 10:44:14 2014 -0500
Fix compile errors created by bundling queue.h
commit 2d1e2552857c51b424704d214c3226d9b2a89ec6
Author: Anthony G. Basile <blueness@gentoo.org>
Date: Thu Oct 23 19:56:19 2014 -0400
helpers.h, start-stop-daemon.c: remove uneeded macros
TAILQ_CONCAT, TAILQ_FOREACH_SAFE and LIST_FOREACH_SAFE are defined
in our bundled queue.h and are no longer required.
commit 6f9fd30edb7f9938cff5efcf33d4f867c9b94def
Author: Anthony G. Basile <blueness@gentoo.org>
Date: Thu Oct 23 18:33:27 2014 -0400
Bundle <sys/queue.h> from NetBSD
We are bundling this to allow building on musl-based systems since musl
does not include <sys/queue.h>.
commit e0c32c23dc00d7aff79614129614944f4b1fde92
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Oct 23 18:47:04 2014 -0500
Fix all tests for GNU/kFreeBSD
It is necessary to check for both the kernel and c library because
__FreeBSD_kernel is also defined on native FreeBSD [1].
[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/
commit 4777035d53cc56444865cbeb287e2b5e73d7e901
Author: Gabriele Giacone <1o5g4r8o@gmail.com>
Date: Wed Oct 22 15:02:51 2014 -0500
Fix rc_svcdir for GNU/Hurd
commit f049b535b3dfb4becd62143289a0f7804329c72d
Author: Svante Signell <svante.signell@gmail.com>
Date: Wed Oct 22 14:59:01 2014 -0500
fix defines for GNU/Hurd
commit 4ba30c5a1bb0571e7d79f30c29525f206bed12e5
Author: Svante Signell <svante.signell@gmail.com>
Date: Wed Oct 22 14:25:00 2014 -0500
add missing files for GNU/Hurd
commit 91734d20be62dfbf7f637df576b70c9f04bae73d
Author: Gabriele Giacone <1o5g4r8o@gmail.com>
Date: Tue Oct 21 21:17:52 2014 -0500
Fix rc_svcdir for GNU/kFreeBSD
commit b4194fef43c05cb7c601a2c454687eebf6e77e99
Author: Gabriele Giacone <1o5g4r8o@gmail.com>
Date: Tue Oct 21 02:24:12 2014 -0500
Add missing files for GNU/kFreeBSD
commit 5f23128f303b98ec882a3afaf7d98087f452a938
Author: Svante Signell <svante.signell@gmail.com>
Date: Tue Oct 21 01:53:37 2014 -0500
Fix GNU/kFreeBSD port
Check for __FreeBSD_kernel instead of __GLIBC__ in source files.
note from William Hubbs:
I was told this is a better check for GNU/kFreeBSD than checking the
C library the source is being compiled against.
GNU/kFreeBSD than checking which library we are using.
commit a634534167f4fb66464568a837ba22a5e0c97410
Author: Anthony G. Basile <blueness@gentoo.org>
Date: Wed Oct 22 07:46:49 2014 -0400
einfo.h, rc.h.in: simplify __BEGIN_DECLS logic
There is no need to redefine __BEGIN_DECLS and __END_DECLS.
We simplify the logic here and avoid undefining these macros.
commit f77006b58e3fffb80208804dae75a69a29414e95
Author: Anthony G. Basile <blueness@gentoo.org>
Date: Tue Oct 21 09:31:07 2014 -0400
einfo.h, rc.h.in: ensure __BEGIN_DECLS is defined
Some Standard C Libraries, like musl, don't define __BEGIN_DECLS
or __END_DECLS. We add some ifdef magic to ensure these are
available.
commit ef22f78a480e4f6efb1ae7a9bef0b2ef9c456cd3
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Oct 20 15:52:11 2014 -0500
Update news file wrt chroot variable
commit 735dc45c392821fbb278ed9cbdefbf8b07b2c750
Author: Alexander Vershilov <alexander.vershilov@gmail.com>
Date: Sun Oct 19 19:41:36 2014 -0500
librc:look for the pid file in a chroot if defined
X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
commit 0d3fdd3769be9801b800f89ee8ce9d1b816434db
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Oct 19 19:36:57 2014 -0500
runscript.sh: add chroot support
This adds support for a chroot variable which will be passed to the
start-stop-daemon --chroot switch to runscript.sh when starting a
daemon. This also needs to be saved so it can be used in locating the
pid file when stopping the daemon.
X-Gentoo-Bug: 524388
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=524388
commit 5a1a94b2cc7a5ab8e6a7bc75e503d2dd2377558a
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Oct 20 15:28:13 2014 -0500
Add NEWS file
commit a76e5a827c23616760e8aab8870239b66c9fda59
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Oct 1 17:14:25 2014 -0500
add back nfs and nfs4 file systems
Fix gentoo bug #427996 correctly.
We should attempt to mount the file systems, but not try to start the
daemons. The previous fix removed mounting the file systems as well as
starting the daemons.
X-Gentoo-Bug: 508574
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=508574
commit b964de828731b5989fb1117822016cacbfe1ad8a
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Sep 19 17:23:55 2014 -0500
man: Document start_inactive and in_background_fake
commit 2c1051ad3fc6d39a6201b676f94b055d00265813
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Sep 20 16:51:30 2014 -0500
typo fix
commit a2187e897e3c0fc9a29adb0b81a57f2b718e74c5
Author: Roy Marples <roy@marples.name>
Date: Thu Sep 11 13:26:58 2014 -0500
Use exception-based approach for cgroup/ulimit setup
Note from William Hubbs:
I spoke with Roy about this, and he pointed out that user-defined
functions may need the limits applied, so it is better to go with a
method that uses exceptions to determine which functions apply the
limits.
X-Gentoo-Bug: 522408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=522408
commit e8043fe378a410dfa78b1e14162a94cc859a5f69
Author: Rick Farina (ZeroChaos) <sidhayn@gmail.com>
Date: Mon Oct 6 11:15:44 2014 -0500
localmount: unmount aufs branches
commit 082fd53d9e634318e87e2cb1f2ccc7bf12bf09df
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Sep 11 12:02:51 2014 -0500
runscript: move verbose mode setting near debug setting
commit 61fd8b29961650a0132b9cfece80bdf7d16cd05c
Author: Joe M <joe9mail@gmail.com>
Date: Fri Aug 29 09:10:58 2014 -0500
savecache: check permissions on the correct directory
commit 43d727dc3f17bc9a1d020ed2a5684d4a26bb620a
Author: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Mon Aug 25 15:46:28 2014 -0400
tmpfiles.sh: add support for C action
Recursively copies files or directories. Added by systemd in 849958d1.
commit b8e52583ca590d0f956acea0ec558e84495e3818
Author: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Mon Aug 25 15:37:45 2014 -0400
tmpfiles.sh: add support for + modifier
systemd added support for b+, c+, p+, and L+ in 2e78fa79 and 1554afae to
remove the target path if it already exists.
commit 1a7af5bbde0108d5d997d96af7e513eb362d71c5
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Oct 13 11:43:20 2014 -0500
Start work on 0.13.2
commit 785b61e8725f26b7d7c66b00e6e87597dd7bd735
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Aug 22 12:41:55 2014 -0500
cgroups: fix cgroup subsystem mounting
Originally, we aborted all of the cgroup setup if /sys/fs/cgroup/openrc
was already mounted. This caused an issue in lxc containers, so we
should always allow the subsystems to be mounted.
X-Gentoo-Bug: 520606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=520606
commit 54ed42503fbae45eb1fa6cf8c09ca1e34c8002cd
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Aug 22 14:18:33 2014 -0500
start work on 0.13.1
commit c60ef5c381e9edc7e30be9dcc9cc7e123515452e
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Aug 17 11:23:52 2014 -0500
mtab: add verbose level deprecation warnings
commit bee3f8463cbc372c344541077924ddd45ca62ef1
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Aug 17 00:11:14 2014 -0500
README: Clarify devfs changes
I was informed that the previous explanation of the devfs changes could
be interpreted to mean that we mount a second /dev on top of the one
that was mounted by the kernel or initramfs. This change makes it clear
that is not the case.
commit 72b7b32502ff149c0f0f8a7833cfd213f6cf933e
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Aug 16 17:16:20 2014 -0500
README: add notes about devfs changes
commit 645f7b6947d9fc44fbece0931a3ddb10d3d79b27
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Aug 16 15:07:48 2014 -0500
adjust deprecation schedule for mtab
- Quiet the deprecation messages forr now
- update the feature removal schedule to reflect that it will be removed
in 2.0.
commit 1b26d547a50e2554483bdbfd288fae75fd76bfa0
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Aug 14 13:50:48 2014 -0500
Deprecate the mtab service script
The mtab service script is no longer needed on modern Linux systems, so
we can remove it in 1.0. However, we need to set a deprecation notice
first.
commit c8018d04a7b238b57a3d74a68e2af02af395f510
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Aug 13 15:26:37 2014 -0500
tmpfiles: fix relabel to run restorecon before chown and chmod
commit 6f080e9c1a2a9b9c308cdc03f9cf782c4ce4d440
Author: Jason Zaman <jason@perfinion.com>
Date: Wed Aug 13 10:50:34 2014 +0400
tmpfiles: Move relabelling before any other calls for device nodes
Device nodes are normally never device_t so this type does not
have many permissions. After the mknod, the device should have
its label corrected before any other operations (like chmod).
commit 2c265e13c60be0ed583a871ca12a22e4d379a7c0
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Aug 11 13:17:33 2014 -0500
README: expand information about rc and runscript deprecation
commit 24d82d9ff1ca1ba7085814f8f6530124c117aa5f
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Aug 11 12:57:23 2014 -0500
rc.conf: document rc_verbose
commit d1e71b07afd4b900894ce4ea45f94010c70e32cc
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Aug 11 12:29:04 2014 -0500
Show rc and runscript deprecation warnings in verbose mode
These messages are being changed for this release to show in verbose
mode because of the number of times they display.
commit 7b744befac2049eb6372a7f0c5420c740aa0a4ea
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Aug 10 17:15:05 2014 -0500
bootmisc: do not run the clean_run function in an LXC container
commit faaaab4bf540b4df011abea5985963dbc9e1646a
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Aug 10 13:00:39 2014 -0500
hwclock: fix comments about the usage of clock_hctosys
The clock_hctosys variable should be set to YES if you are not using NTP to
synchronize your system time; it doesn't have anything to do with the
kernel configuration.
commit d29db70efb2adfbd200ba4a03fa78653e97893a6
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Aug 6 22:01:30 2014 -0500
sysctl.linux.in: use the --system option
According to the sysctl man page, the --system option causes sysctl to
process all system configuration files, which include the following:
/run/sysctl.d/*.conf
/etc/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
X-Gentoo-Bug: 484796
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=484796
commit 6a337ff6c531d9d7310253b67b3e95d1ce5d214c
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Aug 8 14:49:00 2014 -0500
devfs: several small clarifications
- Rename the static_dev switch in conf.d/devfs to skip_mount_dev since
this is a better description of what the switch does.
- Clarify the error messages in the devfs service script based on the
new name of the switch.
commit 647e08eb9166d23d0c64f0c8767d93a06bd21a40
Author: Jason Zaman <jason@perfinion.com>
Date: Wed Aug 6 02:12:35 2014 +0400
tmpfiles.sh: do not use install
install is in /usr which causes problems if /usr is not mounted.
Instead, checkpath and "mkdir -p" can do everything required and are
both available before /usr is mounted.
Since checkpath also handles selinux labels correctly,
_restorecon after is not required.
X-Gentoo-Bug: 503408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=503408
commit 2624a8c8a7030180f9548a6e2fba5b0a82c5f046
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Jul 28 10:41:24 2014 -0500
checkpath: apply ownership to all paths given on command line
The stat structure was not being initialized correctly in do_check. This
was causing the owner adjustment to be skipped if the first path had the
correct owner.
Also, the "correcting owner" message should always be printed when the
owner is being changed.
X-Gentoo-Bug: 518042
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=518042
commit 275714bdc74c363ca1612b2b6b97f74f7a62b50c
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Jul 25 11:04:57 2014 -0500
checkpath: style fix
commit e3bfb68aece9378a0669c2893285808100fd5ea6
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Jul 23 16:19:25 2014 -0500
hwclock: always set the kernel's timezone
The hwclock service should set the time zone regardless of the setting
of the clock_hctosys variable. This needs to be done to prevent issues
when the system time is being synchronized using ntp.
X-Gentoo-Bug: 434410
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=434410
commit 1f7582c78b2697c3f2617a4a89afabaf3550b0fb
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Jul 19 13:03:00 2014 -0500
src/librc/librc-daemon.c: style fix
commit cc1bc6a4cec772c50a1b5232655ff34370d204b1
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Jul 19 12:59:35 2014 -0500
src/rc/Makefile: typo fix
commit 40f42ced21b1c0c99780b801d28fafd91a858f90
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Jul 17 23:10:28 2014 -0500
rc-status: fix infinite loop when using stacked runlevels
Remove the recursive call in print_stacked_services which was causing an
infinite loop when using stacked runlevels.
I would like to thank Doug Freed and Jason Zaman for assisting with
tracking this down.
X-Gentoo-Bug: 514972
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=514972
commit 1a1d53335b2e6e3240b738ba1f81de64e552c337
Author: Jason Zaman <jason@perfinion.com>
Date: Thu Jul 17 03:07:19 2014 +0400
devfs: fix restorecon ebegin message to match sys
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 99939b9839fb45093fe193e06139eab4a95637da
Author: Jason Zaman <jason@perfinion.com>
Date: Thu Jul 17 03:07:18 2014 +0400
sysfs: restorecon after mounting /sys
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 89907b60bac51db2cda1afe4555676577ef498a8
Author: Jason Zaman <jason@perfinion.com>
Date: Thu Jul 17 00:46:25 2014 +0400
move the selinux_setup function into rc-selinux
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit a94a9740d545817294cc431180db0f22fc923b13
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Jul 16 15:03:11 2014 -0500
checkpath: style fixes
commit 8b8edc29705b843988b97242942a409241c182eb
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Jul 16 14:48:03 2014 -0500
style fixes
commit 010c2ab18b4be2068237cf0db97e9348bba65ac6
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Jul 16 14:14:37 2014 -0500
Rename SELinux source files
The name rc-selinux-util.* is a bit long, so I renamed the source files
to rc-selinux.*
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 9c689542c3246e793310db938374bc97600435e6
Author: Jason Zaman <jason@perfinion.com>
Date: Tue Jul 15 22:27:34 2014 +0400
checkpath: restore the SELinux context
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 525d7140b12a8e259f9d919f24148e369e9ff7d1
Author: Jason Zaman <jason@perfinion.com>
Date: Tue Jul 15 22:27:33 2014 +0400
devfs: fix SELinux contexts
SELinux contexts in /dev need to be fixed after it is mounted
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 4f784bd46923486773edcd7749246a21bd419e6b
Author: Jason Zaman <jason@perfinion.com>
Date: Tue Jul 15 22:27:32 2014 +0400
tmpfiles: set the proper SELinux context
Restore the label on the created file / dir based on the policy
fcontexts.
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 4a1afa694cd8ebd6591d5a825ee35e4f57c98469
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Tue Jul 15 11:38:02 2014 -0500
Add SELinux support to the build system
X-Gentoo-Bug: 516956
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516956
commit 25c229cf830c8e822a206f2e08f9c94964a47aa9
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Jul 14 15:58:50 2014 -0500
sysfs.in: fix indentation
commit 71d6d61b28c4c0f285ec51459551d900dfa4ea71
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Jul 13 14:12:36 2014 -0500
checkpath: fix logic for the writable option
The -W option does not need an argument of its own; it can take the
first path after all other options are processed on the command line.
Also, move the processing for the -W option out of the switch so it will
be in the same loop as the other processing.
commit 40141244e349e6e1d2dfb9ebfbcbf62f68d33a9d
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Jul 13 11:15:26 2014 -0500
man/openrc-run.8: more updates and clarifications for checkpath
X-Gentoo-Bug: 500606
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
commit d59737afb159d993916836903d9e670a1334c93a
Author: Alexander V Vershilov <qnikst@gentoo.org>
Date: Sun Feb 16 04:08:23 2014 +0400
man/openrc.8: update checkpath documentation
X-GENTOO-BUG: 500606
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500606
commit f66f41c4f03d8077bdaa047a7a93f6c92c0a69de
Author: Alexander V Vershilov <qnikst@gentoo.org>
Date: Fri Jul 11 16:33:42 2014 -0500
typo fix
commit d80482c2f4ec35a880ee099eeb3983b255d65e8f
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Jul 11 15:23:38 2014 -0500
checkpath: fix error message in previous commit
commit d0040aff0aa033fd5d5c40480008e98ee5e1f11a
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Jul 11 14:50:20 2014 -0500
checkpath: report an error if required options were not specified
Before this commit, not specifying -d, -f, -p or -W in a checkpath
command meant the command exited successfully but actually did nothing.
This is an error condition, so report it as such.
commit 75e06d85584fc3ebfa26fbca97ea60b687247bb0
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Jul 10 05:18:00 2014 -0500
Style Fixes
commit 1a44be0f16a7a1de8a176e7c656f8513494e0e64
Author: Alexander V Vershilov <qnikst@gentoo.org>
Date: Sun Feb 16 04:27:52 2014 +0400
cgroups: only run cgroup setup when starting a service
Status call should not set limits as it requires root permissions,
also this is not safe, as current process may reach limitation.
Solution is to set limits and move process to service cgroup only
on start.
X-GENTOO-BUG: 500364
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364
commit f265ddde971d0fdb97a4f14b4cc96140be7b4628
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Jul 10 09:04:04 2014 -0500
FEATURE_REMOVAL_SCHEDULE: add entry for local_start/stop
commit 57b9e601a97fac3a044ec5d7e5f11b6219c892b7
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Jul 5 14:30:33 2014 -0500
init.d/local: bring functioning more in line with how sysctl works
- remove the has_executables variable since it isn't used.
- Convert the conditional calls to ewend/vewend to a single call to veend.
- Always call eend after all scripts are executed passing the appropriate
error code.
Because of this change, you will see only an overall status when
starting or stopping local unless you are using verbose mode.
commit c1de8c09bf4895c6108d297fcebd63046e49e614
Author: Thomas D <whissi@whissi.de>
Date: Tue Jun 10 15:23:17 2014 +0200
Add support for verbose "local" service runscript
With this patch, the "local" service runscript will be verbose like the
"sysctl" service when 'rc_verbose="yes"' is set.
Example output successful start:
* Stopping local ...
* Executing "/etc/local.d/00will-stop.stop" ... [ ok ]
* Starting local ...
* Executing "/etc/local.d/00will-start.start" ... [ ok ]
* Executing "/etc/local.d/01 test.start" ... [ ok ]
Example output with failing executables:
* Stopping local ...
* Executing "/etc/local.d/00will-stop.stop" ... [ ok ]
* Executing "/etc/local.d/will-fail.stop" ...
mount: can't find foo in /etc/fstab
* Execution of "/etc/local.d/will-fail.stop" failed. [ !! ]
* Starting local ...
* Executing "/etc/local.d/00will-start.start" ... [ ok ]
* Executing "/etc/local.d/01 test.start" ... [ ok ]
* Executing "/etc/local.d/will-fail2.start" ...
mount: can't find bar in /etc/fstab
* Execution of "/etc/local.d/will-fail2.start" failed. [ !! ]
* Executing "/etc/local.d/will-fail.start" ...
mount: can't find foo in /etc/fstab
* Execution of "/etc/local.d/will-fail.start" failed. [ !! ]
X-Gentoo-Bug: 489274
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489274
commit 143f1c64c13e4930e3880a393b7253d6fbc0ed58
Author: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Date: Wed Jul 2 11:45:14 2014 +0300
sysctl.Linux.in: remove -lxc from keywords
certain tunables can be set independently for each container
X-Gentoo-Bug: 516050
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=516050
commit b4b34d909c36898095a0036f90a328838137e3a4
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Tue Jul 1 07:14:31 2014 -0500
Schedule removal of the opts variable from service scripts
commit 56112a6f1f176696e5f39a86fe4b52017ccdd04c
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Jun 30 20:30:39 2014 -0500
sysfs: Do not mount openrc cgroup if it is already mounted
We were not checking to see if /sys/fs/cgroup/openrc was already mounted
before we mounted it. This fixes that issue.
Thanks to Robin Johnson <robbat2@gentoo.org> for pointing this out.
commit 09d81e86f210acf5270ea4bd0fa7319a49f88131
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Mon Jun 23 20:26:18 2014 -0500
Make history a separate document
Move the additional history information from Daniel Robbins' wiki
page along with the history from README to a separate file,
README.history.
X-Gentoo-Bug: 513024
X-Gentoo-Bug-URL: https://bugs.gentoo.org/513024
commit 23cb55d843b165d5508f330287ed329358fc85dc
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sat Jun 21 01:53:17 2014 -0500
man/start-stop-daemon.8: correct argument from --nice to --nicelevel
X-Gentoo-Bug: 510648
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=510648
commit 094bc17cb0ad75da189ebf1a8242a378928a1eef
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Jun 20 19:39:07 2014 -0500
tmpfiles.sh: fix comment processing
If you happened to format a comment with no white space after the '#',
it was not being processed.
Reported-by: consus@gmx.com
X-Gentoo-Bug: 511804
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511804
commit 6126700a0723efa4ef1e299da0f58498f742c3a1
Author: Sven Vermeulen <sven.vermeulen@siphos.be>
Date: Sat Apr 19 21:18:18 2014 +0200
SELinux filesystem is at /sys/fs/selinux
The SELinux filesystem has been moved to /sys/fs/selinux for quite some
time. We kept supporting /selinux for backwards compatibility, but it's
time to move forward on this.
X-Gentoo-Bug: 511718
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=511718
Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
commit 19cccb2e9416311b85fcad3c15d4d988fed2f954
Author: Robin H. Johnson <robbat2@gentoo.org>
Date: Sun May 25 23:51:37 2014 -0700
sh/tmpfiles.sh: license under 2-clause BSD
As the author of our tmpfiles.sh script, I hereby license it under
2-clause BSD, like the rest of openrc.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
commit 9eb9b28d3e3b6725559fb38101ae869c1e4530ce
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Jun 20 16:01:47 2014 -0500
librc: filter out container processes on OpenVZ host
Thanks to info and testing done by Daniel Robbins <drobbins@funtoo.org>,
there is now a fix for this. Below is his description of the steps
OpenRC needed to use.
1) See if /proc/<pid>/status exists
2) If it does, see if it has a "envID:" field
3) If it does, see if "envID:" is set to "0"
4) If so, then it's one of the host's processes and should be a
candidate for the list. Otherwise, it is one of the container's
processes and should be ignored.
This should fix the bug and allow start-stop-daemon to work properly on
OpenVZ hosts.
X-Gentoo-Bug: 376817
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=376817
commit a817915632f7f2162e7c3740d204989f6cfde554
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Wed Apr 9 19:27:12 2014 -0500
README.busybox: document incompatibility with built-in ip applet
commit 20d7b83150b18b0eca550d9bb2e1d5fb0acbbd89
Author: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Wed Mar 26 12:14:08 2014 -0400
tmpfiles.dev: remove --remove option
For compatibility with systemd.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
commit 686ee62a79e12ad73581ef4e151baad21b624935
Author: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Wed Mar 26 12:13:20 2014 -0400
tmpfiles: add support for --boot option
For compatibility with systemd-tmpfiles.
Fixes #17
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
commit c081633762dc66235fe385eedcc2cdf6bff83391
Author: Andrew Gregory <andrew.gregory.8@gmail.com>
Date: Thu Mar 27 11:02:47 2014 -0400
tmpfiles: ignore all files starting with systemd-
systemd recently moved creation of /run/nologin to systemd-nologin.conf
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
commit e0e1f2a4da376d9d05487ec23922c1ca356cbbc6
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Fri Mar 14 22:18:25 2014 -0500
rc.conf: typo fix
commit 7fb209a6fc3512d3437bbb175853f1f01393b74d
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Thu Mar 13 15:27:40 2014 -0500
conf.d/hwclock: typo fix
commit d0186d422c3bb75ac2977dfe7d1f8f97c3ce5c3b
Author: William Hubbs <w.d.hubbs@gmail.com>
Date: Sun Mar 9 15:35:41 2014 -0500
rc.conf: document rc_nocolor setting

View File

@@ -1,3 +1,3 @@
NAME= openrc
VERSION= 0.13
VERSION= 0.13.9
PKG= ${NAME}-${VERSION}

44
NEWS Normal file
View File

@@ -0,0 +1,44 @@
OpenRC NEWS
This file will contain a list of notable changes for each release.
OpenRC-0.13.2
=============
A chroot variable has been added to the service script variables.
This fixes the support for running a service in a chroot.
This is documented in man 8 openrc-run.
The netmount service now mounts nfs file systems.
This change was made to correct a fix for an earlier bug.
OpenRC-0.13
===========
/sbin/rc was renamed to /sbin/openrc and /sbin/runscript was renamed to
/sbin/openrc-run due to naming conflicts with other software.
Backward compatible symbolic links are currently in place so your
system will keep working if you are using the old names; however, it is
strongly advised that you migrate to the new names because the symbolic
links will be removed in the future.
Warnings have been added to assist with this migration; however, due to the
level of noise they produce, they only appear in verbose mode in this release.
The devfs script now handles the initial mounting and setup of the
/dev directory. If /dev has already been mounted by the kernel or an
initramfs, devfs will remount /dev with the correct mount options
instead of mounting a second /dev over the existing mount point.
It attempts to mount /dev from fstab first if an entry exists there. If
it doesn't it attempts to mount devtmpfs if it is configured in the
kernel. If not, it attempts to mount tmpfs.
If none of these is available, an error message is displayed and static
/dev is assumed.
OpenRC-0.12
===========
The net.* scripts, originally from Gentoo Linux, have
been removed. If you need these scripts, look for a package called
netifrc, which is maintained by them.

28
README
View File

@@ -57,34 +57,6 @@ init.d.misc is not installed by default as the scripts will need
tweaking on a per distro basis. They are also non essential to the operation
of the system.
As of OpenRC-0.12, the net.* scripts, originally from Gentoo Linux, have
been removed. If you need these scripts, look for a package called
netifrc, which is maintained by them.
As of OpenRC-0.13, two binaries have been renamed due to naming
conflicts with other software. The /sbin/rc binary was renamed to
/sbin/openrc, and /sbin/runscript was renamed to /sbin/openrc-run.
Backward compatible symbolic links are currently in place so your
system will keep working if you are using the old names; however, it is
strongly advised that you migrate to the new names because the symbolic
links will be removed in the future.
Warnings have been added to assist with this migration; however, they
only show in verbose mode in this release due to the level of noise they
produce.
Also, the devfs script now handles the initial mounting and setup of the
/dev directory. If /dev has already been mounted by the kernel or an
initramfs, devfs will remount /dev with the correct mount options
instead of mounting a second /dev over the existing mount point.
It attempts to mount /dev from fstab first if an entry exists there. If
it doesn't it attempts to mount devtmpfs if it is configured in the
kernel. If not, it attempts to mount tmpfs.
If none of these is available, an error message is displayed and static
/dev is assumed.
Reporting Bugs
--------------
Since Gentoo Linux is hosting OpenRC development, Bugs should go to

View File

@@ -0,0 +1,4 @@
# You can assign a default route
#defaultroute="192.168.0.1"
#defaultroute6="2001:a:b:c"

4
conf.d/network.GNU.in Normal file
View File

@@ -0,0 +1,4 @@
# You can assign a default route
#defaultroute="gw 192.168.0.1"
#defaultroute6="gw 2001:a:b:c"

View File

@@ -0,0 +1,5 @@
# Separate multiple routes using ; or new lines.
# Example static routes. See route(8) for syntax.
#staticroute="net 192.168.0.0 10.73.1.1 netmask 255.255.255.0
#net 192.168.1.0 10.73.1.1 netmask 255.255.255.0"

View File

@@ -0,0 +1,7 @@
# Separate multiple routes using ; or new lines.
# /etc/route.conf(5) takes precedence over this configuration.
# Example static routes. See route(8) for syntax.
# FIXME: "net ..." not supported
#staticroute="net 192.168.0.0 -netmask 255.255.255.0 --address 10.73.1.1
#net 192.168.1.0 -netmask 255.255.255.0 --address 10.73.1.1"

14
etc/rc.conf.GNU Normal file
View File

@@ -0,0 +1,14 @@
##############################################################################
# GNU/Hurd SPECIFIC OPTIONS
# This is the subsystem type. Valid options on GNU/Hurd:
# "" - nothing special
# "subhurd" - Hurd subhurds (to be checked)
# If this is commented out, automatic detection will be used.
#
# This should be set to the value representing the environment this file is
# PRESENTLY in, not the virtualization the environment is capable of.
#rc_sys=""
# This is the number of tty's used in most of the rc-scripts (like
# consolefont, numlock, etc ...)
#rc_tty_number=6?

View File

@@ -69,7 +69,14 @@ seed_dev()
# so udev can add its start-message to dmesg
[ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
# Mount required stuff as user may not have then in /etc/fstab
# extra symbolic links not provided by default
[ -e /dev/fd ] || ln -snf /proc/self/fd /dev/fd
[ -e /dev/stdin ] || ln -snf /proc/self/fd/0 /dev/stdin
[ -e /dev/stdout ] || ln -snf /proc/self/fd/1 /dev/stdout
[ -e /dev/stderr ] || ln -snf /proc/self/fd/2 /dev/stderr
[ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core
# Mount required directories as user may not have them in /etc/fstab
for x in \
"mqueue /dev/mqueue 1777 ,nodev mqueue" \
"devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \

View File

@@ -63,6 +63,31 @@ stop()
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
if [ "$RC_UNAME" = Linux ] && [ -d /sys/fs/aufs ] ; then
#if / is aufs we remount it noxino during shutdown
if mountinfo -q -f '^aufs$' / ; then
mount -o remount,noxino,rw /
sync
fi
local aufs_branch aufs_mount_dir aufs_mount_point aufs_si_dir aufs_si_id
for aufs_si_dir in /sys/fs/aufs/*; do
aufs_mount_dir=${aufs_si_dir#/sys/fs/aufs/}
aufs_si_id="$(printf "%s" $aufs_mount_dir | sed 's/_/=/g')"
aufs_mount_point="$(mountinfo -o ${aufs_si_id})"
for x in $aufs_si_dir/br[0-9][0-9][0-9]; do
aufs_branch=$(sed 's/=.*//g' $x)
eindent
if ! mount -o "remount,del:$aufs_branch" "$aufs_mount_point" > /dev/null 2>&1; then
ewarn "Failed to remove branch $aufs_branch from aufs \
$aufs_mount_point"
fi
eoutdent
sync
done
done
fi
# Umount loop devices
einfo "Unmounting loop devices"
eindent

View File

@@ -2,15 +2,12 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
description="Mounts network shares, other than NFS, according to /etc/fstab."
# We skip all NFS shares in this script because they require extra
# daemons to be running on the client in order to work correctly.
# It is best to allow nfs-utils to handle all nfs shares.
description="Mounts network shares according to /etc/fstab."
depend()
{
config /etc/fstab
use afc-client amd autofs openvpn
use afc-client amd nfsclient autofs openvpn
use dns
keyword -jail -prefix -vserver -lxc
}
@@ -19,11 +16,6 @@ start()
{
local x= fs= rc=
for x in $net_fs_list $extra_net_fs_list; do
case "$x" in
nfs|nfs4)
continue
;;
esac
fs="$fs${fs:+,}$x"
done
@@ -46,14 +38,7 @@ stop()
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
for x in $net_fs_list $extra_net_fs_list; do
case "$x" in
nfs|nfs4)
continue
;;
*)
fs="$fs${fs:+,}$x"
;;
esac
fs="$fs${fs:+,}$x"
done
if [ -n "$fs" ]; then
umount -at $fs || eerror "Failed to simply unmount filesystems"
@@ -62,14 +47,7 @@ stop()
eindent
fs=
for x in $net_fs_list $extra_net_fs_list; do
case "$x" in
nfs|nfs4)
continue
;;
*)
fs="$fs${fs:+|}$x"
;;
esac
fs="$fs${fs:+|}$x"
done
[ -n "$fs" ] && fs="^($fs)$"
do_unmount umount ${fs:+--fstype-regex} $fs --netdev

View File

@@ -13,8 +13,8 @@ start()
return 1
fi
fi
if ! checkpath -W "$RC_LIBEXECDIR"; then
ewarn "WARNING: ${RC_LIBEXECDIR} is not writable!"
if ! checkpath -W "$RC_LIBEXECDIR"/cache; then
ewarn "WARNING: ${RC_LIBEXECDIR}/cache is not writable!"
if ! yesno "${RC_GOINGDOWN}"; then
ewarn "Unable to save deptree cache"
return 1

View File

@@ -0,0 +1,31 @@
#!@SBINDIR@/openrc-run
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
depend()
{
before bootmisc logger
keyword -prefix
}
start()
{
[ -e /etc/sysctl.conf ] || return 0
local retval=0 var= comments= conf=
ebegin "Configuring kernel parameters"
eindent
for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do
if [ -r "$conf" ]; then
vebegin "applying $conf"
while read var comments; do
case "$var" in
""|"#"*) continue;;
esac
sysctl -w "$var" >/dev/null || retval=1
done < "$conf"
veend $retval
fi
done
eoutdent
eend $retval "Some errors were encountered"
}

32
init.d/sysctl.GNU.in Normal file
View File

@@ -0,0 +1,32 @@
#!@PREFIX@/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
#FIXME: Modify for GNU/Hurd
depend()
{
before bootmisc logger
keyword -prefix
}
start()
{
[ -e /etc/sysctl.conf ] || return 0
local retval=0 var= comments= conf=
ebegin "Configuring kernel parameters"
eindent
for conf in @SYSCONFDIR@/sysctl.conf @SYSCONFDIR@/sysctl.d/*.conf; do
if [ -r "$conf" ]; then
vebegin "applying $conf"
while read var comments; do
case "$var" in
""|"#"*) continue;;
esac
sysctl -w "$var" >/dev/null || retval=1
done < "$conf"
veend $retval
fi
done
eoutdent
eend $retval "Some errors were encountered"
}

View File

@@ -100,19 +100,21 @@ mount_misc()
mount_cgroups()
{
mountinfo -q /sys/fs/cgroup || return 0
mountinfo -q /sys/fs/cgroup/openrc || return 0
local agent="@LIBEXECDIR@/sh/cgroup-release-agent.sh"
mkdir /sys/fs/cgroup/openrc
mount -n -t cgroup \
-o none,${sysfs_opts},name=openrc,release_agent="$agent" \
openrc /sys/fs/cgroup/openrc
echo 1 > /sys/fs/cgroup/openrc/notify_on_release
if ! mountinfo -q /sys/fs/cgroup/openrc; then
local agent="@LIBEXECDIR@/sh/cgroup-release-agent.sh"
mkdir /sys/fs/cgroup/openrc
mount -n -t cgroup \
-o none,${sysfs_opts},name=openrc,release_agent="$agent" \
openrc /sys/fs/cgroup/openrc
echo 1 > /sys/fs/cgroup/openrc/notify_on_release
fi
yesno ${rc_controller_cgroups:-YES} && [ -e /proc/cgroups ] || return 0
while read name hier groups enabled rest; do
case "${enabled}" in
1) mkdir /sys/fs/cgroup/${name}
1) mountinfo -q /sys/fs/cgroup/${name} && continue
mkdir /sys/fs/cgroup/${name}
mount -n -t cgroup -o ${sysfs_opts},${name} \
${name} /sys/fs/cgroup/${name}
;;
@@ -128,25 +130,13 @@ restorecon_sys()
restorecon -rF /sys/fs/cgroup >/dev/null 2>&1
eend $?
fi
return 0
}
start()
{
local retval
mount_sys
retval=$?
if [ $retval -eq 0 ]; then
mount_misc
retval=$?
fi
if [ $retval -eq 0 ]; then
mount_cgroups
retval=$?
fi
mount_misc
mount_cgroups
restorecon_sys
return $retval
return 0
}

View File

@@ -14,7 +14,7 @@ depend()
start()
{
ebegin "setting up tmpfiles.d entries for /dev"
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create ${tmpfiles_opts}
@LIBEXECDIR@/sh/tmpfiles.sh --prefix=/dev --create --boot ${tmpfiles_opts}
eend $?
return 0
}

View File

@@ -120,6 +120,9 @@ Set this to "true", "yes" or "1" (case-insensitive) to force the daemon into
the background. This implies the "--make-pidfile" and "--pidfile" option of
.Xr start-stop-daemon 8
so the pidfile variable must be set.
.It Ar chroot
.Xr start-stop-daemon 8
will chroot into this path before writing the pid file or starting the daemon.
.It Ar pidfile
Pidfile to use for the above defined command.
.It Ar name
@@ -131,6 +134,12 @@ timeout in seconds or multiple signal/timeout pairs (like SIGTERM/5).
A list of directories which must exist for the service to start.
.It Ar required_files
A list of files which must exist for the service to start.
.It Ar start_inactive
Set to yes to have the service marked inactive when it starts. This is
used along with in_background_fake to support re-entrant services.
.It Ar in_background_fake
Space separated list of commands which should always succeed when
in_background is yes.
.El
.Sh DEPENDENCIES
You should define a

View File

@@ -8,12 +8,17 @@ DISTFILE?= ${DISTPREFIX}.tar.bz2
CLEANFILES+= ${NAME}-*.tar.bz2
CHANGELOG_LIMIT?= --after="1 year ago"
_SNAP_SH= date -u +%Y%m%d%H%M
_SNAP:= $(shell ${_SNAP_SH})
SNAP= ${_SNAP}
SNAPDIR= ${DISTPREFIX}-${SNAP}
SNAPFILE= ${SNAPDIR}.tar.bz2
changelog:
git log ${CHANGELOG_LIMIT} --format=medium > ChangeLog
dist:
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}

View File

@@ -3,7 +3,9 @@
# Generic definitions
SFX= .GNU-kFreeBSD.in
PKG_PREFIX?= /usr
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700
LIBDL= -Wl,-Bdynamic -ldl
LIBKVM?=
include ${MK}/os-BSD.mk

8
mk/os-GNU.mk Normal file
View File

@@ -0,0 +1,8 @@
# Copyright (c) 2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
SFX= .GNU.in
PKG_PREFIX?= /usr
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DMAXPATHLEN=4096 -DMAX_PATH=4096
LIBDL= -Wl,-Bdynamic -ldl

View File

@@ -1,11 +1,12 @@
ifeq (${MKTERMCAP},ncurses)
LTERMCAP:= $(shell pkg-config ncurses --libs 2> /dev/null)
TERMCAP_CFLAGS:= $(shell pkg-config ncurses --cflags 2> /dev/null)
LTERMCAP:= $(shell pkg-config ncurses --libs 2> /dev/null)
ifeq ($(LTERMCAP),)
LIBTERMCAP?= -lncurses
else
LIBTERMCAP?= $(LTERMCAP)
endif
CPPFLAGS+= -DHAVE_TERMCAP
CPPFLAGS+= -DHAVE_TERMCAP ${TERMCAP_CFLAGS}
LDADD+= ${LIBTERMCAP}
else ifeq (${MKTERMCAP},termcap)
LIBTERMCAP?= -ltermcap

View File

@@ -0,0 +1,35 @@
#!@SHELL@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
if [ ! -d /run ]; then
ebegin "Creating /run"
mkdir -p /run
eend $?
fi
if [ -L $RC_SVCDIR ]; then
rm $RC_SVCDIR
fi
ebegin "Mounting /run"
if ! fstabinfo --mount /run; then
mount -t tmpfs -o mode=0755,noexec,nosuid,size=10% tmpfs /run
if [ $? != 0 ]; then
eerror "Unable to mount tmpfs on /run."
eerror "Can't continue."
exit 1
fi
fi
eend
ebegin "Creating $RC_SVCDIR"
mkdir -p $RC_SVCDIR
eend $?
if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
echo sysinit >"$RC_SVCDIR"/softlevel
exit 0

38
sh/init.sh.GNU.in Normal file
View File

@@ -0,0 +1,38 @@
#!@SHELL@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Copyright (c) 2014 Svante Signell <svante.signell@gmail.com>
# Released under the 2-clause BSD license.
if [ ! -d /run ]; then
ebegin "Creating /run"
mkdir -p /run
eend $?
fi
if [ -L $RC_SVCDIR ]; then
rm $RC_SVCDIR
fi
if ! mountinfo -q /run; then
ebegin "Mounting /run"
if ! fstabinfo --mount /run; then
mount -t tmpfs -o mode=0755,no-suid,size=10% tmpfs /run
if [ $? != 0 ]; then
eerror "Unable to mount tmpfs on /run."
eerror "Can't continue."
exit 1
fi
fi
eend
fi
ebegin "Creating $RC_SVCDIR"
mkdir -p $RC_SVCDIR
eend $?
if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
echo sysinit >"$RC_SVCDIR"/softlevel
exit 0

View File

@@ -2,6 +2,7 @@
# Copyright (c) 2012 Alexander Vershilov <qnikst@gentoo.org>
# Released under the 2-clause BSD license.
extra_stopped_commands="${extra_stopped_commands} cgroup_cleanup"
description_cgroup_cleanup="Kill all processes in the cgroup"
cgroup_find_path()
{

View File

@@ -142,12 +142,14 @@ start()
fi
eval start-stop-daemon --start \
--exec $command \
${chroot:+--chroot} $chroot \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
$_background $start_stop_daemon_args \
-- $command_args
if eend $? "Failed to start $RC_SVCNAME"; then
service_set_value "command" "${command}"
[ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
[ -n "${procname}" ] && service_set_value "procname" "${procname}"
return 0
@@ -163,9 +165,11 @@ start()
stop()
{
local startcommand="$(service_get_value "command")"
local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
local startprocname="$(service_get_value "procname")"
command="${startcommand:-$command}"
chroot="${startchroot:-$chroot}"
pidfile="${startpidfile:-$pidfile}"
procname="${startprocname:-$procname}"
[ -n "$command" -o -n "$procname" -o -n "$pidfile" ] || return 0
@@ -174,7 +178,7 @@ stop()
${retry:+--retry} $retry \
${command:+--exec} $command \
${procname:+--name} $procname \
${pidfile:+--pidfile} $pidfile \
${pidfile:+--pidfile} $chroot$pidfile \
${stopsig:+--signal} $stopsig
eend $? "Failed to stop $RC_SVCNAME"
}
@@ -185,6 +189,10 @@ status()
}
yesno $RC_DEBUG && set -x
if yesno "${rc_verbose:-$RC_VERBOSE}"; then
EINFO_VERBOSE=yes
export EINFO_VERBOSE
fi
_conf_d=${RC_SERVICE%/*}/../conf.d
# If we're net.eth0 or openvpn.work then load net or openvpn config
@@ -205,25 +213,29 @@ unset _conf_d
# Load any system overrides
sourcex -e "@SYSCONFDIR@/rc.conf"
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && ulimit ${rc_ulimit:-$RC_ULIMIT}
# Set verbose mode
if yesno "${rc_verbose:-$RC_VERBOSE}"; then
EINFO_VERBOSE=yes
export EINFO_VERBOSE
fi
# Apply cgroups settings if defined
if [ "$1" = "start" ] ; then
if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
cgroup_add_service /sys/fs/cgroup/openrc
cgroup_add_service /sys/fs/cgroup/systemd/system
for _cmd; do
if [ "$_cmd" != status -a "$_cmd" != describe ]; then
# Apply any ulimit defined
[ -n "${rc_ulimit:-$RC_ULIMIT}" ] && \
ulimit ${rc_ulimit:-$RC_ULIMIT}
# Apply cgroups settings if defined
if [ "$(command -v cgroup_add_service)" = \
"cgroup_add_service" ]
then
if [ -d /sys/fs/cgroup -a ! -w /sys/fs/cgroup ]; then
eerror "No permission to apply cgroup settings"
break
fi
cgroup_add_service /sys/fs/cgroup/openrc
cgroup_add_service /sys/fs/cgroup/systemd/system
fi
[ "$(command -v cgroup_set_limits)" = \
"cgroup_set_limits" ] && \
cgroup_set_limits
break
fi
[ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
cgroup_set_limits
fi
done
# Load our script
sourcex "$RC_SERVICE"

View File

@@ -80,6 +80,17 @@ _c() {
fi
}
_C() {
# recursively copy a file or directory
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
if [ ! -e "$path" ]; then
dryrun_or_real cp -r "$arg" "$path"
_restorecon "$path"
[ $uid != '-' ] && dryrun_or_real chown "$uid" "$path"
[ $gid != '-' ] && dryrun_or_real chgrp "$gid" "$path"
[ $mode != '-' ] && dryrun_or_real chmod "$mode" "$path"
fi
}
_f() {
# Create a file if it doesn't exist yet
@@ -304,6 +315,7 @@ for FILE in $tmpfiles_d ; do
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
FORCE=0
# Unless we have both command and path, skip this line.
if [ -z "$cmd" -o -z "$path" ]; then
@@ -311,13 +323,20 @@ for FILE in $tmpfiles_d ; do
fi
case $cmd in
*!) [ "$BOOT" -eq "1" ] || continue; cmd=${cmd%!} ;;
\#*) continue ;;
esac
while [ ${#cmd} -gt 1 ]; do
case $cmd in
*!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;;
*+) cmd=${cmd%+}; FORCE=1; ;;
*) warninvalid ; continue 2 ;;
esac
done
# whine about invalid entries
case $cmd in
f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
\#*) continue ;;
f|F|w|d|D|p|L|c|C|b|x|X|r|R|z|Z) ;;
*) warninvalid ; continue ;;
esac
@@ -326,7 +345,7 @@ for FILE in $tmpfiles_d ; do
case "$cmd" in
p|f|F) mode=0644 ;;
d|D) mode=0755 ;;
z|Z|x|r|R|L) ;;
C|z|Z|x|r|R|L) ;;
esac
fi
@@ -338,6 +357,13 @@ for FILE in $tmpfiles_d ; do
[ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue
[ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue
if [ $FORCE -gt 0 ]; then
case $cmd in
p|L|c|b) [ -f "$path" ] && dryrun_or_real rm -f "$path"
esac
fi
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"
_$cmd "$@"
rc=$?

View File

@@ -48,25 +48,6 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* Some libc implemntations don't have these */
#ifndef TAILQ_CONCAT
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (0)
#endif
#ifndef TAILQ_FOREACH_SAFE
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = TAILQ_FIRST((head)); \
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifdef __GLIBC__
# if ! defined (__UCLIBC__) && ! defined (__dietlibc__)
# define strlcpy(dst, src, size) snprintf(dst, size, "%s", src)

846
src/includes/queue.h Normal file
View File

@@ -0,0 +1,846 @@
/* $NetBSD: queue.h,v 1.67 2014/05/17 21:22:56 rmind Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)queue.h 8.5 (Berkeley) 8/20/94
*/
#ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_
/*
* This file defines five types of data structures: singly-linked lists,
* lists, simple queues, tail queues, and circular queues.
*
* A singly-linked list is headed by a single forward pointer. The
* elements are singly linked for minimum space and pointer manipulation
* overhead at the expense of O(n) removal for arbitrary elements. New
* elements can be added to the list after an existing element or at the
* head of the list. Elements being removed from the head of the list
* should use the explicit macro for this purpose for optimum
* efficiency. A singly-linked list may only be traversed in the forward
* direction. Singly-linked lists are ideal for applications with large
* datasets and few or no removals or for implementing a LIFO queue.
*
* A list is headed by a single forward pointer (or an array of forward
* pointers for a hash table header). The elements are doubly linked
* so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before
* or after an existing element or at the head of the list. A list
* may only be traversed in the forward direction.
*
* A simple queue is headed by a pair of pointers, one the head of the
* list and the other to the tail of the list. The elements are singly
* linked to save space, so elements can only be removed from the
* head of the list. New elements can be added to the list after
* an existing element, at the head of the list, or at the end of the
* list. A simple queue may only be traversed in the forward direction.
*
* A tail queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or
* after an existing element, at the head of the list, or at the end of
* the list. A tail queue may be traversed in either direction.
*
* A circle queue is headed by a pair of pointers, one to the head of the
* list and the other to the tail of the list. The elements are doubly
* linked so that an arbitrary element can be removed without a need to
* traverse the list. New elements can be added to the list before or after
* an existing element, at the head of the list, or at the end of the list.
* A circle queue may be traversed in either direction, but has a more
* complex end of list detection.
*
* For details on the use of these macros, see the queue(3) manual page.
*/
/*
* Include the definition of NULL only on NetBSD because sys/null.h
* is not available elsewhere. This conditional makes the header
* portable and it can simply be dropped verbatim into any system.
* The caveat is that on other systems some other header
* must provide NULL before the macros can be used.
*/
#ifdef __NetBSD__
#include <sys/null.h>
#endif
#if defined(QUEUEDEBUG)
# if defined(_KERNEL)
# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__)
# else
# include <err.h>
# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__)
# endif
#endif
/*
* Singly-linked List definitions.
*/
#define SLIST_HEAD(name, type) \
struct name { \
struct type *slh_first; /* first element */ \
}
#define SLIST_HEAD_INITIALIZER(head) \
{ NULL }
#define SLIST_ENTRY(type) \
struct { \
struct type *sle_next; /* next element */ \
}
/*
* Singly-linked List access methods.
*/
#define SLIST_FIRST(head) ((head)->slh_first)
#define SLIST_END(head) NULL
#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
#define SLIST_FOREACH(var, head, field) \
for((var) = (head)->slh_first; \
(var) != SLIST_END(head); \
(var) = (var)->field.sle_next)
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) != SLIST_END(head) && \
((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
/*
* Singly-linked List functions.
*/
#define SLIST_INIT(head) do { \
(head)->slh_first = SLIST_END(head); \
} while (/*CONSTCOND*/0)
#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
(elm)->field.sle_next = (slistelm)->field.sle_next; \
(slistelm)->field.sle_next = (elm); \
} while (/*CONSTCOND*/0)
#define SLIST_INSERT_HEAD(head, elm, field) do { \
(elm)->field.sle_next = (head)->slh_first; \
(head)->slh_first = (elm); \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE_AFTER(slistelm, field) do { \
(slistelm)->field.sle_next = \
SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE_HEAD(head, field) do { \
(head)->slh_first = (head)->slh_first->field.sle_next; \
} while (/*CONSTCOND*/0)
#define SLIST_REMOVE(head, elm, type, field) do { \
if ((head)->slh_first == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} \
else { \
struct type *curelm = (head)->slh_first; \
while(curelm->field.sle_next != (elm)) \
curelm = curelm->field.sle_next; \
curelm->field.sle_next = \
curelm->field.sle_next->field.sle_next; \
} \
} while (/*CONSTCOND*/0)
/*
* List definitions.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
/*
* List access methods.
*/
#define LIST_FIRST(head) ((head)->lh_first)
#define LIST_END(head) NULL
#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head))
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
#define LIST_FOREACH(var, head, field) \
for ((var) = ((head)->lh_first); \
(var) != LIST_END(head); \
(var) = ((var)->field.le_next))
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) != LIST_END(head) && \
((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
#define LIST_MOVE(head1, head2) do { \
LIST_INIT((head2)); \
if (!LIST_EMPTY((head1))) { \
(head2)->lh_first = (head1)->lh_first; \
LIST_INIT((head1)); \
} \
} while (/*CONSTCOND*/0)
/*
* List functions.
*/
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
if ((head)->lh_first && \
(head)->lh_first->field.le_prev != &(head)->lh_first) \
QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_LIST_OP(elm, field) \
if ((elm)->field.le_next && \
(elm)->field.le_next->field.le_prev != \
&(elm)->field.le_next) \
QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \
__FILE__, __LINE__); \
if (*(elm)->field.le_prev != (elm)) \
QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \
__FILE__, __LINE__);
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \
(elm)->field.le_next = (void *)1L; \
(elm)->field.le_prev = (void *)1L;
#else
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
#define QUEUEDEBUG_LIST_OP(elm, field)
#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
#endif
#define LIST_INIT(head) do { \
(head)->lh_first = LIST_END(head); \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
QUEUEDEBUG_LIST_OP((listelm), field) \
if (((elm)->field.le_next = (listelm)->field.le_next) != \
LIST_END(head)) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
QUEUEDEBUG_LIST_OP((listelm), field) \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
} while (/*CONSTCOND*/0)
#define LIST_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (/*CONSTCOND*/0)
#define LIST_REMOVE(elm, field) do { \
QUEUEDEBUG_LIST_OP((elm), field) \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define LIST_REPLACE(elm, elm2, field) do { \
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
(elm2)->field.le_next->field.le_prev = \
&(elm2)->field.le_next; \
(elm2)->field.le_prev = (elm)->field.le_prev; \
*(elm2)->field.le_prev = (elm2); \
QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
/*
* Simple queue definitions.
*/
#define SIMPLEQ_HEAD(name, type) \
struct name { \
struct type *sqh_first; /* first element */ \
struct type **sqh_last; /* addr of last next element */ \
}
#define SIMPLEQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).sqh_first }
#define SIMPLEQ_ENTRY(type) \
struct { \
struct type *sqe_next; /* next element */ \
}
/*
* Simple queue access methods.
*/
#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
#define SIMPLEQ_END(head) NULL
#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head))
#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
#define SIMPLEQ_FOREACH(var, head, field) \
for ((var) = ((head)->sqh_first); \
(var) != SIMPLEQ_END(head); \
(var) = ((var)->field.sqe_next))
#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \
for ((var) = ((head)->sqh_first); \
(var) != SIMPLEQ_END(head) && \
((next = ((var)->field.sqe_next)), 1); \
(var) = (next))
/*
* Simple queue functions.
*/
#define SIMPLEQ_INIT(head) do { \
(head)->sqh_first = NULL; \
(head)->sqh_last = &(head)->sqh_first; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
(head)->sqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.sqe_next = NULL; \
*(head)->sqh_last = (elm); \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
(head)->sqh_last = &(elm)->field.sqe_next; \
(listelm)->field.sqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE_HEAD(head, field) do { \
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
(head)->sqh_last = &(head)->sqh_first; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \
if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
== NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_REMOVE(head, elm, type, field) do { \
if ((head)->sqh_first == (elm)) { \
SIMPLEQ_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->sqh_first; \
while (curelm->field.sqe_next != (elm)) \
curelm = curelm->field.sqe_next; \
if ((curelm->field.sqe_next = \
curelm->field.sqe_next->field.sqe_next) == NULL) \
(head)->sqh_last = &(curelm)->field.sqe_next; \
} \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_CONCAT(head1, head2) do { \
if (!SIMPLEQ_EMPTY((head2))) { \
*(head1)->sqh_last = (head2)->sqh_first; \
(head1)->sqh_last = (head2)->sqh_last; \
SIMPLEQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
#define SIMPLEQ_LAST(head, type, field) \
(SIMPLEQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->sqh_last) - offsetof(struct type, field))))
/*
* Tail queue definitions.
*/
#define _TAILQ_HEAD(name, type, qual) \
struct name { \
qual type *tqh_first; /* first element */ \
qual type *qual *tqh_last; /* addr of last next element */ \
}
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
#define TAILQ_HEAD_INITIALIZER(head) \
{ TAILQ_END(head), &(head).tqh_first }
#define _TAILQ_ENTRY(type, qual) \
struct { \
qual type *tqe_next; /* next element */ \
qual type *qual *tqe_prev; /* address of previous next element */\
}
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
/*
* Tail queue access methods.
*/
#define TAILQ_FIRST(head) ((head)->tqh_first)
#define TAILQ_END(head) (NULL)
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
#define TAILQ_LAST(head, headname) \
(*(((struct headname *)((head)->tqh_last))->tqh_last))
#define TAILQ_PREV(elm, headname, field) \
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head))
#define TAILQ_FOREACH(var, head, field) \
for ((var) = ((head)->tqh_first); \
(var) != TAILQ_END(head); \
(var) = ((var)->field.tqe_next))
#define TAILQ_FOREACH_SAFE(var, head, field, next) \
for ((var) = ((head)->tqh_first); \
(var) != TAILQ_END(head) && \
((next) = TAILQ_NEXT(var, field), 1); (var) = (next))
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));\
(var) != TAILQ_END(head); \
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \
for ((var) = TAILQ_LAST((head), headname); \
(var) != TAILQ_END(head) && \
((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev))
/*
* Tail queue functions.
*/
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
if ((head)->tqh_first && \
(head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \
QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
if (*(head)->tqh_last != NULL) \
QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_OP(elm, field) \
if ((elm)->field.tqe_next && \
(elm)->field.tqe_next->field.tqe_prev != \
&(elm)->field.tqe_next) \
QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \
__FILE__, __LINE__); \
if (*(elm)->field.tqe_prev != (elm)) \
QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \
__FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \
if ((elm)->field.tqe_next == NULL && \
(head)->tqh_last != &(elm)->field.tqe_next) \
QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\
(head), (elm), __FILE__, __LINE__);
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \
(elm)->field.tqe_next = (void *)1L; \
(elm)->field.tqe_prev = (void *)1L;
#else
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
#define QUEUEDEBUG_TAILQ_OP(elm, field)
#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
#endif
#define TAILQ_INIT(head) do { \
(head)->tqh_first = TAILQ_END(head); \
(head)->tqh_last = &(head)->tqh_first; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \
if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \
(elm)->field.tqe_next = TAILQ_END(head); \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
QUEUEDEBUG_TAILQ_OP((listelm), field) \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \
TAILQ_END(head)) \
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
QUEUEDEBUG_TAILQ_OP((listelm), field) \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
} while (/*CONSTCOND*/0)
#define TAILQ_REMOVE(head, elm, field) do { \
QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \
QUEUEDEBUG_TAILQ_OP((elm), field) \
if (((elm)->field.tqe_next) != TAILQ_END(head)) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
} while (/*CONSTCOND*/0)
#define TAILQ_REPLACE(head, elm, elm2, field) do { \
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \
TAILQ_END(head)) \
(elm2)->field.tqe_next->field.tqe_prev = \
&(elm2)->field.tqe_next; \
else \
(head)->tqh_last = &(elm2)->field.tqe_next; \
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
*(elm2)->field.tqe_prev = (elm2); \
QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \
} while (/*CONSTCOND*/0)
#define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
/*
* Singly-linked Tail queue declarations.
*/
#define STAILQ_HEAD(name, type) \
struct name { \
struct type *stqh_first; /* first element */ \
struct type **stqh_last; /* addr of last next element */ \
}
#define STAILQ_HEAD_INITIALIZER(head) \
{ NULL, &(head).stqh_first }
#define STAILQ_ENTRY(type) \
struct { \
struct type *stqe_next; /* next element */ \
}
/*
* Singly-linked Tail queue access methods.
*/
#define STAILQ_FIRST(head) ((head)->stqh_first)
#define STAILQ_END(head) NULL
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head))
/*
* Singly-linked Tail queue functions.
*/
#define STAILQ_INIT(head) do { \
(head)->stqh_first = NULL; \
(head)->stqh_last = &(head)->stqh_first; \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_HEAD(head, elm, field) do { \
if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
(head)->stqh_last = &(elm)->field.stqe_next; \
(head)->stqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_TAIL(head, elm, field) do { \
(elm)->field.stqe_next = NULL; \
*(head)->stqh_last = (elm); \
(head)->stqh_last = &(elm)->field.stqe_next; \
} while (/*CONSTCOND*/0)
#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
(head)->stqh_last = &(elm)->field.stqe_next; \
(listelm)->field.stqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define STAILQ_REMOVE_HEAD(head, field) do { \
if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
(head)->stqh_last = &(head)->stqh_first; \
} while (/*CONSTCOND*/0)
#define STAILQ_REMOVE(head, elm, type, field) do { \
if ((head)->stqh_first == (elm)) { \
STAILQ_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->stqh_first; \
while (curelm->field.stqe_next != (elm)) \
curelm = curelm->field.stqe_next; \
if ((curelm->field.stqe_next = \
curelm->field.stqe_next->field.stqe_next) == NULL) \
(head)->stqh_last = &(curelm)->field.stqe_next; \
} \
} while (/*CONSTCOND*/0)
#define STAILQ_FOREACH(var, head, field) \
for ((var) = ((head)->stqh_first); \
(var); \
(var) = ((var)->field.stqe_next))
#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = STAILQ_FIRST((head)); \
(var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#define STAILQ_CONCAT(head1, head2) do { \
if (!STAILQ_EMPTY((head2))) { \
*(head1)->stqh_last = (head2)->stqh_first; \
(head1)->stqh_last = (head2)->stqh_last; \
STAILQ_INIT((head2)); \
} \
} while (/*CONSTCOND*/0)
#define STAILQ_LAST(head, type, field) \
(STAILQ_EMPTY((head)) ? \
NULL : \
((struct type *)(void *) \
((char *)((head)->stqh_last) - offsetof(struct type, field))))
#ifndef _KERNEL
/*
* Circular queue definitions. Do not use. We still keep the macros
* for compatibility but because of pointer aliasing issues their use
* is discouraged!
*/
/*
* __launder_type(): We use this ugly hack to work around the the compiler
* noticing that two types may not alias each other and elide tests in code.
* We hit this in the CIRCLEQ macros when comparing 'struct name *' and
* 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC
* 4.8) declare these comparisons as always false, causing the code to
* not run as designed.
*
* This hack is only to be used for comparisons and thus can be fully const.
* Do not use for assignment.
*
* If we ever choose to change the ABI of the CIRCLEQ macros, we could fix
* this by changing the head/tail sentinal values, but see the note above
* this one.
*/
static __inline const void * __launder_type(const void *);
static __inline const void *
__launder_type(const void *__x)
{
__asm __volatile("" : "+r" (__x));
return __x;
}
#if defined(QUEUEDEBUG)
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \
if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \
(head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \
QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \
__FILE__, __LINE__); \
if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \
(head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \
QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \
__FILE__, __LINE__);
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \
if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \
if ((head)->cqh_last != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \
(elm), __FILE__, __LINE__); \
} else { \
if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \
(elm), __FILE__, __LINE__); \
} \
if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \
if ((head)->cqh_first != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \
(elm), __FILE__, __LINE__); \
} else { \
if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \
QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \
(elm), __FILE__, __LINE__); \
}
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \
(elm)->field.cqe_next = (void *)1L; \
(elm)->field.cqe_prev = (void *)1L;
#else
#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
#endif
#define CIRCLEQ_HEAD(name, type) \
struct name { \
struct type *cqh_first; /* first element */ \
struct type *cqh_last; /* last element */ \
}
#define CIRCLEQ_HEAD_INITIALIZER(head) \
{ CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
#define CIRCLEQ_ENTRY(type) \
struct { \
struct type *cqe_next; /* next element */ \
struct type *cqe_prev; /* previous element */ \
}
/*
* Circular queue functions.
*/
#define CIRCLEQ_INIT(head) do { \
(head)->cqh_first = CIRCLEQ_END(head); \
(head)->cqh_last = CIRCLEQ_END(head); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm)->field.cqe_next; \
(elm)->field.cqe_prev = (listelm); \
if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm); \
else \
(listelm)->field.cqe_next->field.cqe_prev = (elm); \
(listelm)->field.cqe_next = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \
(elm)->field.cqe_next = (listelm); \
(elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm); \
else \
(listelm)->field.cqe_prev->field.cqe_next = (elm); \
(listelm)->field.cqe_prev = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = (head)->cqh_first; \
(elm)->field.cqe_prev = CIRCLEQ_END(head); \
if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm); \
else \
(head)->cqh_first->field.cqe_prev = (elm); \
(head)->cqh_first = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
(elm)->field.cqe_next = CIRCLEQ_END(head); \
(elm)->field.cqe_prev = (head)->cqh_last; \
if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm); \
else \
(head)->cqh_last->field.cqe_next = (elm); \
(head)->cqh_last = (elm); \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_REMOVE(head, elm, field) do { \
QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \
QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \
if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
(head)->cqh_last = (elm)->field.cqe_prev; \
else \
(elm)->field.cqe_next->field.cqe_prev = \
(elm)->field.cqe_prev; \
if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
(head)->cqh_first = (elm)->field.cqe_next; \
else \
(elm)->field.cqe_prev->field.cqe_next = \
(elm)->field.cqe_next; \
QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \
} while (/*CONSTCOND*/0)
#define CIRCLEQ_FOREACH(var, head, field) \
for ((var) = ((head)->cqh_first); \
(var) != CIRCLEQ_ENDC(head); \
(var) = ((var)->field.cqe_next))
#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
for ((var) = ((head)->cqh_last); \
(var) != CIRCLEQ_ENDC(head); \
(var) = ((var)->field.cqe_prev))
/*
* Circular queue access methods.
*/
#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
#define CIRCLEQ_LAST(head) ((head)->cqh_last)
/* For comparisons */
#define CIRCLEQ_ENDC(head) (__launder_type(head))
/* For assignments */
#define CIRCLEQ_END(head) ((void *)(head))
#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
#define CIRCLEQ_EMPTY(head) \
(CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head))
#define CIRCLEQ_LOOP_NEXT(head, elm, field) \
(((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \
? ((head)->cqh_first) \
: (elm->field.cqe_next))
#define CIRCLEQ_LOOP_PREV(head, elm, field) \
(((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \
? ((head)->cqh_last) \
: (elm->field.cqe_prev))
#endif /* !_KERNEL */
#endif /* !_SYS_QUEUE_H_ */

View File

@@ -48,7 +48,10 @@
# endif
#endif
__BEGIN_DECLS
/* __BEGIN_DECLS */
#ifdef __cplusplus
extern "C" {
#endif
/*! @brief Color types to use */
typedef enum
@@ -140,5 +143,9 @@ void eoutdentv(void);
/*! @brief Prefix each einfo line with something */
void eprefix(const char * EINFO_RESTRICT);
__END_DECLS
/* __END_DECLS */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -28,9 +28,10 @@
* SUCH DAMAGE.
*/
#include "queue.h"
#include "librc.h"
#if defined(__linux__) || defined (__GLIBC__)
#if defined(__linux__) || (defined (__FreeBSD_kernel__) && defined(__GLIBC__))
static bool
pid_is_exec(pid_t pid, const char *exec)
{
@@ -553,6 +554,16 @@ rc_service_daemons_crashed(const char *service)
}
fclose(fp);
char *ch_root = rc_service_value_get(basename_c(service), "chroot");
char *spidfile = pidfile;
if (ch_root && pidfile) {
spidfile = xmalloc(strlen(ch_root) + strlen(pidfile) + 1);
strcpy(spidfile, ch_root);
strcat(spidfile, pidfile);
free(pidfile);
pidfile = spidfile;
}
pid = 0;
if (pidfile) {
retval = true;

View File

@@ -30,6 +30,7 @@
#include <sys/utsname.h>
#include "queue.h"
#include "librc.h"
#define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh"

View File

@@ -28,6 +28,7 @@
* SUCH DAMAGE.
*/
#include "queue.h"
#include "librc.h"
bool

View File

@@ -28,6 +28,7 @@
* SUCH DAMAGE.
*/
#include "queue.h"
#include "librc.h"
RC_STRINGLIST *

View File

@@ -30,6 +30,7 @@
const char librc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "queue.h"
#include "librc.h"
#ifdef __FreeBSD__
# include <sys/sysctl.h>

View File

@@ -57,11 +57,13 @@
#include <time.h>
#include <unistd.h>
#ifdef BSD
#if defined(BSD) && !defined(__GNU__)
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <kvm.h>
#else
#include <sys/param.h>
#endif
#include "rc.h"

View File

@@ -27,11 +27,13 @@
#define __RC_H__
#include <sys/types.h>
#include <sys/queue.h>
#include <stdbool.h>
#include <stdio.h>
__BEGIN_DECLS
/* __BEGIN_DECLS */
#ifdef __cplusplus
extern "C" {
#endif
#define RC_PREFIX "@PREFIX@"
#define RC_SYSCONFDIR "@SYSCONFDIR@"
@@ -39,7 +41,8 @@ __BEGIN_DECLS
#define RC_LIBEXECDIR "@LIBEXECDIR@"
#if defined(PREFIX)
#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
#elif defined(__linux__)
#elif defined(__linux__) || (defined(__FreeBSD_kernel__) && \
defined(__GLIBC__)) || defined(__GNU__)
#define RC_SVCDIR "/run/openrc"
#else
#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
@@ -74,6 +77,51 @@ __BEGIN_DECLS
# define RC_LOCAL_CONFDIR RC_LOCAL_PREFIX "/etc/conf.d"
#endif
#ifndef _SYS_QUEUE_H_
/*
* The following are copied directly from our imported queue.h.
*/
/*
* List definitions.
*/
#define LIST_HEAD(name, type) \
struct name { \
struct type *lh_first; /* first element */ \
}
#define LIST_HEAD_INITIALIZER(head) \
{ NULL }
#define LIST_ENTRY(type) \
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}
/*
* Tail queue definitions.
*/
#define _TAILQ_HEAD(name, type, qual) \
struct name { \
qual type *tqh_first; /* first element */ \
qual type *qual *tqh_last; /* addr of last next element */ \
}
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
#define TAILQ_HEAD_INITIALIZER(head) \
{ TAILQ_END(head), &(head).tqh_first }
#define _TAILQ_ENTRY(type, qual) \
struct { \
qual type *tqe_next; /* next element */ \
qual type *qual *tqe_prev; /* address of previous next element */\
}
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
#endif /* _SYS_QUEUE_H_ */
/* A doubly linked list using queue(3) for ease of use */
typedef struct rc_string {
char *value;
@@ -563,5 +611,9 @@ bool rc_getfile(const char *, char **, size_t *);
* we have our own */
ssize_t rc_getline(char **, size_t *, FILE *);
__END_DECLS
/* __END_DECLS */
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -23,6 +23,7 @@
* SUCH DAMAGE.
*/
#include "queue.h"
#include "rc.h"
int checkpath(int, char **);

View File

@@ -70,6 +70,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"

View File

@@ -35,11 +35,12 @@
# include <sys/ucred.h>
# include <sys/mount.h>
# define F_FLAGS f_flags
#elif defined(BSD)
#elif defined(BSD) && !defined(__GNU__)
# include <sys/statvfs.h>
# define statfs statvfs
# define F_FLAGS f_flag
#elif defined (__linux__) || defined (__GLIBC__)
#elif defined (__linux__) || (defined(__FreeBSD_kernel__) && \
defined(__GLIBC__)) || defined(__GNU__)
# include <mntent.h>
#endif
@@ -53,6 +54,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
@@ -168,7 +170,7 @@ process_mount(RC_STRINGLIST *list, struct args *args,
return -1;
}
#ifdef BSD
#if defined(BSD) && !defined(__GNU__)
/* Translate the mounted options to english
* This is taken directly from FreeBSD mount.c */
@@ -265,7 +267,8 @@ find_mounts(struct args *args)
return list;
}
#elif defined (__linux__) || defined (__GLIBC__)
#elif defined (__linux__) || (defined (__FreeBSD_kernel__) && \
defined(__GLIBC__))
static struct mntent *
getmntfile(const char *file)
{

View File

@@ -46,6 +46,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"

View File

@@ -44,7 +44,7 @@
#include <time.h>
#include <unistd.h>
#if defined(__linux__) || defined(__GLIBC__)
#if defined(__linux__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
@@ -54,6 +54,7 @@
#include "einfo.h"
#include "rc-logger.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"

View File

@@ -47,6 +47,7 @@
#include <unistd.h>
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "version.h"

View File

@@ -43,6 +43,7 @@
#include <unistd.h>
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"

View File

@@ -38,6 +38,7 @@
#include <selinux/label.h>
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"

View File

@@ -36,6 +36,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
@@ -57,7 +58,7 @@ static const struct option longopts[] = {
};
static const char * const longopts_help[] = {
"tests if the service exists or not",
"if the service exsits then run the command",
"if the service exists then run the command",
"list all available services",
"resolve the service name to an init script",
longopts_help_COMMON

View File

@@ -36,6 +36,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"

View File

@@ -39,6 +39,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"

View File

@@ -60,6 +60,7 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-logger.h"
#include "rc-misc.h"

View File

@@ -51,7 +51,8 @@
#include <time.h>
#include <unistd.h>
#if defined(__linux__) || defined(__GLIBC__)
#if defined(__linux__) || (defined(__FreeBSD_kernel__) && \
defined(__GLIBC__))
# include <pty.h>
#elif defined(__NetBSD__) || defined(__OpenBSD__)
# include <util.h>
@@ -61,6 +62,7 @@
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
#include "rc-plugin.h"

View File

@@ -74,18 +74,10 @@ static struct pam_conv conv = { NULL, NULL};
#include "builtins.h"
#include "einfo.h"
#include "queue.h"
#include "rc.h"
#include "rc-misc.h"
/* Some libc implementations don't define this */
#ifndef LIST_FOREACH_SAFE
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
(var) = (tvar))
#endif
typedef struct scheduleitem
{
enum