Compare commits
	
		
			49 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 8d6370d469 | ||
|   | 75ce3addd2 | ||
|   | d818be6e2b | ||
|   | b812524303 | ||
|   | 56c006ebd6 | ||
|   | 067088bbff | ||
|   | 52d4e56674 | ||
|   | 6e6902c28b | ||
|   | 084823182a | ||
|   | 7478c104fc | ||
|   | 065b7ecc0d | ||
|   | b054aca50b | ||
|   | f9e7a00ba9 | ||
|   | f1f48011ac | ||
|   | 427a1ce299 | ||
|   | f43cec34ca | ||
|   | d64c9d2050 | ||
|   | b2b2c57a38 | ||
|   | 155b845194 | ||
|   | 9b578808fb | ||
|   | 03164dd38d | ||
|   | 2b82766452 | ||
|   | 3eef6e9127 | ||
|   | 77f09900a2 | ||
|   | 50d77a4e5d | ||
|   | 2d31b0a3f8 | ||
|   | b84d0bac4d | ||
|   | 1ff3a37c60 | ||
|   | 7e95d924c9 | ||
| a15b532a02 | |||
|   | 3e00fbc9b0 | ||
|   | 846e460075 | ||
|   | a32b14bbb4 | ||
|   | 084877eb52 | ||
|   | 97e74f9734 | ||
|   | d328de198d | ||
|   | a9fc26ac13 | ||
|   | 40f7046696 | ||
|   | 894995176e | ||
|   | 5246ea7b6f | ||
|   | ed8b768c4a | ||
|   | 825caa14de | ||
|   | d5c396cbfc | ||
|   | 5427783fdf | ||
|   | d95425b08a | ||
|   | 76420d9849 | ||
|   | bebc604438 | ||
|   | 9dae4f2e38 | ||
|   | d126542dc6 | 
							
								
								
									
										15
									
								
								.cirrus.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.cirrus.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| # Cirrus CI integration | ||||
| # https://cirrus-ci.org | ||||
|  | ||||
| test_task: | ||||
|   freebsd_instance: | ||||
|     matrix: | ||||
|       image: freebsd-12-0-release-amd64 | ||||
|       image: freebsd-11-2-release-amd64 | ||||
|   env: | ||||
|     OS: FreeBSD | ||||
|   procfs_script: > | ||||
|     [ -f /proc/curproc ] || mount -t procfs proc /proc | ||||
|   pkg_install_script: pkg install -y bash gawk gmake gsed | ||||
|   gsed_hack_script: rm /usr/bin/sed && ln -s /usr/local/bin/gsed /usr/bin/sed | ||||
|   test_script: bash ci/cirrus.sh | ||||
							
								
								
									
										16
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -9,6 +9,20 @@ os: | ||||
| compiler: | ||||
|   - gcc | ||||
|   - clang | ||||
|   - musl-gcc | ||||
|  | ||||
| addons: | ||||
|   apt: | ||||
|     packages: | ||||
|     - musl-tools | ||||
|  | ||||
| notifications: | ||||
|   irc: | ||||
|     channels: | ||||
|       - "irc.freenode.org#openrc" | ||||
|     on_success: change  # options: [always|never|change] default: always | ||||
|     on_failure: always  # options: [always|never|change] default: always | ||||
|     on_start: false     # default: false | ||||
|  | ||||
| script: | ||||
|   - ./test/travis.sh | ||||
|   - ./ci/travis.sh | ||||
|   | ||||
							
								
								
									
										885
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										885
									
								
								ChangeLog
									
									
									
									
									
								
							| @@ -1,4 +1,470 @@ | ||||
