Compare commits
	
		
			34 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 60f42c415d | ||
|   | 93c8cbe684 | ||
|   | 386bdf66f9 | ||
|   | 81ab30c51d | ||
|   | d05c8c2159 | ||
|   | 7850e12071 | ||
|   | 11d3a8bead | ||
|   | e36e9a30eb | ||
|   | 7da99d77b5 | ||
|   | 01c34c28e6 | ||
|   | 56ddda54b5 | ||
|   | 3a803b3135 | ||
|   | 72df51e17b | ||
|   | b2f5531194 | ||
|   | 19bf49a710 | ||
|   | 64354831da | ||
|   | e14edd765f | ||
|   | f9d41243d8 | ||
|   | be7ad06d4a | ||
|   | a616516895 | ||
|   | 04721ece03 | ||
|   | c7e8f1133a | ||
|   | 47e4bfae57 | ||
|   | 8a945194af | ||
|   | aa4a004c29 | ||
|   | 9ec5d36bdd | ||
|   | a097933eda | ||
|   | a6f5b1bb63 | ||
|   | e6d01471fe | ||
|   | d4501a9f06 | ||
|   | ec8abea460 | ||
|   | e4ddfa38e0 | ||
|   | 21d30bc6d9 | ||
|   | 2a1ff6e49c | 
							
								
								
									
										832
									
								
								ChangeLog
									
									
									
									
									
								
							
							
						
						
									
										832
									
								
								ChangeLog
									
									
									
									
									
								
							| @@ -1,3 +1,224 @@ | ||||
