Compare commits

...
Sign in to create a new pull request.

7 commits

Author SHA1 Message Date
Fedora Release Engineering
629da164ac dist-git conversion 2010-07-29 14:46:14 +00:00
Bill Nottingham
cc49021baa Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:15:35 +00:00
Dennis Gilmore
82560694f2 apply OLPC init patch 2008-06-12 20:40:29 +00:00
Dennis Gilmore
934e819237 Initialize branch OLPC-3 for upstart 2008-06-12 20:39:20 +00:00
Bill Nottingham
77efc19190 move the obsoletes/provides for sysvinit here 2008-04-25 21:22:21 +00:00
Bill Nottingham
9b026ea12c more typos 2008-04-24 20:34:54 +00:00
Bill Nottingham
8fdf36e71d - fix some man page typos (#444008, <archimerged@gmail.com>) 2008-04-24 18:15:04 +00:00
6 changed files with 206 additions and 25 deletions

View file

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: upstart
# $Id$
NAME := upstart
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -109,7 +109,7 @@ fork in the background and that its PID needs to be obtained.
.TP
.BI respawn
This sets the daemon, service, and respawn falgs for the job.
This sets the daemon, service, and respawn flags for the job.
The respawn flag means that the process will be restarted when
it ends.
@ -146,7 +146,7 @@ Sets the time to wait between sending TERM and KILL signals to
.TP
.BI "normal exit <status>"
When used with \fBespawn\fR any exit codes denoted in \fIstatus\fR will
When used with \fBrespawn\fR any exit codes denoted in \fIstatus\fR will
prevent a respawn of the process.
.TP

20
upstart-initctl-man.patch Normal file
View file

@ -0,0 +1,20 @@
--- upstart-0.3.9/util/man/initctl.8-orig 2008-04-09 16:52:23.000000000 -0400
+++ upstart-0.3.9/util/man/initctl.8 2008-04-24 01:42:57.000000000 -0400
@@ -4,7 +4,7 @@
initctl \- init daemon control utility
.\"
.SH SYNOPSIS
-\fBinitctl\fR [\fIOPTION\fR]... \fICOMMAND\fR [\fIOPTION\fR]... \fIARG...\fR
+\fBinitctl\fR [\fIOPTION\fR]... \fICOMMAND\fR [\fIOPTION\fR]... \fIARG\fR...
.\"
.SH DESCRIPTION
.B initctl
@@ -14,7 +14,7 @@
.IR COMMAND .
Normally it is invoked directly with the command specified as the first
-non-option argument, however symbolic or hard links may be used so that
+non-option argument; however, symbolic or hard links may be used so that
it is invoked as the name of a command, in which case it behaves
accordingly.
.\"

168
upstart-olpc-init.patch Normal file
View file

@ -0,0 +1,168 @@
diff -ru upstart-0.3.9/init/control.c upstart-0.3.9/init/control.c
--- upstart-0.3.9/init/control.c 2008-05-06 23:45:35.000000000 -0400
+++ upstart-0.3.9/init/control.c 2008-05-06 23:43:31.000000000 -0400
@@ -26,6 +26,8 @@
#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
#include <errno.h>
#include <unistd.h>
@@ -134,7 +136,69 @@
UPSTART_MESSAGE_LAST
};
+/**
+ * upstart_addr:
+ * @addr: address structure to fill,
+ * @pid: process id.
+ *
+ * Fills the given address structure with the address that a process of
+ * @pid should be listening for responses on.
+ *
+ * The AF_UNIX abstract namespace is used with the init daemon (process #1)
+ * bound to /com/ubuntu/upstart and clients bound to /com/ubuntu/upstart/$PID
+ *
+ * Returns: size of address.
+ **/
+static size_t
+upstart_init_addr (struct sockaddr_un *addr,
+ pid_t pid)
+{
+ size_t addrlen;
+
+ nih_assert (addr != NULL);
+ nih_assert (pid > 0);
+
+ addr->sun_family = AF_UNIX;
+ addr->sun_path[0] = '\0';
+ addrlen = offsetof (struct sockaddr_un, sun_path) + 1;
+ addrlen += snprintf (addr->sun_path + 1,
+ sizeof (addr->sun_path) - 1,
+ "/com/ubuntu/upstart");
+
+ return addrlen;
+}
+
+int
+upstart_init_open (void)
+{
+ struct sockaddr_un addr;
+ size_t addrlen;
+ int sock, optval;
+
+ /* Communication is performed using a unix datagram socket */
+ sock = socket (PF_UNIX, SOCK_DGRAM, 0);
+ if (sock < 0)
+ nih_return_system_error (-1);
+
+ /* Bind the socket so we can receive responses */
+ addrlen = upstart_init_addr (&addr, getpid ());
+ if (bind (sock, (struct sockaddr *)&addr, addrlen) < 0)
+ goto error;
+
+ /* Always requests credentials */
+ optval = 1;
+ if (setsockopt (sock, SOL_SOCKET, SO_PASSCRED, &optval,
+ sizeof (optval)) < 0)
+ goto error;
+
+ return sock;
+
+error:
+ nih_error_raise_system ();
+ close (sock);
+ return -1;
+}
/**
* control_open:
@@ -150,7 +214,7 @@
{
int sock;
- sock = upstart_open ();
+ sock = upstart_init_open ();
if (sock < 0)
return NULL;
diff -ru upstart-0.3.9/init/main.c ./main.c
--- upstart-0.3.9/init/main.c 2008-05-06 23:45:35.000000000 -0400
+++ ./main.c 2008-05-06 23:37:53.000000000 -0400
@@ -95,6 +95,8 @@
**/
static int rescue = FALSE;
+static int snarf = FALSE;
+
/**
* options:
@@ -102,8 +104,9 @@
* Command-line options we accept.
**/
static NihOption options[] = {
- { 0, "restart", NULL, NULL, NULL, &restart, NULL },
- { 0, "rescue", NULL, NULL, NULL, &rescue, NULL },
+ { 'd', "restart", "Restart init (bad idea?)", NULL, NULL, &restart, NULL },
+ { 's', "rescue", "Perform rescue operations?", NULL, NULL, &rescue, NULL },
+ { 'i', "init", "Snarf PID happily.", NULL, NULL, &snarf, NULL },
/* Ignore invalid options */
{ '-', "--", NULL, NULL, NULL, NULL, NULL },
@@ -139,7 +142,9 @@
}
/* Check we're process #1 */
- if (getpid () > 1) {
+ if (snarf) {
+ int pid = getpid();
+ } else if (getpid () > 1) {
execv (TELINIT, argv);
/* Ignore failure, probably just that telinit doesn't exist */
@@ -147,7 +152,6 @@
exit (1);
}
-
/* Clear our arguments from the command-line, so that we show up in
* ps or top output as /sbin/init, with no extra flags.
*
diff -ru upstart-0.3.9/upstart/message.c ./main.c
--- upstart-0.3.9/upstart/message.c 2008-05-07 10:45:31.000000000 -0400
+++ upstart-0.3.9/upstart/message.c 2008-05-07 10:46:00.000000000 -0400
@@ -515,30 +515,6 @@
*/
}
- /* Check the origin of the message, this is a safety trap so we
- * don't even bother parsing memory if the process shouldn't be able
- * to talk to us.
- *
- * Only the init daemon accepts messages from any process, others
- * will only accept messages from the init daemon or themselves.
- *
- * In addition, we only permit messages to come from a process
- * running as root or our own user id (though this may be relaxed
- * for the init daemon later).
- */
- if (! upstart_disable_safeties) {
- if (cred.pid == 0)
- goto illegal;
-
- if ((cred.pid != UPSTART_INIT_DAEMON)
- && (cred.pid != getpid ())
- && (getpid () != UPSTART_INIT_DAEMON))
- goto illegal;
-
- if ((cred.uid != 0) && (cred.uid != getuid ()))
- goto illegal;
- }
-
/* Read the header from the message, which tells us what type of
* message follows.

View file

@ -1,6 +1,6 @@
Name: upstart
Version: 0.3.9
Release: 17%{?dist}
Release: 19%{?dist}.1
Summary: An event-driven init system
Group: System Environment/Base
@ -14,8 +14,11 @@ Patch2: upstart-tty-stack.patch
Patch3: upstart-rpm.patch
Patch4: upstart-fedora-buglist.patch
Patch5: upstart-telinit-u.patch
Patch6: upstart-initctl-man.patch
Patch7: upstart-olpc-init.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24
Provides: SysVinit = 2.86-24, sysvinit = 2.86-24
BuildRequires: gettext
%description
@ -31,6 +34,8 @@ during shutdown and supervising them while the system is running.
%patch3
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%build
%configure --enable-compat=sysv --sbindir=/sbin --libdir=/%{_lib}
@ -96,6 +101,15 @@ rm -rf %{buildroot}
%{_mandir}/man8/telinit.8.gz
%changelog
* Wed May 07 2008 Dennis Gilmore <dennis@laptop.org> - 0.3.9-19.1
- apply patch from Blake Setlow allowing upstart to run as a PID other than 1
* Fri Apr 25 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-19
- with the merge of event-compat-sysv, move the sysvinit obsoletes/provides here
* Thu Apr 24 2008 Bill Nottingham <notting@redhat.com> - 0.3.9-18
- fix some man page typos (#444008, <archimerged@gmail.com>)
* Wed Apr 09 2008 Casey Dahlin <cjdahlin@ncsu.edu> - 0.3.9-17
- Added list of stock events to events(5)