| commit 69fbd129938522cdd9b82fea2b83c857796a32af | ||||
| commit d818be6e2bc00c790f6f4aeb2670f007951b2ab3 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc: fix potential buffer overflow in pid_is_argv | ||||
|      | ||||
|     This fixes #299. | ||||
|  | ||||
| commit b812524303ae42bf7f61a642c45e8be39aa222e5 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Revert "src/librc/librc-daemon.c: fix buffer overrun in pid_is_argv" | ||||
|      | ||||
|     This reverts commit 084877eb52971faf8f52c780ddd08ed9af140eb6. | ||||
|     The mentioned commit caused some systems to have some services reported | ||||
|     as crashed. | ||||
|      | ||||
|     This fixes #297. | ||||
|     This fixes #298. | ||||
|  | ||||
| commit 56c006ebd68d572e303c01c38291a1f5f4fc1c30 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 067088bbff42ca2fb9106acf309f1d9ce3e78ada | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     move ci scripts to their own directory | ||||
|      | ||||
|     This fixes #296. | ||||
|  | ||||
| commit 52d4e566743f57b9de81c77fdb605c171c02eacb | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     combine test directories | ||||
|      | ||||
|     This fixes #295. | ||||
|  | ||||
| commit 6e6902c28b715826fdfc7b42a592db88459b9a57 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     remove unused test ignore patterns | ||||
|  | ||||
| commit 084823182aec4aef6fb880d642bba2d0ef91a3ad | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     remove unused test data files | ||||
|  | ||||
| commit 7478c104fc479067d71d191dccfa4cbf541311d8 | ||||
| Author: Georgy Yakovlev <gyakovlev@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc/librc-depend.c: fix NULL pointer dereference | ||||
|      | ||||
|     In some cases deptree or depinfo can be NULL, check | ||||
|     before dereferencing. | ||||
|      | ||||
|     Fixes https://github.com/OpenRC/openrc/issues/293 | ||||
|     Fixes https://github.com/OpenRC/openrc/pulls/294 | ||||
|     X-Gentoo-Bug: 659906 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/659906 | ||||
|  | ||||
| commit 065b7ecc0d4ddd046cc235d60de20140db1a6fe8 | ||||
| Author: Georgy Yakovlev <gyakovlev@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     use cirrus-ci for FreeBSD builds | ||||
|      | ||||
|     This fixes #265. | ||||
|  | ||||
| commit b054aca50b31fc46fc736a542ec2719de2d23d30 | ||||
| Author: Sergei Trofimovich <slyfox@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     src/test/runtests.sh: drop 'readelf'-based tests | ||||
|      | ||||
|     The 'readelf'-based tests cover a few situations: | ||||
|     1. undefined symbols in shared libraries | ||||
|     2. unexpected exports in shared libraries | ||||
|      | ||||
|     Bug #575958 shows that [2.] implementation is too simplistic | ||||
|     in assuming that presence of relocation equals to export presence. | ||||
|      | ||||
|     It is incorrect for PLT stubs and local symbols. | ||||
|     Let's just drop these tests. | ||||
|      | ||||
|     If one needs to cover [1.] it is better to use LDFLAGS=-Wl,--no-undefined. | ||||
|      | ||||
|     This closes #292. | ||||
|      | ||||
|     X-Reported-by: Benda Xu | ||||
|     X-Gentoo-Bug: https://bugs.gentoo.org/575958 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/575958 | ||||
|  | ||||
| commit f9e7a00ba9c9b179c697fc0af83a19e923c831b0 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status: style fixes | ||||
|  | ||||
| commit f1f48011acb266db309922f145653b86f11e0baf | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     update ChangeLog | ||||
|  | ||||
| commit 427a1ce2995b376ed6d112c5c5b422217f815fbb | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status: add -f option to allow formatting output | ||||
|      | ||||
|     The -f option can be used when showing the status of services in | ||||
|     runlevels to allow making the output more easily parsable. | ||||
|     Currently, the .ini format is the only one supported. | ||||
|  | ||||
| commit f43cec34ca0201031fc10b584bcb391859f302cd | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status.c: small style changes | ||||
|  | ||||
| commit d64c9d205083ca82823f9f5ff178a5581f6c8b2a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add experimental support for an alternate shell for service scripts | ||||
|      | ||||
|     This is for #288. | ||||
|  | ||||
| commit b2b2c57a3898c945b33b8bf0a10b658483be09c1 | ||||
| Author: Edan Bedrik <3d4nb3@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc: fix realpath() return value check | ||||
|      | ||||
|     This fixes #226. | ||||
|  | ||||
| commit 155b8451945f8a17cd61ad56be3bb09541c3719a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     improve shutdown documentation | ||||
|      | ||||
|     This fixes #290. | ||||
|  | ||||
| commit 9b578808fb67682780adb17157330934a5c2cce7 | ||||
| Author: Austin English <austinenglish@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     travis: try enabling musl-gcc | ||||
|      | ||||
|     This fixes #261. | ||||
|  | ||||
| commit 03164dd38d9e8d9a93141e5d6b495f306875bcd9 | ||||
| Author: Austin English <austinenglish@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix build with muslc | ||||
|      | ||||
|     This fixes #261. | ||||
|  | ||||
| commit 2b82766452adec4eb99f61902d62f0fa2e369fa4 | ||||
| Author: Austin English <austinenglish@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     test/skel.runtests.sh: remove unused file | ||||
|      | ||||
|     git grep shows no usage, and `make test` passes | ||||
|      | ||||
|     This fixes #256. | ||||
|  | ||||
| commit 3eef6e91274f2e07bd566f206e89d9b0b9c45fb9 | ||||
| Author: Felix Neumärker <xdch47@posteo.de> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     zsh-completion: _rc-service support extra actions | ||||
|      | ||||
|       - use rc-service <service> describe to get action list | ||||
|      | ||||
|     This is for #285. | ||||
|  | ||||
| commit 77f09900a2e0eeb1475e9ee404b6e7ff76ff8e9d | ||||
| Author: Felix Neumärker <xdch47@posteo.de> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     zsh-completion: _rc-service fix flag/command combinations | ||||
|      | ||||
|       - handle `rc-service -<flag> <service> <action>` correctly | ||||
|      | ||||
|     This is for #285. | ||||
|  | ||||
| commit 50d77a4e5d8c321cc89565295db13e60b2fb2cc7 | ||||
| Author: Kim Jahn <kim@maisspace.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc.8: add openrc-run.8  to see also | ||||
|      | ||||
|     This fixes #283. | ||||
|  | ||||
| commit 2d31b0a3f8b4be7290e596cb7072b78361e1734b | ||||
| Author: Mike Frysinger <vapier@gentoo.org> | ||||
| Commit: Mike Frysinger <vapier@gentoo.org> | ||||
|  | ||||
|     man: supervise-daemon: fix various style issues | ||||
|      | ||||
|     The .Dt header is supposed to be all caps.  This was mixing case. | ||||
|      | ||||
|     The options block was being incorrectly indented due to a missing .El. | ||||
|      | ||||
|     Some of the new options were missing the .It block, so add that. | ||||
|      | ||||
|     Finally, the -D option was missing capitalization. | ||||
|  | ||||
| commit b84d0bac4d3f23ff969827d74808fd7bd1c621c3 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     travis-ci: add IRC notifications | ||||
|  | ||||
| commit 1ff3a37c60e89da31c5c06bb4edd184770c91923 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: fix compiler warning | ||||
|  | ||||
| commit 7e95d924c9067d9d643fc3b533f777ea7a5234d7 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     bash-completions/rc-service: allow tab to be used again | ||||
|      | ||||
|     X-Gentoo-Bug: 670290 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/670290 | ||||
|  | ||||
| commit a15b532a02094b3afe9d698f6b98e70f0fd4506a | ||||
| Author: artoo <artoo@artixlinux.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     scripts: fix halt, poweroff and reboot wrappers | ||||
|      | ||||
|     These are designed to emulate the sysvinit equivalents, so pass "now" as | ||||
|     the time argument if no arguments are given. | ||||
|      | ||||
|     This fixes #268. | ||||
|  | ||||
| commit 3e00fbc9b08dde9e2c7fc26ecb9e831417012dd1 | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix leading whitespace | ||||
|      | ||||
|     Clean up code indented with mixed tabs and spaces. | ||||
|     No actual code changes. | ||||
|      | ||||
|     This fixes #280. | ||||
|  | ||||
| commit 846e4600754dab3f0cb49edb4ad9e2b2b73d3f47 | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix potential out-of-bounds reads | ||||
|      | ||||
|     readlink(3) does not nul-terminate the result it sticks | ||||
|     into the supplied buffer. Consequently, the code | ||||
|      | ||||
|       rc = readlink(path, buf, sizeof(buf)); | ||||
|      | ||||
|     does not necessarily produce a C string. | ||||
|      | ||||
|     The code in rc_find_pid() produces some C strings this way | ||||
|     and passes them to strlen() and strcmp(), which can lead | ||||
|     to an out-of-bounds read. | ||||
|      | ||||
|     In this case, since the code already takes care to | ||||
|     zero-initialize the buffers before passing them | ||||
|     to readlink(3), only allow sizeof(buf)-1 bytes to | ||||
|     be returned. | ||||
|      | ||||
|     (While fixing this issue, I fixed two other locations that | ||||
|     used the same problematic pattern.) | ||||
|      | ||||
|     This fixes #270. | ||||
|  | ||||
| commit a32b14bbb43e9888acaaea6f764fb8dcb34fb941 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Do not use UT_LINESIZE or __UT_LINESIZE | ||||
|      | ||||
|     These are not standard. | ||||
|     For more information see issue #279. | ||||
|     This fixes #279. | ||||
|  | ||||
| commit 084877eb52971faf8f52c780ddd08ed9af140eb6 | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     src/librc/librc-daemon.c: fix buffer overrun in pid_is_argv | ||||
|      | ||||
|     The contents of /proc/<pid>/cmdline are read into | ||||
|     a stack buffer using | ||||
|      | ||||
|       bytes = read(fd, buffer, sizeof(buffer)); | ||||
|      | ||||
|     followed by appending a null terminator to the buffer with | ||||
|      | ||||
|       buffer[bytes] = '\0'; | ||||
|      | ||||
|     If bytes == sizeof(buffer), then this write is out-of-bounds. | ||||
|      | ||||
|     Refactor the code to use rc_getfile instead, since PATH_MAX | ||||
|     is not the maximum size of /proc/<pid>/cmdline. (I hit this | ||||
|     issue in practice while compiling Linux; it tripped the | ||||
|     stack-smashing protector.) | ||||
|      | ||||
|     This is roughly the same buffer overflow condition | ||||
|     that was fixed by commit 0ddee9b7d2b8dea810e252ca6a95c457876df120 | ||||
|     This fixes #269. | ||||
|  | ||||
| commit 97e74f97347f5798e01a47057efab00906754546 | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     src/rc/supervise-daemon.c: formatting fixes | ||||
|      | ||||
|     Fix misleading indentation and other erroneous whitespace. | ||||
|     This fixes #273. | ||||
|  | ||||
| commit d328de198d0ad980188b105decc09405652aa3d6 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     remove /run migration script again | ||||
|      | ||||
|     This time it was done correctly. | ||||
|     I missed a '\' the last time. | ||||
|  | ||||
| commit a9fc26ac1367ac887eab76007e8834dfe787edcd | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: Mike Frysinger <vapier@gmail.com> | ||||
|  | ||||
|     src/rc/supervise-daemon.c: do not pass NULL to strcmp | ||||
|      | ||||
|     The following will cause a segfault due to NULL being | ||||
|     passed to strcmp(3) | ||||
|      | ||||
|     $ RC_SVCNAME=foo supervise-daemon | ||||
|      | ||||
|     Fix the bounds check on argc in main. If argc<=1, then | ||||
|     it is not safe to dereference argv[1]. | ||||
|  | ||||
| commit 40f70466969b340ee5e277c98a4b27a9117b795e | ||||
| Author: philhofer <phofer@umich.edu> | ||||
| Commit: Mike Frysinger <vapier@gmail.com> | ||||
|  | ||||
|     src/rc/openrc-run.c: remove duplicate statement | ||||
|      | ||||
|     The statement | ||||
|      | ||||
|       ll = strlen(applet); | ||||
|      | ||||
|     appears twice in the same block without any | ||||
|     intervening assignment to the variables | ||||
|     'll' or 'applet' | ||||
|      | ||||
|     Remove the second (duplicate) statement. | ||||
|  | ||||
| commit 894995176e827eef16bf90b6479b7c285677ceef | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Revert "remove /run migration script" | ||||
|     For some reason removing this broke the build. | ||||
|      | ||||
|     This reverts commit 5246ea7b6f8c6a247403f725f8301457f6ddfffd. | ||||
|  | ||||
| commit 5246ea7b6f8c6a247403f725f8301457f6ddfffd | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     remove /run migration script | ||||
|      | ||||
|     We have used /run for some time now and we have had this migration | ||||
|     script for 6 years. Linux users should have upgraded by now to a version | ||||
|     of OpenRC which stores its information in /run. | ||||
|  | ||||
| commit ed8b768c4a68042eed0c21c8305640841b22f006 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix compiler warnings | ||||
|  | ||||
| commit 825caa14de6160c966d44d64d5c0254f4038d9a0 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: do not use the exec_service() function | ||||
|      | ||||
|     In order to run healthcheck() and the unhealthy() function, add an | ||||
|     exec_command call to the supervisor. | ||||
|     Another difference is This function also logs errors instead of | ||||
|     attempting to display them. | ||||
|      | ||||
|     This is for #271. | ||||
|  | ||||
| commit d5c396cbfc49ce88f58d944c8ab01d2c36ccdc7b | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Add debug logging to start-stop-daemon and rc-supervisor | ||||
|      | ||||
|     This will make it easier to track down why the supervisor intermittently | ||||
|     hangs after it runs for a long time. | ||||
|  | ||||
| commit 5427783fdf3d183ea4e63afc507c31d88f0d2c9c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     standardize the default shell | ||||
|      | ||||
|     I do not know of a need to have the default shell be a build-time | ||||
|     configurable setting. All *nix systems I am aware of have /bin/sh as a | ||||
|     default posix compatible shell. | ||||
|     If some systems running OpenRC do not make that assumption about | ||||
|     /bin/sh, I will consider bringing this back, so feel free to open an | ||||
|     issue. | ||||
|  | ||||
| commit d95425b08a1675efb66def056d0f92e6b2d78a77 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-cgroup.sh: remove shebang line | ||||
|      | ||||
|     This is not a stand-alone script, so it does not need the shebang line. | ||||
|     This also means it is not necessary to run this through sed. | ||||
|  | ||||
| commit 76420d9849e6832a52aa4c1ba1fd2895b7d51a08 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/agetty: set default respawn period to 60 seconds | ||||
|      | ||||
|     Without a respawn period setting, the supervisor will give up on | ||||
|     respawning agetty after it is respawned respawn_max times. For most | ||||
|     daemons giving up like this is reasonable, but not for agettys. Agettys | ||||
|     should always be respawned unless they are respawning too fafst,. | ||||
|      | ||||
|     If an agetty is respawning faster than 10 times in 60 seconds, this | ||||
|     seems to be too fast. | ||||
|  | ||||
| commit bebc604438f9586f26d0cad8bd72749ae84b4335 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: fix busy loop | ||||
|      | ||||
|     This fixes #264. | ||||
|  | ||||
| commit 9dae4f2e38ceae227933673e25db9583e8f610a6 | ||||
| Author: Alexander Zubkov <green@msu.ru> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
| @@ -6,11 +472,11 @@ Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|      | ||||
|     This fixes #239. | ||||
|  | ||||
| commit 4aa5686d9037132b27d7554436738fa98e8e9057 | ||||
| commit d126542dc626c8295b0f2cfcdee7bf5aa79daff1 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.40.1 | ||||
|     version 0.41 | ||||
|  | ||||
| commit ab6c8d56f155564f56d61553c4b1af9e7f63a9d2 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| @@ -1004,416 +1470,3 @@ Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|      | ||||
|     The default path provided by the system if one isn't set only includes | ||||
|     "/bin:/usr/bin". This adds the default path setting from sysvinit. | ||||
|  | ||||
| commit 16ff3cd8df6169f73e3d7cf00758a4703f62cbf0 | ||||
| Author: Christian Brauner <christian.brauner@ubuntu.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     check whether /sys/fs/cgroup is a mountpoint | ||||
|      | ||||
|     The current check only tries to detect whether /sys/fs/cgroup exists and | ||||
|     whether it is writable or not. But when the init system doesn't mount | ||||
|     cgroups then /sys/fs/cgroup will just be an empty directory. When paired | ||||
|     with unprivileged containers that mount sysfs this will cause misleading | ||||
|     errors to be printed since /sys/fs/cgroup will be owned by user | ||||
|     nobody:nogroup in this case. Independent of this specific problem this | ||||
|     check will also be misleading when the /sys/fs/cgroup exists and is in | ||||
|     fact writable by the init system but isn't actually a mountpoint. | ||||
|      | ||||
|     Note from William. "grep -qs" doesn't need to redirect output to | ||||
|     /dev/null since it is completely silent. | ||||
|      | ||||
|     This fixes #209. | ||||
|  | ||||
| commit 38032626a6c2f8e869197999f32ac3634667cc86 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     improve cgroup configuration checks | ||||
|      | ||||
|     make the base/controller functions return successfully if cgroups v1/v2 | ||||
|     are not configured in the kernel | ||||
|  | ||||
| commit aa7d3a7911b658c550e7ce76cd6d7d46541fc323 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc: force deptree update for sysinit runlevel | ||||
|  | ||||
| commit 98262647a9d2f3c65a7ceb1aaa81095522c1ef06 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: zero out the cmdline buffer when it is allocated | ||||
|  | ||||
| commit 5868abe97babcc287794dcb36ad8e77989b6ddcf | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: compiler warning cleanup | ||||
|  | ||||
| commit 71aad16256604e0e9e146221957a9b00cfe67b99 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc-run: clean up a compiler warning | ||||
|  | ||||
| commit e275da84de1589253da5ff6a7c272cf1c82f8567 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: remove references to PATH_MAX | ||||
|  | ||||
| commit a6cc7f06cf3807a0e0590697e1f14e6ab9055271 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc.c: remove PATH_MAX references | ||||
|  | ||||
| commit c1178c8eebb92c9f3702e981cd4af9ef41f51884 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-selinux.c: remove references to path_max | ||||
|  | ||||
| commit 3c031ca9780c555817fe9ccb8b23ceb231129724 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-plubin.c: remove references to PATH_MAX | ||||
|  | ||||
| commit 8e02406d8fbf92167c30431987d5de8de72cd7df | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-misc.c: remove references to PATH_MAX | ||||
|  | ||||
| commit 8dbdabcc5e0df8ac36722a4ba7bfe30664cc9919 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: clean up string handling | ||||
|  | ||||
| commit 488d8989c518d9256f183899aac02024c679b93e | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc-run: clean up string handling | ||||
|      | ||||
|     - remove references to PATH_MAX | ||||
|     - use xasprintf to create strings | ||||
|  | ||||
| commit 9e14b35da8942bd8fa552363617c3415887f485f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-update: remove reference to PATH_MAX | ||||
|  | ||||
| commit 7b4879cb72e907414b70553663bd9b6fda8d4408 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     mountinfo: create strings with xasprintf | ||||
|  | ||||
| commit 74cfb455c59298f86849541e724ae346ff205c3d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     kill_all: create strings with xasprintf | ||||
|  | ||||
| commit 0110487722646ebf9bc2c4e12b4b4a3c358cb10d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     helpers.h: silence compiler warnings about xasprintf | ||||
|  | ||||
| commit 68b9b0bc2a11d144870d14fcb8ac24e6c9c63354 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     xasprintf: exit if return value of vsnprintf is invalid | ||||
|  | ||||
| commit 4616f8f809ee8566904ca37f2b8bf0409a487475 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     helpers.h: add xasprintf function | ||||
|      | ||||
|     This is our own version of asprintf(). This original code was written by | ||||
|     Mike Frysinger, and I was able to modify it to use our memory helper | ||||
|     functions. | ||||
|      | ||||
|     We need a version of this code because it is not available on glibc at | ||||
|     least without defining _GNU_SOURCE, and I would rather not do that. | ||||
|      | ||||
|     This is the first step in improving string handling in OpenRC for #207. | ||||
|  | ||||
| commit 287d71bd2591ddec73efe356db081020e65cd922 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     helpers.h: style fix | ||||
|  | ||||
| commit c1ffe4d9f2e10b6853464cc298d1922c81ae92f4 | ||||
| Author: Michael Orlitzky <michael@orlitzky.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc-run.8: fix mountinfo args. | ||||
|      | ||||
|     The "Ar" tag for the mountinfo command contained a typo (leading | ||||
|     space) that resulted in the tag being output verbatim; that is, | ||||
|      | ||||
|       mountinfo ... .Ar mount1 mount2 | ||||
|      | ||||
|     rather than e.g. | ||||
|      | ||||
|       mountinfo ... <mount1> <mount2> | ||||
|      | ||||
|     This commit deletes the leading space to fix the output. | ||||
|      | ||||
|     This fixes #204. | ||||
|  | ||||
| commit 4c517bdb2b69eac36f004ae41bb9cbb212fe0a51 | ||||
| Author: Michael Orlitzky <michael@orlitzky.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc-run.8: add missing "Xo" tags for fstabinfo and mountinfo. | ||||
|      | ||||
|     The BUILTINS are all surrounded by Xo...Xc tags, but the opening "Xo" | ||||
|     was missing from the two commands fstabinfo and mountinfo. This commit | ||||
|     adds them, and thereby fixes the spacing when viewed by man. | ||||
|      | ||||
|     This is for #204. | ||||
|  | ||||
| commit 110582491ff02db061b567636a237460afbc489c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     service-script-guide.md cleanups | ||||
|      | ||||
|     Refer to /var/run in the documentation instead of /run, and make it | ||||
|     clear at the top of the pidfile section that we use /run under Linux. | ||||
|      | ||||
|     This is for #202. | ||||
|  | ||||
| commit 5dd1d39d20c118064d31ed65dc7ae2de75dd7908 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     typo fix | ||||
|  | ||||
| commit 1771bc2a83fe65bfe6ec3e93ea7632609e697a38 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     checkpath: use fchown and fchmod to handle ownership and mode changes | ||||
|      | ||||
|     This is related to #195. | ||||
|      | ||||
|     This is an attempt to shorten the window for the first two issues | ||||
|     discussed by using a file descriptor which does not follow symbolic | ||||
|     links and using the fchmod and fchown calls instead of chown and chmod. | ||||
|     with. | ||||
|  | ||||
| commit 87c98ebb01873120eecc1757e615b3a4c14a2f1f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     checkpath: fix lchown error message | ||||
|      | ||||
|     X-Gentoo-Bug: 643084 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084 | ||||
|  | ||||
| commit 4af5a80b0c516773286cc30e743dc90a2d19df23 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     _rc_deptree_load - return NULL if the stat() call is not successful | ||||
|      | ||||
|     X-Gentoo-Bug: 643084 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=643084 | ||||
|  | ||||
| commit fee2ffe559bc39beec16585daf557b902a53137b | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Reformat and fix titles in documentation | ||||
|  | ||||
| commit 8878f8916b7682a333d1e40af991cd7354192be1 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Rename guide.md to user-guide.md to better describe its purpose | ||||
|  | ||||
| commit 14e3359a9e4174da3e422957d9de56907f025875 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     move developer documentation from guide.md to service-script-guide.md | ||||
|  | ||||
| commit 918d955fd2de1f594b83508f5ddd5271534e3591 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     checkpath: use lchown instead of chown | ||||
|      | ||||
|     Checkpath should never follow symbolic links when changing ownership of a file. | ||||
|      | ||||
|     This is for https://github.com/openrc/openrc/issues/195. | ||||
|  | ||||
| commit 92cfa0e543d380ab290d06e98e2fef1b283349fe | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     service-script-guide.md: formatting changes | ||||
|      | ||||
|     Add a title, adjust the headings and update the example that referred to | ||||
|     "net.lo" to refer to "loopback". | ||||
|  | ||||
| commit c2bd33e4838eb56bebe2707f6ca6bd05e9df5b24 | ||||
| Author: Michael Orlitzky <michael@orlitzky.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     service-script-guide.md: new guide for service script authors. | ||||
|      | ||||
|     This fixes #162. | ||||
|  | ||||
| commit f42ec82f21f3760b829507344ad0ae761e1d59aa | ||||
| Author: 3PO <r2d2@freakmail.de> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     net-online: only process symbolic links in /sys/class/net | ||||
|      | ||||
|     The /sys/class/net directory contains files which are not symlinks if | ||||
|     the system has bonded devices [1].  We should ignore these files. | ||||
|      | ||||
|     This fixes #196. | ||||
|      | ||||
|     [1] https://elkano.org/blog/manage-interface-bondings-sysfs-interface/ | ||||
|  | ||||
| commit 7affff568a0aa83d732757c4699d4b94b7e3a9aa | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d.examples: pid files always go in /var | ||||
|      | ||||
|     This removes the @VARBASE@ substitution since it is always translated to | ||||
|     /var. | ||||
|  | ||||
| commit 4f750933fd8ef944be58bfeef071a8e35fc0c606 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     procfs: remove the @sysconfdir@ reference | ||||
|  | ||||
| commit 50b69d564a8f89b8137bb6d9d53aac1e44f6c23c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     hostname: replace @SYSCONFDIR@ references with /etc | ||||
|      | ||||
|     I do not know of any situation where /etc/hostname is at any other | ||||
|     location. Also, this does not run on prefix. | ||||
|  | ||||
| commit eb18f4f3483b99705f944c7274b4a6b451716df7 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     hwclock: use shell variables for configuration file path | ||||
|      | ||||
|     This removes a reference to @SYSCONFDIR@. | ||||
|  | ||||
| commit d5f3fe52c87928095bd2659823b985d231f0718c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     sysctl: hard code paths for sysctl files on *bsd | ||||
|      | ||||
|     For *BSD,the sysctl*.conf files are always in /etc. | ||||
|  | ||||
| commit bb1bc6eeb73b3483a1ebdfc142a11240b58588cf | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     local: misc cleanups | ||||
|      | ||||
|     Remove references to @SYSCONFDIR@ since these can be calculated at | ||||
|     runtime. | ||||
|     Also style fixes. | ||||
|  | ||||
| commit 53844fd0dcd9741b5f19dee7c00787be7e904c3c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     devfs: cleanup | ||||
|      | ||||
|     clean up local definitions. Also remove @SYSCONFDIR@ substitutions since | ||||
|     they can be calculated at runtime. | ||||
|  | ||||
| commit 14938c29cefe869872b987f8e606da72024fa8bb | ||||
| Author: bell07 <web.alexander@web.de> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     net-online: wait for ping_test_host | ||||
|      | ||||
|     The script should wait till the ping host is available or timeout reached | ||||
|     Closes : #179 | ||||
|     Closes : #191 | ||||
|  | ||||
| commit 8bf501aaf2cb60b8ddf1b2fa2d1ba0ef970fb790 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     network: use 'command -v ip' to test for the ip executable | ||||
|      | ||||
|     This is an improved test because it doesn't require the ip executable to be | ||||
|     in a specific path. | ||||
|  | ||||
| commit 9d05f68b51d7b31634cde30a482ec0e3da3b1c21 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Do not use file tests in net-online | ||||
|      | ||||
|     https://unix.stackexchange.com/questions/252002/help-testing-special-file-in-sys-class-net | ||||
|      | ||||
|     This is for #189 | ||||
|  | ||||
| commit ee2524cd1d0305e207f7dfac52742a1d5e77ea4a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     net-online: clean up quoting and test for existence | ||||
|      | ||||
|     This is for #178. | ||||
|  | ||||
| commit 5c81661d4758dea039860ae2481476a70e78ac47 | ||||
| Author: Marcel Greter <marcel.greter@ocbnet.ch> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Gracefully handle unreadable /sys/class/net/dev/ nodes | ||||
|      | ||||
|     Fixes https://bugs.gentoo.org/629228 | ||||
|     Fixes #189 | ||||
|     Fixes #185 | ||||
|     Fixes #178 | ||||
|  | ||||
| commit fb96c9c127dcfa932460b0e8a977ba5f7d26a418 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Make bash-completion and zsh-completion optional | ||||
|  | ||||
| commit 6c456f9383ab0000527b4363bc82fc17850aba18 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Add zsh-completion support | ||||
|  | ||||
| commit d220fc272337b216bff6ac781a7b6be4e6f3caee | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add bash completion support | ||||
|      | ||||
|     This fixes #188. | ||||
|   | ||||
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							| @@ -33,8 +33,9 @@ ifeq (${MKZSHCOMP},yes) | ||||
| SUBDIR+=	zsh-completion | ||||
| endif | ||||
|  | ||||
| # We need to ensure that runlevels is done last | ||||
| # We need to ensure that runlevels is done last other than test | ||||
| SUBDIR+=	runlevels | ||||
| SUBDIR+=	test | ||||
|  | ||||
| INSTALLAFTER=	_installafter | ||||
|  | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| NAME=		openrc | ||||
| VERSION=	0.40.1 | ||||
| VERSION=	0.41.1 | ||||
| PKG=		${NAME}-${VERSION} | ||||
|   | ||||
							
								
								
									
										12
									
								
								NEWS.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								NEWS.md
									
									
									
									
									
								
							| @@ -4,6 +4,18 @@ OpenRC NEWS | ||||