| commit 93c8cbe68428dcf7823a6483d30698ba001f4271 | ||||
| Author: Zac Medico <zmedico@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: fix respawn_max off by one | ||||
|      | ||||
|     Fix the comparison between respawn_count and respawn_max so that | ||||
|     respawn_max = 1 will allow for one respawn. Since respawn_count is | ||||
|     incremented before the comparison, use a 'greater than' comparison | ||||
|     so that respawn will be triggered when respawn_count is equal to | ||||
|     respawn_max. | ||||
|      | ||||
|     Fixes: https://github.com/OpenRC/openrc/issues/247 | ||||
|     Fixes: https://github.com/OpenRC/openrc/issues/248 | ||||
|  | ||||
| commit 386bdf66f9622b6a86847ff678077c5c6456d74e | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.38.3 | ||||
|  | ||||
| commit 81ab30c51dba9bfac71dd36c65e96bc1e3e5f2ae | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit d05c8c2159a9cbcf9286adbd6cbc3b0d5d2a3b43 | ||||
| Author: Zac Medico <zmedico@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc: fix EACCES errno false-positive crash | ||||
|      | ||||
|     Use errno != EACCES to fix false-positive for non-root users | ||||
|     with grsecurity kernels. | ||||
|      | ||||
|     Fixes: 37e29442721a ("librc: Add check for crashed state") | ||||
|     This fixes #237 | ||||
|  | ||||
| commit 7850e12071891321f6564979e4e574eb775bf102 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.38.2 | ||||
|  | ||||
| commit 11d3a8beadc4561e6b5d8f7fd86af39e4caf9d4f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit e36e9a30eb830ea27b467383fa2ae02cd2b0d9d4 | ||||
| Author: Holger Hoffstätte <holger@applied-asynchrony.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status: initialize uptime pointer to prevent memory corruption | ||||
|      | ||||
|     This fixes #231. | ||||
|  | ||||
| commit 7da99d77b5bbd789cb84be347d8b8d96d21f85c4 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.38.1 | ||||
|  | ||||
| commit 01c34c28e6d6d7bfecc0f88bdf1fb15e97ab8823 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 56ddda54b5aa01474bf563d5a662075c35152858 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon.c: clean up memory leaks | ||||
|  | ||||
| commit 3a803b3135837665d51ef4dd7a8b913c78e71ff6 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc-daemon.c: fix memory leaks | ||||
|  | ||||
| commit 72df51e17ba0e1a0f94451b4bbfb338288c4625c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc-daemon: convert most snprintf calls to xasprintf | ||||
|  | ||||
| commit b2f5531194e33c229462e9f52fa1d9388463f7b7 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     librc-misc: convert snprintf calls to xasprintf | ||||
|  | ||||
| commit 19bf49a710f27d4774ed4c6372d87d6ba15f189e | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     libeinfo: convert remaining snprintf calls to xasprintf | ||||
|  | ||||
| commit 64354831da2adeba5cb2f91a81fa0f56e1ce4ed9 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc: convert snprintf calls to xasprintf | ||||
|  | ||||
| commit e14edd765fdc4ed43356d2eef35fa99228e5d461 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: convert snprintf calls to xasprintf | ||||
|  | ||||
| commit f9d41243d8499c5d7027177d5aa716d5b5859cd6 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: convert snprintf calls to xasprintf | ||||
|  | ||||
| commit be7ad06d4a0efce2a1144b2cf6f0cc361f2a81e4 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status: convert snprintf calls to xasprintf | ||||
|  | ||||
| commit a6165168953b9c7a62c089ce946476b23b73fb12 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-status: fix gcc 7 warnings | ||||
|  | ||||
| commit 04721ece03b15503aa220f60e7c6159d01ee75e1 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: fix gcc 7 warnings | ||||
|  | ||||
| commit c7e8f1133a42152cc293e6b637985f81bcf8b310 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     checkpath: fix gcc 7 warnings | ||||
|  | ||||
| commit 47e4bfae57402eedd017d6098b432c2c411cd374 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix gcc 7 warnings in pipe routines | ||||
|  | ||||
| commit 8a945194afb106428bc700e751078ef9944ee617 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     libeinfo: clean up gcc 7 compiler warnings | ||||
|  | ||||
| commit aa4a004c297ec7a1fb794ad2e53ef3ac8b3f4fd1 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.38 | ||||
|  | ||||
| commit 9ec5d36bdddf5bb0e96b0c561bc5d013a8a2da2a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit a097933edab9d7221df1831e098415d604437c98 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     sh/start-stop-daemon.sh: fix processing of the logger arguments | ||||
|  | ||||
| commit a6f5b1bb63070c24145df72040fa7b465948003c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit e6d01471fe2a8eb8a15bb906d7c91c11805d1bef | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: add ability to log stdout or stderr to processes | ||||
|  | ||||
| commit d4501a9f06c807f87be04f128e535a74b370fdb4 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix a typo | ||||
|  | ||||
| commit ec8abea4605395a2a59b26906ce4677a578e3c60 | ||||
| Author: Mike Gilbert <floppym@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Add helper to spawn process with stdin connected to a pipe | ||||
|  | ||||
| commit e4ddfa38e0e0318abf442b7aa07e0d8206191dd7 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     user-guide.md: small cleanups | ||||
|  | ||||
| commit 21d30bc6d9caca31d007631717a480a552b89701 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     service-script-guide.md: small cleanups | ||||
|  | ||||
| commit 2a1ff6e49c6603bb81eec3cafe2c587fa734289f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.37 | ||||
|  | ||||
| commit 6762cb875c9c039b79dcc447b9d0eb65356a7708 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 6edf516a1fe0ad4f4e8738f9fdd1bf0bc7718361 | ||||
| Author: Austin English <austinenglish@gmail.com> | ||||
| Commit: Doug Freed <dwfreed@mtu.edu> | ||||
| @@ -1115,614 +1336,3 @@ Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|     program and adding --reexec support | ||||
|     - factor the supervisor into its own function | ||||
|     - fix test for whether we are already running | ||||
|  | ||||
| commit 35b1996704f6635bb29ea3604410e133209e6432 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: elevate some log messages to warnings | ||||
|      | ||||
|     Prior to this change, we were logging unexpected terminations of daemons | ||||
|     we were supervising at the info level. This change moves the logs to | ||||
|     warnings. | ||||
|  | ||||
| commit 3c8e7ed255edb8df0d548d6ce514544d5422cbf0 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.34 | ||||
|  | ||||
| commit acaed1f910a2a00fdd5b6aeab752c552075a7292 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 91109e31d81ecd48f5690ad6f63103fca545dec7 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     update news | ||||
|  | ||||
| commit 2b6eeea01d1c64d58929788f4bfa0758393885bf | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man: remove service(8) man page | ||||
|  | ||||
| commit a15de23e5713d840d871c526b46050983dc6ea1e | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     typo fix | ||||
|  | ||||
| commit efa9ba485d9328f780f3e60dc18339c75974c6c6 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/sysfs.in: fix reference to RC_LIBEXECDIR | ||||
|      | ||||
|     The sysfs init script referred to @LIBEXECDIR@ before this change, but | ||||
|     it is better to refer to RC_LIBEXECDIR so that we get rid of a sed | ||||
|     substitution. | ||||
|  | ||||
| commit d4ddd72701ff5533a1ba07b1da60806859c63d88 | ||||
| Author: Chris Cromer <chris@cromer.cl> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add option to make agetty startup quiet | ||||
|      | ||||
|     This fixes #150 | ||||
|  | ||||
| commit 1e9af2cd421423404ffe1491bd35af76c2885f1f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix compiler warning | ||||
|  | ||||
| commit 3c05db74f6e733890e9035c183a774db3d512512 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     remove service binary | ||||
|      | ||||
|     The service binary was just a synonym for rc-service, so use rc-service | ||||
|     instead of service. If you want a "service" binary, it should be | ||||
|     something that can determine which service manager you are running and | ||||
|     run the appropriate service manager commands. | ||||
|  | ||||
| commit edc54b03770d5f58d1a4969d06c28660003dfb04 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.33 | ||||
|  | ||||
| commit 8e53a3fa8a33fb714064ddbe38bff2213fcf6837 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 7f3b41311119e3a96a15b0fb473b44f422e903e9 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     use printf consistently in cgroups handling | ||||
|      | ||||
|     This makes the cgroups handling consistent between cgroups v1 and v2. | ||||
|     Also, it fixes #167. | ||||
|  | ||||
| commit 1ccba056584ee1a8e09fb1d5eebd988b47912c06 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     sh/rc-functions.sh: add need_if_exists convenience function | ||||
|  | ||||
| commit c46adf14343df3a74aef7e4ae5be175ae5fa7a01 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc-run.8: Clarify the explanation of the need dependency | ||||
|  | ||||
| commit 1cac8b080c16f9aab19c7a3ae1ca155c20dfa14d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     ignore sigchld when shutting down the supervised process | ||||
|      | ||||
|     We need to do this to skip the zombie state for the child process since | ||||
|     we are not easily able to wait() for it. | ||||
|  | ||||
| commit b58194ef63ec8c0a7e0ea3c291da9c19aa83cb1a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     typo fix | ||||
|  | ||||
| commit b28c0d6f66e42b1e6d2a39c286a18c8d92881790 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     typo fix | ||||
|  | ||||
| commit 3cf19b0f30a90157d23d09ded304439f1eb42d4a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     supervise-daemon: code cleanup | ||||
|      | ||||
|     Clean up the process for killing an active supervisor when stopping. | ||||
|  | ||||
| commit 0eb47b9af340dd07209a3920944ed085fe7bd359 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     initialize the stop schedule | ||||
|  | ||||
| commit 4ab60ff10935122277bbaed437f82a765279cd19 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-schedules.c: pass the correct pid to rc_find_pids | ||||
|      | ||||
|     This is for #163. | ||||
|  | ||||
| commit db4a578273dbfa15b8b96686391bcc9ecc04b646 | ||||
| Author: Jason Zaman <jason@perfinion.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     selinux: fix const qualifier warning | ||||
|      | ||||
|     rc-selinux.c: In function ‘selinux_setup’: | ||||
|     rc-selinux.c:361:9: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | ||||
|       curr_t = context_type_get(curr_con); | ||||
|              ^ | ||||
|  | ||||
| commit b1c3422f453921e838d419640fe39144dbf8d13d | ||||
| Author: Jason Zaman <jason@perfinion.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     selinux: use openrc contexts path to get contexts | ||||
|      | ||||
|     The minimum requirement for libselinux is now >=2.6 | ||||
|     The refpolicy and the gentoo policy contain the | ||||
|     contexts since version 2.20170204-r4 | ||||
|  | ||||
| commit 3fafd7a76e6adf15ec72a7ba5f44583eff8fab7a | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     sysfs: fix cgroup hybrid mode | ||||
|      | ||||
|     In hybrid mode, we should not try to mount cgroup2 if it is not | ||||
|     available in the kernel. | ||||
|      | ||||
|     This fixes #164. | ||||
|  | ||||
| commit cd5722aca50f0eaddde7ce04ee00da53c313ba7d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     cgroup2_find_path: use legacy mode if cgroup2 is not in the kernel | ||||
|      | ||||
|     This is related to #164. | ||||
|  | ||||
| commit dcb4a4d2613a1fdf85651b32e5b7a87528f487bc | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.32 | ||||
|  | ||||
| commit e312e569970c74cf52e255da67034391b68dafac | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 2f60a959b442866b0e879d83f2732c4fa3ed3f7d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     update news file | ||||
|  | ||||
| commit 25b45a5a239318fb57c405c3fe64e53b0738ad68 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     cgroup_cleanup: try to remove the cgroup version 2 cgroup | ||||
|      | ||||
|     If we were able to kill all the processes in the cgroup, it should be | ||||
|     removed. | ||||
|  | ||||
| commit 4651b8c7e9e2ef9c1ea1fb8d174d1ca4693627af | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-cgroup.sh: cgroup_cleanup fix error handling | ||||
|      | ||||
|     cgroup_cleanup should warn if it is unable to clean up all processes in | ||||
|     the control group, but it will always return success. | ||||
|  | ||||
| commit 50608b54ed98acb54fec5fe3323909ea684d3af9 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-cgroup.sh: fix signal names | ||||
|      | ||||
|     The "SIG" prefix on signal names passed to kill -s isn't portable. | ||||
|  | ||||
| commit b0a077a35f85e266fdb82a245dcbda18664a8567 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add quiet switch to do_stop in src-schedules.c | ||||
|      | ||||
|     This allows supervise-daemon to run this code without attempting to | ||||
|     print some status messages used by start-stop-daemon. | ||||
|  | ||||
| commit 6a5ca2ab368d0a85f51bb559672dba2e3ffcc6be | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     make the procedure for killing child processes of services configurable | ||||
|  | ||||
| commit 2b0345165e5af57ca61a4000c3671bbe6d677cf9 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Make cgroup_cleanup send only one sigterm and sigkill | ||||
|      | ||||
|     Instead of looping and sending multiple signals to child processes in | ||||
|     cgroup_cleanup, we send sigterm followed by sleeping one second then | ||||
|     sigkill. | ||||
|      | ||||
|     This brings us more in line with systemd's "control group" killmode | ||||
|     setting. | ||||
|      | ||||
|     Also, this commit includes several shellcheck cleanups. | ||||
|  | ||||
| commit 8885580986ab8adc951fe32b9323c8b16130fb4f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     rc-cgroup.sh: move cgroup_cleanup to the end of the file | ||||
|  | ||||
| commit 6d7713a758b7e78f05e6a3cc101f862d28d778ab | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     guide.md: clarify cgroups documentation | ||||
|      | ||||
|     Update the documentation to reflect cgroups version 2 support. | ||||
|     Also, add a section on dealing with orphaned service processes. | ||||
|      | ||||
|     This fixes #94. | ||||
|  | ||||
| commit 457f928e793cb1f6ef254935ad07f58b8762c72f | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add support for control groups version 2 | ||||
|      | ||||
|     This is for #94. | ||||
|  | ||||
| commit a71a461e452a98554346c47411e9c9012023c201 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.31 | ||||
|  | ||||
| commit a09b8af3f98c0700a9b838b7f3683ee58eecc912 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 382efdbfcb99703d03211efacd800c9575e64230 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add quiet parameter to run_stop_schedule | ||||
|  | ||||
| commit 17b5cc78d35dc5fe4904e5951715c3e0d07d6343 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add retry option to supervise-daemon | ||||
|      | ||||
|     The --retry option for supervise-daemon defines how the supervisor will | ||||
|     attempt to stop the child process it is monitoring. It is defined when | ||||
|     the supervisor is started since stopping the supervisor just sends a | ||||
|     signal to the active supervisor. | ||||
|      | ||||
|     This fixes #160. | ||||
|  | ||||
| commit 36a0ab9054512ade413226fb8e8b28060045e9a4 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     make run_stop_schedule accept a pid instead of a pid file | ||||
|  | ||||
| commit 27c2bd997d5173aa30844a16bc22dc8caab09f8c | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.30 | ||||
|  | ||||
| commit d7938f54f29193251e083ad35a7d464949829096 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     start-stop-daemon: move --retry processing code to a shared module | ||||
|      | ||||
|     This was part of start-stop-daemon; however, it needs to be shared in | ||||
|     order to be used by supervise-daemon. | ||||
|  | ||||
| commit cfbe9c2ede24dac530ef58e5c35bd57f22a788a3 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     move get_pid function to a shared file | ||||
|  | ||||
| commit df28002b728b033c00c2da64dedf2bcd4ab5e11b | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit 66ed8082d0c865a0b4f4cc436cf9e13351e3d6fe | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     sh/openrc-run: source service script before ulimit is processed | ||||
|      | ||||
|     This is needed to allow the service script author to set a default for | ||||
|     rc_ulimit inside the service script. | ||||
|  | ||||
| commit c2d256bafb9d1dfafbfd0846c035c5d26f7449c8 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc-run.8: document fstabinfo and mountinfo | ||||
|      | ||||
|     X-Gentoo-Bug: 592374 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592374 | ||||
|  | ||||
| commit f48d9c33a5c708c871d6657a39485d1c0c735548 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man/openrc-run.8: document _pre and _post functions | ||||
|      | ||||
|     Fixes https://github.com/openrc/openrc/issues/155. | ||||
|  | ||||
| commit 6d4e8433974fd8567885635ae0454031290f96b1 | ||||
| Author: Jason Graham <jgraha8@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix ENT macro usage | ||||
|      | ||||
|     X-Gentoo-Bug: 624796 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=624796 | ||||
|  | ||||
| commit 0513cd3964a9564e0ba39b50aa8ebd3d7e9a3920 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.29 | ||||
|  | ||||
| commit 72bb2e57de935ab46ad000f97a5720265bed9342 | ||||
| Author: John R. Graham <john_r_graham@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Typo fix | ||||
|      | ||||
|     X-Gentoo-Bug: 624908 | ||||
|     X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=624908 | ||||
|  | ||||
| commit 84c5da30695db89d686d3c28c7cacdf172cbf429 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit b35099cb707e333b6b8d30d956ffa93bcd2da0ab | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Add comment about overriding the default efivars mount in fstab to news | ||||
|  | ||||
| commit 3fd3bfc76dccc3752f4af949ad4076dab26357fb | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add link to efivars issue to news file | ||||
|  | ||||
| commit 492a6303cb8314263bfd3631e3b0de5a9df178da | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit e7807b3136d8993805082320784460f5059e6275 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix sysvinit compatibility for shutdown wrapper | ||||
|  | ||||
| commit 03a461ac0ee34b7900868cdea624c6fd868b1656 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix sysvinit compatibility for reboot wrapper | ||||
|  | ||||
| commit 7e0f76e0adc545c74a8332a6ef0811d2aa62cb81 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix sysvinit compatibility for poweroff wrapper | ||||
|  | ||||
| commit 9812ce5b8dc22fe36cc7bf75cf6e62db204ece3d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix halt wrapper so it is sysvinit compatible | ||||
|      | ||||
|     This makes the halt wrapper sysvinit compatible. It ignores several | ||||
|     command line switches which are not currently implemented; however, | ||||
|     those can be implemented if we need to do so. | ||||
|      | ||||
|     This fixes https://github.com/openrc/openrc/issues/146. | ||||
|  | ||||
| commit 12f75e4167f84a9a85f69924ebdb28ad36c085cb | ||||
| Author: Adam Borowski <kilobyte@angband.pl> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man: fix an unclosed .Bl/.El warning | ||||
|      | ||||
|     This fixes #151. | ||||
|  | ||||
| commit 260368e0103e95625c29760f2c2ec89143e5a233 | ||||
| Author: Adam Borowski <kilobyte@angband.pl> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man: fix missing .Pp warnings | ||||
|      | ||||
|     This fixes #151. | ||||
|  | ||||
| commit f87a9eec3d23ea01578500972f1df993d5d24fba | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/sysfs: mount efivars read only | ||||
|      | ||||
|     This fixes #134. | ||||
|  | ||||
| commit 1e837d596e483ceb5cec177a6c7faff24a42384b | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix argument parsing for the sysvinit shutdown wrapper | ||||
|      | ||||
|     This fixes #140. | ||||
|  | ||||
| commit dcc686e42b406d63d52ef75de9a326f67d0a06c9 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     scripts/shutdown: fix arguments to be sysvinit shutdown compatible | ||||
|      | ||||
|     This fixes #140. | ||||
|  | ||||
| commit 2f81c100afdf45ebf787dfc5d3261aa6055640e4 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Fix link to shutdown for MKSYSVINIT=yes | ||||
|  | ||||
| commit a511a48d77b1dcb8a3fb0dd1abddb750a152869b | ||||
| Author: Nuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/hostname: fix default parameter syntax | ||||
|      | ||||
|     The syntax for expanding a variable with a default value is | ||||
|             ${parameter:-word} | ||||
|     not | ||||
|             ${parameter-word} | ||||
|     although the latter still works for a reason I could not explain. | ||||
|      | ||||
|     This fixes #143. | ||||
|  | ||||
| commit 1e5322e5c55ec744a2cdcc3342ef6547eab7c46f | ||||
| Author: Nuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/hostname: fix indentation | ||||
|      | ||||
|     This is for #143. | ||||
|  | ||||
| commit 199a210d2fbc524c9c400a06f832dabffd7ed1b3 | ||||
| Author: udeved <artoo@manjaro.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     scripts/Makefile: make symlinks absolute instead of relative | ||||
|      | ||||
|     This closes #142. | ||||
|  | ||||
| commit 5b7667af32effddf867a5d021c66d43f0645d374 | ||||
| Author: udeved <artoo@manjaro.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     scripts/Makefile: respect SBINDIR with MKSYSVINIT | ||||
|      | ||||
|     This is for #142. | ||||
|  | ||||
| commit 11243f85b67e5f450ddf50346ffd4a1b2c6faeb5 | ||||
| Author: Jory A. Pratt <anarchy@gentoo.org> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     kill_all: include limits.h for PATH_MAX | ||||
|  | ||||
| commit 3c40826d3466cdda1a46abcd5c86b661b8185f46 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     version 0.28 | ||||
|  | ||||
| commit 560d874d2fee63bf7ca11f17cf9933021b639a1d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     fix compile issue for musl | ||||
|  | ||||
| commit e84366fd232a41c3ba79ed351e93c74cef8d7c8d | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     Update ChangeLog | ||||
|  | ||||
| commit caacedc0a82285fb2d25c6d3473f154044c7ad66 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     man: update openrc-shutdown man page | ||||
|      | ||||
|     Add the new wtmp options and fix some cross references. | ||||
|  | ||||
| commit 84d140a1f6abf95a4170d13527152d3ab14e6613 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     scripts/shutdown: pass --single to openrc-shutdown | ||||
|      | ||||
|     Sysvinit shutdown has a default of single user mode, but openrc-shutdown | ||||
|     makes you choose a default action. Because of this, the shutdown wrapper | ||||
|     needs to pass --single to openrc-shutdown. | ||||
|  | ||||
| commit ee886c44824b1dd892eaff2c6da666286e61bc73 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc-shutdown: add --single option and clean up option processing | ||||
|  | ||||
| commit 1801561c2d36c330df7fd02c7508f503a61ff5ba | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     init.d/bootmisc: use openrc-shutdown instead of halt to write halt record | ||||
|      | ||||
|     This fixes #139 and fixes #128. | ||||
|     and fixes #124. | ||||
|  | ||||
| commit 7689106aa10f7852b707b4c21ec080ccb2767280 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     add support for writing reboot and shutdown records to wtmp | ||||
|  | ||||
| commit 1564e155b726308200ecd5df315c002bd8b16952 | ||||
| Author: William Hubbs <w.d.hubbs@gmail.com> | ||||
| Commit: William Hubbs <w.d.hubbs@gmail.com> | ||||
|  | ||||
|     openrc-init: add optional sysvinit compatibility | ||||
|   | ||||
| @@ -1,3 +1,3 @@ | ||||
| NAME=		openrc | ||||
| VERSION=	0.36 | ||||
| VERSION=	0.38.3 | ||||
| PKG=		${NAME}-${VERSION} | ||||
|   | ||||
							
								
								
									
										9
									
								
								NEWS.md
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								NEWS.md
									
									
									
									
									
								
							| @@ -4,6 +4,15 @@ 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.37 | ||||
