FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 01-08-2011, 09:09 PM
Mike Frysinger
 
Default openrc: make exit codes comply with Linux Standard Base

On Saturday, January 08, 2011 18:51:36 Eray Aslan wrote:
> The trivial patch below makes openrc comply with LSB. I am not aware of
> any service depending on the changed behaviour.

this belongs in bugzilla, not the gentoo-dev mailing list
-mike
 
Old 01-08-2011, 09:21 PM
Eray Aslan
 
Default openrc: make exit codes comply with Linux Standard Base

On Sat, Jan 08, 2011 at 05:09:21PM -0500, Mike Frysinger wrote:
> this belongs in bugzilla, not the gentoo-dev mailing list

Well, this is the upstream ML but anyway, no big deal:

https://bugs.gentoo.org/show_bug.cgi?id=351160

--
Eray Aslan
Developer, Gentoo Linux eras <at> gentoo.org
 
Old 01-08-2011, 09:43 PM
Mike Frysinger
 
Default openrc: make exit codes comply with Linux Standard Base

On Saturday, January 08, 2011 17:21:18 Eray Aslan wrote:
> On Sat, Jan 08, 2011 at 05:09:21PM -0500, Mike Frysinger wrote:
> > this belongs in bugzilla, not the gentoo-dev mailing list
>
> Well, this is the upstream ML

which might be relevant if we were talking about a project dedicated to a
package or two, but we arent. this is a general distro development list, not
random sub-projects that happen to come out of it. same goes for sandbox, or
catalyst, or genkernel, or crossdev, or gli, or ...

also, nowhere in the openrc package does it indicate the gentoo-dev mailing
list should be used for reporting. it does say explicitly to use bugs.g.o
though. it also mentions Roy's old site, but i'll fix that.
-mike
 
Old 01-08-2011, 10:51 PM
Eray Aslan
 
Default openrc: make exit codes comply with Linux Standard Base

Linux Standard Base[1] states that for init scripts:

* status command for a stopped service should have a return code of 3
* starting an already started service or stopping an already stopped
service should be considered as successful

The trivial patch below makes openrc comply with LSB. I am not aware of
any service depending on the changed behaviour.

Use case: One can use Gentoo init scripts with cluster management
software - such as sys-cluster/pacemaker - instead of writing a resource
agent or trying to work around their limitations for each managed
service.

[1]
http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html


Signed-off-by: Eray Aslan <eras@gentoo.org>
---
sh/runscript.sh.in | 2 +-
src/rc/runscript.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 3d7252a..ea40573 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -89,7 +89,7 @@ _status()
return 0
else
einfo "status: stopped"
- return 1
+ return 3
fi
}

diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index f3f0517..a264535 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -596,8 +596,10 @@ svc_start_check(void)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);

- if (state & RC_SERVICE_STARTED)
- ewarnx("WARNING: %s has already been started", applet);
+ if (state & RC_SERVICE_STARTED) {
+ einfo("%s has already been started", applet);
+ exit(EXIT_SUCCESS);
+ }
else if (state & RC_SERVICE_INACTIVE && !in_background)
ewarnx("WARNING: %s has already started, but is inactive",
applet);
@@ -845,8 +847,10 @@ svc_stop_check(RC_SERVICE *state)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);

- if (*state & RC_SERVICE_STOPPED)
- ewarnx("WARNING: %s is already stopped", applet);
+ if (*state & RC_SERVICE_STOPPED) {
+ einfo("%s is already stopped", applet);
+ exit(EXIT_SUCCESS);
+ }

rc_service_mark(service, RC_SERVICE_STOPPING);
hook_out = RC_HOOK_SERVICE_STOP_OUT;
--
1.7.3.4
 

Thread Tools




All times are GMT. The time now is 04:48 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org