| This file will contain a list of notable changes for each release. Note | ||||
| the information in this file is in reverse order. | ||||
|  | ||||
| ## OpenRC 0.41. | ||||
|  | ||||
| This version adds the ability to format the output of rc-status when | ||||
| showing the status of services in a runlevel so that it may be parsed. | ||||
| Currently, the -f switch only accepts ini as an argument which | ||||
| causes the output to be in the .ini format. | ||||
|  | ||||
| This version adds an experimental build time switch to allow setting the | ||||
| default shell to use for service scripts. | ||||
| By default, this is set to /bin/sh if it is changed, the new shell must | ||||
| be able to understand posix-compatible syntax. | ||||
|  | ||||
| ## OpenRC 0.40 | ||||
|  | ||||
| In this version, the keymaps and termencoding services on Linux needed | ||||
|   | ||||
| @@ -38,6 +38,7 @@ PKG_PREFIX=/usr/pkg | ||||
| LOCAL_PREFIX=/usr/local | ||||
| PREFIX=/usr/local | ||||
| BRANDING=\"Gentoo/$(uname -s)\" | ||||
| SH=/bin/sh | ||||
| ``` | ||||
|  | ||||
| ## Notes | ||||
|   | ||||
| @@ -91,11 +91,14 @@ _rc_service() | ||||
| 			done)) | ||||
| 			return 0 | ||||
| 		elif [[ ${COMP_CWORD} -eq 2 ]] && [[ ${prev} != -* ]]; then # if second word typed and we didn't type in a function | ||||
| 			filename=$(rc-service --resolve ${prev}) | ||||
| 			opts=$(cat ${filename} | grep "^\w*()" | sed "s/().*$//")	# Greps the functions included in the init script | ||||
| 			if [[ "x${opts}" == "x" ]] ; then			   # if no options found loosen the grep algorhythm | ||||
| 				opts=$(cat ${filename} | grep "\w*()" | sed "s/().*$//") | ||||
| 			rc-service --exists "$prev" || return | ||||
| 			shopt -s extglob | ||||
| 			while read -r _ line; do | ||||
| 				if [[ $line == +([[:alnum:]_]):* ]]; then | ||||
| 					opts+="${line%%:*} " | ||||
| 				fi | ||||
| 			done < <(rc-service "$prev" describe 2>&1) | ||||
| 			shopt -u extglob | ||||
| 			COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | ||||
| 			return 0 | ||||
| 		fi | ||||
|   | ||||
							
								
								
									
										21
									
								
								ci/cirrus.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										21
									
								
								ci/cirrus.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| #!/bin/bash | ||||
| # Copyright (c) 2007-2018 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
| # | ||||
| # This file is part of OpenRC. It is subject to the license terms in | ||||
| # the LICENSE file found in the top-level directory of this | ||||
| # distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE | ||||
| # This file may not be copied, modified, propagated, or distributed | ||||
| # except according to the terms contained in the LICENSE file. | ||||
|  | ||||
| set -e | ||||
| set -u | ||||
| set -x | ||||
|  | ||||
| # These are steps to run on Cirrus CI under a jailed FreeBSD system. | ||||
| # See $TOP/.cirrus.yml for more info about the Cirrus CI setup. | ||||
|  | ||||
| cpus=$(getconf NPROCESSORS_CONF || echo 1) | ||||
| gmake -j"${cpus}" -O | ||||
| gmake test | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -12,6 +12,7 @@ | ||||
| description="start agetty on a terminal line" | ||||
| supervisor=supervise-daemon | ||||
| port="${RC_SVCNAME#*.}" | ||||
| respawn_period="${respawn_period:-60}" | ||||
| term_type="${term_type:-linux}" | ||||
| command=/sbin/agetty | ||||
| command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}" | ||||
|   | ||||
| @@ -17,15 +17,35 @@ | ||||
| .Sh SYNOPSIS | ||||
| .Nm | ||||
| .Op Fl c , -cancel | ||||
| .Nm | ||||
| .Op Fl R , -reexec | ||||
| .Nm | ||||
| .Op Fl w , -write-only | ||||
| .Nm | ||||
| .Op Fl d , -no-write | ||||
| .Op Fl D , -dry-run | ||||
| .Op Fl H , -halt | ||||
| time | ||||
| .Nm | ||||
| .Op Fl d , -no-write | ||||
| .Op Fl D , -dry-run | ||||
| .Op Fl k , -kexec | ||||
| time | ||||
| .Nm | ||||
| .Op Fl d , -no-write | ||||
| .Op Fl D , -dry-run | ||||
| .Op Fl p , -poweroff | ||||
| .Op Fl R , -reexec | ||||
| time | ||||
| .Nm | ||||
| .Op Fl d , -no-write | ||||
| .Op Fl D , -dry-run | ||||
| .Op Fl r , -reboot | ||||
| time | ||||
| .Nm | ||||
| .Op Fl d , -no-write | ||||
| .Op Fl D , -dry-run | ||||
| .Op Fl s , -single | ||||
| .Op Fl w , -write-only | ||||
| time | ||||
| .Sh DESCRIPTION | ||||
| .Nm | ||||
| is the utility that communicates with | ||||
| @@ -56,7 +76,7 @@ Stop all services, kill all processes and reboot the system. | ||||
| .It Fl s , -single | ||||
| Stop all services, kill all processes and move to single user mode. | ||||
| .It Fl w , -write-only | ||||
| Stop all services, kill all processes and move to single user mode. | ||||
| Wrrite a wtmp shutdown record and do nothing else. | ||||
| .El | ||||
| .Sh SEE ALSO | ||||
| .Xr openrc-init 8 , | ||||
|   | ||||
| @@ -66,6 +66,7 @@ and | ||||
| .Xr shutdown 8 | ||||
| and let them call these special runlevels. | ||||
| .Sh SEE ALSO | ||||
| .Xr openrc-run 8 , | ||||
| .Xr rc-status 8 , | ||||
| .Xr rc-update 8 , | ||||
| .Xr init 8 , | ||||
|   | ||||
| @@ -17,6 +17,7 @@ | ||||
| .Sh SYNOPSIS | ||||
| .Nm | ||||
| .Op Fl aclsuC | ||||
| .Op Fl f Ar ini | ||||
| .Op Ar runlevel | ||||
| .Sh DESCRIPTION | ||||
| .Nm | ||||
| @@ -37,6 +38,9 @@ The options are as follows: | ||||
| Show all runlevels and their services. | ||||
| .It Fl c , -crashed | ||||
| List all services that have crashed. | ||||
| .It Fl f , -format | ||||
| Select a format for the output. Currently, the only one that can be | ||||
| specified is ini, which outputs in *.ini format. | ||||
| .It Fl l , -list | ||||
| List all defined runlevels. | ||||
| .It Fl m , -manual | ||||
|   | ||||
| @@ -9,7 +9,7 @@ | ||||
| .\"    except according to the terms contained in the LICENSE file. | ||||
| .\" | ||||
| .Dd April 27, 2016 | ||||
| .Dt supervise-DAEMON 8 SMM | ||||
| .Dt SUPERVISE-DAEMON 8 SMM | ||||
| .Os OpenRC | ||||
| .Sh NAME | ||||
| .Nm supervise-daemon | ||||
| @@ -88,16 +88,17 @@ owned by the user. You can optionally append a | ||||
| name here also. | ||||
| .It Fl v , -verbose | ||||
| Print the action(s) that are taken just before doing them. | ||||
| .El | ||||
| .Pp | ||||
| The options are as follows: | ||||
| .Bl -tag -width indent | ||||
| .Fl a , -healthcheck-timer Ar seconds | ||||
| .It Fl a , -healthcheck-timer Ar seconds | ||||
| Run the healthcheck() command, possibly followed by the unhealthy() | ||||
| command every time this number of seconds passes. | ||||
| .Fl A , -healthcheck-delay Ar seconds | ||||
| .It Fl A , -healthcheck-delay Ar seconds | ||||
| Wait this long before the first health check. | ||||
| .It Fl D , -respawn-delay Ar seconds | ||||
| wait this number of seconds before restarting a daemon after it crashes. | ||||
| Wait this number of seconds before restarting a daemon after it crashes. | ||||
| The default is 0. | ||||
| .It Fl d , -chdir Ar path | ||||
| chdir to this directory before starting the daemon. | ||||
|   | ||||
| @@ -11,7 +11,7 @@ | ||||
| SFX=		.Linux.in | ||||
| PKG_PREFIX?=	/usr | ||||
|  | ||||
| CPPFLAGS+=	-D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L | ||||
| CPPFLAGS+=	-D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE -D_XOPEN_SOURCE | ||||
| LIBDL=		-Wl,-Bdynamic -ldl | ||||
|  | ||||
| ifeq (${MKSELINUX},yes) | ||||
|   | ||||
| @@ -19,7 +19,7 @@ _PKG_SED:=		$(shell ${_PKG_SED_SH}) | ||||
| _LCL_SED_SH=		if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi | ||||
| _LCL_SED:=		$(shell ${_LCL_SED_SH}) | ||||
|  | ||||
| SED_REPLACE=		-e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED} | ||||
| SED_REPLACE=		-e 's:@SHELL@:${SH}:' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED} | ||||
|  | ||||
| # Tweak our shell scripts | ||||
| %.sh: %.sh.in | ||||
| @@ -53,7 +53,6 @@ realinstall: ${BIN} ${CONF} ${INC} | ||||
| install: all realinstall ${INSTALLAFTER} | ||||
|  | ||||
| check test:: | ||||
| 	@if test -e runtests.sh ; then ./runtests.sh || exit $$? ; fi | ||||
|  | ||||
| # A lot of scripts don't have anything to clean | ||||
| # Also, some rm implentation require a file argument regardless of error | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
|  | ||||
| option_arg= | ||||
| poweroff_arg= | ||||
| @@ -21,4 +21,9 @@ if [ -z "${poweroff_arg}" ]; then | ||||
| 	poweroff_arg=--poweroff | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@" | ||||
| script_args="$@" | ||||
| if [ -z "${script_args}" ]; then | ||||
| 	script_args=now | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}" | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
|  | ||||
| option_arg= | ||||
| poweroff_arg= | ||||
| @@ -20,4 +20,9 @@ if [ -z "${poweroff_arg}" ]; then | ||||
| 	poweroff_arg=--poweroff | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@" | ||||
| script_args="$@" | ||||
| if [ -z "${script_args}" ]; then | ||||
| 	script_args=now | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}" | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
|  | ||||
| option_arg= | ||||
| poweroff_arg= | ||||
| @@ -22,4 +22,9 @@ if [ -z "${poweroff_arg}" ]; then | ||||
| 	poweroff_arg=--reboot | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "$@" | ||||
| script_args="$@" | ||||
| if [ -z "${script_args}" ]; then | ||||
| 	script_args=now | ||||
| fi | ||||
|  | ||||
| exec @SBINDIR@/openrc-shutdown ${option_arg} ${poweroff_arg} "${script_args}" | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
|  | ||||
| shutdown_arg= | ||||
| while getopts :akrhPHfFnct: opt; do | ||||
|   | ||||
							
								
								
									
										2
									
								
								sh/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								sh/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -4,6 +4,4 @@ openrc-run.sh | ||||
| cgroup-release-agent.sh | ||||
| init.sh | ||||
| init-early.sh | ||||
| rc-cgroup.sh | ||||
| migrate-to-run.sh | ||||
| binfmt.sh | ||||
|   | ||||
							
								
								
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ DIR=	${LIBEXECDIR}/sh | ||||
| SRCS=	init.sh.in functions.sh.in gendepends.sh.in \ | ||||
| 	openrc-run.sh.in ${SRCS-${OS}} | ||||
| INC=	rc-mount.sh functions.sh rc-functions.sh runit.sh s6.sh \ | ||||
| 		start-stop-daemon.sh supervise-daemon.sh | ||||
| 		start-stop-daemon.sh supervise-daemon.sh ${INC-${OS}} | ||||
| BIN=	gendepends.sh init.sh openrc-run.sh ${BIN-${OS}} | ||||
|  | ||||
| INSTALLAFTER=	_installafter | ||||
| @@ -13,10 +13,9 @@ include ${MK}/os.mk | ||||
| SRCS-FreeBSD= | ||||
| BIN-FreeBSD= | ||||
|  | ||||
| SRCS-Linux=	binfmt.sh.in cgroup-release-agent.sh.in init-early.sh.in \ | ||||
| 	migrate-to-run.sh.in rc-cgroup.sh.in | ||||
| BIN-Linux=	binfmt.sh cgroup-release-agent.sh init-early.sh migrate-to-run.sh \ | ||||
| 	rc-cgroup.sh | ||||
| SRCS-Linux=	binfmt.sh.in cgroup-release-agent.sh.in init-early.sh.in | ||||
| BIN-Linux=	binfmt.sh cgroup-release-agent.sh init-early.sh | ||||
| INC-Linux= rc-cgroup.sh | ||||
|  | ||||
| SRCS-NetBSD= | ||||
| BIN-NetBSD= | ||||
| @@ -32,4 +31,3 @@ _installafter: | ||||
| 	ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$? | ||||
|  | ||||
| check test:: | ||||
| 	./runtests.sh | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # This is a reimplementation of the systemd binfmt.d code to register | ||||
| # misc binary formats with the kernel. | ||||
| # | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # This is run by the kernel after the last task is removed from a | ||||
| # control group in the openrc hierarchy. | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 2007-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| #!@SHELL@ | ||||
| #!/bin/sh | ||||
| # Copyright (c) 1999-2007 Gentoo Foundation | ||||
| # Copyright (c) 2007-2009 Roy Marples <roy@marples.name> | ||||
| # Released under the 2-clause BSD license. | ||||
|   | ||||
| @@ -1,36 +0,0 @@ | ||||
| #!@SHELL@ | ||||
| # Copyright (c) 2012-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
| # | ||||
| # This file is part of OpenRC. It is subject to the license terms in | ||||
| # the LICENSE file found in the top-level directory of this | ||||
| # distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE | ||||
| # This file may not be copied, modified, propagated, or distributed | ||||
| #    except according to the terms contained in the LICENSE file. | ||||
|  | ||||
| . "@LIBEXECDIR@/sh/functions.sh" | ||||
|  | ||||
| if [ -e /run/openrc/softlevel ]; then | ||||
| 	einfo "The OpenRC dependency data has already been migrated." | ||||
| 	exit 0 | ||||
| fi | ||||
|  | ||||
| if [ ! -d /run ]; then | ||||
| 	eerror "/run is not a directory." | ||||
| 	eerror "moving /run to /run.pre-openrc" | ||||
| 	mv /run /run.pre-openrc | ||||
| 	mkdir /run | ||||
| fi | ||||
|  | ||||
| rm -rf /run/openrc | ||||
|  | ||||
| if ! mountinfo -q -f tmpfs /run; then | ||||
| 	ln -s "@LIBEXECDIR@"/init.d /run/openrc | ||||
| else | ||||
| 	cp -a "@LIBEXECDIR@/init.d" /run/openrc | ||||
| 	rc-update -u | ||||
| fi | ||||
|  | ||||
| einfo "The OpenRC dependency data was migrated successfully." | ||||
| exit 0 | ||||
| @@ -1,4 +1,3 @@ | ||||
| #!@SHELL@ | ||||
| # Copyright (c) 2012-2015 The OpenRC Authors. | ||||
| # See the Authors file at the top-level directory of this distribution and | ||||
| # https://github.com/OpenRC/openrc/blob/master/AUTHORS | ||||
| @@ -1,7 +1,7 @@ | ||||
| # Copyright (c) 2007-2008 Roy Marples <roy@marples.name> | ||||
| # Released under the 2-clause BSD license. | ||||
|  | ||||
| SUBDIR=		test libeinfo librc rc | ||||
| SUBDIR=		libeinfo librc rc | ||||
|  | ||||
| MK=		../mk | ||||
| include		${MK}/subdir.mk | ||||
|   | ||||
| @@ -59,7 +59,7 @@ pid_is_argv(pid_t pid, const char *const *argv) | ||||
| 		free(cmdline); | ||||
| 		return false; | ||||
| 	} | ||||
| 	bytes = read(fd, buffer, sizeof(buffer)); | ||||
| 	bytes = read(fd, buffer, sizeof(buffer) - 1); | ||||
| 	close(fd); | ||||
| 	free(cmdline); | ||||
| 	if (bytes == -1) | ||||
| @@ -141,7 +141,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) | ||||
| 	memset(my_ns, 0, sizeof(my_ns)); | ||||
| 	memset(proc_ns, 0, sizeof(proc_ns)); | ||||
| 	if (exists("/proc/self/ns/pid")) { | ||||
| 		rc = readlink("/proc/self/ns/pid", my_ns, sizeof(my_ns)); | ||||
| 		rc = readlink("/proc/self/ns/pid", my_ns, sizeof(my_ns)-1); | ||||
| 		if (rc <= 0) | ||||
| 			my_ns[0] = '\0'; | ||||
| 	} | ||||
| @@ -155,7 +155,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) | ||||
| 			continue; | ||||
| 		xasprintf(&buffer, "/proc/%d/ns/pid", p); | ||||
| 		if (exists(buffer)) { | ||||
| 			rc = readlink(buffer, proc_ns, sizeof(proc_ns)); | ||||
| 			rc = readlink(buffer, proc_ns, sizeof(proc_ns)-1); | ||||
| 			if (rc <= 0) | ||||
| 				proc_ns[0] = '\0'; | ||||
| 		} | ||||
|   | ||||
| @@ -84,10 +84,11 @@ static RC_DEPINFO * | ||||
| get_depinfo(const RC_DEPTREE *deptree, const char *service) | ||||
| { | ||||
| 	RC_DEPINFO *di; | ||||
|  | ||||
| 	if (deptree) { | ||||
| 		TAILQ_FOREACH(di, deptree, entries) | ||||
| 			if (strcmp(di->service, service) == 0) | ||||
| 				return di; | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| @@ -96,9 +97,11 @@ get_deptype(const RC_DEPINFO *depinfo, const char *type) | ||||
| { | ||||
| 	RC_DEPTYPE *dt; | ||||
|  | ||||
| 	if (depinfo) { | ||||
| 		TAILQ_FOREACH(dt, &depinfo->depends, entries) | ||||
| 			if (strcmp(dt->type, type) == 0) | ||||
| 				return dt; | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -277,7 +277,6 @@ static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config) | ||||
| 	char *tmp = NULL; | ||||
| 	char *value = NULL; | ||||
| 	size_t varlen = 0; | ||||
| 	size_t len = 0; | ||||
|  | ||||
| 	overrides = rc_stringlist_new(); | ||||
|  | ||||
| @@ -295,7 +294,6 @@ static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config) | ||||
| 		} | ||||
|  | ||||
| 		if (value != NULL) { | ||||
| 			len = varlen + strlen(value) + 2; | ||||
| 			xasprintf(&tmp, "%s=%s", override->value, value); | ||||
| 		} | ||||
|  | ||||
|   | ||||
| @@ -558,7 +558,7 @@ rc_service_resolve(const char *service) | ||||
|  | ||||
| 	if (*file) { | ||||
| 		memset(buffer, 0, sizeof(buffer)); | ||||
| 		r = readlink(file, buffer, sizeof(buffer)); | ||||
| 		r = readlink(file, buffer, sizeof(buffer)-1); | ||||
| 		if (r > 0) | ||||
| 			return xstrdup(buffer); | ||||
| 	} | ||||
| @@ -1047,7 +1047,6 @@ rc_service_add(const char *runlevel, const char *service) | ||||
| 	char *init; | ||||
| 	char file[PATH_MAX]; | ||||
| 	char path[MAXPATHLEN] = { '\0' }; | ||||
| 	char *p = NULL; | ||||
| 	char binit[PATH_MAX]; | ||||
| 	char *i; | ||||
|  | ||||
| @@ -1068,8 +1067,7 @@ rc_service_add(const char *runlevel, const char *service) | ||||
| 	/* We need to ensure that only things in /etc/init.d are added | ||||
| 	 * to the boot runlevel */ | ||||
| 	if (strcmp(runlevel, RC_LEVEL_BOOT) == 0) { | ||||
| 		p = realpath(dirname(init), path); | ||||
| 		if (!*p) { | ||||
| 		if (realpath(dirname(init), path) == NULL) { | ||||
| 			free(init); | ||||
| 			return false; | ||||
| 		} | ||||
|   | ||||
| @@ -37,10 +37,6 @@ | ||||
| # define _PATH_DEV	"/dev/" | ||||
| #endif | ||||
|  | ||||
| #ifndef UT_LINESIZE | ||||
| #define UT_LINESIZE __UT_LINESIZE | ||||
| #endif | ||||
|  | ||||
| static sigjmp_buf jbuf; | ||||
|  | ||||
| /* | ||||
| @@ -62,7 +58,7 @@ static void getuidtty(char **userp, char **ttyp) | ||||
| 	uid_t			uid; | ||||
| 	char			*tty; | ||||
| 	static char		uidbuf[32]; | ||||
| 	static char		ttynm[UT_LINESIZE + 4]; | ||||
| 	char		*ttynm = NULL; | ||||
|  | ||||
| 	uid = getuid(); | ||||
| 	if ((pwd = getpwuid(uid)) != NULL) { | ||||
| @@ -82,10 +78,8 @@ static void getuidtty(char **userp, char **ttyp) | ||||
| 			if (tty[0] == '/') | ||||
| 				tty++; | ||||
| 		} | ||||
| 		snprintf(ttynm, sizeof(ttynm), "(%.*s) ", | ||||
| 				 UT_LINESIZE, tty); | ||||
| 	} else | ||||
| 		ttynm[0] = 0; | ||||
| 		xasprintf(&ttynm, "(%s) ", tty); | ||||
| 	} | ||||
|  | ||||
| 	*userp = uidbuf; | ||||
| 	*ttyp  = ttynm; | ||||
| @@ -133,7 +127,7 @@ void broadcast(char *text) | ||||
| 	char *p; | ||||
| 	char *line = NULL; | ||||
| 	struct sigaction sa; | ||||
| 	int fd; | ||||
| 	volatile int fd; | ||||
| 	FILE *tp; | ||||
| 	int	flags; | ||||
| 	char *term = NULL; | ||||
| @@ -156,6 +150,7 @@ void broadcast(char *text) | ||||
|  | ||||
| 	xasprintf(&line, "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", | ||||
| 			user, name.nodename, tty, date); | ||||
| 	free(tty); | ||||
|  | ||||
| 	/* | ||||
| 	 *	Fork to avoid hanging in a write() | ||||
|   | ||||
| @@ -1152,7 +1152,7 @@ int main(int argc, char **argv) | ||||
| 	} | ||||
| 	lnk = xmalloc(4096); | ||||
| 	memset(lnk, 0, 4096); | ||||
| 	if (readlink(argv[1], lnk, 4096)) { | ||||
| 	if (readlink(argv[1], lnk, 4096-1)) { | ||||
| 		dir = dirname(path); | ||||
| 		if (strchr(lnk, '/')) { | ||||
| 			save = xstrdup(dir); | ||||
| @@ -1223,7 +1223,6 @@ int main(int argc, char **argv) | ||||
|  | ||||
| 		/* Make our prefix string */ | ||||
| 		prefix = xmalloc(sizeof(char) * l + 1); | ||||
| 		ll = strlen(applet); | ||||
| 		memcpy(prefix, applet, ll); | ||||
| 		memset(prefix + ll, ' ', l - ll); | ||||
| 		memset(prefix + l, 0, 1); | ||||
|   | ||||
| @@ -67,7 +67,15 @@ const char * const longopts_help[] = { | ||||
| 	"write wtmp boot record and exit", | ||||
| 	longopts_help_COMMON | ||||
| }; | ||||
| const char *usagestring = NULL; | ||||
| const char *usagestring = "" \ | ||||
| 						   "Usage: openrc-shutdown -c | --cancel\n" \ | ||||
| 						   "   or: openrc-shutdown -R | --reexec\n" \ | ||||
| 						   "   or: openrc-shutdown -w | --write-only\n" \ | ||||
| 						   "   or: openmrc-shutdown -H | --halt time\n" \ | ||||
| 						   "   or: openrc-shutdown -K | --kexec time\n" \ | ||||
| 						   "   or: openrc-shutdown -p | --poweroff time\n" \ | ||||
| 						   "   or: openrc-shutdown -r | --reboot time\n" \ | ||||
| 						   "   or: openrc-shutdown -s | --single time"; | ||||
| const char *exclusive = "Select one of " | ||||
| 	"--cancel, --halt, --kexec, --poweroff, --reexec, --reboot, --single or \n" | ||||
| 	"--write-only"; | ||||
| @@ -160,9 +168,7 @@ static void sleep_no_interrupt(int seconds) | ||||
|  | ||||
| static void stop_shutdown(int sig) | ||||
| { | ||||
| 	/* use the sig parameter so the compiler will not complain */ | ||||
| 	if (sig == SIGINT) | ||||
| 		; | ||||
| 	(void) sig; | ||||
| 	unlink(nologin_file); | ||||
| 	unlink(shutdown_pid); | ||||
| einfo("Shutdown canceled"); | ||||
|   | ||||
| @@ -28,6 +28,7 @@ | ||||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <syslog.h> | ||||
| #include <time.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/stat.h> | ||||
| @@ -270,8 +271,11 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, | ||||
| 			einfo("Would send signal %d to PID %d", sig, pi->pid); | ||||
| 			nkilled++; | ||||
| 		} else { | ||||
| 			if (sig) { | ||||
| 				syslog(LOG_DEBUG, "Sending signal %d to PID %d", sig, pi->pid); | ||||
| 				if (!quiet) | ||||
| 					ebeginv("Sending signal %d to PID %d", sig, pi->pid); | ||||
| 			} | ||||
| 			errno = 0; | ||||
| 			killed = (kill(pi->pid, sig) == 0 || | ||||
| 			    errno == ESRCH ? true : false); | ||||
| @@ -279,6 +283,9 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, | ||||
| 				eendv(killed ? 0 : 1, | ||||
| 				"%s: failed to send signal %d to PID %d: %s", | ||||
| 				applet, sig, pi->pid, strerror(errno)); | ||||
| 			else if (!killed) | ||||
| 				syslog(LOG_ERR, "Failed to send signal %d to PID %d: %s", | ||||
| 						sig, pi->pid, strerror(errno)); | ||||
| 			if (!killed) { | ||||
| 				nkilled = -1; | ||||
| 			} else { | ||||
| @@ -310,12 +317,18 @@ int run_stop_schedule(const char *applet, | ||||
| 	if (!(pid > 0 || exec || uid || (argv && *argv))) | ||||
| 		return 0; | ||||
|  | ||||
| 	if (exec) | ||||
| 	if (exec) { | ||||
| 		einfov("Will stop %s", exec); | ||||
| 	if (pid > 0) | ||||
| 		syslog(LOG_DEBUG, "Will stop %s", exec); | ||||
| 	} | ||||
| 	if (pid > 0) { | ||||
| 		einfov("Will stop PID %d", pid); | ||||
| 	if (uid) | ||||
| 		syslog(LOG_DEBUG, "Will stop PID %d", pid); | ||||
| 	} | ||||
| 	if (uid) { | ||||
| 		einfov("Will stop processes owned by UID %d", uid); | ||||
| 		syslog(LOG_DEBUG, "Will stop processes owned by UID %d", uid); | ||||
| 	} | ||||
| 	if (argv && *argv) { | ||||
| 		einfovn("Will stop processes of `"); | ||||
| 		if (rc_yesno(getenv("EINFO_VERBOSE"))) { | ||||
|   | ||||
| @@ -27,12 +27,18 @@ | ||||
| #include "rc-misc.h" | ||||
| #include "_usage.h" | ||||
|  | ||||
| enum format_t { | ||||
| 	FORMAT_DEFAULT, | ||||
| 	FORMAT_INI, | ||||
| }; | ||||
|  | ||||
| const char *applet = NULL; | ||||
| const char *extraopts = NULL; | ||||
| const char *getoptstring = "aclmrsSu" getoptstring_COMMON; | ||||
| const char *getoptstring = "acf:lmrsSu" getoptstring_COMMON; | ||||
| const struct option longopts[] = { | ||||
| 	{"all",         0, NULL, 'a'}, | ||||
| 	{"crashed",     0, NULL, 'c'}, | ||||
| 	{"format",     1, NULL, 'f'}, | ||||
| 	{"list",        0, NULL, 'l'}, | ||||
| 	{"manual",        0, NULL, 'm'}, | ||||
| 	{"runlevel",    0, NULL, 'r'}, | ||||
| @@ -44,6 +50,7 @@ const struct option longopts[] = { | ||||
| const char * const longopts_help[] = { | ||||
| 	"Show services from all run levels", | ||||
| 	"Show crashed services", | ||||
| 	"format status to be parsable (currently arg must be ini)", | ||||
| 	"Show list of run levels", | ||||
| 	"Show manually started services", | ||||
| 	"Show the name of the current runlevel", | ||||
| @@ -53,7 +60,7 @@ const char * const longopts_help[] = { | ||||
| 	longopts_help_COMMON | ||||
| }; | ||||
| const char *usagestring = ""						\ | ||||
| 	"Usage: rc-status [options] <runlevel>...\n"		\ | ||||
| 	"Usage: rc-status [options] -f ini <runlevel>...\n"		\ | ||||
| 	"   or: rc-status [options] [-a | -c | -l | -m | -r | -s | -u]"; | ||||
|  | ||||
| static RC_DEPTREE *deptree; | ||||
| @@ -62,19 +69,27 @@ static RC_STRINGLIST *types; | ||||
| static RC_STRINGLIST *levels, *services, *tmp, *alist; | ||||
| static RC_STRINGLIST *sservices, *nservices, *needsme; | ||||
|  | ||||
| static void | ||||
| print_level(const char *prefix, const char *level) | ||||
| static void print_level(const char *prefix, const char *level, | ||||
| 		enum format_t format) | ||||
| { | ||||
| 	switch (format) { | ||||
| 	case FORMAT_DEFAULT: | ||||
| 		if (prefix) | ||||
| 			printf("%s ", prefix); | ||||
| 		printf ("Runlevel: "); | ||||
| 		if (isatty(fileno(stdout))) | ||||
| 			printf("%s%s%s\n", | ||||
| 		       ecolor(ECOLOR_HILITE), | ||||
| 		       level, | ||||
| 		       ecolor(ECOLOR_NORMAL)); | ||||
| 					ecolor(ECOLOR_HILITE), level, ecolor(ECOLOR_NORMAL)); | ||||
| 		else | ||||
| 			printf("%s\n", level); | ||||
| 		break; | ||||
| 	case FORMAT_INI: | ||||
| 		printf("%s", "["); | ||||
| 		if (prefix) | ||||
| 			printf("%s ", prefix); | ||||
| 		printf("%s]\n", level); | ||||
| 		break; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| static char *get_uptime(const char *service) | ||||
| @@ -125,14 +140,13 @@ static char *get_uptime(const char *service) | ||||
| 	return uptime; | ||||
| } | ||||
|  | ||||
| static void | ||||
| print_service(const char *service) | ||||
| static void print_service(const char *service, enum format_t format) | ||||
| { | ||||
| 	char *status = NULL; | ||||
| 	char *uptime = NULL; | ||||
| 	char *child_pid = NULL; | ||||
| 	char *start_time = NULL; | ||||
| 	int cols =  printf(" %s", service); | ||||
| 	int cols; | ||||
| 	const char *c = ecolor(ECOLOR_GOOD); | ||||
| 	RC_SERVICE state = rc_service_state(service); | ||||
| 	ECOLOR color = ECOLOR_BAD; | ||||
| @@ -176,14 +190,22 @@ print_service(const char *service) | ||||
| 		xasprintf(&status, " stopped "); | ||||
|  | ||||
| 	errno = 0; | ||||
| 	switch (format) { | ||||
| 	case FORMAT_DEFAULT: | ||||
| 		cols =  printf(" %s", service); | ||||
| 		if (c && *c && isatty(fileno(stdout))) | ||||
| 			printf("\n"); | ||||
| 		ebracket(cols, color, status); | ||||
| 		break; | ||||
| 	case FORMAT_INI: | ||||
| 		printf("%s = %s\n", service, status); | ||||
| 		break; | ||||
| 	} | ||||
| 	free(status); | ||||
| } | ||||
|  | ||||
| static void | ||||
| print_services(const char *runlevel, RC_STRINGLIST *svcs) | ||||
| static void print_services(const char *runlevel, RC_STRINGLIST *svcs, | ||||
| 		enum format_t format) | ||||
| { | ||||
| 	RC_STRINGLIST *l = NULL; | ||||
| 	RC_STRING *s; | ||||
| @@ -197,7 +219,7 @@ print_services(const char *runlevel, RC_STRINGLIST *svcs) | ||||
| 		TAILQ_FOREACH(s, svcs, entries) | ||||
| 			if (!runlevel || | ||||
| 			    rc_service_in_runlevel(s->value, runlevel)) | ||||
| 				print_service(s->value); | ||||
| 				print_service(s->value, format); | ||||
| 		return; | ||||
| 	} | ||||
| 	if (!types) { | ||||
| @@ -217,13 +239,12 @@ print_services(const char *runlevel, RC_STRINGLIST *svcs) | ||||
| 		if (!rc_stringlist_find(svcs, s->value)) | ||||
| 			continue; | ||||
| 		if (!runlevel || rc_service_in_runlevel(s->value, runlevel)) | ||||
| 			print_service(s->value); | ||||
| 			print_service(s->value, format); | ||||
| 	} | ||||
| 	rc_stringlist_free(l); | ||||
| } | ||||
|  | ||||
| static void | ||||
| print_stacked_services(const char *runlevel) | ||||
| static void print_stacked_services(const char *runlevel, enum format_t format) | ||||
| { | ||||
| 	RC_STRINGLIST *stackedlevels, *servicelist; | ||||
| 	RC_STRING *stackedlevel; | ||||
| @@ -232,9 +253,9 @@ print_stacked_services(const char *runlevel) | ||||
| 	TAILQ_FOREACH(stackedlevel, stackedlevels, entries) { | ||||
| 		if (rc_stringlist_find(levels, stackedlevel->value) != NULL) | ||||
| 			continue; | ||||
| 		print_level("Stacked", stackedlevel->value); | ||||
| 		print_level("Stacked", stackedlevel->value, format); | ||||
| 		servicelist = rc_services_in_runlevel(stackedlevel->value); | ||||
| 		print_services(stackedlevel->value, servicelist); | ||||
| 		print_services(stackedlevel->value, servicelist, format); | ||||
| 		rc_stringlist_free(servicelist); | ||||
| 	} | ||||
| 	rc_stringlist_free(stackedlevels); | ||||
| @@ -245,6 +266,8 @@ int main(int argc, char **argv) | ||||
| { | ||||
| 	RC_SERVICE state; | ||||
| 	RC_STRING *s, *l, *t, *level; | ||||
| 	enum format_t format = FORMAT_DEFAULT; | ||||
| 	bool levels_given = false; | ||||
| 	bool show_all = false; | ||||
| 	char *p, *runlevel = NULL; | ||||
| 	int opt, retval = 0; | ||||
| @@ -267,6 +290,12 @@ int main(int argc, char **argv) | ||||
| 				} | ||||
| 			goto exit; | ||||
| 			/* NOTREACHED */ | ||||
| 		case 'f': | ||||
| 			if (strcasecmp(optarg, "ini") == 0) | ||||
| 				format = FORMAT_INI; | ||||
| 			else | ||||
| 				eerrorx("%s: invalid argument to --format switch\n", applet); | ||||
| 			break; | ||||
| 		case 'l': | ||||
| 			levels = rc_runlevel_list(); | ||||
| 			TAILQ_FOREACH(l, levels, entries) | ||||
| @@ -291,7 +320,7 @@ int main(int argc, char **argv) | ||||
| 					free(s->value); | ||||
| 					free(s); | ||||
| 				} | ||||
| 			print_services(NULL, services); | ||||
| 			print_services(NULL, services, FORMAT_DEFAULT); | ||||
| 			goto exit; | ||||
| 		case 'r': | ||||
| 			runlevel = rc_runlevel_get(); | ||||
| @@ -303,12 +332,12 @@ int main(int argc, char **argv) | ||||
| 			TAILQ_FOREACH_SAFE(s, services, entries, t) | ||||
| 				if (!rc_service_value_get(s->value, "child_pid")) | ||||
| 					TAILQ_REMOVE(services, s, entries); | ||||
| 			print_services(NULL, services); | ||||
| 			print_services(NULL, services, FORMAT_DEFAULT); | ||||
| 			goto exit; | ||||
| 			/* NOTREACHED */ | ||||
| 		case 's': | ||||
| 			services = rc_services_in_runlevel(NULL); | ||||
| 			print_services(NULL, services); | ||||
| 			print_services(NULL, services, FORMAT_DEFAULT); | ||||
| 			goto exit; | ||||
| 			/* NOTREACHED */ | ||||
| 		case 'u': | ||||
| @@ -323,7 +352,7 @@ int main(int argc, char **argv) | ||||
| 						break; | ||||
| 					} | ||||
| 			} | ||||
| 			print_services(NULL, services); | ||||
| 			print_services(NULL, services, FORMAT_DEFAULT); | ||||
| 			goto exit; | ||||
| 			/* NOTREACHED */ | ||||
|  | ||||
| @@ -335,6 +364,7 @@ int main(int argc, char **argv) | ||||
| 	opt = (optind < argc) ? 0 : 1; | ||||
| 	while (optind < argc) { | ||||
| 		if (rc_runlevel_exists(argv[optind])) { | ||||
| 			levels_given = true; | ||||
| 			rc_stringlist_add(levels, argv[optind++]); | ||||
| 			opt++; | ||||
| 		} else | ||||
| @@ -351,21 +381,21 @@ int main(int argc, char **argv) | ||||
| 	deptree = _rc_deptree_load(0, NULL); | ||||
|  | ||||
| 	TAILQ_FOREACH(l, levels, entries) { | ||||
| 		print_level(NULL, l->value); | ||||
| 		print_level(NULL, l->value, format); | ||||
| 		services = rc_services_in_runlevel(l->value); | ||||
| 		print_services(l->value, services); | ||||
| 		print_stacked_services(l->value); | ||||
| 		print_services(l->value, services, format); | ||||
| 		print_stacked_services(l->value, format); | ||||
| 		rc_stringlist_free(nservices); | ||||
| 		nservices = NULL; | ||||
| 		rc_stringlist_free(services); | ||||
| 		services = NULL; | ||||
| 	} | ||||
|  | ||||
| 	if (show_all || argc < 2) { | ||||
| 	if (show_all || !levels_given) { | ||||
| 		/* Show hotplugged services */ | ||||
| 		print_level("Dynamic", "hotplugged"); | ||||
| 		print_level("Dynamic", "hotplugged", format); | ||||
| 		services = rc_services_in_state(RC_SERVICE_HOTPLUGGED); | ||||
| 		print_services(NULL, services); | ||||
| 		print_services(NULL, services, format); | ||||
| 		rc_stringlist_free(services); | ||||
| 		services = NULL; | ||||
|  | ||||
| @@ -422,10 +452,10 @@ int main(int argc, char **argv) | ||||
| 		 * be added to the list | ||||
| 		 */ | ||||
| 		unsetenv("RC_SVCNAME"); | ||||
| 		print_level("Dynamic", "needed/wanted"); | ||||
| 		print_services(NULL, nservices); | ||||
| 		print_level("Dynamic", "manual"); | ||||
| 		print_services(NULL, services); | ||||
| 		print_level("Dynamic", "needed/wanted", format); | ||||
| 		print_services(NULL, nservices, format); | ||||
| 		print_level("Dynamic", "manual", format); | ||||
| 		print_services(NULL, services, format); | ||||
| 	} | ||||
|  | ||||
| exit: | ||||
|   | ||||
| @@ -492,7 +492,7 @@ int main(int argc, char **argv) | ||||
| 			startas = optarg; | ||||
| 			break; | ||||
| 		case 'w': | ||||
| 			if (sscanf(optarg, "%d", &start_wait) != 1) | ||||
| 			if (sscanf(optarg, "%u", &start_wait) != 1) | ||||
| 				eerrorx("%s: `%s' not a number", | ||||
| 				    applet, optarg); | ||||
| 			break; | ||||
|   | ||||
| @@ -184,13 +184,22 @@ static void re_exec_supervisor(void) | ||||
| static void handle_signal(int sig) | ||||
| { | ||||
| 	int serrno = errno; | ||||
| 	pid_t pid; | ||||
|  | ||||
| 	switch (sig) { | ||||
| 	case SIGALRM: | ||||
| 		do_healthcheck = 1; | ||||
| 		break; | ||||
| 	case SIGCHLD: | ||||
| 		if (exiting) | ||||
| 			while (waitpid((pid_t)(-1), NULL, WNOHANG) > 0) {} | ||||
| 		else { | ||||
| 			while ((pid = waitpid((pid_t)(-1), NULL, WNOHANG|WNOWAIT)) > 0) { | ||||
| 				if (pid == child_pid) | ||||
| 					break; | ||||
| 				pid = waitpid(pid, NULL, WNOHANG); | ||||
| 			} | ||||
| 		} | ||||
| 		break; | ||||
| 	case SIGTERM: | ||||
| 		exiting = 1; | ||||
| @@ -258,6 +267,56 @@ static char *make_cmdline(char **argv) | ||||
| 	return cmdline; | ||||
| } | ||||
|  | ||||
| static pid_t exec_command(const char *cmd) | ||||
| { | ||||
| 	char *file; | ||||
| 	pid_t pid = -1; | ||||
| 	sigset_t full; | ||||
| 	sigset_t old; | ||||
| 	struct sigaction sa; | ||||
|  | ||||
| 	file = rc_service_resolve(svcname); | ||||
| 	if (!exists(file)) { | ||||
| 		free(file); | ||||
| 		return 0; | ||||
| 	} | ||||
|  | ||||
| 	/* We need to block signals until we have forked */ | ||||
| 	memset(&sa, 0, sizeof (sa)); | ||||
| 	sa.sa_handler = SIG_DFL; | ||||
| 	sigemptyset(&sa.sa_mask); | ||||
| 	sigfillset(&full); | ||||
| 	sigprocmask(SIG_SETMASK, &full, &old); | ||||
|  | ||||
| 	pid = fork(); | ||||
| 	if (pid == 0) { | ||||
| 		/* Restore default handlers */ | ||||
| 		sigaction(SIGCHLD, &sa, NULL); | ||||
| 		sigaction(SIGHUP, &sa, NULL); | ||||
| 		sigaction(SIGINT, &sa, NULL); | ||||
| 		sigaction(SIGQUIT, &sa, NULL); | ||||
| 		sigaction(SIGTERM, &sa, NULL); | ||||
| 		sigaction(SIGUSR1, &sa, NULL); | ||||
| 		sigaction(SIGWINCH, &sa, NULL); | ||||
|  | ||||
| 		/* Unmask signals */ | ||||
| 		sigprocmask(SIG_SETMASK, &old, NULL); | ||||
|  | ||||
| 		/* Safe to run now */ | ||||
| 		execl(file, file, cmd, (char *) NULL); | ||||
| 		syslog(LOG_ERR, "unable to exec `%s': %s\n", | ||||
| 		    file, strerror(errno)); | ||||
| 		_exit(EXIT_FAILURE); | ||||
| 	} | ||||
|  | ||||
| 	if (pid == -1) | ||||
| 		syslog(LOG_ERR, "fork: %s\n",strerror (errno)); | ||||
|  | ||||
| 	sigprocmask(SIG_SETMASK, &old, NULL); | ||||
| 	free(file); | ||||
| 	return pid; | ||||
| } | ||||
|  | ||||
| static void child_process(char *exec, char **argv) | ||||
| { | ||||
| 	RC_STRINGLIST *env_list; | ||||
| @@ -476,7 +535,7 @@ static void supervisor(char *exec, char **argv) | ||||
| 	sigaction(SIGTERM, &sa, NULL); | ||||
|  | ||||
| 	fp = fopen(pidfile, "w"); | ||||
| 	if (! fp) | ||||
| 	if (!fp) | ||||
| 		eerrorx("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); | ||||
| 	fprintf(fp, "%d\n", getpid()); | ||||
| 	fclose(fp); | ||||
| @@ -498,18 +557,18 @@ static void supervisor(char *exec, char **argv) | ||||
| 		alarm(healthcheckdelay); | ||||
| 	else if (healthchecktimer) | ||||
| 		alarm(healthchecktimer); | ||||
|  fifo_fd = open(fifopath, O_RDONLY |O_NONBLOCK); | ||||
| 	failing = 0; | ||||
| 	while (!exiting) { | ||||
| 		healthcheck_respawn = 0; | ||||
| 		wait_pid = waitpid(child_pid, &i, WNOHANG); | ||||
| 		fifo_fd = open(fifopath, O_RDONLY); | ||||
| 		if (fifo_fd > 0) { | ||||
| 			memset(buf, 0, sizeof(buf)); | ||||
| 		if (fifo_fd >= 0) { | ||||
| 			count = read(fifo_fd, buf, sizeof(buf) - 1); | ||||
| 			close(fifo_fd); | ||||
| 			if (count != -1) | ||||
| 				buf[count] = 0; | ||||
| 		} | ||||
| 		if (strlen(buf) > 0) { | ||||
| 			if (count == 0) | ||||
| 				continue; | ||||
| 			syslog(LOG_DEBUG, "Received %s from fifo", buf); | ||||
| 			if (strncasecmp(buf, "sig", 3) == 0) { | ||||
| 				if ((sscanf(buf, "%s %d", cmd, &sig_send) == 2) | ||||
| @@ -521,18 +580,19 @@ static void supervisor(char *exec, char **argv) | ||||
| 								sig_send, child_pid); | ||||
| 				} | ||||
| 			} | ||||
| 			continue; | ||||
| 		} | ||||
| 		if (do_healthcheck) { | ||||
| 			do_healthcheck = 0; | ||||
| 			alarm(0); | ||||
| 			syslog(LOG_DEBUG, "running health check for %s", svcname); | ||||
| 			health_pid = exec_service(svcname, "healthcheck"); | ||||
| 			health_pid = exec_command("healthcheck"); | ||||
| 			health_status = rc_waitpid(health_pid); | ||||
| 			if (WIFEXITED(health_status) && WEXITSTATUS(health_status) == 0) | ||||
| 				alarm(healthchecktimer); | ||||
| 			else { | ||||
| 				syslog(LOG_WARNING, "health check for %s failed", svcname); | ||||
| 				health_pid = exec_service(svcname, "unhealthy"); | ||||
| 				health_pid = exec_command("unhealthy"); | ||||
| 				rc_waitpid(health_pid); | ||||
| 				syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid); | ||||
| 				nkilled = run_stop_schedule(applet, NULL, NULL, child_pid, 0, | ||||
| @@ -544,7 +604,7 @@ static void supervisor(char *exec, char **argv) | ||||
| 					healthcheck_respawn = 1; | ||||
| 			} | ||||
| 		} | ||||
| 		if (exiting ) { | ||||
| 		if (exiting) { | ||||
| 			alarm(0); | ||||
| 			syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid); | ||||
| 			nkilled = run_stop_schedule(applet, NULL, NULL, child_pid, 0, | ||||
| @@ -553,6 +613,7 @@ static void supervisor(char *exec, char **argv) | ||||
| 				syslog(LOG_INFO, "killed %d processes", nkilled); | ||||
| 			continue; | ||||
| 		} | ||||
| 		wait_pid = waitpid(child_pid, &i, WNOHANG); | ||||
| 		if (wait_pid == child_pid) { | ||||
| 			if (WIFEXITED(i)) | ||||
| 				syslog(LOG_WARNING, "%s, pid %d, exited with return code %d", | ||||
| @@ -659,7 +720,7 @@ int main(int argc, char **argv) | ||||
| 		eerrorx("%s: The RC_SVCNAME environment variable is not set", applet); | ||||
| 	openlog(applet, LOG_PID, LOG_DAEMON); | ||||
|  | ||||
| 	if (argc >= 1 && svcname && strcmp(argv[1], svcname)) | ||||
| 	if (argc <= 1 || strcmp(argv[1], svcname)) | ||||
| 		eerrorx("%s: the first argument is %s and must be %s", | ||||
| 				applet, argv[1], svcname); | ||||
|  | ||||
|   | ||||
							
								
								
									
										6
									
								
								src/test/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								src/test/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +0,0 @@ | ||||
| einfo.data.out | ||||
| einfo.funcs.out | ||||
| librc.funcs.hidden.out | ||||
| librc.funcs.hidden.list | ||||
| rc.data.out | ||||
| rc.funcs.out | ||||
| @@ -1 +0,0 @@ | ||||
| EINFO_1.0 | ||||
| @@ -1,52 +0,0 @@ | ||||
| ebegin | ||||
| ebegin@@EINFO_1.0 | ||||
| ebeginv | ||||
| ebeginv@@EINFO_1.0 | ||||
| ebracket | ||||
| ebracket@@EINFO_1.0 | ||||
| ecolor | ||||
| ecolor@@EINFO_1.0 | ||||
| eend | ||||
| eend@@EINFO_1.0 | ||||
| eendv | ||||
| eendv@@EINFO_1.0 | ||||
| eerror | ||||
| eerror@@EINFO_1.0 | ||||
| eerrorn | ||||
| eerrorn@@EINFO_1.0 | ||||
| eerrorx | ||||
| eerrorx@@EINFO_1.0 | ||||
| eindent | ||||
| eindent@@EINFO_1.0 | ||||
| eindentv | ||||
| eindentv@@EINFO_1.0 | ||||
| einfo | ||||
| einfo@@EINFO_1.0 | ||||
| einfon | ||||
| einfon@@EINFO_1.0 | ||||
| einfov | ||||
| einfov@@EINFO_1.0 | ||||
| einfovn | ||||
| einfovn@@EINFO_1.0 | ||||
| elog | ||||
| elog@@EINFO_1.0 | ||||
| eoutdent | ||||
| eoutdent@@EINFO_1.0 | ||||
| eoutdentv | ||||
| eoutdentv@@EINFO_1.0 | ||||
| eprefix | ||||
| eprefix@@EINFO_1.0 | ||||
| ewarn | ||||
| ewarn@@EINFO_1.0 | ||||
| ewarnn | ||||
| ewarnn@@EINFO_1.0 | ||||
| ewarnv | ||||
| ewarnv@@EINFO_1.0 | ||||
| ewarnvn | ||||
| ewarnvn@@EINFO_1.0 | ||||
| ewarnx | ||||
| ewarnx@@EINFO_1.0 | ||||
| ewend | ||||
| ewend@@EINFO_1.0 | ||||
| ewendv | ||||
| ewendv@@EINFO_1.0 | ||||
| @@ -1,3 +0,0 @@ | ||||
| RC_1.0 | ||||
| rc_environ_fd | ||||
| rc_environ_fd@@RC_1.0 | ||||
| @@ -1,116 +0,0 @@ | ||||
| rc_conf_value | ||||
| rc_conf_value@@RC_1.0 | ||||
| rc_config_list | ||||
| rc_config_list@@RC_1.0 | ||||
| rc_config_load | ||||
| rc_config_load@@RC_1.0 | ||||
| rc_config_value | ||||
| rc_config_value@@RC_1.0 | ||||
| rc_deptree_depend | ||||
| rc_deptree_depend@@RC_1.0 | ||||
| rc_deptree_depends | ||||
| rc_deptree_depends@@RC_1.0 | ||||
| rc_deptree_free | ||||
| rc_deptree_free@@RC_1.0 | ||||
| rc_deptree_load | ||||
| rc_deptree_load@@RC_1.0 | ||||
| rc_deptree_load_file | ||||
| rc_deptree_load_file@@RC_1.0 | ||||
| rc_deptree_order | ||||
| rc_deptree_order@@RC_1.0 | ||||
| rc_deptree_update | ||||
| rc_deptree_update@@RC_1.0 | ||||
| rc_deptree_update_needed | ||||
| rc_deptree_update_needed@@RC_1.0 | ||||
| rc_find_pids | ||||
| rc_find_pids@@RC_1.0 | ||||
| rc_getfile | ||||
| rc_getfile@@RC_1.0 | ||||
| rc_getline | ||||
| rc_getline@@RC_1.0 | ||||
| rc_newer_than | ||||
| rc_newer_than@@RC_1.0 | ||||
| rc_older_than | ||||
| rc_older_than@@RC_1.0 | ||||
| rc_proc_getent | ||||
| rc_proc_getent@@RC_1.0 | ||||
| rc_runlevel_exists | ||||
| rc_runlevel_exists@@RC_1.0 | ||||
| rc_runlevel_get | ||||
| rc_runlevel_get@@RC_1.0 | ||||
| rc_runlevel_list | ||||
| rc_runlevel_list@@RC_1.0 | ||||
| rc_runlevel_set | ||||
| rc_runlevel_set@@RC_1.0 | ||||
| rc_runlevel_stack | ||||
| rc_runlevel_stack@@RC_1.0 | ||||
| rc_runlevel_stacks | ||||
| rc_runlevel_stacks@@RC_1.0 | ||||
| rc_runlevel_starting | ||||
| rc_runlevel_starting@@RC_1.0 | ||||
| rc_runlevel_stopping | ||||
| rc_runlevel_stopping@@RC_1.0 | ||||
| rc_runlevel_unstack | ||||
| rc_runlevel_unstack@@RC_1.0 | ||||
| rc_service_add | ||||
| rc_service_add@@RC_1.0 | ||||
| rc_service_daemon_set | ||||
| rc_service_daemon_set@@RC_1.0 | ||||
| rc_service_daemons_crashed | ||||
| rc_service_daemons_crashed@@RC_1.0 | ||||
| rc_service_delete | ||||
| rc_service_delete@@RC_1.0 | ||||
| rc_service_description | ||||
| rc_service_description@@RC_1.0 | ||||
| rc_service_exists | ||||
| rc_service_exists@@RC_1.0 | ||||
| rc_service_extra_commands | ||||
| rc_service_extra_commands@@RC_1.0 | ||||
| rc_service_in_runlevel | ||||
| rc_service_in_runlevel@@RC_1.0 | ||||
| rc_service_mark | ||||
| rc_service_mark@@RC_1.0 | ||||
| rc_service_resolve | ||||
| rc_service_resolve@@RC_1.0 | ||||
| rc_service_schedule_clear | ||||
| rc_service_schedule_clear@@RC_1.0 | ||||
| rc_service_schedule_start | ||||
| rc_service_schedule_start@@RC_1.0 | ||||
| rc_service_started_daemon | ||||
| rc_service_started_daemon@@RC_1.0 | ||||
| rc_service_state | ||||
| rc_service_state@@RC_1.0 | ||||
| rc_service_value_get | ||||
| rc_service_value_get@@RC_1.0 | ||||
| rc_service_value_set | ||||
| rc_service_value_set@@RC_1.0 | ||||
| rc_services_in_runlevel | ||||
| rc_services_in_runlevel@@RC_1.0 | ||||
| rc_services_in_runlevel_stacked | ||||
| rc_services_in_runlevel_stacked@@RC_1.0 | ||||
| rc_services_in_state | ||||
| rc_services_in_state@@RC_1.0 | ||||
| rc_services_scheduled | ||||
| rc_services_scheduled@@RC_1.0 | ||||
| rc_services_scheduled_by | ||||
| rc_services_scheduled_by@@RC_1.0 | ||||
| rc_stringlist_add | ||||
| rc_stringlist_add@@RC_1.0 | ||||
| rc_stringlist_addu | ||||
| rc_stringlist_addu@@RC_1.0 | ||||
| rc_stringlist_delete | ||||
| rc_stringlist_delete@@RC_1.0 | ||||
| rc_stringlist_find | ||||
| rc_stringlist_find@@RC_1.0 | ||||
| rc_stringlist_free | ||||
| rc_stringlist_free@@RC_1.0 | ||||
| rc_stringlist_new | ||||
| rc_stringlist_new@@RC_1.0 | ||||
| rc_stringlist_sort | ||||
| rc_stringlist_sort@@RC_1.0 | ||||
| rc_stringlist_split | ||||
| rc_stringlist_split@@RC_1.0 | ||||
| rc_sys | ||||
| rc_sys@@RC_1.0 | ||||
| rc_yesno | ||||
| rc_yesno@@RC_1.0 | ||||
| @@ -1,6 +1,6 @@ | ||||
| #!/bin/sh | ||||
| 
 | ||||
| top_srcdir=${top_srcdir:-../..} | ||||
| top_srcdir=${top_srcdir:-..} | ||||
| . ${top_srcdir}/test/setup_env.sh | ||||
| 
 | ||||
| libeinfo_srcdir="${srcdir}/../libeinfo" | ||||
| @@ -27,53 +27,6 @@ fail_on_out() { | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| ebegin "Checking exported symbols in libeinfo.so (data)" | ||||
| checkit einfo.data $( | ||||
| readelf -Ws ${libeinfo_builddir}/libeinfo.so \ | ||||
| 	| awk '$4 == "OBJECT" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \ | ||||
| 	| LC_ALL=C sort -u | ||||
| ) | ||||
| 
 | ||||
| ebegin "Checking exported symbols in libeinfo.so (functions)" | ||||
| checkit einfo.funcs $( | ||||
| readelf -Ws ${libeinfo_builddir}/libeinfo.so \ | ||||
| 	| awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \ | ||||
| 	| LC_ALL=C sort -u \ | ||||
| 	| egrep -v \ | ||||
| 		-e '^_(init|fini)$' | ||||
| ) | ||||
| 
 | ||||
| ebegin "Checking exported symbols in librc.so (data)" | ||||
| checkit rc.data $( | ||||
| readelf -Ws ${librc_builddir}/librc.so \ | ||||
| 	| awk '$4 == "OBJECT" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \ | ||||
| 	| LC_ALL=C sort -u | ||||
| ) | ||||
| 
 | ||||
| ebegin "Checking exported symbols in librc.so (functions)" | ||||
| checkit rc.funcs $( | ||||
| readelf -Ws ${librc_builddir}/librc.so \ | ||||
| 	| awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $NF}' \ | ||||
| 	| LC_ALL=C sort -u \ | ||||
| 	| egrep -v \ | ||||
| 		-e '^_(init|fini)$' | ||||
| ) | ||||
| 
 | ||||
| ebegin "Checking hidden functions in librc.so" | ||||
| sed -n '/^librc_hidden_proto/s:.*(\(.*\))$:\1:p' ${librc_srcdir}/librc.h \ | ||||
| 	| LC_ALL=C sort -u \ | ||||
| 	> librc.funcs.hidden.list | ||||
| readelf -Wr $(grep -l '#include[[:space:]]"librc\.h"' ${librc_srcdir}/*.c | sed 's:\.c$:.o:') \ | ||||
| 	| egrep -v -e 'R_PARISC_(DP|SEG)REL' \ | ||||
| 	| awk '$5 ~ /^rc_/ {print $5}' \ | ||||
| 	| LC_ALL=C sort -u \ | ||||
| 	| egrep -v '^rc_environ_fd$' \ | ||||
| 	> librc.funcs.hidden.out | ||||
| syms=$(diff -u librc.funcs.hidden.list librc.funcs.hidden.out | sed -n '/^+[^+]/s:^+::p') | ||||
| [ -z "${syms}" ] | ||||
| eend $? "Missing hidden defs:"$'\n'"${syms}" | ||||
| : $(( ret += $? )) | ||||
| 
 | ||||
| ebegin "Checking trailing whitespace in code" | ||||
| # XXX: Should we check man pages too ? | ||||
| out=$(cd ${top_srcdir}; find */ \ | ||||
| @@ -1,5 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| # top_srcdir=${top_srcdir:-SET/THIS/PATH/OK!?} | ||||
| . ${top_srcdir}/test/setup_env.sh | ||||
|  | ||||
| @@ -15,7 +15,6 @@ | ||||
| ret=0 | ||||
| 
 | ||||
| tret=0 | ||||
| ebegin "Testing yesno()" | ||||
| for f in yes YES Yes true TRUE True 1 ; do | ||||
| 	if ! yesno $f; then | ||||
| 		: $(( tret += 1 )) | ||||
| @@ -28,7 +27,7 @@ for f in no NO No false FALSE False 0 ; do | ||||
| 		echo "!$f!" | ||||
| 	fi | ||||
| done | ||||
| eend $tret | ||||
| : $(( ret += $tret )) | ||||
| 
 | ||||
| eend $ret | ||||
| exit $ret | ||||
| @@ -1,27 +1,37 @@ | ||||
| #compdef rc-service | ||||
|  | ||||
| if (( CURRENT == 2 )); then | ||||
|   _arguments -s \ | ||||
|     '(-e --exists)'{-e,--exists}"[tests if the service exists or not]" \ | ||||
| _rc_services() { | ||||
|   if [[ -n "${opt_args[(i)-l|--list]}" ]]; then | ||||
|     _nothing | ||||
|   else | ||||
|     _values 'service' $(rc-service -l) | ||||
|   fi | ||||
| } | ||||
|  | ||||
| _rc_actions() { | ||||
|   local service="${line[1]}" | ||||
|  | ||||
|   if [[ -n "${opt_args[(i)-e|--exists|-r|--resolve]}" ]] || ! $(rc-service -e $service) ; then | ||||
|     _nothing | ||||
|   else | ||||
|     local -a actions=(${(f)"$(rc-service -C $service describe 2>&1)"}) | ||||
|     shift actions | ||||
|     actions=(${actions# \* }) | ||||
|     actions=(${actions/:*}) | ||||
|     actions=(stop start restart describe zap ${actions[@]}) | ||||
|     _describe -V 'action' actions | ||||
|   fi | ||||
|  | ||||
| } | ||||
|  | ||||
| _arguments -C -s \ | ||||
|   '(-e --exists)'{-e,--exists}'[tests if the service exists or not]' \ | ||||
|   '(-l --list)'{-l,--list}'[list all available services]' \ | ||||
|   '(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \ | ||||
|   '(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \ | ||||
|   '(-v --verbose)'{-v,--verbose}'[Run verbosely]' \ | ||||
|     '(-q --quiet)'{-q,--quiet}'[Run quietly]' | ||||
|   _values "service" $(rc-service --list) | ||||
| else | ||||
|   case $words[2] in | ||||
|     -e|--exists|-r|--resolve) | ||||
|       (( CURRENT > 3 )) && return 0 | ||||
| 	  _values "service" $(rc-service --list) | ||||
|       ;; | ||||
|     -*) | ||||
|           return 0 | ||||
|           ;; | ||||
|     *) | ||||
|       _values "action" stop start restart describe zap | ||||
|   ;; | ||||
|   esac | ||||
| fi | ||||
|   '(-q --quiet)'{-q,--quiet}'[Run quietly]' \ | ||||
|   '1:service:_rc_services' \ | ||||
|   '2:action:_rc_actions' | ||||
|  | ||||
| # vim: set et sw=2 ts=2 ft=zsh: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user