|  | ||||
| start-stop-daemon now supports logging stdout and stderr of daemons to | ||||
| processes instead of files. These processes are defined by the | ||||
| output_logger and error_logger variables in standard service scripts, or | ||||
| by the  -3/--output-logger or -4/--error-logger switches if you use | ||||
| start-stop-daemon directly. For more information on this, see the | ||||
| start-stop-daemon man page. | ||||
|  | ||||
| ## OpenRC 0.36 | ||||
|  | ||||
| In this release, the modules-load service has been combined into the | ||||
|   | ||||
| @@ -173,6 +173,23 @@ variable is set. | ||||
| The same thing as | ||||
| .Pa output_log | ||||
| but for the standard error output. | ||||
| .It Ar output_logger | ||||
| This is a process which will be used to log the standard output from the | ||||
| service.  If you are starting this service with | ||||
| .Xr start-stop-daemon 8 , | ||||
| ,  you must set | ||||
| .Pa command_background | ||||
| to true. Keep in mind that this command must be executable as a shell | ||||
| command inside the chroot if the | ||||
| .Pa chroot | ||||
| variable is set. Keep in mind also that this command works by accepting | ||||
| the stdout of the service on stdin. | ||||
| An example of a command that can be run this way is logger if you want | ||||
| your service output to go to syslog. | ||||
| .It Ar error_logger | ||||
| The same thing as | ||||
| .Pa output_logger | ||||
| but for the standard error output. | ||||
| .It Ar directory | ||||
| .Xr start-stop-daemon 8 | ||||
| and | ||||
|   | ||||
| @@ -131,9 +131,34 @@ Modifies the scheduling priority of the daemon. | ||||
| .It Fl 1 , -stdout Ar logfile | ||||
| Redirect the standard output of the process to logfile when started with | ||||
| .Fl background . | ||||
| Must be an absolute pathname, but relative to the path optionally given with | ||||
| The logfile Must be an absolute pathname, but relative to the path | ||||
| optionally given with | ||||
| .Fl r , -chroot . | ||||
| The logfile can also be a named pipe. | ||||
| .It Fl 2 , -stderr Ar logfile | ||||
| Redirect the standard error of the process to logfile when started with | ||||
| .Fl background . | ||||
| The logfile must be an absolute pathname, but relative to the path | ||||
| optionally given with | ||||
| .Fl r , -chroot . | ||||
| The logfile can also be a named pipe. | ||||
| .It Fl 3 , -stdout-logger Ar cmd | ||||
| Run cmd as a child process redirecting the standard output to the | ||||
| standard input of cmd when started with | ||||
| .Fl background . | ||||
| Cmd must be an absolute pathname, but relative to the path optionally given with | ||||
| .Fl r , -chroot . | ||||
| This process must be prepared to accept input on stdin and be able to | ||||
| log it or send it to another location. | ||||
| .It Fl 4 , -stderr-logger Ar cmd | ||||
| Run cmd as a child process and  | ||||
| Redirect the standard error of the process to the standard input of cmd | ||||
| when started with | ||||
| .Fl background . | ||||
| Cmd must be an absolute pathname, but relative to the path optionally given with | ||||
| .Fl r , -chroot . | ||||
| This process must be prepared to accept input on stdin and be able to | ||||
| log it or send it to another location. | ||||
| .It Fl w , -wait Ar milliseconds | ||||
| Wait | ||||
| .Ar milliseconds | ||||
|   | ||||
| @@ -29,7 +29,9 @@ Not using this interpreter will break the use of dependencies and is not | ||||
| supported. (iow: if you insist on using `#!/bin/sh` you're on your own) | ||||
|  | ||||
| A `depend` function declares the dependencies of this service script. | ||||
| All scripts must have start/stop/status functions, but defaults are provided and should be used unless you have a very strong reason not to use them. | ||||
| All scripts must have start/stop/status functions, but defaults are | ||||
| provided and should be used unless you have a very strong reason not to | ||||
| use them. | ||||
|  | ||||
| Extra functions can be added easily: | ||||
|  | ||||
|   | ||||
| @@ -38,6 +38,10 @@ ssd_start() | ||||
| 		service_inactive && _inactive=true | ||||
| 		mark_service_inactive | ||||
| 	fi | ||||
| 	[ -n "$output_logger" ] &&  | ||||
| 		output_logger_arg="--stdout-logger \"$output_logger\"" | ||||
| 	[ -n "$error_logger" ] &&  | ||||
| 		error_logger_arg="--stderr-logger \"$error_logger\"" | ||||
| 	#the eval call is necessary for cases like: | ||||
| 	# command_args="this \"is a\" test" | ||||
| 	# to work properly. | ||||
| @@ -47,6 +51,8 @@ ssd_start() | ||||
| 		${directory:+--chdir} $directory \ | ||||
| 		${output_log+--stdout} $output_log \ | ||||
| 		${error_log+--stderr} $error_log \ | ||||
| 		${output_logger_arg} \ | ||||
| 		${error_logger_arg} \ | ||||
| 		${procname:+--name} $procname \ | ||||
| 		${pidfile:+--pidfile} $pidfile \ | ||||
| 		${command_user+--user} $command_user \ | ||||
|   | ||||
| @@ -883,7 +883,7 @@ eindent(void) | ||||
| { | ||||
| 	char *env = getenv("EINFO_INDENT"); | ||||
| 	int amount = 0; | ||||
| 	char num[10]; | ||||
| 	char *num; | ||||
|  | ||||
| 	if (env) { | ||||
| 		errno = 0; | ||||
| @@ -894,8 +894,9 @@ eindent(void) | ||||
| 	amount += INDENT_WIDTH; | ||||
| 	if (amount > INDENT_MAX) | ||||
| 		amount = INDENT_MAX; | ||||
| 	snprintf(num, 10, "%08d", amount); | ||||
| 	xasprintf(&num, "%08d", amount); | ||||
| 	setenv("EINFO_INDENT", num, 1); | ||||
| 	free(num); | ||||
| } | ||||
| hidden_def(eindent) | ||||
|  | ||||
| @@ -903,7 +904,7 @@ void eoutdent(void) | ||||
| { | ||||
| 	char *env = getenv("EINFO_INDENT"); | ||||
| 	int amount = 0; | ||||
| 	char num[10]; | ||||
| 	char *num = NULL; | ||||
| 	int serrno = errno; | ||||
|  | ||||
| 	if (!env) | ||||
| @@ -917,8 +918,9 @@ void eoutdent(void) | ||||
| 	if (amount <= 0) | ||||
| 		unsetenv("EINFO_INDENT"); | ||||
| 	else { | ||||
| 		snprintf(num, 10, "%08d", amount); | ||||
| 		xasprintf(&num, "%08d", amount); | ||||
| 		setenv("EINFO_INDENT", num, 1); | ||||
| 		free(num); | ||||
| 	} | ||||
| 	errno = serrno; | ||||
| } | ||||
|   | ||||
| @@ -23,13 +23,13 @@ | ||||
| static bool | ||||
| pid_is_exec(pid_t pid, const char *exec) | ||||
| { | ||||
| 	char buffer[32]; | ||||
| 	char *buffer = NULL; | ||||
| 	FILE *fp; | ||||
| 	int c; | ||||
| 	bool retval = false; | ||||
|  | ||||
| 	exec = basename_c(exec); | ||||
| 	snprintf(buffer, sizeof(buffer), "/proc/%d/stat", pid); | ||||
| 	xasprintf(&buffer, "/proc/%d/stat", pid); | ||||
| 	if ((fp = fopen(buffer, "r"))) { | ||||
| 		while ((c = getc(fp)) != EOF && c != '(') | ||||
| 			; | ||||
| @@ -41,23 +41,27 @@ pid_is_exec(pid_t pid, const char *exec) | ||||
| 		} | ||||
| 		fclose(fp); | ||||
| 	} | ||||
| 	free(buffer); | ||||
| 	return retval; | ||||
| } | ||||
|  | ||||
| static bool | ||||
| pid_is_argv(pid_t pid, const char *const *argv) | ||||
| { | ||||
| 	char cmdline[32]; | ||||
| 	char *cmdline = NULL; | ||||
| 	int fd; | ||||
| 	char buffer[PATH_MAX]; | ||||
| 	char *p; | ||||
| 	ssize_t bytes; | ||||
|  | ||||
| 	snprintf(cmdline, sizeof(cmdline), "/proc/%u/cmdline", pid); | ||||
| 	if ((fd = open(cmdline, O_RDONLY)) < 0) | ||||
| 	xasprintf(&cmdline, "/proc/%u/cmdline", pid); | ||||
| 	if ((fd = open(cmdline, O_RDONLY)) < 0) { | ||||
| 		free(cmdline); | ||||
| 		return false; | ||||
| 	} | ||||
| 	bytes = read(fd, buffer, sizeof(buffer)); | ||||
| 	close(fd); | ||||
| 	free(cmdline); | ||||
| 	if (bytes == -1) | ||||
| 		return false; | ||||
|  | ||||
| @@ -88,7 +92,7 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) | ||||
| 	char proc_ns[30]; | ||||
| 	size_t len = 0; | ||||
| 	pid_t p; | ||||
| 	char buffer[PATH_MAX]; | ||||
| 	char *buffer = NULL; | ||||
| 	struct stat sb; | ||||
| 	pid_t openrc_pid = 0; | ||||
| 	char *pp; | ||||
| @@ -149,18 +153,22 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) | ||||
| 			continue; | ||||
| 		if (pid != 0 && pid != p) | ||||
| 			continue; | ||||
| 		snprintf(buffer, sizeof(buffer), "/proc/%d/ns/pid", p); | ||||
| 		xasprintf(&buffer, "/proc/%d/ns/pid", p); | ||||
| 		if (exists(buffer)) { | ||||
| 			rc = readlink(buffer, proc_ns, sizeof(proc_ns)); | ||||
| 			if (rc <= 0) | ||||
| 				proc_ns[0] = '\0'; | ||||
| 		} | ||||
| 		free(buffer); | ||||
| 		if (strlen(my_ns) && strlen (proc_ns) && strcmp(my_ns, proc_ns)) | ||||
| 			continue; | ||||
| 		if (uid) { | ||||
| 			snprintf(buffer, sizeof(buffer), "/proc/%d", p); | ||||
| 			if (stat(buffer, &sb) != 0 || sb.st_uid != uid) | ||||
| 			xasprintf(&buffer, "/proc/%d", p); | ||||
| 			if (stat(buffer, &sb) != 0 || sb.st_uid != uid) { | ||||
| 				free(buffer); | ||||
| 				continue; | ||||
| 			} | ||||
| 			free(buffer); | ||||
| 		} | ||||
| 		if (exec && !pid_is_exec(p, exec)) | ||||
| 			continue; | ||||
| @@ -169,9 +177,10 @@ rc_find_pids(const char *exec, const char *const *argv, uid_t uid, pid_t pid) | ||||
| 			continue; | ||||
| 		/* If this is an OpenVZ host, filter out container processes */ | ||||
| 		if (openvz_host) { | ||||
| 			snprintf(buffer, sizeof(buffer), "/proc/%d/status", p); | ||||
| 			xasprintf(&buffer, "/proc/%d/status", p); | ||||
| 			if (exists(buffer)) { | ||||
| 				fp = fopen(buffer, "r"); | ||||
| 				free(buffer); | ||||
| 				if (! fp) | ||||
| 					continue; | ||||
| 				while (! feof(fp)) { | ||||
| @@ -315,12 +324,13 @@ _match_daemon(const char *path, const char *file, RC_STRINGLIST *match) | ||||
| { | ||||
| 	char *line = NULL; | ||||
| 	size_t len = 0; | ||||
| 	char ffile[PATH_MAX]; | ||||
| 	char *ffile = NULL; | ||||
| 	FILE *fp; | ||||
| 	RC_STRING *m; | ||||
|  | ||||
| 	snprintf(ffile, sizeof(ffile), "%s/%s", path, file); | ||||
| 	xasprintf(&ffile, "%s/%s", path, file); | ||||
| 	fp = fopen(ffile, "r"); | ||||
| 	free(ffile); | ||||
|  | ||||
| 	if (!fp) | ||||
| 		return false; | ||||
| @@ -346,29 +356,22 @@ _match_list(const char *exec, const char *const *argv, const char *pidfile) | ||||
| { | ||||
| 	RC_STRINGLIST *match = rc_stringlist_new(); | ||||
| 	int i = 0; | ||||
| 	size_t l; | ||||
| 	char *m; | ||||
|  | ||||
| 	if (exec) { | ||||
| 		l = strlen(exec) + 6; | ||||
| 		m = xmalloc(sizeof(char) * l); | ||||
| 		snprintf(m, l, "exec=%s", exec); | ||||
| 		xasprintf(&m, "exec=%s", exec); | ||||
| 		rc_stringlist_add(match, m); | ||||
| 		free(m); | ||||
| 	} | ||||
|  | ||||
| 	while (argv && argv[i]) { | ||||
| 		l = strlen(*argv) + strlen("argv_=") + 16; | ||||
| 		m = xmalloc(sizeof(char) * l); | ||||
| 		snprintf(m, l, "argv_0=%s", argv[i++]); | ||||
| 		xasprintf(&m, "argv_0=%s", argv[i++]); | ||||
| 		rc_stringlist_add(match, m); | ||||
| 		free(m); | ||||
| 	} | ||||
|  | ||||
| 	if (pidfile) { | ||||
| 		l = strlen(pidfile) + 9; | ||||
| 		m = xmalloc(sizeof(char) * l); | ||||
| 		snprintf(m, l, "pidfile=%s", pidfile); | ||||
| 		xasprintf(&m, "pidfile=%s", pidfile); | ||||
| 		rc_stringlist_add(match, m); | ||||
| 		free(m); | ||||
| 	} | ||||
| @@ -381,8 +384,8 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
|     const char *const *argv, | ||||
|     const char *pidfile, bool started) | ||||
| { | ||||
| 	char dirpath[PATH_MAX]; | ||||
| 	char file[PATH_MAX]; | ||||
| 	char *dirpath = NULL; | ||||
| 	char *file = NULL; | ||||
| 	int nfiles = 0; | ||||
| 	char oldfile[PATH_MAX] = { '\0' }; | ||||
| 	bool retval = false; | ||||
| @@ -397,8 +400,7 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
| 	snprintf(dirpath, sizeof(dirpath), RC_SVCDIR "/daemons/%s", | ||||
| 	    basename_c(service)); | ||||
| 	xasprintf(&dirpath, RC_SVCDIR "/daemons/%s", basename_c(service)); | ||||
|  | ||||
| 	/* Regardless, erase any existing daemon info */ | ||||
| 	if ((dp = opendir(dirpath))) { | ||||
| @@ -407,8 +409,7 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
| 			if (d->d_name[0] == '.') | ||||
| 				continue; | ||||
|  | ||||
| 			snprintf(file, sizeof(file), "%s/%s", | ||||
| 			    dirpath, d->d_name); | ||||
| 			xasprintf(&file, "%s/%s", dirpath, d->d_name); | ||||
| 			nfiles++; | ||||
|  | ||||
| 			if (!*oldfile) { | ||||
| @@ -421,6 +422,7 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
| 				rename(file, oldfile); | ||||
| 				strlcpy(oldfile, file, sizeof(oldfile)); | ||||
| 			} | ||||
| 			free(file); | ||||
| 		} | ||||
| 		closedir(dp); | ||||
| 		rc_stringlist_free(match); | ||||
| @@ -429,8 +431,7 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
| 	/* Now store our daemon info */ | ||||
| 	if (started) { | ||||
| 		if (mkdir(dirpath, 0755) == 0 || errno == EEXIST) { | ||||
| 			snprintf(file, sizeof(file), "%s/%03d", | ||||
| 			    dirpath, nfiles + 1); | ||||
| 			xasprintf(&file, "%s/%03d", dirpath, nfiles + 1); | ||||
| 			if ((fp = fopen(file, "w"))) { | ||||
| 				fprintf(fp, "exec="); | ||||
| 				if (exec) | ||||
| @@ -446,10 +447,12 @@ rc_service_daemon_set(const char *service, const char *exec, | ||||
| 				fclose(fp); | ||||
| 				retval = true; | ||||
| 			} | ||||
| 			free(file); | ||||
| 		} | ||||
| 	} else | ||||
| 		retval = true; | ||||
|  | ||||
| 	free(dirpath); | ||||
| 	return retval; | ||||
| } | ||||
| librc_hidden_def(rc_service_daemon_set) | ||||
| @@ -458,8 +461,8 @@ bool | ||||
| rc_service_started_daemon(const char *service, | ||||
|     const char *exec, const char *const *argv, int indx) | ||||
| { | ||||
| 	char dirpath[PATH_MAX]; | ||||
| 	char file[16]; | ||||
| 	char *dirpath = NULL; | ||||
| 	char *file = NULL; | ||||
| 	RC_STRINGLIST *match; | ||||
| 	bool retval = false; | ||||
| 	DIR *dp; | ||||
| @@ -468,13 +471,13 @@ rc_service_started_daemon(const char *service, | ||||
| 	if (!service || !exec) | ||||
| 		return false; | ||||
|  | ||||
| 	snprintf(dirpath, sizeof(dirpath), RC_SVCDIR "/daemons/%s", | ||||
| 	    basename_c(service)); | ||||
| 	xasprintf(&dirpath, RC_SVCDIR "/daemons/%s", basename_c(service)); | ||||
| 	match = _match_list(exec, argv, NULL); | ||||
|  | ||||
| 	if (indx > 0) { | ||||
| 		snprintf(file, sizeof(file), "%03d", indx); | ||||
| 		xasprintf(&file, "%03d", indx); | ||||
| 		retval = _match_daemon(dirpath, file, match); | ||||
| 		free(file); | ||||
| 	} else { | ||||
| 		if ((dp = opendir(dirpath))) { | ||||
| 			while ((d = readdir(dp))) { | ||||
| @@ -489,6 +492,7 @@ rc_service_started_daemon(const char *service, | ||||
| 	} | ||||
|  | ||||
| 	rc_stringlist_free(match); | ||||
| 	free(dirpath); | ||||
| 	return retval; | ||||
| } | ||||
| librc_hidden_def(rc_service_started_daemon) | ||||
|   | ||||
| @@ -237,13 +237,9 @@ static void rc_config_set_value(RC_STRINGLIST *config, char *value) | ||||
| 		if (token[i] == '\n') | ||||
| 			token[i] = 0; | ||||
|  | ||||
| 		i = strlen(entry) + strlen(token) + 2; | ||||
| 		newline = xmalloc(sizeof(char) * i); | ||||
| 		snprintf(newline, i, "%s=%s", entry, token); | ||||
| 		xasprintf(&newline, "%s=%s", entry, token); | ||||
| 	} else { | ||||
| 		i = strlen(entry) + 2; | ||||
| 		newline = xmalloc(sizeof(char) * i); | ||||
| 		snprintf(newline, i, "%s=", entry); | ||||
| 		xasprintf(&newline, "%s=", entry); | ||||
| 	} | ||||
|  | ||||
| 	replaced = false; | ||||
| @@ -300,8 +296,7 @@ static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config) | ||||
|  | ||||
| 		if (value != NULL) { | ||||
| 			len = varlen + strlen(value) + 2; | ||||
| 			tmp = xmalloc(sizeof(char) * len); | ||||
| 			snprintf(tmp, len, "%s=%s", override->value, value); | ||||
| 			xasprintf(&tmp, "%s=%s", override->value, value); | ||||
| 		} | ||||
|  | ||||
| 		/* | ||||
|   | ||||
| @@ -850,7 +850,7 @@ rc_service_state(const char *service) | ||||
| 	} | ||||
|  | ||||
| 	if (state & RC_SERVICE_STARTED) { | ||||
| 		if (rc_service_daemons_crashed(service)) | ||||
| 		if (rc_service_daemons_crashed(service) && errno != EACCES) | ||||
| 			state |= RC_SERVICE_CRASHED; | ||||
| 	} | ||||
| 	if (state & RC_SERVICE_STOPPED) { | ||||
|   | ||||
| @@ -5,8 +5,8 @@ include ${MK}/os.mk | ||||
| SRCS=	checkpath.c do_e.c do_mark_service.c do_service.c \ | ||||
| 		do_value.c fstabinfo.c is_newer_than.c is_older_than.c \ | ||||
| 		mountinfo.c openrc-run.c rc-abort.c rc.c \ | ||||
| 		rc-depend.c rc-logger.c rc-misc.c rc-plugin.c \ | ||||
| 		rc-service.c rc-status.c rc-update.c \ | ||||
| 		rc-depend.c rc-logger.c rc-misc.c rc-pipes.c \ | ||||
| 		rc-plugin.c rc-service.c rc-status.c rc-update.c \ | ||||
| 		shell_var.c start-stop-daemon.c supervise-daemon.c swclock.c _usage.c | ||||
|  | ||||
| ifeq (${MKSELINUX},yes) | ||||
| @@ -158,7 +158,7 @@ rc-service: rc-service.o _usage.o rc-misc.o | ||||
| rc-update: rc-update.o _usage.o rc-misc.o | ||||
| 	${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} | ||||
|  | ||||
| start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-schedules.o | ||||
| start-stop-daemon: start-stop-daemon.o _usage.o rc-misc.o rc-pipes.o rc-schedules.o | ||||
| 	${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD} | ||||
|  | ||||
| supervise-daemon: supervise-daemon.o _usage.o rc-misc.o rc-schedules.o | ||||
|   | ||||
| @@ -269,11 +269,13 @@ int main(int argc, char **argv) | ||||
| 		switch (opt) { | ||||
| 		case 'D': | ||||
| 			trunc = true; | ||||
| 			/* falls through */ | ||||
| 		case 'd': | ||||
| 			type = inode_dir; | ||||
| 			break; | ||||
| 		case 'F': | ||||
| 			trunc = true; | ||||
| 			/* falls through */ | ||||
| 		case 'f': | ||||
| 			type = inode_file; | ||||
| 			break; | ||||
|   | ||||
							
								
								
									
										56
									
								
								src/rc/rc-pipes.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/rc/rc-pipes.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| /* | ||||
|  * rc-pipes.c | ||||
|  * Helper to handle spawning processes and connecting them to pipes. | ||||
|  */ | ||||
|  | ||||
| /* | ||||
|  * Copyright (c) 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. | ||||
|  */ | ||||
|  | ||||
| #include <stdlib.h> | ||||
| #include <unistd.h> | ||||
| #include <sys/types.h> | ||||
|  | ||||
| #include "rc-pipes.h" | ||||
|  | ||||
| static const int pipe_read_end = 0; | ||||
| static const int pipe_write_end = 1; | ||||
|  | ||||
| /* | ||||
|  * Starts a command with stdin redirected from a pipe | ||||
|  * Returns the write end of the pipe or -1 | ||||
|  */ | ||||
| int rc_pipe_command(char *cmd) | ||||
| { | ||||
| 	int pfd[2]; | ||||
| 	pid_t pid; | ||||
|  | ||||
| 	if (pipe(pfd) < 0) | ||||
| 		return -1; | ||||
|  | ||||
| 	pid = fork(); | ||||
| 	if (pid > 0) { | ||||
| 		/* parent */ | ||||
| 		close(pfd[pipe_read_end]); | ||||
| 		return pfd[pipe_write_end]; | ||||
| 	} else if (pid == 0) { | ||||
| 		/* child */ | ||||
| 		close(pfd[pipe_write_end]); | ||||
| 		if (pfd[pipe_read_end] != STDIN_FILENO) { | ||||
| 			if (dup2(pfd[pipe_read_end], STDIN_FILENO) < 0) | ||||
| 				exit(1); | ||||
| 			close(pfd[pipe_read_end]); | ||||
| 		} | ||||
| 		execl("/bin/sh", "sh", "-c", cmd, NULL); | ||||
| 		exit(1); | ||||
| 	} | ||||
| 	return -1; | ||||
| } | ||||
							
								
								
									
										18
									
								
								src/rc/rc-pipes.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/rc/rc-pipes.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| /* | ||||
|  * Copyright (c) 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. | ||||
|  */ | ||||
|  | ||||
| #ifndef RC_PIPES_H | ||||
| #define RC_PIPES_H | ||||
|  | ||||
| int rc_pipe_command(char *cmd); | ||||
|  | ||||
| #endif | ||||
| @@ -75,7 +75,7 @@ print_level(const char *prefix, const char *level) | ||||
| 		printf("%s\n", level); | ||||
| } | ||||
|  | ||||
| static void get_uptime(const char *service, char *uptime, int uptime_size) | ||||
| static char *get_uptime(const char *service) | ||||
| { | ||||
| 	RC_SERVICE state = rc_service_state(service); | ||||
| 	char *start_count; | ||||
| @@ -87,8 +87,8 @@ static void get_uptime(const char *service, char *uptime, int uptime_size) | ||||
| 	time_t diff_hours = (time_t) 0; | ||||
| 	time_t diff_mins = (time_t) 0; | ||||
| 	time_t diff_secs = (time_t) 0; | ||||
| 	char *uptime = NULL; | ||||
|  | ||||
| 	uptime[0] = '\0'; | ||||
| 	if (state & RC_SERVICE_STARTED) { | ||||
| 		start_count = rc_service_value_get(service, "start_count"); | ||||
| 		start_time_string = rc_service_value_get(service, "start_time"); | ||||
| @@ -110,23 +110,24 @@ static void get_uptime(const char *service, char *uptime, int uptime_size) | ||||
| 				diff_secs %= diff_mins * (time_t) 60; | ||||
| 			} | ||||
| 			if (diff_days > 0) | ||||
| 				snprintf(uptime, uptime_size, | ||||
| 				xasprintf(&uptime, | ||||
| 						"%ld day(s) %02ld:%02ld:%02ld (%s)", | ||||
| 						diff_days, diff_hours, diff_mins, diff_secs, | ||||
| 						start_count); | ||||
| 			else | ||||
| 				snprintf(uptime, uptime_size, | ||||
| 				xasprintf(&uptime, | ||||
| 						"%02ld:%02ld:%02ld (%s)", | ||||
| 						diff_hours, diff_mins, diff_secs, start_count); | ||||
| 		} | ||||
| 	} | ||||
| 	return uptime; | ||||
| } | ||||
|  | ||||
| static void | ||||
| print_service(const char *service) | ||||
| { | ||||
| 	char status[60]; | ||||
| 	char uptime [40]; | ||||
| 	char *status = NULL; | ||||
| 	char *uptime = NULL; | ||||
| 	char *child_pid = NULL; | ||||
| 	char *start_time = NULL; | ||||
| 	int cols =  printf(" %s", service); | ||||
| @@ -135,12 +136,12 @@ print_service(const char *service) | ||||
| 	ECOLOR color = ECOLOR_BAD; | ||||
|  | ||||
| 	if (state & RC_SERVICE_STOPPING) | ||||
| 		snprintf(status, sizeof(status), "stopping "); | ||||
| 		xasprintf(&status, "stopping "); | ||||
| 	else if (state & RC_SERVICE_STARTING) { | ||||
| 		snprintf(status, sizeof(status), "starting "); | ||||
| 		xasprintf(&status, "starting "); | ||||
| 		color = ECOLOR_WARN; | ||||
| 	} else if (state & RC_SERVICE_INACTIVE) { | ||||
| 		snprintf(status, sizeof(status), "inactive "); | ||||
| 		xasprintf(&status, "inactive "); | ||||
| 		color = ECOLOR_WARN; | ||||
| 	} else if (state & RC_SERVICE_STARTED) { | ||||
| 		errno = 0; | ||||
| @@ -149,26 +150,31 @@ print_service(const char *service) | ||||
| 			child_pid = rc_service_value_get(service, "child_pid"); | ||||
| 			start_time = rc_service_value_get(service, "start_time"); | ||||
| 			if (start_time && child_pid) | ||||
| 				snprintf(status, sizeof(status), " unsupervised "); | ||||
| 				xasprintf(&status, " unsupervised "); | ||||
| 			else | ||||
| 				snprintf(status, sizeof(status), " crashed "); | ||||
| 				xasprintf(&status, " crashed "); | ||||
| 			free(child_pid); | ||||
| 			free(start_time); | ||||
| 		} else { | ||||
| 			get_uptime(service, uptime, 40); | ||||
| 			snprintf(status, sizeof(status), " started %s", uptime); | ||||
| 			uptime = get_uptime(service); | ||||
| 			if (uptime) { | ||||
| 				xasprintf(&status, " started %s", uptime); | ||||
| 				free(uptime); | ||||
| 			} else | ||||
| 				xasprintf(&status, " started "); | ||||
| 			color = ECOLOR_GOOD; | ||||
| 		} | ||||
| 	} else if (state & RC_SERVICE_SCHEDULED) { | ||||
| 		snprintf(status, sizeof(status), "scheduled"); | ||||
| 		xasprintf(&status, "scheduled"); | ||||
| 		color = ECOLOR_WARN; | ||||
| 	} else | ||||
| 		snprintf(status, sizeof(status), " stopped "); | ||||
| 		xasprintf(&status, " stopped "); | ||||
|  | ||||
| 	errno = 0; | ||||
| 	if (c && *c && isatty(fileno(stdout))) | ||||
| 		printf("\n"); | ||||
| 	ebracket(cols, color, status); | ||||
| 	free(status); | ||||
| } | ||||
|  | ||||
| static void | ||||
|   | ||||
							
								
								
									
										40
									
								
								src/rc/rc.c
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								src/rc/rc.c
									
									
									
									
									
								
							| @@ -101,7 +101,6 @@ clean_failed(void) | ||||
| { | ||||
| 	DIR *dp; | ||||
| 	struct dirent *d; | ||||
| 	size_t l; | ||||
| 	char *path; | ||||
|  | ||||
| 	/* Clean the failed services state dir now */ | ||||
| @@ -112,16 +111,11 @@ clean_failed(void) | ||||
| 				(d->d_name[1] == '.' && d->d_name[2] == '\0'))) | ||||
| 				continue; | ||||
|  | ||||
| 			l = strlen(RC_SVCDIR "/failed/") + | ||||
| 			    strlen(d->d_name) + 1; | ||||
| 			path = xmalloc(sizeof(char) * l); | ||||
| 			snprintf(path, l, RC_SVCDIR "/failed/%s", d->d_name); | ||||
| 			if (path) { | ||||
| 				if (unlink(path)) | ||||
| 					eerror("%s: unlink `%s': %s", | ||||
| 					    applet, path, strerror(errno)); | ||||
| 				free(path); | ||||
| 			} | ||||
| 			xasprintf(&path, RC_SVCDIR "/failed/%s", d->d_name); | ||||
| 			if (unlink(path)) | ||||
| 				eerror("%s: unlink `%s': %s", | ||||
| 				    applet, path, strerror(errno)); | ||||
| 			free(path); | ||||
| 		} | ||||
| 		closedir(dp); | ||||
| 	} | ||||
| @@ -391,7 +385,7 @@ static void | ||||
| handle_signal(int sig) | ||||
| { | ||||
| 	int serrno = errno; | ||||
| 	char signame[10] = { '\0' }; | ||||
| 	char *signame = NULL; | ||||
| 	pid_t pid; | ||||
| 	RC_PID *pi; | ||||
| 	int status = 0; | ||||
| @@ -422,16 +416,16 @@ handle_signal(int sig) | ||||
| 		break; | ||||
|  | ||||
| 	case SIGINT: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGINT"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGINT"); | ||||
| 		/* FALLTHROUGH */ | ||||
| 	case SIGTERM: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGTERM"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGTERM"); | ||||
| 		/* FALLTHROUGH */ | ||||
| 	case SIGQUIT: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGQUIT"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGQUIT"); | ||||
| 		eerrorx("%s: caught %s, aborting", applet, signame); | ||||
| 		/* NOTREACHED */ | ||||
| 	case SIGUSR1: | ||||
| @@ -512,14 +506,11 @@ runlevel_config(const char *service, const char *level) | ||||
| { | ||||
| 	char *init = rc_service_resolve(service); | ||||
| 	char *conf, *dir; | ||||
| 	size_t l; | ||||
| 	bool retval; | ||||
|  | ||||
| 	dir = dirname(init); | ||||
| 	dir = dirname(init); | ||||
| 	l = strlen(dir) + strlen(level) + strlen(service) + 10; | ||||
| 	conf = xmalloc(sizeof(char) * l); | ||||
| 	snprintf(conf, l, "%s/conf.d/%s.%s", dir, service, level); | ||||
| 	xasprintf(&conf, "%s/conf.d/%s.%s", dir, service, level); | ||||
| 	retval = exists(conf); | ||||
| 	free(conf); | ||||
| 	free(init); | ||||
| @@ -744,7 +735,7 @@ int main(int argc, char **argv) | ||||
| 	bool going_down = false; | ||||
| 	int depoptions = RC_DEP_STRICT | RC_DEP_TRACE; | ||||
| 	char *krunlevel = NULL; | ||||
| 	char pidstr[10]; | ||||
| 	char *pidstr = NULL; | ||||
| 	int opt; | ||||
| 	bool parallel; | ||||
| 	int regen = 0; | ||||
| @@ -844,8 +835,9 @@ int main(int argc, char **argv) | ||||
| 	setenv("EINFO_LOG", "openrc", 1); | ||||
|  | ||||
| 	/* Export our PID */ | ||||
| 	snprintf(pidstr, sizeof(pidstr), "%d", getpid()); | ||||
| 	xasprintf(&pidstr, "%d", getpid()); | ||||
| 	setenv("RC_PID", pidstr, 1); | ||||
| 	free(pidstr); | ||||
|  | ||||
| 	/* Create a list of all services which should be started for the new or | ||||
| 	* current runlevel including those in boot, sysinit and hotplugged | ||||
|   | ||||
| @@ -59,13 +59,14 @@ static struct pam_conv conv = { NULL, NULL}; | ||||
| #include "queue.h" | ||||
| #include "rc.h" | ||||
| #include "rc-misc.h" | ||||
| #include "rc-pipes.h" | ||||
| #include "rc-schedules.h" | ||||
| #include "_usage.h" | ||||
| #include "helpers.h" | ||||
|  | ||||
| const char *applet = NULL; | ||||
| const char *extraopts = NULL; | ||||
| const char *getoptstring = "I:KN:PR:Sa:bc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:" \ | ||||
| const char *getoptstring = "I:KN:PR:Sa:bc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:3:4:" \ | ||||
| 	getoptstring_COMMON; | ||||
| const struct option longopts[] = { | ||||
| 	{ "ionice",       1, NULL, 'I'}, | ||||
| @@ -93,6 +94,8 @@ const struct option longopts[] = { | ||||
| 	{ "exec",         1, NULL, 'x'}, | ||||
| 	{ "stdout",       1, NULL, '1'}, | ||||
| 	{ "stderr",       1, NULL, '2'}, | ||||
| 	{ "stdout-logger",1, NULL, '3'}, | ||||
| 	{ "stderr-logger",1, NULL, '4'}, | ||||
| 	{ "progress",     0, NULL, 'P'}, | ||||
| 	longopts_COMMON | ||||
| }; | ||||
| @@ -122,6 +125,8 @@ const char * const longopts_help[] = { | ||||
| 	"Binary to start/stop", | ||||
| 	"Redirect stdout to file", | ||||
| 	"Redirect stderr to file", | ||||
| 	"Redirect stdout to process", | ||||
| 	"Redirect stderr to process", | ||||
| 	"Print dots each second while waiting", | ||||
| 	longopts_help_COMMON | ||||
| }; | ||||
| @@ -162,20 +167,20 @@ handle_signal(int sig) | ||||
| { | ||||
| 	int status; | ||||
| 	int serrno = errno; | ||||
| 	char signame[10] = { '\0' }; | ||||
| 	char *signame = NULL; | ||||
|  | ||||
| 	switch (sig) { | ||||
| 	case SIGINT: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGINT"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGINT"); | ||||
| 		/* FALLTHROUGH */ | ||||
| 	case SIGTERM: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGTERM"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGTERM"); | ||||
| 		/* FALLTHROUGH */ | ||||
| 	case SIGQUIT: | ||||
| 		if (!signame[0]) | ||||
| 			snprintf(signame, sizeof(signame), "SIGQUIT"); | ||||
| 		if (!signame) | ||||
| 			xasprintf(&signame, "SIGQUIT"); | ||||
| 		eerrorx("%s: caught %s, aborting", applet, signame); | ||||
| 		/* NOTREACHED */ | ||||
|  | ||||
| @@ -194,6 +199,9 @@ handle_signal(int sig) | ||||
| 		eerror("%s: caught unknown signal %d", applet, sig); | ||||
| 	} | ||||
|  | ||||
| 	/* free signame */ | ||||
| 	free(signame); | ||||
|  | ||||
| 	/* Restore errno */ | ||||
| 	errno = serrno; | ||||
| } | ||||
| @@ -202,7 +210,6 @@ static char * | ||||
| expand_home(const char *home, const char *path) | ||||
| { | ||||
| 	char *opath, *ppath, *p, *nh; | ||||
| 	size_t len; | ||||
| 	struct passwd *pw; | ||||
|  | ||||
| 	if (!path || *path != '~') | ||||
| @@ -233,9 +240,7 @@ expand_home(const char *home, const char *path) | ||||
| 		return xstrdup(home); | ||||
| 	} | ||||
|  | ||||
| 	len = strlen(ppath) + strlen(home) + 1; | ||||
| 	nh = xmalloc(len); | ||||
| 	snprintf(nh, len, "%s%s", home, ppath); | ||||
| 	xasprintf(&nh, "%s%s", home, ppath); | ||||
| 	free(opath); | ||||
| 	return nh; | ||||
| } | ||||
| @@ -276,6 +281,8 @@ int main(int argc, char **argv) | ||||
| 	int tid = 0; | ||||
| 	char *redirect_stderr = NULL; | ||||
| 	char *redirect_stdout = NULL; | ||||
| 	char *stderr_process = NULL; | ||||
| 	char *stdout_process = NULL; | ||||
| 	int stdin_fd; | ||||
| 	int stdout_fd; | ||||
| 	int stderr_fd; | ||||
| @@ -379,6 +386,7 @@ int main(int argc, char **argv) | ||||
| 		case 'c':  /* --chuid <username>|<uid> */ | ||||
| 			/* DEPRECATED */ | ||||
| 			ewarn("WARNING: -c/--chuid is deprecated and will be removed in the future, please use -u/--user instead"); | ||||
| 			/* falls through */ | ||||
| 		case 'u':  /* --user <username>|<uid> */ | ||||
| 		{ | ||||
| 			p = optarg; | ||||
| @@ -500,6 +508,14 @@ int main(int argc, char **argv) | ||||
| 			redirect_stderr = optarg; | ||||
| 			break; | ||||
|  | ||||
| 		case '3':   /* --stdout-logger "command to run for stdout logging" */ | ||||
| 			stdout_process = optarg; | ||||
| 			break; | ||||
|  | ||||
| 		case '4':  /* --stderr-logger "command to run for stderr logging" */ | ||||
| 			stderr_process = optarg; | ||||
| 			break; | ||||
|  | ||||
| 		case_RC_COMMON_GETOPT | ||||
| 		} | ||||
|  | ||||
| @@ -551,6 +567,9 @@ int main(int argc, char **argv) | ||||
| 		if (redirect_stdout || redirect_stderr) | ||||
| 			eerrorx("%s: --stdout and --stderr are only relevant" | ||||
| 			    " with --start", applet); | ||||
| 		if (stdout_process || stderr_process) | ||||
| 			eerrorx("%s: --stdout-logger and --stderr-logger are only relevant" | ||||
| 			    " with --start", applet); | ||||
| 		if (start_wait) | ||||
| 			ewarn("using --wait with --stop has no effect," | ||||
| 			    " use --retry instead"); | ||||
| @@ -563,6 +582,15 @@ int main(int argc, char **argv) | ||||
| 		if ((redirect_stdout || redirect_stderr) && !background) | ||||
| 			eerrorx("%s: --stdout and --stderr are only relevant" | ||||
| 			    " with --background", applet); | ||||
| 		if ((stdout_process || stderr_process) && !background) | ||||
| 			eerrorx("%s: --stdout-logger and --stderr-logger are only relevant" | ||||
| 			    " with --background", applet); | ||||
| 		if (redirect_stdout && stdout_process) | ||||
| 			eerrorx("%s: do not use --stdout and --stdout-logger together", | ||||
| 					applet); | ||||
| 		if (redirect_stderr && stderr_process) | ||||
| 			eerrorx("%s: do not use --stderr and --stderr-logger together", | ||||
| 					applet); | ||||
| 	} | ||||
|  | ||||
| 	/* Expand ~ */ | ||||
| @@ -603,7 +631,6 @@ int main(int argc, char **argv) | ||||
| 		    *exec_file ? exec_file : exec); | ||||
| 		free(exec_file); | ||||
| 		exit(EXIT_FAILURE); | ||||
|  | ||||
| 	} | ||||
| 	if (start && retry) | ||||
| 		ewarn("using --retry with --start has no effect," | ||||
| @@ -886,6 +913,12 @@ int main(int argc, char **argv) | ||||
| 				eerrorx("%s: unable to open the logfile" | ||||
| 				    " for stdout `%s': %s", | ||||
| 				    applet, redirect_stdout, strerror(errno)); | ||||
| 		}else if (stdout_process) { | ||||
| 			stdout_fd = rc_pipe_command(stdout_process); | ||||
| 			if (stdout_fd == -1) | ||||
| 				eerrorx("%s: unable to open the logging process" | ||||
| 				    " for stdout `%s': %s", | ||||
| 				    applet, stdout_process, strerror(errno)); | ||||
| 		} | ||||
| 		if (redirect_stderr) { | ||||
| 			if ((stderr_fd = open(redirect_stderr, | ||||
| @@ -894,13 +927,21 @@ int main(int argc, char **argv) | ||||
| 				eerrorx("%s: unable to open the logfile" | ||||
| 				    " for stderr `%s': %s", | ||||
| 				    applet, redirect_stderr, strerror(errno)); | ||||
| 		}else if (stderr_process) { | ||||
| 			stderr_fd = rc_pipe_command(stderr_process); | ||||
| 			if (stderr_fd == -1) | ||||
| 				eerrorx("%s: unable to open the logging process" | ||||
| 				    " for stderr `%s': %s", | ||||
| 				    applet, stderr_process, strerror(errno)); | ||||
| 		} | ||||
|  | ||||
| 		if (background) | ||||
| 			dup2(stdin_fd, STDIN_FILENO); | ||||
| 		if (background || redirect_stdout || rc_yesno(getenv("EINFO_QUIET"))) | ||||
| 		if (background || redirect_stdout || stdout_process | ||||
| 				|| rc_yesno(getenv("EINFO_QUIET"))) | ||||
| 			dup2(stdout_fd, STDOUT_FILENO); | ||||
| 		if (background || redirect_stderr || rc_yesno(getenv("EINFO_QUIET"))) | ||||
| 		if (background || redirect_stderr || stderr_process | ||||
| 				|| rc_yesno(getenv("EINFO_QUIET"))) | ||||
| 			dup2(stderr_fd, STDERR_FILENO); | ||||
|  | ||||
| 		for (i = getdtablesize() - 1; i >= 3; --i) | ||||
|   | ||||
| @@ -186,7 +186,6 @@ static void handle_signal(int sig) | ||||
| static char * expand_home(const char *home, const char *path) | ||||
| { | ||||
| 	char *opath, *ppath, *p, *nh; | ||||
| 	size_t len; | ||||
| 	struct passwd *pw; | ||||
|  | ||||
| 	if (!path || *path != '~') | ||||
| @@ -217,9 +216,7 @@ static char * expand_home(const char *home, const char *path) | ||||
| 		return xstrdup(home); | ||||
| 	} | ||||
|  | ||||
| 	len = strlen(ppath) + strlen(home) + 1; | ||||
| 	nh = xmalloc(len); | ||||
| 	snprintf(nh, len, "%s%s", home, ppath); | ||||
| 	xasprintf(&nh, "%s%s", home, ppath); | ||||
| 	free(opath); | ||||
| 	return nh; | ||||
| } | ||||
| @@ -510,7 +507,7 @@ static void supervisor(char *exec, char **argv) | ||||
| 					first_spawn = 0; | ||||
| 				} else | ||||
| 					respawn_count++; | ||||
| 				if (respawn_count >= respawn_max) { | ||||
| 				if (respawn_count > respawn_max) { | ||||
| 					syslog(LOG_WARNING, | ||||
| 							"respawned \"%s\" too many times, exiting", exec); | ||||
| 					exiting = true; | ||||
| @@ -863,10 +860,13 @@ int main(int argc, char **argv) | ||||
| 		varbuf = NULL; | ||||
| 		xasprintf(&varbuf, "%i", respawn_delay); | ||||
| 		rc_service_value_set(svcname, "respawn_delay", varbuf); | ||||
| 		free(varbuf); | ||||
| 		xasprintf(&varbuf, "%i", respawn_max); | ||||
| 		rc_service_value_set(svcname, "respawn_max", varbuf); | ||||
| 		free(varbuf); | ||||
| 		xasprintf(&varbuf, "%i", respawn_period); | ||||
| 		rc_service_value_set(svcname, "respawn_period", varbuf); | ||||
| 		free(varbuf); | ||||
| 		child_pid = fork(); | ||||
| 		if (child_pid == -1) | ||||
| 			eerrorx("%s: fork: %s", applet, strerror(errno)); | ||||
| @@ -894,6 +894,7 @@ int main(int argc, char **argv) | ||||
| 			} | ||||
| 			xasprintf(&varbuf, "%d", x); | ||||
| 				rc_service_value_set(svcname, "argc", varbuf); | ||||
| 				free(varbuf); | ||||
| 			rc_service_value_set(svcname, "exec", exec); | ||||
| 			supervisor(exec, argv); | ||||
| 		} else | ||||
|   | ||||
| @@ -90,8 +90,8 @@ the service script by hand. | ||||
|  | ||||
| FIXME: Document stacked runlevels | ||||
|  | ||||
| The default startup uses the runlevels `boot`, `sysinit` and `default`, in that  | ||||
| order. Shutdown uses the `shutdown` runlevel. | ||||
| The default startup uses the runlevels `sysinit`, `boot`, and `default`, | ||||
| in that order. Shutdown uses the `shutdown` runlevel. | ||||
|  | ||||
| # The Magic of `conf.d` | ||||
|  | ||||
| @@ -162,7 +162,6 @@ stopped, by using: | ||||
| The `rc_cgroup_cleanup` setting can be changed to yes to make this | ||||
| happen automatically when the service is stopped. | ||||
|  | ||||
|  | ||||
| # Caching | ||||
|  | ||||
| For performance reasons OpenRC keeps a cache of pre-parsed service metadata | ||||
|   | ||||
		Reference in New Issue
	
	Block a user