This commit is contained in:
commit
6183ffa1b0
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
4
killproc-2.12.dif
Normal file
4
killproc-2.12.dif
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
--- .touch
|
||||||
|
+++ .touch
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+This patch is empty
|
3
killproc-2.12.tar.bz2
Normal file
3
killproc-2.12.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:806aec54c3de16eaf9b412e1efc0fdd5ef4e4151b92602f29ab874879b8b3ffa
|
||||||
|
size 32251
|
254
powerd-2.0.2.dif
Normal file
254
powerd-2.0.2.dif
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
--- Makefile.in
|
||||||
|
+++ Makefile.in 2006-02-07 16:29:20.000000000 +0100
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
detectups: detectups.c
|
||||||
|
- $(CC) $(LFLAGS) $(LIBS) detectups.c -o detectups
|
||||||
|
+ $(CC) $(LFLAGS) $(CFLAGS) $(LIBS) detectups.c -o detectups
|
||||||
|
|
||||||
|
powerd: powerd.h config.h $(OBJS)
|
||||||
|
$(CC) $(LFLAGS) $(LIBS) $(OBJS) -o $@
|
||||||
|
--- config.h
|
||||||
|
+++ config.h 2006-02-07 16:31:03.000000000 +0100
|
||||||
|
@@ -8,7 +8,12 @@
|
||||||
|
/* You shouldnt (and it wont work unless you have modified init) change
|
||||||
|
* this file - this is what init uses to know the power status.
|
||||||
|
*/
|
||||||
|
-#define PWRSTAT "/etc/powerstatus"
|
||||||
|
+#define PWRSTAT "/var/run/powerstatus"
|
||||||
|
+#if defined(linux)
|
||||||
|
+# include <initreq.h>
|
||||||
|
+# define NEWINIT
|
||||||
|
+# define INIT_REQ_SLEEP 5
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Define this if you want to develop on powerd. This will cause powerd to
|
||||||
|
--- powerd.c
|
||||||
|
+++ powerd.c 2006-02-07 17:18:38.000000000 +0100
|
||||||
|
@@ -27,7 +27,6 @@
|
||||||
|
|
||||||
|
#include "powerd.h"
|
||||||
|
|
||||||
|
-
|
||||||
|
static Client *clients;
|
||||||
|
static Listen *listens;
|
||||||
|
|
||||||
|
@@ -73,7 +72,10 @@
|
||||||
|
int i;
|
||||||
|
#endif
|
||||||
|
char *me=argv[0];
|
||||||
|
+ char *base = basename(me);
|
||||||
|
+ char *pidf = NULL;
|
||||||
|
int delay = 16;
|
||||||
|
+ int n;
|
||||||
|
|
||||||
|
if (argc<1 || (argc >1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")))) {
|
||||||
|
printf("powerd %s by: James Brents <james@nistix.com> (DaSyonic)\n\n", ver);
|
||||||
|
@@ -92,10 +94,36 @@
|
||||||
|
setsid();
|
||||||
|
|
||||||
|
if ((root = getuid())) {
|
||||||
|
- fprintf(stderr, "%s: need to have root privlidges.", me);
|
||||||
|
+ fprintf(stderr, "%s: need to have root privliges\n", me);
|
||||||
|
} else if (touser != NULL) {
|
||||||
|
if (seteuid(user = uname2id(touser)) == -1)
|
||||||
|
- fprintf(stderr, "%s is not a valid username.", touser);
|
||||||
|
+ fprintf(stderr, "%s is not a valid username: %s\n", touser, strerror(errno));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((pidf = (char*)malloc(strlen(_PATH_VARRUN)+strlen(base)+1+3+1)) == NULL) {
|
||||||
|
+ fprintf(stderr, "%s: can create pid file: %s\n", me, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ pidf = strcpy(pidf, _PATH_VARRUN);
|
||||||
|
+ pidf = strcat(pidf, base);
|
||||||
|
+ pidf = strcat(pidf, ".pid");
|
||||||
|
+
|
||||||
|
+ if ((n = open(pidf, O_WRONLY|O_CREAT|O_TRUNC)) == -1) {
|
||||||
|
+ fprintf(stderr, "%s: can create pid file: %s\n", me, strerror(errno));
|
||||||
|
+ } else {
|
||||||
|
+ snprintf(logbuffer, sizeof(logbuffer)-1, "%d", (int)getpid());
|
||||||
|
+ write(n, logbuffer, strlen(logbuffer));
|
||||||
|
+ close(n);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((n = open("/dev/null", O_RDWR)) == -1) {
|
||||||
|
+ fprintf(stderr, "%s: can not open /dev/null.", me);
|
||||||
|
+ } else {
|
||||||
|
+ (void)dup2(n, 0);
|
||||||
|
+ (void)dup2(n, 1);
|
||||||
|
+ (void)dup2(n, 2);
|
||||||
|
+ (void)close(n);
|
||||||
|
+ errno=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
@@ -116,6 +144,8 @@
|
||||||
|
monitorups(delay);
|
||||||
|
else if (mode == 1)
|
||||||
|
bindport();
|
||||||
|
+ if (pidf)
|
||||||
|
+ (void)unlink(pidf);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -194,9 +224,12 @@
|
||||||
|
/* log to the syslog */
|
||||||
|
void log(int type, int facility, const char *entry, ...)
|
||||||
|
{
|
||||||
|
+ va_list ap;
|
||||||
|
+ va_start(ap, entry);
|
||||||
|
openlog("powerd", LOG_CONS | LOG_PID, facility);
|
||||||
|
- syslog(type, entry);
|
||||||
|
+ vsyslog(type, entry, ap);
|
||||||
|
closelog();
|
||||||
|
+ va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Borrowed from Apache
|
||||||
|
@@ -220,12 +253,39 @@
|
||||||
|
*/
|
||||||
|
void notifyinit(int status) {
|
||||||
|
unsigned int file;
|
||||||
|
+#ifdef NEWINIT
|
||||||
|
+ struct init_request req;
|
||||||
|
+ int success = 0;
|
||||||
|
+ void (*save_sigalrm)();
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
|
if (touser != NULL)
|
||||||
|
seteuid(root);
|
||||||
|
|
||||||
|
+#ifdef NEWINIT
|
||||||
|
+ /* Fill out the request struct. */
|
||||||
|
+ memset(&req, 0, sizeof(req));
|
||||||
|
+ req.magic = INIT_MAGIC;
|
||||||
|
+ req.sleeptime = INIT_REQ_SLEEP;
|
||||||
|
+ req.cmd = (status == FAIL) ? INIT_CMD_POWERFAIL : INIT_CMD_POWEROK;
|
||||||
|
+
|
||||||
|
+ /* Open the fifo (with timeout) */
|
||||||
|
+ save_sigalrm = signal(SIGALRM, alarm_handler);
|
||||||
|
+ alarm(3);
|
||||||
|
+ if ((file = open(INIT_FIFO, O_WRONLY, 0644)) >= 0) {
|
||||||
|
+ if (write(file, &req, sizeof(req)) == sizeof(req))
|
||||||
|
+ success = 1;
|
||||||
|
+ close(file);
|
||||||
|
+ }
|
||||||
|
+ alarm(0);
|
||||||
|
+ (void)signal(SIGALRM, save_sigalrm);
|
||||||
|
+
|
||||||
|
+ if (!success) {
|
||||||
|
+ /* The old method ... */
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if ((file = open(PWRSTAT, O_CREAT | O_WRONLY, 0644)) == -1) {
|
||||||
|
fprintf(stderr, "Cant open %s: %s\n", PWRSTAT, strerror(errno));
|
||||||
|
exit(-1);
|
||||||
|
@@ -237,6 +297,10 @@
|
||||||
|
#else
|
||||||
|
bsdshutdown(status);
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+#ifdef NEWINIT
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
if (touser != NULL)
|
||||||
|
seteuid(user);
|
||||||
|
|
||||||
|
@@ -259,7 +323,8 @@
|
||||||
|
* connections
|
||||||
|
*/
|
||||||
|
int bindport() {
|
||||||
|
- int len, addr_len, newfd, sin_size, numbytes;
|
||||||
|
+ socklen_t len, sin_size;
|
||||||
|
+ int newfd, numbytes;
|
||||||
|
struct sockaddr_in serveraddr, remoteaddr;
|
||||||
|
struct timeval mytv;
|
||||||
|
FileDescriptor *list;
|
||||||
|
@@ -289,7 +354,7 @@
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
- len = sizeof(serveraddr);
|
||||||
|
+ len = (socklen_t)sizeof(serveraddr);
|
||||||
|
|
||||||
|
if (getsockname(serverfd, (struct sockaddr *)&serveraddr, &len)) {
|
||||||
|
fprintf(stderr, "getsockname()\n");
|
||||||
|
@@ -301,8 +366,6 @@
|
||||||
|
if ((touser != NULL) && (listenport < 1024))
|
||||||
|
seteuid(user);
|
||||||
|
|
||||||
|
- addr_len = sizeof(struct sockaddr);
|
||||||
|
-
|
||||||
|
// printf("Im here\n");
|
||||||
|
while (1) {
|
||||||
|
errno = 0;
|
||||||
|
@@ -321,7 +384,7 @@
|
||||||
|
|
||||||
|
if (FD_ISSET(serverfd, &readfds)) {
|
||||||
|
FileDescriptor *tmp;
|
||||||
|
- sin_size = sizeof(struct sockaddr_in);
|
||||||
|
+ sin_size = (socklen_t)sizeof(struct sockaddr_in);
|
||||||
|
if ((newfd=accept(serverfd, (struct sockaddr *)&remoteaddr,
|
||||||
|
&sin_size)) == -1) {
|
||||||
|
perror("accept");
|
||||||
|
@@ -540,6 +603,15 @@
|
||||||
|
mypower = (mypower == 1) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+#ifdef NEWINIT
|
||||||
|
+/* alarm handler for communication with init */
|
||||||
|
+/* static */ void alarm_handler (int sig)
|
||||||
|
+{
|
||||||
|
+ printf("Writing to init FIFO %s timed out\n", INIT_FIFO);
|
||||||
|
+ sleep(1);
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Open and parse the configuration file
|
||||||
|
*/
|
||||||
|
void openconfig(int *delay) {
|
||||||
|
--- powerd.h.in
|
||||||
|
+++ powerd.h.in 2006-02-07 17:07:39.000000000 +0100
|
||||||
|
@@ -60,6 +60,7 @@
|
||||||
|
/*********** If you do, Please send patches. **********/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
+#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
@@ -77,6 +78,11 @@
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
+#include <libgen.h>
|
||||||
|
+#include <paths.h>
|
||||||
|
+#ifndef _PATH_VARRUN
|
||||||
|
+# define _PATH_VARRUN "/var/run/"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#define CONNECTED 0x01
|
||||||
|
#define SENTNOTICE 0x02
|
||||||
|
@@ -122,7 +128,8 @@
|
||||||
|
Listen *listen;
|
||||||
|
};
|
||||||
|
|
||||||
|
-void log(int type, int facility, const char *entry, ...);
|
||||||
|
+void mylog(int type, int facility, const char *entry, ...);
|
||||||
|
+#define log(args...) mylog(args)
|
||||||
|
uid_t uname2id(char *name);
|
||||||
|
void notifyinit(int status);
|
||||||
|
void monitorups(int delay);
|
||||||
|
@@ -139,6 +146,7 @@
|
||||||
|
void auth(FileDescriptor *fd, char *password);
|
||||||
|
void quit_sig(int sig);
|
||||||
|
void debughelp(int sig);
|
||||||
|
+/* static */ void alarm_handler(int sig);
|
||||||
|
int notifyclients(int status);
|
||||||
|
void getrid(FileDescriptor *fd, int i);
|
||||||
|
void bsdshutdown(int status);
|
3
powerd-2.0.2.tar.bz2
Normal file
3
powerd-2.0.2.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:af54361f205d922126162c872c9b5fa68090ef3f9b105619a8ebe6df9ccc7afc
|
||||||
|
size 59034
|
64
rc.powerd
Normal file
64
rc.powerd
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# System startup script for the UPS monitoring daemon
|
||||||
|
#
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: powerd
|
||||||
|
# Required-Start: $syslog
|
||||||
|
# Should-Start:
|
||||||
|
# Required-Stop: $syslog
|
||||||
|
# Should-Stop:
|
||||||
|
# Default-Start: 2 3 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Description: Start the UPS monitoring daemon
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
POWERD=/sbin/powerd
|
||||||
|
test -x $POWERD || exit 5
|
||||||
|
|
||||||
|
POWERD_CONFIG=/etc/powerd.conf
|
||||||
|
test -f $POWERD_CONFIG || exit 6
|
||||||
|
|
||||||
|
# Source SuSE config
|
||||||
|
. /etc/rc.status
|
||||||
|
|
||||||
|
rc_reset
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
echo -n "Starting UPS monitoring daemon"
|
||||||
|
startproc -f $POWERD
|
||||||
|
rc_status -v
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
echo -n "Shutting down UPS monitoring daemon"
|
||||||
|
killproc -TERM $POWERD
|
||||||
|
rc_status -v
|
||||||
|
;;
|
||||||
|
try-restart)
|
||||||
|
$0 status >/dev/null && $0 restart
|
||||||
|
rc_status
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
$0 start
|
||||||
|
rc_status
|
||||||
|
;;
|
||||||
|
force-reload)
|
||||||
|
$0 try-restart
|
||||||
|
rc_status
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
$0 try-restart
|
||||||
|
rc_status
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
echo -n "Checking for UPS monitoring service"
|
||||||
|
checkproc $POWERD
|
||||||
|
rc_status -v
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
rc_exit
|
599
showconsole-1.08.dif
Normal file
599
showconsole-1.08.dif
Normal file
@ -0,0 +1,599 @@
|
|||||||
|
--- blogd.c
|
||||||
|
+++ blogd.c 2006-08-10 18:41:55.000000000 +0200
|
||||||
|
@@ -155,25 +155,60 @@ static void reset_signal(int sig, struct
|
||||||
|
* To be able to reconnect to real tty on EIO
|
||||||
|
*/
|
||||||
|
static char * tty;
|
||||||
|
+static char * second;
|
||||||
|
static void reconnect(int fd)
|
||||||
|
{
|
||||||
|
int newfd = -1;
|
||||||
|
|
||||||
|
- if ((newfd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
|
||||||
|
- error("can not open %s: %s\n", tty, strerror(errno));
|
||||||
|
-
|
||||||
|
- if (newfd != 1)
|
||||||
|
- dup2(newfd, 1);
|
||||||
|
- if (newfd != 2)
|
||||||
|
- dup2(newfd, 2);
|
||||||
|
-
|
||||||
|
- if (fd == 1 || fd == 2)
|
||||||
|
- goto out;
|
||||||
|
- if (newfd != fd)
|
||||||
|
- dup2(newfd, fd);
|
||||||
|
-out:
|
||||||
|
- if (newfd > 2)
|
||||||
|
- close(newfd);
|
||||||
|
+ switch (fd) {
|
||||||
|
+ case 0: /* Standard in */
|
||||||
|
+
|
||||||
|
+ if (tty == (char*)0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if ((newfd = open(tty, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
|
||||||
|
+ error("can not open %s: %s\n", tty, strerror(errno));
|
||||||
|
+
|
||||||
|
+ if (newfd != 0) {
|
||||||
|
+ dup2(newfd, 0);
|
||||||
|
+ close(newfd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 1: /* Standard out */
|
||||||
|
+ case 2: /* Standard error */
|
||||||
|
+
|
||||||
|
+ if (tty == (char*)0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if ((newfd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
|
||||||
|
+ error("can not open %s: %s\n", tty, strerror(errno));
|
||||||
|
+
|
||||||
|
+ if (newfd != 1)
|
||||||
|
+ dup2(newfd, 1);
|
||||||
|
+ if (newfd != 2)
|
||||||
|
+ dup2(newfd, 2);
|
||||||
|
+ if (newfd > 2)
|
||||||
|
+ close(newfd);
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default: /* IO of second console */
|
||||||
|
+
|
||||||
|
+ if (second == (char*)0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if ((newfd = open(second, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
|
||||||
|
+ error("can not open %s: %s\n", second, strerror(errno));
|
||||||
|
+
|
||||||
|
+ if (newfd != fd) {
|
||||||
|
+ dup2(newfd, fd);
|
||||||
|
+ close(newfd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -181,7 +216,7 @@ out:
|
||||||
|
*/
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
- int fd, flags;
|
||||||
|
+ int fd, fd2, flags;
|
||||||
|
int ptm, pts, cntrtty = 1;
|
||||||
|
pid_t pid, ppid = getppid();
|
||||||
|
char ptsname[NAME_MAX+1];
|
||||||
|
@@ -198,7 +233,7 @@ int main(int argc, char *argv[])
|
||||||
|
if (argc == 2)
|
||||||
|
tty = argv[1];
|
||||||
|
else
|
||||||
|
- tty = fetchtty(getpid(), ppid);
|
||||||
|
+ tty = fetchtty(getpid(), ppid, NULL);
|
||||||
|
|
||||||
|
if (!tty || !*tty)
|
||||||
|
error("can not discover real system console tty, boot logging disabled.\n");
|
||||||
|
@@ -241,6 +276,38 @@ int main(int argc, char *argv[])
|
||||||
|
if (!w.ws_col)
|
||||||
|
w.ws_row = 80;
|
||||||
|
|
||||||
|
+ fd2 = -1;
|
||||||
|
+ do {
|
||||||
|
+
|
||||||
|
+ if ((second = secondtty(tty)) == (char*)0)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if ((fd2 = open(second, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
|
||||||
|
+ warn("can not open %s: %s\n", second, strerror(errno));
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((flags = fcntl(fd2, F_GETFL)) < 0) {
|
||||||
|
+ warn("can not get terminal flags of %s: %s\n", second, strerror(errno));
|
||||||
|
+ close(fd2);
|
||||||
|
+ fd2 = -1;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ flags &= ~(O_NONBLOCK);
|
||||||
|
+ flags |= O_NOCTTY;
|
||||||
|
+ if (fcntl(fd2, F_SETFL, flags) < 0) {
|
||||||
|
+ warn("can not set terminal flags of %s: %s\n", second, strerror(errno));
|
||||||
|
+ close(fd2);
|
||||||
|
+ fd2 = -1;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ out:
|
||||||
|
+ free(second);
|
||||||
|
+
|
||||||
|
+ } while (0);
|
||||||
|
+
|
||||||
|
if (openpty(&ptm, &pts, ptsname, &t, &w) < 0)
|
||||||
|
error("can not open pty/tty pair: %s\n", strerror(errno));
|
||||||
|
|
||||||
|
@@ -268,12 +335,15 @@ int main(int argc, char *argv[])
|
||||||
|
dup2(fd, 1);
|
||||||
|
dup2(fd, 2);
|
||||||
|
close(ptm);
|
||||||
|
- close(fd);
|
||||||
|
+ if (fd > 2)
|
||||||
|
+ close(fd);
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
close(pts);
|
||||||
|
close(ptm);
|
||||||
|
close(fd);
|
||||||
|
+ if (fd2 > 0)
|
||||||
|
+ close(fd2);
|
||||||
|
error("can not fork to become daemon: %s\n", strerror(errno));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
@@ -282,12 +352,13 @@ int main(int argc, char *argv[])
|
||||||
|
close(pts);
|
||||||
|
close(ptm);
|
||||||
|
close(fd);
|
||||||
|
+ if (fd2 > 0)
|
||||||
|
+ close(fd2);
|
||||||
|
fprintf(stdout, "\rBoot logging started on %s(%s) at %.24s\n", tty, name, stt);
|
||||||
|
fflush(stdout);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
- free(name);
|
||||||
|
- prepareIO(reconnect, pidfile, 0, 1);
|
||||||
|
+ prepareIO(reconnect, pidfile, 0, 1, fd2);
|
||||||
|
while (!signaled)
|
||||||
|
safeIO();
|
||||||
|
|
||||||
|
@@ -297,6 +368,10 @@ int main(int argc, char *argv[])
|
||||||
|
if (!cntrtty)
|
||||||
|
kill(ppid, SIGCONT);
|
||||||
|
|
||||||
|
+ if (fd2 > 0) {
|
||||||
|
+ (void)tcflush(fd2, TCOFLUSH);
|
||||||
|
+ close(fd2);
|
||||||
|
+ }
|
||||||
|
(void)tcflush(1, TCOFLUSH);
|
||||||
|
close(1);
|
||||||
|
(void)tcflush(2, TCOFLUSH);
|
||||||
|
--- libconsole.c
|
||||||
|
+++ libconsole.c 2006-08-10 18:41:23.000000000 +0200
|
||||||
|
@@ -158,41 +158,52 @@ static void (*vc_reconnect)(int fd) = NU
|
||||||
|
static inline void safeout (int fd, const char *ptr, size_t s)
|
||||||
|
{
|
||||||
|
int saveerr = errno;
|
||||||
|
- static int repeated;
|
||||||
|
+ int repeated = 0;
|
||||||
|
+ static int eiocount;
|
||||||
|
|
||||||
|
- repeated = 0;
|
||||||
|
while (s > 0) {
|
||||||
|
ssize_t p = write (fd, ptr, s);
|
||||||
|
if (p < 0) {
|
||||||
|
- if (repeated++ > 1000)
|
||||||
|
- error("Repeated error on writing to fd %d: %s\n", fd, STRERR);
|
||||||
|
- if (errno == EPIPE)
|
||||||
|
+ if (errno == EPIPE) {
|
||||||
|
+ warn("error on writing to fd %d: %s\n", fd, STRERR);
|
||||||
|
exit (0);
|
||||||
|
+ }
|
||||||
|
if (errno == EINTR) {
|
||||||
|
errno = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (errno == EAGAIN) { /* Kernel 2.6 seems todo this very often */
|
||||||
|
+ int ret;
|
||||||
|
fd_set check;
|
||||||
|
- struct timeval two = {2, 0};
|
||||||
|
|
||||||
|
- errno = 0;
|
||||||
|
+ if (repeated++ > 1000)
|
||||||
|
+ error("repeated error on writing to fd %d: %s\n", fd, STRERR);
|
||||||
|
+
|
||||||
|
FD_ZERO (&check);
|
||||||
|
FD_SET (fd, &check);
|
||||||
|
|
||||||
|
/* Avoid high load: wait upto two seconds if system is not ready */
|
||||||
|
- select(fd + 1, (fd_set*)0, &check, (fd_set*)0, &two);
|
||||||
|
errno = 0;
|
||||||
|
+ do {
|
||||||
|
+ struct timeval two = {2, 0};
|
||||||
|
+ ret = select(fd + 1, (fd_set*)0, &check, (fd_set*)0, &two);
|
||||||
|
+
|
||||||
|
+ } while ((ret < 0) && (errno == EINTR));
|
||||||
|
+
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ error("can not write to fd %d: %s\n", fd, STRERR);
|
||||||
|
|
||||||
|
+ errno = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- if (errno == EIO && vc_reconnect) {
|
||||||
|
+ if (errno == EIO) {
|
||||||
|
+ if ((eiocount++ > 10) || !vc_reconnect)
|
||||||
|
+ error("can not write to fd %d: %s\n", fd, STRERR);
|
||||||
|
(*vc_reconnect)(fd);
|
||||||
|
- vc_reconnect = NULL;
|
||||||
|
errno = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
- error("Can not write to fd %d: %s\n", fd, STRERR);
|
||||||
|
+ error("can not write to fd %d: %s\n", fd, STRERR);
|
||||||
|
}
|
||||||
|
repeated = 0;
|
||||||
|
ptr += p;
|
||||||
|
@@ -267,6 +278,7 @@ out:
|
||||||
|
*/
|
||||||
|
static FILE * flog = NULL;
|
||||||
|
static int fdwrite = -1;
|
||||||
|
+static int fdsec = -1;
|
||||||
|
static int fdread = -1;
|
||||||
|
static int fdfifo = -1;
|
||||||
|
|
||||||
|
@@ -714,12 +726,13 @@ static void *action(void *dummy)
|
||||||
|
static void (*rw_connect)(void) = NULL;
|
||||||
|
static const char *fifo_name = _PATH_BLOG_FIFO;
|
||||||
|
|
||||||
|
-void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out)
|
||||||
|
+void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out, const int second)
|
||||||
|
{
|
||||||
|
vc_reconnect = rfunc;
|
||||||
|
rw_connect = cfunc;
|
||||||
|
fdread = in;
|
||||||
|
fdwrite = out;
|
||||||
|
+ fdsec = second;
|
||||||
|
|
||||||
|
if (fifo_name && fdfifo < 0) {
|
||||||
|
struct stat st;
|
||||||
|
@@ -729,7 +742,7 @@ void prepareIO(void (*rfunc)(int), void
|
||||||
|
(void)mkfifo(fifo_name, 0600);
|
||||||
|
errno = 0;
|
||||||
|
if (!stat(fifo_name, &st) && S_ISFIFO(st.st_mode)) {
|
||||||
|
- if ((fdfifo = open(fifo_name, O_RDWR)) < 0)
|
||||||
|
+ if ((fdfifo = open(fifo_name, O_RDWR|O_NOCTTY)) < 0)
|
||||||
|
warn("can not open named fifo %s: %s\n", fifo_name, STRERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -769,12 +782,17 @@ static void more_input (struct timeval *
|
||||||
|
const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans));
|
||||||
|
|
||||||
|
if (cnt > 0) {
|
||||||
|
- parselog(trans, cnt); /* Parse and make copy of the input */
|
||||||
|
+ parselog(trans, cnt); /* Parse and make copy of the input */
|
||||||
|
+
|
||||||
|
+ safeout(fdwrite, (char*)trans, cnt); /* Write copy of input to real tty */
|
||||||
|
+ (void)tcdrain(fdwrite);
|
||||||
|
|
||||||
|
- safeout(fdwrite, (char*)trans, cnt); /* Write copy of input to real tty */
|
||||||
|
- tcdrain(fdwrite);
|
||||||
|
+ if (fdsec > 0) {
|
||||||
|
+ safeout(fdsec, (char*)trans, cnt); /* Write copy of input to second tty */
|
||||||
|
+ (void)tcdrain(fdsec);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- flushlog();
|
||||||
|
+ flushlog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -883,6 +901,8 @@ void closeIO(void)
|
||||||
|
} else
|
||||||
|
warn("no message logging because /var file system is not accessible\n");
|
||||||
|
(void)tcdrain(fdwrite); /* Hold in sync with console */
|
||||||
|
+ if (fdsec > 0)
|
||||||
|
+ (void)tcdrain(fdsec); /* Hold in sync with second console */
|
||||||
|
|
||||||
|
do {
|
||||||
|
/*
|
||||||
|
@@ -926,6 +946,8 @@ void closeIO(void)
|
||||||
|
flog = NULL;
|
||||||
|
xout:
|
||||||
|
(void)tcdrain(fdwrite);
|
||||||
|
+ if (fdsec > 0)
|
||||||
|
+ (void)tcdrain(fdsec);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -941,7 +963,7 @@ static void ctty(pid_t pid, unsigned int
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
sprintf(fetched, "/proc/%d/stat", (int)pid);
|
||||||
|
- if ((fd = open(fetched, O_RDONLY)) < 0)
|
||||||
|
+ if ((fd = open(fetched, O_RDONLY|O_NOCTTY)) < 0)
|
||||||
|
error("can not open(%s): %s\n", fetched, STRERR);
|
||||||
|
cnt = safein(fd, fetched, sizeof(fetched));
|
||||||
|
close(fd);
|
||||||
|
@@ -1034,12 +1056,11 @@ static int checkdev(char ** retname, uns
|
||||||
|
int found = 0;
|
||||||
|
struct dirent * d;
|
||||||
|
struct stat st;
|
||||||
|
- char * name = NULL;
|
||||||
|
static int deep;
|
||||||
|
|
||||||
|
memset(&st, 0, sizeof(struct stat));
|
||||||
|
while ((d = readdir(dev))) {
|
||||||
|
- name = d->d_name;
|
||||||
|
+ char * name = d->d_name;
|
||||||
|
|
||||||
|
if (*name == '.')
|
||||||
|
continue;
|
||||||
|
@@ -1143,6 +1164,14 @@ static int checkdev(char ** retname, uns
|
||||||
|
}
|
||||||
|
|
||||||
|
found++;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Allocate memory to be able to return several
|
||||||
|
+ * different buffers for different files names.
|
||||||
|
+ */
|
||||||
|
+ name = strdup(name);
|
||||||
|
+ if (!name)
|
||||||
|
+ error("checkdev(): %s\n", STRERR);
|
||||||
|
*retname = name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -1151,7 +1180,7 @@ static int checkdev(char ** retname, uns
|
||||||
|
}
|
||||||
|
|
||||||
|
/* main routine to fetch tty */
|
||||||
|
-char * fetchtty(const pid_t pid, const pid_t ppid)
|
||||||
|
+char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi)
|
||||||
|
{
|
||||||
|
unsigned int tty = 0, found = 0;
|
||||||
|
char * name = NULL;
|
||||||
|
@@ -1167,14 +1196,15 @@ char * fetchtty(const pid_t pid, const p
|
||||||
|
if (!(name = ttyname(0)) || !strcmp(name, "/dev/console"))
|
||||||
|
tty = fallback(pid, ppid);
|
||||||
|
else {
|
||||||
|
- strcpy(lnk, name);
|
||||||
|
- free(name);
|
||||||
|
- name = lnk;
|
||||||
|
+ name = strdup(name);
|
||||||
|
+ if (!name)
|
||||||
|
+ error("fetchtty(): %s\n", STRERR);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
#ifdef TIOCGDEV
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
+ if (mjmi) *mjmi = tty;
|
||||||
|
|
||||||
|
if (!(dev = opendir("/dev")))
|
||||||
|
error("can not opendir(/dev): %s\n", STRERR);
|
||||||
|
@@ -1186,8 +1216,131 @@ char * fetchtty(const pid_t pid, const p
|
||||||
|
if (!name)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
- if (!found)
|
||||||
|
- *name = '\0';
|
||||||
|
+ if (!found) {
|
||||||
|
+ free(name);
|
||||||
|
+ name = (char*)0;
|
||||||
|
+ }
|
||||||
|
out:
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+/* Do we have some more system console around? */
|
||||||
|
+char * secondtty(char * compare)
|
||||||
|
+{
|
||||||
|
+ char buf[1024], *ptr, *shcmp, *res = (char*)0;
|
||||||
|
+ unsigned int tty = 0, found = 0;
|
||||||
|
+ int fd = -1, len;
|
||||||
|
+ char * name = (char*)0;
|
||||||
|
+ DIR * dev;
|
||||||
|
+
|
||||||
|
+ if ((fd = open("/proc/cmdline", O_RDONLY|O_NOCTTY)) < 0) {
|
||||||
|
+ warn("can not open /proc/cmdline\n");
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((len = read(fd, buf, sizeof(buf) - 1)) < 0) {
|
||||||
|
+ warn("can not read /proc/cmdline\n");
|
||||||
|
+ close(fd);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+ close(fd);
|
||||||
|
+
|
||||||
|
+ if (len == 0)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ shcmp = compare;
|
||||||
|
+ if (!strncmp(shcmp, "/dev/", 5))
|
||||||
|
+ shcmp += 5;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Check for e.g. /dev/tty[1-9] which is equal to /dev/tty0
|
||||||
|
+ */
|
||||||
|
+ if (!strncmp(shcmp, "tty", 3)) {
|
||||||
|
+ size_t len = strspn(shcmp + 3, "123456789");
|
||||||
|
+
|
||||||
|
+ if (strlen(shcmp) == len + 3) {
|
||||||
|
+ compare = "/dev/tty0";
|
||||||
|
+ shcmp = "tty0";
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ptr = &buf[len];
|
||||||
|
+ while (ptr >= &buf[0]) {
|
||||||
|
+ if (*ptr == ',' || *ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n') {
|
||||||
|
+ *ptr-- = 0;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (*ptr == 'c' && !strncmp(ptr, "console=", 8)) {
|
||||||
|
+ char * console = ptr + 8;
|
||||||
|
+
|
||||||
|
+ if (!strncmp(console, "/dev/", 5))
|
||||||
|
+ console += 5;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Compare known console tty with that of the kernel command
|
||||||
|
+ * line. If already known skip this console tty and search
|
||||||
|
+ * for the next one.
|
||||||
|
+ */
|
||||||
|
+ if (strcmp(shcmp, console)) {
|
||||||
|
+ res = console; /* New device not identical to tty */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ ptr--;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!res)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ if (!(dev = opendir("/dev")))
|
||||||
|
+ error("can not opendir(/dev): %s\n", STRERR);
|
||||||
|
+ pushd("/dev");
|
||||||
|
+
|
||||||
|
+ /* Open second console e.g. /dev/tty0 */
|
||||||
|
+ if ((fd = open(res, O_RDWR|O_NONBLOCK|O_NOCTTY)) < 0)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * We do this because if we would write out the buffered
|
||||||
|
+ * messages to e.g. /dev/tty0 after this we would (re)read
|
||||||
|
+ * those and buffer them again which leads to an endless loop.
|
||||||
|
+ */
|
||||||
|
+#ifdef TIOCGDEV
|
||||||
|
+ if (ioctl (fd, TIOCGDEV, &tty) < 0) {
|
||||||
|
+ if (errno == EINVAL && !getenv("NOTIOCGDEV"))
|
||||||
|
+ warn("Warning: the ioctl TIOCGDEV is not known by the kernel\n");
|
||||||
|
+ close(fd);
|
||||||
|
+ popd();
|
||||||
|
+ closedir(dev);
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
|
+# error The ioctl TIOCGDEV is not defined (SuSE TIOCGDEV patch is missed)
|
||||||
|
+#endif
|
||||||
|
+ close(fd);
|
||||||
|
+
|
||||||
|
+ /* Try to open the real device e.g. /dev/tty1 */
|
||||||
|
+ found = checkdev(&name, tty, dev);
|
||||||
|
+
|
||||||
|
+ popd();
|
||||||
|
+ closedir(dev);
|
||||||
|
+
|
||||||
|
+ if (!name)
|
||||||
|
+ goto out;
|
||||||
|
+
|
||||||
|
+ if (!found) {
|
||||||
|
+ free(name);
|
||||||
|
+ name = (char*)0;
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!strcmp(compare, name)) {
|
||||||
|
+ free(name);
|
||||||
|
+ name = (char*)0;
|
||||||
|
+ goto out; /* Already in use */
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return name;
|
||||||
|
+out:
|
||||||
|
+ return (char*)0;
|
||||||
|
+}
|
||||||
|
--- libconsole.h
|
||||||
|
+++ libconsole.h 2006-08-10 18:41:28.000000000 +0200
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
extern void pushd(const char * path);
|
||||||
|
extern void popd(void);
|
||||||
|
-extern char * fetchtty(const pid_t pid, const pid_t ppid);
|
||||||
|
-extern void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out);
|
||||||
|
+extern char * fetchtty(const pid_t pid, const pid_t ppid, unsigned int *mjmi);
|
||||||
|
+extern char * secondtty(char * compare);
|
||||||
|
+extern void prepareIO(void (*rfunc)(int), void (*cfunc)(void), const int in, const int out, const int second);
|
||||||
|
extern void safeIO (void);
|
||||||
|
extern void closeIO(void);
|
||||||
|
--- showconsole.8
|
||||||
|
+++ showconsole.8 2006-08-10 18:55:37.000000000 +0200
|
||||||
|
@@ -16,6 +16,7 @@ Setconsole \- sets the underlying tty of
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.\"
|
||||||
|
.B showconsole
|
||||||
|
+.RI [ -n ]
|
||||||
|
.PP
|
||||||
|
.B setconsole /dev/tty<xy> < /dev/console
|
||||||
|
.SH DESCRIPTION
|
||||||
|
@@ -38,6 +39,15 @@ with
|
||||||
|
and exactly one argument, a valid character device
|
||||||
|
is given.
|
||||||
|
\."
|
||||||
|
+.SH OPTIONS
|
||||||
|
+.TP
|
||||||
|
+.B \-n
|
||||||
|
+Return the major and minor device numbers instead of
|
||||||
|
+the device file name. This can be used to asked the
|
||||||
|
+kernel for the major and minor device numbers of a not
|
||||||
|
+existing device file in
|
||||||
|
+.IR /dev .
|
||||||
|
+\."
|
||||||
|
.SH BUGS
|
||||||
|
.B showconsole
|
||||||
|
needs a mounted
|
||||||
|
--- showconsole.c
|
||||||
|
+++ showconsole.c 2006-08-10 18:51:15.000000000 +0200
|
||||||
|
@@ -51,7 +51,7 @@ void warn (const char *fmt, ...)
|
||||||
|
*/
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
- char * tty = NULL;
|
||||||
|
+ char * tty = NULL, numeric = 0;
|
||||||
|
myname = basename(*argv);
|
||||||
|
|
||||||
|
if (!strcmp(myname, "setconsole")) {
|
||||||
|
@@ -73,8 +73,30 @@ int main(int argc, char *argv[])
|
||||||
|
close(fdc);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
- tty = fetchtty(getpid(), getppid());
|
||||||
|
- if (tty)
|
||||||
|
+
|
||||||
|
+ if (argc == 2) {
|
||||||
|
+ const char* opt = argv[1];
|
||||||
|
+ if (opt && *opt++ == '-' && *opt++ == 'n' && *opt == '\0')
|
||||||
|
+ numeric++;
|
||||||
|
+ else
|
||||||
|
+ error("Usage: %s [-n]\n", myname);
|
||||||
|
+ } else if (argc > 2)
|
||||||
|
+ error("Usage: %s [-n]\n", myname);
|
||||||
|
+
|
||||||
|
+ if (numeric) {
|
||||||
|
+ unsigned int dev = 0;
|
||||||
|
+ (void)fetchtty(getpid(), getppid(), &dev);
|
||||||
|
+
|
||||||
|
+ if (dev)
|
||||||
|
+ printf("%u %u\n", major(dev), minor(dev));
|
||||||
|
+ else {
|
||||||
|
+ error("real tty unknown\n");
|
||||||
|
+ fprintf(stderr, "real tty unknown\n");
|
||||||
|
+ }
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((tty = fetchtty(getpid(), getppid(), NULL)))
|
||||||
|
printf("%s\n", tty);
|
||||||
|
else {
|
||||||
|
error("real tty unknown\n");
|
3
showconsole-1.08.tar.bz2
Normal file
3
showconsole-1.08.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3f3c1462c21db37054e109bbda23490de759311e8d182a3565f1ae8926d10e27
|
||||||
|
size 20821
|
113
startpar-0.49.dif
Normal file
113
startpar-0.49.dif
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
--- Makefile
|
||||||
|
+++ Makefile 2006-05-16 17:16:01.000000000 +0200
|
||||||
|
@@ -21,7 +21,7 @@
|
||||||
|
|
||||||
|
install: startpar
|
||||||
|
$(INSTALL) -d $(DESTDIR)$(sbindir) $(DESTDIR)$(man8dir)
|
||||||
|
- $(INSTALL) -s startpar $(DESTDIR)$(sbindir)/.
|
||||||
|
+ $(INSTALL) startpar $(DESTDIR)$(sbindir)/.
|
||||||
|
$(INSTALL_DATA) startpar.8 $(DESTDIR)$(man8dir)/.
|
||||||
|
|
||||||
|
clean:
|
||||||
|
--- proc.c
|
||||||
|
+++ proc.c 2006-05-16 18:10:47.000000000 +0200
|
||||||
|
@@ -45,30 +45,29 @@
|
||||||
|
|
||||||
|
int read_proc(unsigned long int * const prcs_run, unsigned long int * const prcs_blked)
|
||||||
|
{
|
||||||
|
- static char StatBuf[32*1024];
|
||||||
|
+ char StatBuf[2048], *ptr = &StatBuf[0];
|
||||||
|
unsigned long int running, blocked;
|
||||||
|
- ssize_t n;
|
||||||
|
- int fd;
|
||||||
|
+ ssize_t len;
|
||||||
|
+ size_t skip;
|
||||||
|
+ FILE *stat;
|
||||||
|
|
||||||
|
*prcs_run = 0;
|
||||||
|
*prcs_blked = 0;
|
||||||
|
|
||||||
|
- if ((fd = open( "/proc/stat", O_RDONLY )) < 0) {
|
||||||
|
+ if ((stat = fopen("/proc/stat", "r")) == (FILE*)0) {
|
||||||
|
fprintf(stderr, "ERROR: could not open /proc/stat: %s\n", strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- n = read( fd, StatBuf, (sizeof(StatBuf) - 1));
|
||||||
|
- close(fd);
|
||||||
|
- if (n < 40) {
|
||||||
|
- if (n < 0) {
|
||||||
|
- fprintf(stderr, "ERROR: could not read /proc/stat: %s\n", strerror(errno));
|
||||||
|
- return 1;
|
||||||
|
- }
|
||||||
|
- fprintf(stderr, "ERROR: no enough data in /proc/stat?\n");
|
||||||
|
- return 1;
|
||||||
|
+ len = sizeof(StatBuf);
|
||||||
|
+ while ((len > 0) && (fgets(ptr, len, stat))) {
|
||||||
|
+ if (ptr[0] != 'p')
|
||||||
|
+ continue;
|
||||||
|
+ skip = strlen(ptr);
|
||||||
|
+ len -= skip;
|
||||||
|
+ ptr += skip;
|
||||||
|
}
|
||||||
|
- StatBuf[n] = 0;
|
||||||
|
+ fclose(stat);
|
||||||
|
|
||||||
|
running = scan_one(StatBuf, "procs_running");
|
||||||
|
blocked = scan_one(StatBuf, "procs_blocked");
|
||||||
|
--- startpar.c
|
||||||
|
+++ startpar.c 2006-05-16 17:16:01.000000000 +0200
|
||||||
|
@@ -127,6 +127,19 @@
|
||||||
|
splashpid = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void closeall(void)
|
||||||
|
+{
|
||||||
|
+ int s;
|
||||||
|
+
|
||||||
|
+ if (!prgs)
|
||||||
|
+ return;
|
||||||
|
+ for (s = 0; s < par; s++)
|
||||||
|
+ if (prgs[s].fd)
|
||||||
|
+ close(prgs[s].fd);
|
||||||
|
+ close(pidpipe[0]);
|
||||||
|
+ close(pidpipe[1]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void callsplash(int n, char *path, char *action)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
@@ -169,24 +182,11 @@
|
||||||
|
}
|
||||||
|
close(1);
|
||||||
|
dup(2);
|
||||||
|
+ closeall();
|
||||||
|
execl("/sbin/splash", "splash", "-p", sbuf, "-t", tbuf, splashcfg, (char *)0);
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
-void closeall(void)
|
||||||
|
-{
|
||||||
|
- int s;
|
||||||
|
-
|
||||||
|
- if (!prgs)
|
||||||
|
- return;
|
||||||
|
- for (s = 0; s < par; s++)
|
||||||
|
- if (prgs[s].fd)
|
||||||
|
- close(prgs[s].fd);
|
||||||
|
- close(pidpipe[0]);
|
||||||
|
- close(pidpipe[1]);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
void writebuf(struct prg *p)
|
||||||
|
{
|
||||||
|
char *b = p->buf;
|
||||||
|
@@ -360,6 +360,7 @@
|
||||||
|
|
||||||
|
close(1);
|
||||||
|
dup(2);
|
||||||
|
+ closeall();
|
||||||
|
if (run_mode)
|
||||||
|
{
|
||||||
|
char path[128];
|
3
startpar-0.49.tar.bz2
Normal file
3
startpar-0.49.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:db84542a2fac2f228a25001ae786eed9b14db01c6c3294c4be51a197c4fe10b0
|
||||||
|
size 16566
|
376
swsusp-for-sysvinit-2.86.diff
Normal file
376
swsusp-for-sysvinit-2.86.diff
Normal file
@ -0,0 +1,376 @@
|
|||||||
|
--- README.swsusp
|
||||||
|
+++ README.swsusp 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -0,0 +1,5 @@
|
||||||
|
+ This version of sysvinit contains a patch for supporting the
|
||||||
|
+ Software suspend feature for Linux.
|
||||||
|
+ In order to really use it, you need to patch your kernel
|
||||||
|
+ with Gabor Kuti's software-suspend patch:
|
||||||
|
+ http://falcon.sch.bme.hu/~seasons/linux/
|
||||||
|
--- man/halt.8
|
||||||
|
+++ man/halt.8 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
.\"}}}
|
||||||
|
.\"{{{ Name
|
||||||
|
.SH NAME
|
||||||
|
-halt, reboot, poweroff \- stop the system.
|
||||||
|
+halt, reboot, poweroff, suspend \- stop the system.
|
||||||
|
.\"}}}
|
||||||
|
.\"{{{ Synopsis
|
||||||
|
.SH SYNOPSIS
|
||||||
|
@@ -31,12 +31,16 @@
|
||||||
|
.RB [ \-f ]
|
||||||
|
.RB [ \-i ]
|
||||||
|
.RB [ \-h ]
|
||||||
|
+.br
|
||||||
|
+.B /sbin/swsusp
|
||||||
|
+.RB [ \-w ]
|
||||||
|
+.RB [ \-d ]
|
||||||
|
.\"}}}
|
||||||
|
.\"{{{ Description
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fBHalt\fP notes that the system is being brought down in the file
|
||||||
|
-\fI/var/log/wtmp\fP, and then either tells the kernel to halt, reboot or
|
||||||
|
-poweroff the system.
|
||||||
|
+\fI/var/log/wtmp\fP, and then either tells the kernel to halt, reboot, poweroff,
|
||||||
|
+or suspend the system.
|
||||||
|
.PP
|
||||||
|
If \fBhalt\fP or \fBreboot\fP is called when the system is
|
||||||
|
\fInot\fP in runlevel \fB0\fP or \fB6\fP, in other words when it's running
|
||||||
|
--- man/inittab.5
|
||||||
|
+++ man/inittab.5 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -137,6 +137,13 @@
|
||||||
|
the external UPS is almost empty and the power is failing (provided that the
|
||||||
|
external UPS and the monitoring process are able to detect this condition).
|
||||||
|
.\"}}}
|
||||||
|
+.\"{{{ resume
|
||||||
|
+.IP \fBresume\fP
|
||||||
|
+This process will be executed when \fBinit\fP is told by the kernel that
|
||||||
|
+Software Suspend has resumed the machine. This way you may specify userland
|
||||||
|
+programs what can restore hardware states the kernel cannot (for example
|
||||||
|
+svgatextmode and hdparm).
|
||||||
|
+.\"}}}
|
||||||
|
.\"{{{ ctrlaltdel
|
||||||
|
.IP \fBctrlaltdel\fP
|
||||||
|
The process will be executed when \fBinit\fP receives the SIGINT signal.
|
||||||
|
--- man/shutdown.8
|
||||||
|
+++ man/shutdown.8 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -11,7 +11,7 @@
|
||||||
|
.B /sbin/shutdown
|
||||||
|
.RB [ \-t
|
||||||
|
.IR sec ]
|
||||||
|
-.RB [ \-arkhncfFHP ]
|
||||||
|
+.RB [ \-arkhzncfFHP ]
|
||||||
|
.I time
|
||||||
|
.RI [ warning-message ]
|
||||||
|
.\"}}}
|
||||||
|
@@ -71,6 +71,12 @@
|
||||||
|
The use of this option is discouraged, and its results are not always what
|
||||||
|
you'd expect.
|
||||||
|
.\"}}}
|
||||||
|
+.\"{{{ -z
|
||||||
|
+.IP \fB\-z\fP
|
||||||
|
+Shutdown using software suspend. Using this option will not kill processes
|
||||||
|
+but pass the control to the kernel what makes the proper steps to stop and
|
||||||
|
+save processes to swaps. 'Software\ Suspend' needs to be compiled in.
|
||||||
|
+.\"}}}
|
||||||
|
.\"{{{ -f
|
||||||
|
.IP \fB\-f\fP
|
||||||
|
Skip fsck on reboot.
|
||||||
|
--- man/swsusp.8
|
||||||
|
+++ man/swsusp.8 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+.so man8/halt.8
|
||||||
|
--- src/Makefile
|
||||||
|
+++ src/Makefile 2005-10-19 13:54:38.000000000 +0200
|
||||||
|
@@ -52,7 +52,7 @@
|
||||||
|
SBIN += sulogin
|
||||||
|
USRBIN += utmpdump
|
||||||
|
MAN1 += mountpoint.1
|
||||||
|
-MAN8 += sulogin.8
|
||||||
|
+MAN8 += sulogin.8 swsusp.8
|
||||||
|
endif
|
||||||
|
|
||||||
|
BIN_OWNER = root
|
||||||
|
@@ -131,6 +131,7 @@
|
||||||
|
for i in $(USRBIN); do \
|
||||||
|
$(INSTALL) -m 755 $$i $(ROOT)/usr/bin/; \
|
||||||
|
done
|
||||||
|
+ ln -sf halt $(ROOT)/sbin/swsusp
|
||||||
|
ln -sf halt $(ROOT)/sbin/reboot
|
||||||
|
ln -sf halt $(ROOT)/sbin/poweroff
|
||||||
|
ln -sf init $(ROOT)/sbin/telinit
|
||||||
|
--- src/dowall.c
|
||||||
|
+++ src/dowall.c 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
+#include <sched.h>
|
||||||
|
|
||||||
|
static sigjmp_buf jbuf;
|
||||||
|
|
||||||
|
@@ -214,6 +215,7 @@
|
||||||
|
if (tp != NULL) fclose(tp);
|
||||||
|
}
|
||||||
|
endutent();
|
||||||
|
+ sched_yield();
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
--- src/halt.c
|
||||||
|
+++ src/halt.c 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -172,6 +172,7 @@
|
||||||
|
int do_ifdown = 0;
|
||||||
|
int do_hddown = 0;
|
||||||
|
int do_poweroff = 0;
|
||||||
|
+ int do_swsusp = 0;
|
||||||
|
int c;
|
||||||
|
char *tm = NULL;
|
||||||
|
|
||||||
|
@@ -185,6 +186,7 @@
|
||||||
|
|
||||||
|
if (!strcmp(progname, "reboot")) do_reboot = 1;
|
||||||
|
if (!strcmp(progname, "poweroff")) do_poweroff = 1;
|
||||||
|
+ if (!strcmp(progname, "swsusp")) do_swsusp = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get flags
|
||||||
|
@@ -220,6 +222,14 @@
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ if(do_swsusp) { /* This implies some flags.. */
|
||||||
|
+ do_sync = 0;
|
||||||
|
+ do_ifdown = 0;
|
||||||
|
+ do_poweroff = 0;
|
||||||
|
+ do_reboot = 0;
|
||||||
|
+ do_hard = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (argc != optind) usage();
|
||||||
|
|
||||||
|
if (geteuid() != 0) {
|
||||||
|
@@ -264,6 +274,8 @@
|
||||||
|
|
||||||
|
if (do_reboot) {
|
||||||
|
init_reboot(BMAGIC_REBOOT);
|
||||||
|
+ } else if(do_swsusp) {
|
||||||
|
+ init_reboot(BMAGIC_SWSUSP);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Turn on hard reboot, CTRL-ALT-DEL will reboot now
|
||||||
|
--- src/init.c
|
||||||
|
+++ src/init.c 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -85,6 +85,10 @@
|
||||||
|
# define CBAUDEX 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef SIGRESUME
|
||||||
|
+# define SIGRESUME SIGXCPU
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Set a signal handler. */
|
||||||
|
#define SETSIG(sa, sig, fun, flags) \
|
||||||
|
do { \
|
||||||
|
@@ -143,7 +147,7 @@
|
||||||
|
/* Macro to see if this is a special action */
|
||||||
|
#define ISPOWER(i) ((i) == POWERWAIT || (i) == POWERFAIL || \
|
||||||
|
(i) == POWEROKWAIT || (i) == POWERFAILNOW || \
|
||||||
|
- (i) == CTRLALTDEL)
|
||||||
|
+ (i) == CTRLALTDEL || (i) == RESUME)
|
||||||
|
|
||||||
|
/* ascii values for the `action' field. */
|
||||||
|
struct actions {
|
||||||
|
@@ -165,6 +169,7 @@
|
||||||
|
{ "initdefault", INITDEFAULT },
|
||||||
|
{ "sysinit", SYSINIT },
|
||||||
|
{ "kbrequest", KBREQUEST },
|
||||||
|
+ { "resume", RESUME },
|
||||||
|
{ NULL, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -1129,6 +1134,7 @@
|
||||||
|
case POWERWAIT:
|
||||||
|
case POWERFAILNOW:
|
||||||
|
case POWEROKWAIT:
|
||||||
|
+ case RESUME:
|
||||||
|
case CTRLALTDEL:
|
||||||
|
if (!(ch->flags & XECUTED)) ch->flags |= WAITING;
|
||||||
|
case KBREQUEST:
|
||||||
|
@@ -1822,6 +1828,22 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
+ * Start up userland hwstate restoring.
|
||||||
|
+ */
|
||||||
|
+void do_hwstate_restore(void)
|
||||||
|
+{
|
||||||
|
+ CHILD *ch;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Tell resume entries to start up
|
||||||
|
+ */
|
||||||
|
+ for (ch = family; ch; ch = ch->next) {
|
||||||
|
+ if (ch->action == RESUME)
|
||||||
|
+ ch->flags &= ~XECUTED;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
* Start up powerfail entries.
|
||||||
|
*/
|
||||||
|
static
|
||||||
|
@@ -2318,6 +2340,14 @@
|
||||||
|
int fd;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
+ if (ISMEMBER(got_signals, SIGRESUME)) {
|
||||||
|
+#if DEBUG
|
||||||
|
+ log(L_VB, "got SIGRESUME");
|
||||||
|
+#endif
|
||||||
|
+ do_hwstate_restore();
|
||||||
|
+ DELSET(got_signals, SIGRESUME);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (ISMEMBER(got_signals, SIGPWR)) {
|
||||||
|
INITDBG(L_VB, "got SIGPWR");
|
||||||
|
/* See _what_ kind of SIGPWR this is. */
|
||||||
|
@@ -2474,6 +2504,7 @@
|
||||||
|
SETSIG(sa, SIGPWR, signal_handler, 0);
|
||||||
|
SETSIG(sa, SIGWINCH, signal_handler, 0);
|
||||||
|
SETSIG(sa, SIGUSR1, signal_handler, 0);
|
||||||
|
+ SETSIG(sa, SIGRESUME,signal_handler, 0);
|
||||||
|
SETSIG(sa, SIGSTOP, stop_handler, SA_RESTART);
|
||||||
|
SETSIG(sa, SIGTSTP, stop_handler, SA_RESTART);
|
||||||
|
SETSIG(sa, SIGCONT, cont_handler, SA_RESTART);
|
||||||
|
--- src/init.h
|
||||||
|
+++ src/init.h 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -53,6 +53,7 @@
|
||||||
|
#define SYSINIT 13
|
||||||
|
#define POWERFAILNOW 14
|
||||||
|
#define KBREQUEST 15
|
||||||
|
+#define RESUME 16
|
||||||
|
|
||||||
|
/* Information about a process in the in-core inittab */
|
||||||
|
typedef struct _child_ {
|
||||||
|
--- src/reboot.h
|
||||||
|
+++ src/reboot.h 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -32,5 +32,9 @@
|
||||||
|
# define BMAGIC_POWEROFF BMAGIC_HALT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#ifndef BMAGIC_SWSUSP
|
||||||
|
+# define BMAGIC_SWSUSP 0xd000fce2
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define init_reboot(magic) reboot(magic)
|
||||||
|
|
||||||
|
--- src/shutdown.c
|
||||||
|
+++ src/shutdown.c 2005-10-19 13:52:54.000000000 +0200
|
||||||
|
@@ -1,10 +1,11 @@
|
||||||
|
/*
|
||||||
|
* shutdown.c Shut the system down.
|
||||||
|
*
|
||||||
|
- * Usage: shutdown [-krhfnc] time [warning message]
|
||||||
|
+ * Usage: shutdown [-krhzfnc] time [warning message]
|
||||||
|
* -k: don't really shutdown, only warn.
|
||||||
|
* -r: reboot after shutdown.
|
||||||
|
* -h: halt after shutdown.
|
||||||
|
+ * -z: shutdown using software suspend.
|
||||||
|
* -f: do a 'fast' reboot (skip fsck).
|
||||||
|
* -F: Force fsck on reboot.
|
||||||
|
* -n: do not go through init but do it ourselves.
|
||||||
|
@@ -113,6 +114,7 @@
|
||||||
|
"\t\t -f: do a 'fast' reboot (skip fsck).\n"
|
||||||
|
"\t\t -F: Force fsck on reboot.\n"
|
||||||
|
"\t\t -n: do not go through \"init\" but go down real fast.\n"
|
||||||
|
+ "\t\t -z: shutdown using software suspend.\n"
|
||||||
|
"\t\t -c: cancel a running shutdown.\n"
|
||||||
|
"\t\t -t secs: delay between warning and kill signal.\n"
|
||||||
|
"\t\t ** the \"time\" argument is mandatory! (try \"now\") **\n");
|
||||||
|
@@ -271,6 +273,7 @@
|
||||||
|
void fastdown()
|
||||||
|
{
|
||||||
|
int do_halt = (down_level[0] == '0');
|
||||||
|
+ int do_swsusp = (down_level[0] == 'z');
|
||||||
|
int i;
|
||||||
|
#if 0
|
||||||
|
char cmd[128];
|
||||||
|
@@ -293,6 +296,8 @@
|
||||||
|
script = REBOOTSCRIPT2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
+ if(do_swsusp)
|
||||||
|
+ init_reboot(BMAGIC_SWSUSP);
|
||||||
|
|
||||||
|
/* First close all files. */
|
||||||
|
for(i = 0; i < 3; i++)
|
||||||
|
@@ -364,7 +369,9 @@
|
||||||
|
int do_halt = (down_level[0] == '0');
|
||||||
|
|
||||||
|
/* Warn for the last time */
|
||||||
|
- warn(0);
|
||||||
|
+ /* I don't want to mess up the later resumed screen */
|
||||||
|
+ if(down_level[0] != 'z')
|
||||||
|
+ warn(0);
|
||||||
|
if (dontshut) {
|
||||||
|
hardsleep(1);
|
||||||
|
stopit(0);
|
||||||
|
@@ -467,7 +474,7 @@
|
||||||
|
halttype = NULL;
|
||||||
|
|
||||||
|
/* Process the options. */
|
||||||
|
- while((c = getopt(argc, argv, "HPacqkrhnfFyt:g:i:")) != EOF) {
|
||||||
|
+ while((c = getopt(argc, argv, "HPacqkrhnzfFyt:g:i:")) != EOF) {
|
||||||
|
switch(c) {
|
||||||
|
case 'H':
|
||||||
|
halttype = "HALT";
|
||||||
|
@@ -499,6 +506,9 @@
|
||||||
|
case 'n': /* Don't switch runlevels. */
|
||||||
|
doself = 1;
|
||||||
|
break;
|
||||||
|
+ case 'z': /* Shutdown using software suspend */
|
||||||
|
+ down_level[0] = 'z';
|
||||||
|
+ break;
|
||||||
|
case 't': /* Delay between TERM and KILL */
|
||||||
|
sltime = optarg;
|
||||||
|
break;
|
||||||
|
@@ -592,6 +602,18 @@
|
||||||
|
}
|
||||||
|
if (message[0]) strcat(message, "\r\n");
|
||||||
|
|
||||||
|
+ if(down_level[0] == 'z') {
|
||||||
|
+ doself = 1;
|
||||||
|
+ if(fastboot) {
|
||||||
|
+ fprintf(stderr, "shutdown: -f option ignored");
|
||||||
|
+ fastboot = 0;
|
||||||
|
+ }
|
||||||
|
+ if(forcefsck) {
|
||||||
|
+ fprintf(stderr, "shutdown: -F option ignored");
|
||||||
|
+ forcefsck = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* See if we want to run or cancel. */
|
||||||
|
if (cancel) {
|
||||||
|
if (pid <= 0) {
|
||||||
|
@@ -621,7 +643,8 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra check. */
|
||||||
|
- if (doself && down_level[0] != '0' && down_level[0] != '6') {
|
||||||
|
+ if (doself && down_level[0] != '0' && down_level[0] != '6' &&
|
||||||
|
+ down_level[0] != 'z') {
|
||||||
|
fprintf(stderr,
|
||||||
|
"shutdown: can use \"-n\" for halt or reboot only.\r\n");
|
||||||
|
exit(1);
|
||||||
|
@@ -638,6 +661,9 @@
|
||||||
|
case '1':
|
||||||
|
strcpy(newstate, "to maintenance mode");
|
||||||
|
break;
|
||||||
|
+ case 'z':
|
||||||
|
+ strcpy(newstate, "for system suspend");
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
sprintf(newstate, "to runlevel %s", down_level);
|
||||||
|
break;
|
53
sysvinit-2.82-multiline.patch
Normal file
53
sysvinit-2.82-multiline.patch
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
--- contrib/start-stop-daemon.c
|
||||||
|
+++ contrib/start-stop-daemon.c
|
||||||
|
@@ -108,28 +108,28 @@
|
||||||
|
static void
|
||||||
|
do_help(void)
|
||||||
|
{
|
||||||
|
- printf("\
|
||||||
|
-start-stop-daemon for Debian Linux - small and fast C version written by\n\
|
||||||
|
-Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, public domain.\n"
|
||||||
|
-VERSION "\n\
|
||||||
|
-\n\
|
||||||
|
-Usage:
|
||||||
|
- start-stop-daemon -S|--start options ... -- arguments ...\n\
|
||||||
|
- start-stop-daemon -K|--stop options ...\n\
|
||||||
|
- start-stop-daemon -H|--help\n\
|
||||||
|
- start-stop-daemon -V|--version\n\
|
||||||
|
-\n\
|
||||||
|
-Options (at least one of --exec|--pidfile|--user is required):
|
||||||
|
- -x|--exec <executable> program to start/check if it is running\n\
|
||||||
|
- -p|--pidfile <pid-file> pid file to check\n\
|
||||||
|
- -u|--user <username>|<uid> stop this user's processes\n\
|
||||||
|
- -n|--name <process-name> start/stop processes with this name\n\
|
||||||
|
- -s|--signal <signal> signal to send (default 15)\n\
|
||||||
|
- -t|--test test mode, don't do anything\n\
|
||||||
|
- -o|--oknodo exit status 0 (not 1) if nothing done\n\
|
||||||
|
- -q|--quiet | -v, --verbose\n\
|
||||||
|
-\n\
|
||||||
|
-Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo) 2 = trouble\n");
|
||||||
|
+ printf(
|
||||||
|
+"start-stop-daemon for Debian Linux - small and fast C version written by\n"
|
||||||
|
+"Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, public domain.\n"
|
||||||
|
+VERSION "\n"
|
||||||
|
+"\n"
|
||||||
|
+"Usage:\n"
|
||||||
|
+" start-stop-daemon -S|--start options ... -- arguments ...\n"
|
||||||
|
+" start-stop-daemon -K|--stop options ...\n"
|
||||||
|
+" start-stop-daemon -H|--help\n"
|
||||||
|
+" start-stop-daemon -V|--version\n"
|
||||||
|
+"\n"
|
||||||
|
+"Options (at least one of --exec|--pidfile|--user is required):\n"
|
||||||
|
+" -x|--exec <executable> program to start/check if it is running\n"
|
||||||
|
+" -p|--pidfile <pid-file> pid file to check\n"
|
||||||
|
+" -u|--user <username>|<uid> stop this user's processes\n"
|
||||||
|
+" -n|--name <process-name> start/stop processes with this name\n"
|
||||||
|
+" -s|--signal <signal> signal to send (default 15)\n"
|
||||||
|
+" -t|--test test mode, don't do anything\n"
|
||||||
|
+" -o|--oknodo exit status 0 (not 1) if nothing done\n"
|
||||||
|
+" -q|--quiet | -v, --verbose\n"
|
||||||
|
+"\n"
|
||||||
|
+"Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo) 2 = trouble\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
161
sysvinit-2.82-startstop.patch
Normal file
161
sysvinit-2.82-startstop.patch
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
--- contrib/start-stop-daemon.c
|
||||||
|
+++ contrib/start-stop-daemon.c Wed Feb 14 13:38:07 2001
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
* in C (faster - it is executed many times during system startup).
|
||||||
|
*
|
||||||
|
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
|
||||||
|
+ * modified by Raymund Will <ray@lst.de>,
|
||||||
|
* public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@@ -13,12 +14,13 @@
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
+#include <fcntl.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
|
||||||
|
-#define VERSION "version 0.3, 1996-06-05"
|
||||||
|
+#define VERSION "version 0.3.1, 1996-07-19"
|
||||||
|
|
||||||
|
static int testmode = 0;
|
||||||
|
static int quietmode = 0;
|
||||||
|
@@ -28,9 +30,8 @@
|
||||||
|
static int signal_nr = 15;
|
||||||
|
static int user_id = -1;
|
||||||
|
static const char *userspec = NULL;
|
||||||
|
-static const char *cmdname = NULL;
|
||||||
|
+static char *cmdname = NULL;
|
||||||
|
static char *execname = NULL;
|
||||||
|
-static char *startas = NULL;
|
||||||
|
static const char *pidfile = NULL;
|
||||||
|
static const char *progname = "";
|
||||||
|
|
||||||
|
@@ -122,9 +123,8 @@
|
||||||
|
-x|--exec <executable> program to start/check if it is running\n\
|
||||||
|
-p|--pidfile <pid-file> pid file to check\n\
|
||||||
|
-u|--user <username>|<uid> stop this user's processes\n\
|
||||||
|
- -n|--name <process-name> stop processes with this name\n\
|
||||||
|
+ -n|--name <process-name> start/stop processes with this name\n\
|
||||||
|
-s|--signal <signal> signal to send (default 15)\n\
|
||||||
|
- -a|--startas <pathname> program to start (default <executable>)\n\
|
||||||
|
-t|--test test mode, don't do anything\n\
|
||||||
|
-o|--oknodo exit status 0 (not 1) if nothing done\n\
|
||||||
|
-q|--quiet | -v, --verbose\n\
|
||||||
|
@@ -183,9 +183,7 @@
|
||||||
|
case 'V': /* --version */
|
||||||
|
printf("start-stop-daemon " VERSION "\n");
|
||||||
|
exit(0);
|
||||||
|
- case 'a': /* --startas <pathname> */
|
||||||
|
- startas = optarg;
|
||||||
|
- break;
|
||||||
|
+ case 'a': /* --startas <pathname>: OBSOLETE */
|
||||||
|
case 'n': /* --name <process-name> */
|
||||||
|
cmdname = optarg;
|
||||||
|
break;
|
||||||
|
@@ -225,11 +223,11 @@
|
||||||
|
if (!execname && !pidfile && !userspec)
|
||||||
|
badusage("need at least one of --exec, --pidfile or --user");
|
||||||
|
|
||||||
|
- if (!startas)
|
||||||
|
- startas = execname;
|
||||||
|
+ if (!cmdname)
|
||||||
|
+ cmdname = execname;
|
||||||
|
|
||||||
|
- if (start && !startas)
|
||||||
|
- badusage("--start needs --exec or --startas");
|
||||||
|
+ if (start && !cmdname)
|
||||||
|
+ badusage("--start needs --exec or --cmdname");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -262,25 +260,18 @@
|
||||||
|
static int
|
||||||
|
pid_is_cmd(int pid, const char *name)
|
||||||
|
{
|
||||||
|
- char buf[32];
|
||||||
|
- FILE *f;
|
||||||
|
- int c;
|
||||||
|
+ char buf[1024];
|
||||||
|
+ int h, c;
|
||||||
|
|
||||||
|
- sprintf(buf, "/proc/%d/stat", pid);
|
||||||
|
- f = fopen(buf, "r");
|
||||||
|
- if (!f)
|
||||||
|
- return 0;
|
||||||
|
- while ((c = getc(f)) != EOF && c != '(')
|
||||||
|
- ;
|
||||||
|
- if (c != '(') {
|
||||||
|
- fclose(f);
|
||||||
|
+ sprintf(buf, "/proc/%d/cmdline", pid);
|
||||||
|
+ if ( (h=open(buf, O_RDONLY)) < 0 ||
|
||||||
|
+ (c=read( h, buf, 1023)) <= 0 ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
- /* this hopefully handles command names containing ')' */
|
||||||
|
- while ((c = getc(f)) != EOF && c == *name)
|
||||||
|
- name++;
|
||||||
|
- fclose(f);
|
||||||
|
- return (c == ')' && *name == '\0');
|
||||||
|
+ close( h);
|
||||||
|
+ buf[ c] = '\0';
|
||||||
|
+
|
||||||
|
+ return ( !strcmp( name, buf) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -354,7 +345,7 @@
|
||||||
|
fatal("internal error, please report");
|
||||||
|
|
||||||
|
if (!found) {
|
||||||
|
- if (quietmode <= 0)
|
||||||
|
+ if (quietmode < 0)
|
||||||
|
printf("no %s found; none killed.\n", what);
|
||||||
|
exit(exitnodo);
|
||||||
|
}
|
||||||
|
@@ -373,6 +364,9 @@
|
||||||
|
for (p = killed; p; p = p->next)
|
||||||
|
printf(" %d", p->pid);
|
||||||
|
printf(").\n");
|
||||||
|
+ } else if (quietmode == 0) {
|
||||||
|
+ printf(" %s", what);
|
||||||
|
+ fflush( stdout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -410,21 +404,25 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
- if (quietmode <= 0)
|
||||||
|
+ if (quietmode < 0)
|
||||||
|
printf("%s already running.\n", execname);
|
||||||
|
exit(exitnodo);
|
||||||
|
}
|
||||||
|
if (testmode) {
|
||||||
|
- printf("would start %s ", startas);
|
||||||
|
+ printf("would start %s ", cmdname);
|
||||||
|
while (argc-- > 0)
|
||||||
|
printf("%s ", *argv++);
|
||||||
|
printf(".\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
- if (quietmode < 0)
|
||||||
|
- printf("starting %s ...\n", startas);
|
||||||
|
- *--argv = startas;
|
||||||
|
- execv(startas, argv);
|
||||||
|
- fatal("unable to start %s: %s", startas, strerror(errno));
|
||||||
|
+ if (quietmode < 0) {
|
||||||
|
+ printf("starting %s ...\n", cmdname);
|
||||||
|
+ } else if (quietmode == 0) {
|
||||||
|
+ printf(" %s", cmdname);
|
||||||
|
+ fflush( stdout);
|
||||||
|
+ }
|
||||||
|
+ *--argv = cmdname;
|
||||||
|
+ execv(execname, argv);
|
||||||
|
+ fatal("%s: %s", execname, strerror(errno));
|
||||||
|
}
|
||||||
|
|
26
sysvinit-2.85-paths.patch
Normal file
26
sysvinit-2.85-paths.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
--- man/init.8
|
||||||
|
+++ man/init.8 Fri Mar 12 12:44:29 2004
|
||||||
|
@@ -232,7 +232,7 @@
|
||||||
|
.SH CONFORMING TO
|
||||||
|
\fBInit\fP is compatible with the System V init. It works closely
|
||||||
|
together with the scripts in the directories
|
||||||
|
-\fI/etc/init.d\fP and \fI/etc/rc{runlevel}.d\fP.
|
||||||
|
+\fI/etc/init.d\fP and \fI/etc/init.d/rc{runlevel}.d\fP.
|
||||||
|
If your system uses this convention, there should be a \fIREADME\fP
|
||||||
|
file in the directory \fI/etc/init.d\fP explaining how these scripts work.
|
||||||
|
.\"}}}
|
||||||
|
--- src/paths.h
|
||||||
|
+++ src/paths.h Fri Mar 12 12:45:00 2004
|
||||||
|
@@ -25,10 +25,10 @@
|
||||||
|
#define SDPID "/var/run/shutdown.pid" /* PID of shutdown program */
|
||||||
|
#define SHELL "/bin/sh" /* Default shell */
|
||||||
|
#define INITSCRIPT "/etc/initscript" /* Initscript. */
|
||||||
|
-#define PWRSTAT "/etc/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */
|
||||||
|
+#define PWRSTAT "/var/run/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
-#define INITLVL "/etc/initrunlvl" /* COMPAT: New runlevel */
|
||||||
|
+#define INITLVL "/var/run/initrunlvl" /* COMPAT: New runlevel */
|
||||||
|
#define INITLVL2 "/var/log/initrunlvl" /* COMPAT: New runlevel */
|
||||||
|
/* Note: INITLVL2 definition needs INITLVL */
|
||||||
|
#define HALTSCRIPT1 "/etc/init.d/halt" /* Called by "fast" shutdown */
|
131
sysvinit-2.85-suse.patch
Normal file
131
sysvinit-2.85-suse.patch
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
--- man/init.8
|
||||||
|
+++ man/init.8 Fri Mar 12 12:26:35 2004
|
||||||
|
@@ -272,6 +272,7 @@
|
||||||
|
.\"}}}
|
||||||
|
.\"{{{ See also
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
+.BR init.d (7),
|
||||||
|
.BR getty (1),
|
||||||
|
.BR login (1),
|
||||||
|
.BR sh (1),
|
||||||
|
--- man/inittab.5
|
||||||
|
+++ man/inittab.5 Fri Mar 12 12:33:05 2004
|
||||||
|
@@ -180,7 +180,7 @@
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
.RE
|
||||||
|
-This inittab file executes \fB/etc/rc\fP during boot and starts gettys
|
||||||
|
+This inittab file executes \fB/etc/rc\fP during boot and starts mingettys
|
||||||
|
on tty1\-tty4.
|
||||||
|
.PP
|
||||||
|
A more elaborate \fBinittab\fP with different runlevels (see the comments
|
||||||
|
@@ -188,23 +188,20 @@
|
||||||
|
.RS
|
||||||
|
.sp
|
||||||
|
.nf
|
||||||
|
-.ne 19
|
||||||
|
+.ne 41
|
||||||
|
# Level to run in
|
||||||
|
id:2:initdefault:
|
||||||
|
|
||||||
|
# Boot-time system configuration/initialization script.
|
||||||
|
-si::sysinit:/etc/init.d/rcS
|
||||||
|
+si:I:bootwait:/etc/init.d/boot
|
||||||
|
|
||||||
|
-# What to do in single-user mode.
|
||||||
|
-~:S:wait:/sbin/sulogin
|
||||||
|
-
|
||||||
|
-# /etc/init.d executes the S and K scripts upon change
|
||||||
|
-# of runlevel.
|
||||||
|
-#
|
||||||
|
-# Runlevel 0 is halt.
|
||||||
|
-# Runlevel 1 is single-user.
|
||||||
|
-# Runlevels 2-5 are multi-user.
|
||||||
|
-# Runlevel 6 is reboot.
|
||||||
|
+# Runlevel 0 is System halt (Never use this as initdefault!)
|
||||||
|
+# Runlevel 1 is Single user mode
|
||||||
|
+# Runlevel 2 is Local multiuser without remote network (e.g. NFS)
|
||||||
|
+# Runlevel 3 is Full multiuser with network
|
||||||
|
+# Runlevel 4 is Not used
|
||||||
|
+# Runlevel 5 is Full multiuser with network and xdm
|
||||||
|
+# Runlevel 6 is System reboot (Never use this as initdefault!)
|
||||||
|
|
||||||
|
l0:0:wait:/etc/init.d/rc 0
|
||||||
|
l1:1:wait:/etc/init.d/rc 1
|
||||||
|
@@ -214,17 +211,27 @@
|
||||||
|
l5:5:wait:/etc/init.d/rc 5
|
||||||
|
l6:6:wait:/etc/init.d/rc 6
|
||||||
|
|
||||||
|
+# What to do in single-user mode
|
||||||
|
+ls:S:wait:/etc/init.d/rc S
|
||||||
|
+~~:S:respawn:/sbin/sulogin
|
||||||
|
+
|
||||||
|
# What to do at the "3 finger salute".
|
||||||
|
-ca::ctrlaltdel:/sbin/shutdown -t1 -h now
|
||||||
|
+ca::ctrlaltdel:/sbin/shutdown -t5 -h now
|
||||||
|
|
||||||
|
-# Runlevel 2,3: getty on virtual consoles
|
||||||
|
-# Runlevel 3: getty on terminal (ttyS0) and modem (ttyS1)
|
||||||
|
-1:23:respawn:/sbin/getty tty1 VC linux
|
||||||
|
-2:23:respawn:/sbin/getty tty2 VC linux
|
||||||
|
-3:23:respawn:/sbin/getty tty3 VC linux
|
||||||
|
-4:23:respawn:/sbin/getty tty4 VC linux
|
||||||
|
-S0:3:respawn:/sbin/getty -L 9600 ttyS0 vt320
|
||||||
|
-S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
|
||||||
|
+# Runlevel 2 upto 5: mingetty on console.
|
||||||
|
+# level 2, 3, and 5 also getty on serial port S0.
|
||||||
|
+1:2345:respawn:/sbin/mingetty --noclear tty1
|
||||||
|
+2:2345:respawn:/sbin/mingetty tty2
|
||||||
|
+3:2345:respawn:/sbin/mingetty tty3
|
||||||
|
+4:2345:respawn:/sbin/mingetty tty4
|
||||||
|
+5:2345:respawn:/sbin/mingetty tty5
|
||||||
|
+6:2345:respawn:/sbin/mingetty tty6
|
||||||
|
+S0:235:respawn:/sbin/agetty -L 9600 ttyS0 vt102
|
||||||
|
+
|
||||||
|
+# modem getty(s),
|
||||||
|
+# /dev/modem is a link to the modem device.
|
||||||
|
+#mo:235:respawn:/usr/sbin/mgetty -s 38400 modem
|
||||||
|
+mo:235:respawn:/sbin/uugetty modem M19200
|
||||||
|
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
@@ -244,5 +251,8 @@
|
||||||
|
.\"{{{ See also
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR init (8),
|
||||||
|
-.BR telinit (8)
|
||||||
|
+.BR telinit (8),
|
||||||
|
+.BR init.d (7),
|
||||||
|
+.BR agetty (8),
|
||||||
|
+.BR mgetty (8)
|
||||||
|
.\"}}}
|
||||||
|
--- man/killall5.8
|
||||||
|
+++ man/killall5.8 Fri Mar 12 12:26:35 2004
|
||||||
|
@@ -13,5 +13,6 @@
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR halt (8),
|
||||||
|
.BR reboot (8)
|
||||||
|
+.BR killproc (8)
|
||||||
|
.SH AUTHOR
|
||||||
|
Miquel van Smoorenburg, miquels@cistron.nl
|
||||||
|
--- man/pidof.8
|
||||||
|
+++ man/pidof.8 Fri Mar 12 12:26:35 2004
|
||||||
|
@@ -40,6 +40,7 @@
|
||||||
|
that it returns pids of running programs that happen to have the same name
|
||||||
|
as the program you're after but are actually other programs.
|
||||||
|
.SH SEE ALSO
|
||||||
|
+.BR pidofproc (8),
|
||||||
|
.BR shutdown (8),
|
||||||
|
.BR init (8),
|
||||||
|
.BR halt (8),
|
||||||
|
--- man/sulogin.8
|
||||||
|
+++ man/sulogin.8 Fri Mar 12 12:26:35 2004
|
||||||
|
@@ -16,7 +16,7 @@
|
||||||
|
.PP
|
||||||
|
The user is prompted
|
||||||
|
.IP "" .5i
|
||||||
|
-Give root password for system maintenance
|
||||||
|
+Give root password for system login
|
||||||
|
.br
|
||||||
|
(or type Control-D for normal startup):
|
||||||
|
.PP
|
144
sysvinit-2.86-full-time.patch
Normal file
144
sysvinit-2.86-full-time.patch
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
man/last.1 | 6 ++++--
|
||||||
|
src/last.c | 43 ++++++++++++++++++++++++++++++++-----------
|
||||||
|
2 files changed, 36 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
Index: man/last.1
|
||||||
|
===================================================================
|
||||||
|
--- man/last.1.orig 2005-12-05 18:05:40.000000000 +0100
|
||||||
|
+++ man/last.1 2005-12-05 18:09:27.000000000 +0100
|
||||||
|
@@ -12,7 +12,7 @@ last, lastb \- show listing of last logg
|
||||||
|
.RB [ \-R ]
|
||||||
|
.RB [ \-\fInum\fP ]
|
||||||
|
.RB "[ \-\fBn\fP \fInum\fP ]"
|
||||||
|
-.RB [ \-adiox ]
|
||||||
|
+.RB [ \-adFiox ]
|
||||||
|
.RB "[ \-\fBf\fP \fIfile\fP ]"
|
||||||
|
.RB "[ \-\fBt\fP \fIYYYYMMDDHHMMSS\fP ]"
|
||||||
|
.RI [ name... ]
|
||||||
|
@@ -23,7 +23,7 @@ last, lastb \- show listing of last logg
|
||||||
|
.RB [ \-\fInum\fP ]
|
||||||
|
.RB "[ \-\fBn\fP \fInum\fP ]"
|
||||||
|
.RB "[ \-\fBf\fP \fIfile\fP ]"
|
||||||
|
-.RB [ \-adiox ]
|
||||||
|
+.RB [ \-adFiox ]
|
||||||
|
.RI [ name... ]
|
||||||
|
.RI [ tty... ]
|
||||||
|
.\"}}}
|
||||||
|
@@ -69,6 +69,8 @@ with the next flag.
|
||||||
|
For non-local logins, Linux stores not only the host name of the remote
|
||||||
|
host but its IP number as well. This option translates the IP number
|
||||||
|
back into a hostname.
|
||||||
|
+.IP \fB\-F\fP
|
||||||
|
+Print full login and logout times and dates.
|
||||||
|
.IP \fB\-i\fP
|
||||||
|
This option is like \fB-d\fP in that it displays the IP number of the remote
|
||||||
|
host, but it displays the IP number in numbers-and-dots notation.
|
||||||
|
Index: src/last.c
|
||||||
|
===================================================================
|
||||||
|
--- src/last.c.orig 2005-12-05 18:07:21.000000000 +0100
|
||||||
|
+++ src/last.c 2005-12-05 18:09:53.000000000 +0100
|
||||||
|
@@ -70,6 +70,7 @@ int showhost = 1; /* Show hostname too?
|
||||||
|
int altlist = 0; /* Show hostname at the end. */
|
||||||
|
int usedns = 0; /* Use DNS to lookup the hostname. */
|
||||||
|
int useip = 0; /* Print IP address in number format */
|
||||||
|
+int fulltime = 0; /* Print full dates and times */
|
||||||
|
int oldfmt = 0; /* Use old libc5 format? */
|
||||||
|
char **show = NULL; /* What do they want us to show */
|
||||||
|
char *ufile; /* Filename of this file */
|
||||||
|
@@ -388,9 +389,13 @@ int list(struct utmp *p, time_t t, int w
|
||||||
|
*/
|
||||||
|
tmp = (time_t)p->ut_time;
|
||||||
|
strcpy(logintime, ctime(&tmp));
|
||||||
|
- logintime[16] = 0;
|
||||||
|
- sprintf(logouttime, "- %s", ctime(&t) + 11);
|
||||||
|
- logouttime[7] = 0;
|
||||||
|
+ if (fulltime)
|
||||||
|
+ sprintf(logouttime, "- %s", ctime(&t));
|
||||||
|
+ else {
|
||||||
|
+ logintime[16] = 0;
|
||||||
|
+ sprintf(logouttime, "- %s", ctime(&t) + 11);
|
||||||
|
+ logouttime[7] = 0;
|
||||||
|
+ }
|
||||||
|
secs = t - p->ut_time;
|
||||||
|
mins = (secs / 60) % 60;
|
||||||
|
hours = (secs / 3600) % 24;
|
||||||
|
@@ -409,13 +414,21 @@ int list(struct utmp *p, time_t t, int w
|
||||||
|
break;
|
||||||
|
case R_NOW:
|
||||||
|
length[0] = 0;
|
||||||
|
- sprintf(logouttime, " still");
|
||||||
|
- sprintf(length, "logged in");
|
||||||
|
+ if (fulltime)
|
||||||
|
+ sprintf(logouttime, " still logged in");
|
||||||
|
+ else {
|
||||||
|
+ sprintf(logouttime, " still");
|
||||||
|
+ sprintf(length, "logged in");
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
case R_PHANTOM:
|
||||||
|
length[0] = 0;
|
||||||
|
- sprintf(logouttime, " gone");
|
||||||
|
- sprintf(length, "- no logout");
|
||||||
|
+ if (fulltime)
|
||||||
|
+ sprintf(logouttime, " gone - no logout");
|
||||||
|
+ else {
|
||||||
|
+ sprintf(logouttime, " gone");
|
||||||
|
+ sprintf(length, "- no logout");
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
case R_REBOOT:
|
||||||
|
logouttime[0] = 0; /* Print machine uptime */
|
||||||
|
@@ -451,18 +464,23 @@ int list(struct utmp *p, time_t t, int w
|
||||||
|
#endif
|
||||||
|
if (!altlist) {
|
||||||
|
snprintf(final, sizeof(final),
|
||||||
|
- "%-8.8s %-12.12s %-16.16s "
|
||||||
|
- "%-16.16s %-7.7s %-12.12s\n",
|
||||||
|
+ fulltime ?
|
||||||
|
+ "%-8.8s %-12.12s %-16.16s %-24.24s %-26.26s %-12.12s\n" :
|
||||||
|
+ "%-8.8s %-12.12s %-16.16s %-16.16s %-7.7s %-12.12s\n",
|
||||||
|
p->ut_name, utline,
|
||||||
|
domain, logintime, logouttime, length);
|
||||||
|
} else {
|
||||||
|
snprintf(final, sizeof(final),
|
||||||
|
+ fulltime ?
|
||||||
|
+ "%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s %s\n" :
|
||||||
|
"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s %s\n",
|
||||||
|
p->ut_name, utline,
|
||||||
|
logintime, logouttime, length, domain);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
snprintf(final, sizeof(final),
|
||||||
|
+ fulltime ?
|
||||||
|
+ "%-8.8s %-12.12s %-24.24s %-26.26s %-12.12s\n" :
|
||||||
|
"%-8.8s %-12.12s %-16.16s %-7.7s %-12.12s\n",
|
||||||
|
p->ut_name, utline,
|
||||||
|
logintime, logouttime, length);
|
||||||
|
@@ -492,7 +510,7 @@ void usage(char *s)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s [-num | -n num] [-f file] "
|
||||||
|
"[-t YYYYMMDDHHMMSS] "
|
||||||
|
- "[-R] [-a] [-d] [-i] [-o] [-x] "
|
||||||
|
+ "[-R] [-a] [-d] [-F] [-i] [-o] [-x] "
|
||||||
|
"[username..] [tty..]\n", s);
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
@@ -563,7 +581,7 @@ int main(int argc, char **argv)
|
||||||
|
progname = mybasename(argv[0]);
|
||||||
|
|
||||||
|
/* Process the arguments. */
|
||||||
|
- while((c = getopt(argc, argv, "f:n:Rxadiot:0123456789")) != EOF)
|
||||||
|
+ while((c = getopt(argc, argv, "f:n:RxadFiot:0123456789")) != EOF)
|
||||||
|
switch(c) {
|
||||||
|
case 'R':
|
||||||
|
showhost = 0;
|
||||||
|
@@ -594,6 +612,9 @@ int main(int argc, char **argv)
|
||||||
|
case 'a':
|
||||||
|
altlist++;
|
||||||
|
break;
|
||||||
|
+ case 'F':
|
||||||
|
+ fulltime++;
|
||||||
|
+ break;
|
||||||
|
case 't':
|
||||||
|
if ((until = parsetm(optarg)) == (time_t)-1) {
|
||||||
|
fprintf(stderr, "%s: Invalid time value \"%s\"\n",
|
11
sysvinit-2.86-lib64.patch
Normal file
11
sysvinit-2.86-lib64.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- src/Makefile
|
||||||
|
+++ src/Makefile 2005-10-19 12:03:39.000000000 +0200
|
||||||
|
@@ -50,7 +50,7 @@
|
||||||
|
MANDIR = /usr/share/man
|
||||||
|
|
||||||
|
# Additional libs for GNU libc.
|
||||||
|
-ifneq ($(wildcard /usr/lib/libcrypt.a),)
|
||||||
|
+ifneq ($(wildcard /usr/lib*/libcrypt.a),)
|
||||||
|
LCRYPT = -lcrypt
|
||||||
|
endif
|
||||||
|
|
331
sysvinit-2.86-nfs4pidof.patch
Normal file
331
sysvinit-2.86-nfs4pidof.patch
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
--- src/killall5.c
|
||||||
|
+++ src/killall5.c 2006-12-14 15:53:19.000000000 +0100
|
||||||
|
@@ -40,6 +40,8 @@
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
+#include <mntent.h>
|
||||||
|
+#include <sys/param.h>
|
||||||
|
|
||||||
|
char *Version = "@(#)killall5 2.86 31-Jul-2004 miquels@cistron.nl";
|
||||||
|
|
||||||
|
@@ -56,7 +58,8 @@ typedef struct proc {
|
||||||
|
dev_t dev; /* Device it is on */
|
||||||
|
pid_t pid; /* Process ID. */
|
||||||
|
int sid; /* Session ID. */
|
||||||
|
- int kernel; /* Kernel thread or zombie. */
|
||||||
|
+ char kernel; /* Kernel thread or zombie. */
|
||||||
|
+ char nfs; /* Binary is loacted on NFS part. */
|
||||||
|
struct proc *next; /* Pointer to next struct. */
|
||||||
|
} PROC;
|
||||||
|
|
||||||
|
@@ -73,9 +76,20 @@ typedef struct {
|
||||||
|
PIDQ *next;
|
||||||
|
} PIDQ_HEAD;
|
||||||
|
|
||||||
|
+typedef struct nfs
|
||||||
|
+{
|
||||||
|
+ struct nfs *next; /* Pointer to next struct. */
|
||||||
|
+ struct nfs *prev; /* Pointer to previous st. */
|
||||||
|
+ char * name;
|
||||||
|
+ size_t nlen;
|
||||||
|
+} NFS;
|
||||||
|
+
|
||||||
|
/* List of processes. */
|
||||||
|
PROC *plist;
|
||||||
|
|
||||||
|
+/* List of NFS mountes partitions. */
|
||||||
|
+NFS *nlist;
|
||||||
|
+
|
||||||
|
/* Did we stop all processes ? */
|
||||||
|
int sent_sigstop;
|
||||||
|
|
||||||
|
@@ -152,6 +166,101 @@ int mount_proc(void)
|
||||||
|
return did_mount;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Remember all NFS typed partitions.
|
||||||
|
+ */
|
||||||
|
+void init_nfs(void)
|
||||||
|
+{
|
||||||
|
+ struct stat st;
|
||||||
|
+ struct mntent * ent;
|
||||||
|
+ FILE * mnt;
|
||||||
|
+
|
||||||
|
+ nlist = (NFS*)0;
|
||||||
|
+
|
||||||
|
+ if (stat("/proc/version", &st) < 0)
|
||||||
|
+ return;
|
||||||
|
+ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ while ((ent = getmntent(mnt))) {
|
||||||
|
+ if (!strcasecmp(MNTTYPE_NFS, ent->mnt_type)) {
|
||||||
|
+ NFS * p = (NFS*)xmalloc(sizeof(NFS));
|
||||||
|
+ p->name = (char*)xmalloc(strlen(ent->mnt_dir)+1);
|
||||||
|
+ strcpy(p->name, ent->mnt_dir);
|
||||||
|
+ p->nlen = strlen(p->name);
|
||||||
|
+ if (nlist)
|
||||||
|
+ nlist->prev = p;
|
||||||
|
+ p->next = nlist;
|
||||||
|
+ p->prev = (NFS*)0;
|
||||||
|
+ nlist = p;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ endmntent(mnt);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Check path is located on a NFS partition.
|
||||||
|
+ */
|
||||||
|
+int check4nfs(const char * path, char * real)
|
||||||
|
+{
|
||||||
|
+ char buf[PATH_MAX+1];
|
||||||
|
+ const char *curr;
|
||||||
|
+ int deep = MAXSYMLINKS;
|
||||||
|
+
|
||||||
|
+ if (!nlist) return 0;
|
||||||
|
+
|
||||||
|
+ curr = path;
|
||||||
|
+ do {
|
||||||
|
+ const char *prev;
|
||||||
|
+ int len;
|
||||||
|
+
|
||||||
|
+ if ((prev = strdupa(curr)) == NULL) {
|
||||||
|
+ nsyslog(LOG_ERR, "strdupa(): %s\n", strerror(errno));
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ errno = 0;
|
||||||
|
+ if ((len = readlink(curr, buf, PATH_MAX)) < 0)
|
||||||
|
+ break;
|
||||||
|
+ buf[len] = '\0';
|
||||||
|
+
|
||||||
|
+ if (buf[0] != '/') {
|
||||||
|
+ const char *slash;
|
||||||
|
+
|
||||||
|
+ if ((slash = strrchr(prev, '/'))) {
|
||||||
|
+ size_t off = slash - prev + 1;
|
||||||
|
+
|
||||||
|
+ if (off + len > PATH_MAX)
|
||||||
|
+ len = PATH_MAX - off;
|
||||||
|
+
|
||||||
|
+ memmove(&buf[off], &buf[0], len + 1);
|
||||||
|
+ memcpy(&buf[0], prev, off);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ curr = &buf[0];
|
||||||
|
+
|
||||||
|
+ if (deep-- <= 0) return 0;
|
||||||
|
+
|
||||||
|
+ } while (1);
|
||||||
|
+
|
||||||
|
+ if (real) strcpy(real, curr);
|
||||||
|
+
|
||||||
|
+ if (errno == EINVAL) {
|
||||||
|
+ NFS *p, *n, *l;
|
||||||
|
+ n = nlist;
|
||||||
|
+ l = (NFS*)0;
|
||||||
|
+ for (p = nlist; n; p = n) {
|
||||||
|
+ l = p->prev;
|
||||||
|
+ n = p->next;
|
||||||
|
+ if (!strncmp(curr, p->name, p->nlen))
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int readarg(FILE *fp, char *buf, int sz)
|
||||||
|
{
|
||||||
|
int c = 0, f = 0;
|
||||||
|
@@ -173,8 +282,8 @@ int readproc()
|
||||||
|
PROC *p, *n;
|
||||||
|
struct dirent *d;
|
||||||
|
struct stat st;
|
||||||
|
- char path[256];
|
||||||
|
- char buf[256];
|
||||||
|
+ char path[PATH_MAX+1];
|
||||||
|
+ char buf[PATH_MAX+1];
|
||||||
|
char *s, *q;
|
||||||
|
unsigned long startcode, endcode;
|
||||||
|
int pid, f;
|
||||||
|
@@ -191,6 +300,7 @@ int readproc()
|
||||||
|
n = p->next;
|
||||||
|
if (p->argv0) free(p->argv0);
|
||||||
|
if (p->argv1) free(p->argv1);
|
||||||
|
+ if (p->statname) free(p->statname);
|
||||||
|
free(p);
|
||||||
|
}
|
||||||
|
plist = NULL;
|
||||||
|
@@ -225,6 +335,9 @@ int readproc()
|
||||||
|
nsyslog(LOG_ERR,
|
||||||
|
"can't get program name from %s\n",
|
||||||
|
path);
|
||||||
|
+ if (p->argv0) free(p->argv0);
|
||||||
|
+ if (p->argv1) free(p->argv1);
|
||||||
|
+ if (p->statname) free(p->statname);
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -248,6 +361,9 @@ int readproc()
|
||||||
|
p->sid = 0;
|
||||||
|
nsyslog(LOG_ERR, "can't read sid from %s\n",
|
||||||
|
path);
|
||||||
|
+ if (p->argv0) free(p->argv0);
|
||||||
|
+ if (p->argv1) free(p->argv1);
|
||||||
|
+ if (p->statname) free(p->statname);
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -256,6 +372,9 @@ int readproc()
|
||||||
|
fclose(fp);
|
||||||
|
} else {
|
||||||
|
/* Process disappeared.. */
|
||||||
|
+ if (p->argv0) free(p->argv0);
|
||||||
|
+ if (p->argv1) free(p->argv1);
|
||||||
|
+ if (p->statname) free(p->statname);
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -300,13 +419,18 @@ int readproc()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
/* Process disappeared.. */
|
||||||
|
+ if (p->argv0) free(p->argv0);
|
||||||
|
+ if (p->argv1) free(p->argv1);
|
||||||
|
+ if (p->statname) free(p->statname);
|
||||||
|
free(p);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Try to stat the executable. */
|
||||||
|
snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
|
||||||
|
- if (stat(path, &st) == 0) {
|
||||||
|
+ if (check4nfs(path, NULL))
|
||||||
|
+ p->nfs = 1;
|
||||||
|
+ if ((p->nfs == 0) && (stat(path, &st) == 0)) {
|
||||||
|
p->dev = st.st_dev;
|
||||||
|
p->ino = st.st_ino;
|
||||||
|
}
|
||||||
|
@@ -374,12 +498,25 @@ PIDQ_HEAD *pidof(char *prog)
|
||||||
|
PIDQ_HEAD *q;
|
||||||
|
struct stat st;
|
||||||
|
char *s;
|
||||||
|
+ int nfs = 0;
|
||||||
|
int dostat = 0;
|
||||||
|
int foundone = 0;
|
||||||
|
int ok = 0;
|
||||||
|
+ char real[PATH_MAX+1];
|
||||||
|
|
||||||
|
/* Try to stat the executable. */
|
||||||
|
- if (prog[0] == '/' && stat(prog, &st) == 0) dostat++;
|
||||||
|
+ if (prog[0] == '/') {
|
||||||
|
+ memset(&real[0], 0, sizeof(real));
|
||||||
|
+
|
||||||
|
+ if (check4nfs(prog, real))
|
||||||
|
+ nfs++; /* Binary located on NFS partition. */
|
||||||
|
+
|
||||||
|
+ if (real[0] != '\0')
|
||||||
|
+ prog = &real[0]; /* Binary or its symlink located on NFS. */
|
||||||
|
+
|
||||||
|
+ if ((nfs == 0) && (stat(prog, &st) == 0))
|
||||||
|
+ dostat++; /* Binary located on a local file system. */
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* Get basename of program. */
|
||||||
|
if ((s = strrchr(prog, '/')) == NULL)
|
||||||
|
@@ -393,10 +530,30 @@ PIDQ_HEAD *pidof(char *prog)
|
||||||
|
/* First try to find a match based on dev/ino pair. */
|
||||||
|
if (dostat) {
|
||||||
|
for (p = plist; p; p = p->next) {
|
||||||
|
- if (p->dev == st.st_dev && p->ino == st.st_ino) {
|
||||||
|
- add_pid_to_q(q, p);
|
||||||
|
- foundone++;
|
||||||
|
- }
|
||||||
|
+ if (p->nfs)
|
||||||
|
+ continue;
|
||||||
|
+ if (p->dev != st.st_dev || p->ino != st.st_ino)
|
||||||
|
+ continue;
|
||||||
|
+ add_pid_to_q(q, p);
|
||||||
|
+ foundone++;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Second try to find a match based on full path name on NFS located binaries */
|
||||||
|
+ if (!foundone && nfs) {
|
||||||
|
+ for (p = plist; p; p = p->next) {
|
||||||
|
+ char exe [PATH_MAX+1];
|
||||||
|
+ char path[PATH_MAX+1];
|
||||||
|
+ int len;
|
||||||
|
+
|
||||||
|
+ snprintf(exe, sizeof(exe), "/proc/%d/exe", p->pid);
|
||||||
|
+ if ((len = readlink(exe, path, PATH_MAX)) < 0)
|
||||||
|
+ continue;
|
||||||
|
+ path[len] = '\0';
|
||||||
|
+ if (strcmp(prog, path) != 0)
|
||||||
|
+ continue;
|
||||||
|
+ add_pid_to_q(q, p);
|
||||||
|
+ foundone++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -428,7 +585,7 @@ PIDQ_HEAD *pidof(char *prog)
|
||||||
|
if (ok) add_pid_to_q(q, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return q;
|
||||||
|
+ return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Give usage message and exit. */
|
||||||
|
@@ -477,6 +634,9 @@ int main_pidof(int argc, char **argv)
|
||||||
|
int first = 1;
|
||||||
|
int i, oind, opt, flags = 0;
|
||||||
|
|
||||||
|
+ /* Which NFS partitions are online? */
|
||||||
|
+ init_nfs();
|
||||||
|
+
|
||||||
|
for (oind = PIDOF_OMITSZ-1; oind > 0; oind--)
|
||||||
|
opid[oind] = 0;
|
||||||
|
opterr = 0;
|
||||||
|
@@ -561,6 +721,7 @@ int main(int argc, char **argv)
|
||||||
|
PROC *p;
|
||||||
|
int pid, sid = -1;
|
||||||
|
int sig = SIGKILL;
|
||||||
|
+ int did_mount;
|
||||||
|
|
||||||
|
/* Get program name. */
|
||||||
|
if ((progname = strrchr(argv[0], '/')) == NULL)
|
||||||
|
@@ -583,7 +744,10 @@ int main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* First get the /proc filesystem online. */
|
||||||
|
- mount_proc();
|
||||||
|
+ did_mount = mount_proc();
|
||||||
|
+
|
||||||
|
+ /* Which NFS partitions are online? */
|
||||||
|
+ init_nfs();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ignoring SIGKILL and SIGSTOP do not make sense, but
|
||||||
|
@@ -608,9 +772,13 @@ int main(int argc, char **argv)
|
||||||
|
/* Now kill all processes except our session. */
|
||||||
|
sid = (int)getsid(0);
|
||||||
|
pid = (int)getpid();
|
||||||
|
- for (p = plist; p; p = p->next)
|
||||||
|
- if (p->pid != pid && p->sid != sid && !p->kernel)
|
||||||
|
- kill(p->pid, sig);
|
||||||
|
+ for (p = plist; p; p = p->next) {
|
||||||
|
+ if (p->pid == 1 || p->pid == pid || p->sid == sid || p->kernel) {
|
||||||
|
+ kill(p->pid, SIGCONT);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ kill(p->pid, sig);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* And let them continue. */
|
||||||
|
kill(-1, SIGCONT);
|
33
sysvinit-2.86-race.patch
Normal file
33
sysvinit-2.86-race.patch
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
--- src/init.c
|
||||||
|
+++ src/init.c 2005-10-19 12:01:15.000000000 +0200
|
||||||
|
@@ -20,6 +20,14 @@
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * 4 Sep 2001, Andrea Arcangeli:
|
||||||
|
+ * Fix a race in spawn() that is used to deadlock init in a
|
||||||
|
+ * waitpid() loop: must set the childhandler as default before forking
|
||||||
|
+ * off the child or the chld_handler could run before the waitpid loop
|
||||||
|
+ * has a chance to find its zombie-child.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
@@ -966,6 +974,7 @@
|
||||||
|
dup(f);
|
||||||
|
dup(f);
|
||||||
|
}
|
||||||
|
+ SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
|
||||||
|
if ((pid = fork()) < 0) {
|
||||||
|
initlog(L_VB, "cannot fork");
|
||||||
|
exit(1);
|
||||||
|
@@ -978,7 +987,6 @@
|
||||||
|
SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART);
|
||||||
|
SETSIG(sa, SIGTSTP, SIG_IGN, SA_RESTART);
|
||||||
|
SETSIG(sa, SIGQUIT, SIG_IGN, SA_RESTART);
|
||||||
|
- SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
|
||||||
|
|
||||||
|
while ((rc = waitpid(pid, &st, 0)) != pid)
|
||||||
|
if (rc < 0 && errno == ECHILD)
|
334
sysvinit-2.86-sulogin.patch
Normal file
334
sysvinit-2.86-sulogin.patch
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
--- src/sulogin.c
|
||||||
|
+++ src/sulogin.c 2005-10-19 11:56:43.000000000 +0200
|
||||||
|
@@ -23,13 +23,16 @@
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <shadow.h>
|
||||||
|
#include <termios.h>
|
||||||
|
+#include <sys/ttydefaults.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
#if defined(__GLIBC__)
|
||||||
|
# include <crypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CHECK_DES 1
|
||||||
|
#define CHECK_MD5 1
|
||||||
|
+#define FIXTTY 1
|
||||||
|
|
||||||
|
#define F_PASSWD "/etc/passwd"
|
||||||
|
#define F_SHADOW "/etc/shadow"
|
||||||
|
@@ -37,49 +40,80 @@
|
||||||
|
|
||||||
|
char *Version = "@(#)sulogin 2.85-3 23-Apr-2003 miquels@cistron.nl";
|
||||||
|
|
||||||
|
-int timeout = 0;
|
||||||
|
-int profile = 0;
|
||||||
|
+static int timeout;
|
||||||
|
+static int profile;
|
||||||
|
+
|
||||||
|
+static void (*saved_sigint) = SIG_DFL;
|
||||||
|
+static void (*saved_sigtstp) = SIG_DFL;
|
||||||
|
+static void (*saved_sigquit) = SIG_DFL;
|
||||||
|
|
||||||
|
#ifndef IUCLC
|
||||||
|
# define IUCLC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#if 0
|
||||||
|
+#if FIXTTY
|
||||||
|
/*
|
||||||
|
* Fix the tty modes and set reasonable defaults.
|
||||||
|
* (I'm not sure if this is needed under Linux, but..)
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void fixtty(void)
|
||||||
|
{
|
||||||
|
struct termios tty;
|
||||||
|
+ int serial;
|
||||||
|
+
|
||||||
|
+ /* Skip serial console */
|
||||||
|
+ if (ioctl (0, TIOCMGET, (char*)&serial) == 0)
|
||||||
|
+ goto out;
|
||||||
|
+ /* Expected error */
|
||||||
|
+ serial = errno = 0;
|
||||||
|
|
||||||
|
tcgetattr(0, &tty);
|
||||||
|
|
||||||
|
- /*
|
||||||
|
- * Set or adjust tty modes.
|
||||||
|
- */
|
||||||
|
- tty.c_iflag &= ~(INLCR|IGNCR|IUCLC);
|
||||||
|
- tty.c_iflag |= ICRNL;
|
||||||
|
- tty.c_oflag &= ~(OCRNL|OLCUC|ONOCR|ONLRET|OFILL);
|
||||||
|
- tty.c_oflag |= OPOST|ONLCR;
|
||||||
|
- tty.c_cflag |= CLOCAL;
|
||||||
|
- tty.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * Set the most important characters */
|
||||||
|
- */
|
||||||
|
- tty.c_cc[VINTR] = 3;
|
||||||
|
- tty.c_cc[VQUIT] = 28;
|
||||||
|
- tty.c_cc[VERASE] = 127;
|
||||||
|
- tty.c_cc[VKILL] = 24;
|
||||||
|
- tty.c_cc[VEOF] = 4;
|
||||||
|
- tty.c_cc[VTIME] = 0;
|
||||||
|
- tty.c_cc[VMIN] = 1;
|
||||||
|
- tty.c_cc[VSTART] = 17;
|
||||||
|
- tty.c_cc[VSTOP] = 19;
|
||||||
|
- tty.c_cc[VSUSP] = 26;
|
||||||
|
+ /* Use defaults of <sys/ttydefaults.h> for base settings */
|
||||||
|
+ tty.c_iflag |= TTYDEF_IFLAG;
|
||||||
|
+ tty.c_oflag |= TTYDEF_OFLAG;
|
||||||
|
+ tty.c_lflag |= TTYDEF_LFLAG;
|
||||||
|
+ tty.c_cflag |= (TTYDEF_SPEED | TTYDEF_CFLAG);
|
||||||
|
+
|
||||||
|
+ /* Sane setting, allow eight bit characters, no carriage return delay
|
||||||
|
+ * the same result as `stty sane cr0 pass8'
|
||||||
|
+ */
|
||||||
|
+ tty.c_iflag |= (BRKINT | ICRNL | IMAXBEL);
|
||||||
|
+ tty.c_iflag &= ~(IGNBRK | INLCR | IGNCR | IXOFF | IUCLC | IXANY | ISTRIP);
|
||||||
|
+ tty.c_oflag |= (OPOST | ONLCR | NL0 | CR0 | TAB0 | BS0 | VT0 | FF0);
|
||||||
|
+ tty.c_oflag &= ~(OLCUC | OCRNL | ONOCR | ONLRET | OFILL | OFDEL |\
|
||||||
|
+ NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
|
||||||
|
+ tty.c_lflag |= (ISIG | ICANON | IEXTEN | ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE);
|
||||||
|
+ tty.c_lflag &= ~(ECHONL | NOFLSH | XCASE | TOSTOP | ECHOPRT);
|
||||||
|
+ tty.c_cflag |= (CREAD | CS8 | B9600);
|
||||||
|
+ tty.c_cflag &= ~(PARENB);
|
||||||
|
+
|
||||||
|
+ /* VTIME and VMIN can overlap with VEOF and VEOL since they are
|
||||||
|
+ * only used for non-canonical mode. We just set the at the
|
||||||
|
+ * beginning, so nothing bad should happen.
|
||||||
|
+ */
|
||||||
|
+ tty.c_cc[VTIME] = 0;
|
||||||
|
+ tty.c_cc[VMIN] = 1;
|
||||||
|
+ tty.c_cc[VINTR] = CINTR;
|
||||||
|
+ tty.c_cc[VQUIT] = CQUIT;
|
||||||
|
+ tty.c_cc[VERASE] = CERASE; /* ASCII DEL (0177) */
|
||||||
|
+ tty.c_cc[VKILL] = CKILL;
|
||||||
|
+ tty.c_cc[VEOF] = CEOF;
|
||||||
|
+ tty.c_cc[VSWTC] = _POSIX_VDISABLE;
|
||||||
|
+ tty.c_cc[VSTART] = CSTART;
|
||||||
|
+ tty.c_cc[VSTOP] = CSTOP;
|
||||||
|
+ tty.c_cc[VSUSP] = CSUSP;
|
||||||
|
+ tty.c_cc[VEOL] = _POSIX_VDISABLE;
|
||||||
|
+ tty.c_cc[VREPRINT] = CREPRINT;
|
||||||
|
+ tty.c_cc[VDISCARD] = CDISCARD;
|
||||||
|
+ tty.c_cc[VWERASE] = CWERASE;
|
||||||
|
+ tty.c_cc[VLNEXT] = CLNEXT;
|
||||||
|
+ tty.c_cc[VEOL2] = _POSIX_VDISABLE;
|
||||||
|
|
||||||
|
tcsetattr(0, TCSANOW, &tty);
|
||||||
|
+out:
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -87,7 +121,8 @@
|
||||||
|
/*
|
||||||
|
* Called at timeout.
|
||||||
|
*/
|
||||||
|
-void alrm_handler()
|
||||||
|
+static
|
||||||
|
+void alrm_handler(int sig)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -96,6 +131,7 @@
|
||||||
|
* password is checked for traditional-style DES and
|
||||||
|
* FreeBSD-style MD5 encryption.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int valid(char *pass)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
@@ -134,6 +170,7 @@
|
||||||
|
/*
|
||||||
|
* Set a variable if the value is not NULL.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void set(char **var, char *val)
|
||||||
|
{
|
||||||
|
if (val) *var = val;
|
||||||
|
@@ -142,6 +179,7 @@
|
||||||
|
/*
|
||||||
|
* Get the root password entry.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
struct passwd *getrootpwent(int try_manually)
|
||||||
|
{
|
||||||
|
static struct passwd pwd;
|
||||||
|
@@ -244,6 +282,7 @@
|
||||||
|
* Ask for the password. Note that there is no
|
||||||
|
* default timeout as we normally skip this during boot.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
char *getpasswd(char *crypted)
|
||||||
|
{
|
||||||
|
struct sigaction sa;
|
||||||
|
@@ -252,11 +291,10 @@
|
||||||
|
char *ret = pass;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- if (crypted[0])
|
||||||
|
- printf("Give root password for maintenance\n");
|
||||||
|
- else
|
||||||
|
- printf("Press enter for maintenance\n");
|
||||||
|
- printf("(or type Control-D to continue): ");
|
||||||
|
+ if (crypted[0]) {
|
||||||
|
+ printf("Give root password for login: ");
|
||||||
|
+ } else
|
||||||
|
+ printf("Press enter for login: ");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
tcgetattr(0, &old);
|
||||||
|
@@ -291,6 +329,7 @@
|
||||||
|
/*
|
||||||
|
* Password was OK, execute a shell.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void sushell(struct passwd *pwd)
|
||||||
|
{
|
||||||
|
char shell[128];
|
||||||
|
@@ -332,9 +371,9 @@
|
||||||
|
* Try to execute a shell.
|
||||||
|
*/
|
||||||
|
setenv("SHELL", sushell, 1);
|
||||||
|
- signal(SIGINT, SIG_DFL);
|
||||||
|
- signal(SIGTSTP, SIG_DFL);
|
||||||
|
- signal(SIGQUIT, SIG_DFL);
|
||||||
|
+ signal(SIGINT, saved_sigint);
|
||||||
|
+ signal(SIGTSTP, saved_sigtstp);
|
||||||
|
+ signal(SIGQUIT, saved_sigquit);
|
||||||
|
execl(sushell, shell, NULL);
|
||||||
|
perror(sushell);
|
||||||
|
|
||||||
|
@@ -343,6 +382,7 @@
|
||||||
|
perror(BINSH);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static
|
||||||
|
void usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: sulogin [-e] [-p] [-t timeout] [tty device]\n");
|
||||||
|
@@ -385,50 +425,69 @@
|
||||||
|
/*
|
||||||
|
* See if we need to open an other tty device.
|
||||||
|
*/
|
||||||
|
- signal(SIGINT, SIG_IGN);
|
||||||
|
- signal(SIGQUIT, SIG_IGN);
|
||||||
|
- signal(SIGTSTP, SIG_IGN);
|
||||||
|
+ saved_sigint = signal(SIGINT, SIG_IGN);
|
||||||
|
+ saved_sigtstp = signal(SIGQUIT, SIG_IGN);
|
||||||
|
+ saved_sigquit = signal(SIGTSTP, SIG_IGN);
|
||||||
|
if (optind < argc) tty = argv[optind];
|
||||||
|
- if (tty) {
|
||||||
|
- if ((fd = open(tty, O_RDWR)) < 0) {
|
||||||
|
- perror(tty);
|
||||||
|
- } else if (!isatty(fd)) {
|
||||||
|
- fprintf(stderr, "%s: not a tty\n", tty);
|
||||||
|
- close(fd);
|
||||||
|
- } else {
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * Only go through this trouble if the new
|
||||||
|
- * tty doesn't fall in this process group.
|
||||||
|
- */
|
||||||
|
- pid = getpid();
|
||||||
|
- pgrp = getpgid(0);
|
||||||
|
- ppgrp = getpgid(getppid());
|
||||||
|
- ioctl(fd, TIOCGPGRP, &ttypgrp);
|
||||||
|
-
|
||||||
|
- if (pgrp != ttypgrp && ppgrp != ttypgrp) {
|
||||||
|
- if (pid != getsid(0)) {
|
||||||
|
- if (pid == getpgid(0))
|
||||||
|
- setpgid(0, getpgid(getppid()));
|
||||||
|
- setsid();
|
||||||
|
- }
|
||||||
|
|
||||||
|
- signal(SIGHUP, SIG_IGN);
|
||||||
|
+ if (!tty && !(tty = getenv("CONSOLE")))
|
||||||
|
+ tty = "/dev/console";
|
||||||
|
+
|
||||||
|
+ if ((fd = open(tty, O_RDWR)) < 0) {
|
||||||
|
+ perror(tty);
|
||||||
|
+ fd = dup(0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!isatty(fd)) {
|
||||||
|
+ fprintf(stderr, "%s: not a tty\n", tty);
|
||||||
|
+ close(fd);
|
||||||
|
+ } else {
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Only go through this trouble if the new
|
||||||
|
+ * tty doesn't fall in this process group.
|
||||||
|
+ */
|
||||||
|
+ pid = getpid();
|
||||||
|
+ pgrp = getpgid(0);
|
||||||
|
+ ppgrp = getpgid(getppid());
|
||||||
|
+ ttypgrp = tcgetpgrp(fd);
|
||||||
|
+
|
||||||
|
+ if (pgrp != ttypgrp && ppgrp != ttypgrp) {
|
||||||
|
+ if (pid != getsid(0)) {
|
||||||
|
+ if (pid == getpgid(0))
|
||||||
|
+ setpgid(0, getpgid(getppid()));
|
||||||
|
+ setsid();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ signal(SIGHUP, SIG_IGN);
|
||||||
|
+ if (ttypgrp > 0)
|
||||||
|
ioctl(0, TIOCNOTTY, (char *)1);
|
||||||
|
- signal(SIGHUP, SIG_DFL);
|
||||||
|
- close(0);
|
||||||
|
- close(1);
|
||||||
|
- close(2);
|
||||||
|
+ signal(SIGHUP, SIG_DFL);
|
||||||
|
+ close(0);
|
||||||
|
+ close(1);
|
||||||
|
+ close(2);
|
||||||
|
+ if (fd > 2)
|
||||||
|
close(fd);
|
||||||
|
- fd = open(tty, O_RDWR);
|
||||||
|
+ if ((fd = open(tty, O_RDWR)) < 0) {
|
||||||
|
+ perror(tty);
|
||||||
|
+ } else {
|
||||||
|
+ tcsetpgrp(fd, ppgrp);
|
||||||
|
ioctl(0, TIOCSCTTY, (char *)1);
|
||||||
|
- dup(fd);
|
||||||
|
- dup(fd);
|
||||||
|
- } else
|
||||||
|
+ dup2(fd, 0);
|
||||||
|
+ dup2(fd, 1);
|
||||||
|
+ dup2(fd, 2);
|
||||||
|
+ if (fd > 2)
|
||||||
|
+ close(fd);
|
||||||
|
+ }
|
||||||
|
+ } else
|
||||||
|
+ if (fd > 2)
|
||||||
|
close(fd);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if FIXTTY
|
||||||
|
+ fixtty();
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Get the root password.
|
||||||
|
*/
|
||||||
|
@@ -445,6 +504,9 @@
|
||||||
|
if (pwd->pw_passwd[0] == 0 ||
|
||||||
|
strcmp(crypt(p, pwd->pw_passwd), pwd->pw_passwd) == 0)
|
||||||
|
sushell(pwd);
|
||||||
|
+ saved_sigquit = signal(SIGQUIT, SIG_IGN);
|
||||||
|
+ saved_sigtstp = signal(SIGTSTP, SIG_IGN);
|
||||||
|
+ saved_sigint = signal(SIGINT, SIG_IGN);
|
||||||
|
printf("Login incorrect.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -453,4 +515,3 @@
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
-
|
18
sysvinit-2.86-usage-message.patch
Normal file
18
sysvinit-2.86-usage-message.patch
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
src/last.c | 4 +++-
|
||||||
|
1 files changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
Index: src/last.c
|
||||||
|
===================================================================
|
||||||
|
--- src/last.c.orig 2005-12-05 18:05:40.000000000 +0100
|
||||||
|
+++ src/last.c 2005-12-05 18:07:21.000000000 +0100
|
||||||
|
@@ -492,7 +492,9 @@ void usage(char *s)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s [-num | -n num] [-f file] "
|
||||||
|
"[-t YYYYMMDDHHMMSS] "
|
||||||
|
- "[-R] [-x] [-o] [username..] [tty..]\n", s);
|
||||||
|
+ "[-R] [-a] [-d] [-i] [-o] [-x] "
|
||||||
|
+ "[username..] [tty..]\n", s);
|
||||||
|
+
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
203
sysvinit-2.86-utmp.patch
Normal file
203
sysvinit-2.86-utmp.patch
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
--- src/init.c
|
||||||
|
+++ src/init.c 2006-08-22 15:04:27.000000000 +0200
|
||||||
|
@@ -115,6 +115,8 @@ sig_atomic_t got_signals; /* Set if we r
|
||||||
|
int emerg_shell = 0; /* Start emergency shell? */
|
||||||
|
int wrote_wtmp_reboot = 1; /* Set when we wrote the reboot record */
|
||||||
|
int wrote_utmp_reboot = 1; /* Set when we wrote the reboot record */
|
||||||
|
+int wrote_wtmp_rlevel = 1; /* Set when we wrote the runlevel record */
|
||||||
|
+int wrote_utmp_rlevel = 1; /* Set when we wrote the runlevel record */
|
||||||
|
int sltime = 5; /* Sleep time between TERM and KILL */
|
||||||
|
char *argv0; /* First arguments; show up in ps listing */
|
||||||
|
int maxproclen; /* Maximal length of argv[0] with \0 */
|
||||||
|
@@ -184,6 +186,8 @@ struct {
|
||||||
|
{ "-WU", D_WROTE_UTMP_REBOOT},
|
||||||
|
{ "-ST", D_SLTIME },
|
||||||
|
{ "-DB", D_DIDBOOT },
|
||||||
|
+ { "-LW", D_WROTE_WTMP_RLEVEL},
|
||||||
|
+ { "-LU", D_WROTE_UTMP_RLEVEL},
|
||||||
|
{ "", 0 }
|
||||||
|
};
|
||||||
|
struct {
|
||||||
|
@@ -379,6 +383,12 @@ static CHILD *get_record(FILE *f)
|
||||||
|
case D_DIDBOOT:
|
||||||
|
fscanf(f, "%d\n", &did_boot);
|
||||||
|
break;
|
||||||
|
+ case D_WROTE_WTMP_RLEVEL:
|
||||||
|
+ fscanf(f, "%d\n", &wrote_wtmp_rlevel);
|
||||||
|
+ break;
|
||||||
|
+ case D_WROTE_UTMP_RLEVEL:
|
||||||
|
+ fscanf(f, "%d\n", &wrote_utmp_rlevel);
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
if (cmd > 0 || cmd == C_EOF) {
|
||||||
|
oops_error = -1;
|
||||||
|
@@ -1705,6 +1715,8 @@ int read_level(int arg)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store both the old and the new runlevel. */
|
||||||
|
+ wrote_utmp_rlevel = 0;
|
||||||
|
+ wrote_wtmp_rlevel = 0;
|
||||||
|
write_utmp_wtmp("runlevel", "~~", foo + 256*runlevel, RUN_LVL, "~");
|
||||||
|
thislevel = foo;
|
||||||
|
prevlevel = runlevel;
|
||||||
|
@@ -1905,6 +1917,25 @@ void re_exec(void)
|
||||||
|
initlog(L_CO, "Attempt to re-exec failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Redo utmp/wtmp entries if required or requested
|
||||||
|
+ * Check for written records and size of utmp
|
||||||
|
+ */
|
||||||
|
+static
|
||||||
|
+void redo_utmp_wtmp(void)
|
||||||
|
+{
|
||||||
|
+ struct stat ustat;
|
||||||
|
+ const int ret = stat(UTMP_FILE, &ustat);
|
||||||
|
+
|
||||||
|
+ if ((ret < 0) || (ustat.st_size == 0))
|
||||||
|
+ wrote_utmp_rlevel = wrote_utmp_reboot = 0;
|
||||||
|
+
|
||||||
|
+ if ((wrote_wtmp_reboot == 0) || (wrote_utmp_reboot == 0))
|
||||||
|
+ write_utmp_wtmp("reboot", "~~", 0, BOOT_TIME, "~");
|
||||||
|
+
|
||||||
|
+ if ((wrote_wtmp_rlevel == 0) || (wrote_wtmp_rlevel == 0))
|
||||||
|
+ write_utmp_wtmp("runlevel", "~~", thislevel + 256 * prevlevel, RUN_LVL, "~");
|
||||||
|
+}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We got a change runlevel request through the
|
||||||
|
@@ -1936,6 +1967,7 @@ void fifo_new_level(int level)
|
||||||
|
if (oldlevel != 'S' && runlevel == 'S') console_stty();
|
||||||
|
if (runlevel == '6' || runlevel == '0' ||
|
||||||
|
runlevel == '1') console_stty();
|
||||||
|
+ if (runlevel > '1' && runlevel < '6') redo_utmp_wtmp();
|
||||||
|
read_inittab();
|
||||||
|
fail_cancel();
|
||||||
|
setproctitle("init [%c]", runlevel);
|
||||||
|
@@ -2231,6 +2263,8 @@ void boot_transitions()
|
||||||
|
}
|
||||||
|
if (loglevel > 0) {
|
||||||
|
initlog(L_VB, "Entering runlevel: %c", runlevel);
|
||||||
|
+ wrote_utmp_rlevel = 0;
|
||||||
|
+ wrote_wtmp_rlevel = 0;
|
||||||
|
write_utmp_wtmp("runlevel", "~~", runlevel + 256 * oldlevel, RUN_LVL, "~");
|
||||||
|
thislevel = runlevel;
|
||||||
|
prevlevel = oldlevel;
|
||||||
|
@@ -2409,6 +2443,7 @@ int init_main()
|
||||||
|
console_init();
|
||||||
|
|
||||||
|
if (!reload) {
|
||||||
|
+ int fd;
|
||||||
|
|
||||||
|
/* Close whatever files are open, and reset the console. */
|
||||||
|
close(0);
|
||||||
|
@@ -2426,7 +2461,8 @@ int init_main()
|
||||||
|
* Initialize /var/run/utmp (only works if /var is on
|
||||||
|
* root and mounted rw)
|
||||||
|
*/
|
||||||
|
- (void) close(open(UTMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0644));
|
||||||
|
+ if ((fd = open(UTMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0644)) >= 0)
|
||||||
|
+ close(fd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Say hello to the world
|
||||||
|
--- src/init.h
|
||||||
|
+++ src/init.h 2006-08-22 14:29:39.000000000 +0200
|
||||||
|
@@ -99,6 +99,10 @@ typedef struct _child_ {
|
||||||
|
extern CHILD *family;
|
||||||
|
extern int wrote_wtmp_reboot;
|
||||||
|
extern int wrote_utmp_reboot;
|
||||||
|
+extern int wrote_wtmp_rlevel;
|
||||||
|
+extern int wrote_utmp_rlevel;
|
||||||
|
+extern char thislevel;
|
||||||
|
+extern char prevlevel;
|
||||||
|
|
||||||
|
/* Tokens in state parser */
|
||||||
|
#define C_VER 1
|
||||||
|
@@ -120,4 +124,6 @@ extern int wrote_utmp_reboot;
|
||||||
|
#define D_WROTE_UTMP_REBOOT -7
|
||||||
|
#define D_SLTIME -8
|
||||||
|
#define D_DIDBOOT -9
|
||||||
|
+#define D_WROTE_WTMP_RLEVEL -16
|
||||||
|
+#define D_WROTE_UTMP_RLEVEL -17
|
||||||
|
|
||||||
|
--- src/utmp.c
|
||||||
|
+++ src/utmp.c 2006-08-22 14:28:52.000000000 +0200
|
||||||
|
@@ -49,6 +49,12 @@ char *line) /* Which line is this */
|
||||||
|
struct utsname uname_buf;
|
||||||
|
|
||||||
|
/*
|
||||||
|
+ * Can't do much if WTMP_FILE is not present or not writable.
|
||||||
|
+ */
|
||||||
|
+ if (access(WTMP_FILE, W_OK) < 0)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
* Try to open the wtmp file. Note that we even try
|
||||||
|
* this if we have updwtmp() so we can see if the
|
||||||
|
* wtmp file is accessible.
|
||||||
|
@@ -69,6 +75,23 @@ char *line) /* Which line is this */
|
||||||
|
*/
|
||||||
|
if (wrote_wtmp_reboot == 0 && type != BOOT_TIME)
|
||||||
|
write_wtmp("reboot", "~~", 0, BOOT_TIME, "~");
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Note if we are going to write a runlevel record.
|
||||||
|
+ */
|
||||||
|
+ if (type == RUN_LVL) wrote_wtmp_rlevel++;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * See if we need to write a runlevel record. The reason that
|
||||||
|
+ * we are being so paranoid is that when we first tried to
|
||||||
|
+ * write the reboot record, /var was possibly not mounted
|
||||||
|
+ * yet. As soon as we can open WTMP we write a delayed runlevel record.
|
||||||
|
+ */
|
||||||
|
+ if (wrote_wtmp_rlevel == 0 && type != RUN_LVL) {
|
||||||
|
+ int runlevel = thislevel;
|
||||||
|
+ int oldlevel = prevlevel;
|
||||||
|
+ write_wtmp("runlevel", "~~", runlevel + 256 * oldlevel, RUN_LVL, "~");
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -115,9 +138,9 @@ char *oldline) /* Line of old utmp ent
|
||||||
|
struct utmp *utmptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
- * Can't do much if UTMP_FILE is not present.
|
||||||
|
+ * Can't do much if UTMP_FILE is not present or not writable.
|
||||||
|
*/
|
||||||
|
- if (access(UTMP_FILE, F_OK) < 0)
|
||||||
|
+ if (access(UTMP_FILE, W_OK) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef INIT_MAIN
|
||||||
|
@@ -130,10 +153,27 @@ char *oldline) /* Line of old utmp ent
|
||||||
|
* See if we need to write a reboot record. The reason that
|
||||||
|
* we are being so paranoid is that when we first tried to
|
||||||
|
* write the reboot record, /var was possibly not mounted
|
||||||
|
- * yet. As soon as we can open WTMP we write a delayed boot record.
|
||||||
|
+ * yet. As soon as we can open UTMP we write a delayed boot record.
|
||||||
|
*/
|
||||||
|
if (wrote_utmp_reboot == 0 && type != BOOT_TIME)
|
||||||
|
write_utmp("reboot", "~~", 0, BOOT_TIME, "~", NULL);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Note if we are going to write a runlevel record.
|
||||||
|
+ */
|
||||||
|
+ if (type == RUN_LVL) wrote_utmp_rlevel++;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * See if we need to write a runlevel record. The reason that
|
||||||
|
+ * we are being so paranoid is that when we first tried to
|
||||||
|
+ * write the reboot record, /var was possibly not mounted
|
||||||
|
+ * yet. As soon as we can open UTMP we write a delayed runlevel record.
|
||||||
|
+ */
|
||||||
|
+ if (wrote_utmp_rlevel == 0 && type != RUN_LVL) {
|
||||||
|
+ int runlevel = thislevel;
|
||||||
|
+ int oldlevel = prevlevel;
|
||||||
|
+ write_utmp("runlevel", "~~", runlevel + 256 * oldlevel, RUN_LVL, "~", NULL);
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
922
sysvinit-2.86.dif
Normal file
922
sysvinit-2.86.dif
Normal file
@ -0,0 +1,922 @@
|
|||||||
|
--- .pkgextract
|
||||||
|
+++ .pkgextract 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+patch -p0 -b -s --suffix=.sulogin < ../sysvinit-2.86-sulogin.patch
|
||||||
|
+patch -p0 -b -s --suffix=.ststdmn < ../sysvinit-2.82-startstop.patch
|
||||||
|
+patch -p0 -b -s --suffix=.suse < ../sysvinit-2.85-suse.patch
|
||||||
|
+patch -p0 -b -s --suffix=.paths < ../sysvinit-2.85-paths.patch
|
||||||
|
+patch -p0 -b -s --suffix=.race < ../sysvinit-2.86-race.patch
|
||||||
|
+patch -p0 -b -s --suffix=.lib64 < ../sysvinit-2.86-lib64.patch
|
||||||
|
+patch -p0 -b -s --suffix=.mltline < ../sysvinit-2.82-multiline.patch
|
||||||
|
+patch -p0 -b -s --suffix=.utmp < ../sysvinit-2.86-utmp.patch
|
||||||
|
--- src/Makefile
|
||||||
|
+++ src/Makefile 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -8,17 +8,20 @@
|
||||||
|
# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
|
||||||
|
#
|
||||||
|
|
||||||
|
+DISTRO = SuSE
|
||||||
|
+
|
||||||
|
CC = gcc
|
||||||
|
-CFLAGS = -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE
|
||||||
|
-LDFLAGS = -s
|
||||||
|
-STATIC =
|
||||||
|
+CFLAGS = -Wall $(RPM_OPT_FLAGS) -D_GNU_SOURCE -pipe
|
||||||
|
+LDFLAGS = -Wl,-warn-common
|
||||||
|
+STATIC = -static
|
||||||
|
+IFLAGS = -D__NO_STRING_INLINES -D__OPTIMIZE_SIZE__
|
||||||
|
|
||||||
|
# For some known distributions we do not build all programs, otherwise we do.
|
||||||
|
BIN =
|
||||||
|
SBIN = init halt shutdown runlevel killall5
|
||||||
|
-USRBIN = last mesg
|
||||||
|
+USRBIN = last
|
||||||
|
|
||||||
|
-MAN1 = last.1 lastb.1 mesg.1
|
||||||
|
+MAN1 = last.1 lastb.1
|
||||||
|
MAN5 = initscript.5 inittab.5
|
||||||
|
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
|
||||||
|
MAN8 += shutdown.8 telinit.8
|
||||||
|
@@ -26,27 +29,36 @@ MAN8 += shutdown.8 telinit.8
|
||||||
|
ifeq ($(DISTRO),)
|
||||||
|
BIN += mountpoint
|
||||||
|
SBIN += sulogin bootlogd
|
||||||
|
-USRBIN += utmpdump wall
|
||||||
|
-MAN1 += mountpoint.1 wall.1
|
||||||
|
+USRBIN += utmpdump wall mesg
|
||||||
|
+MAN1 += mountpoint.1 wall.1 mesg.1
|
||||||
|
MAN8 += sulogin.8 bootlogd.8
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DISTRO),Debian)
|
||||||
|
BIN += mountpoint
|
||||||
|
SBIN += sulogin bootlogd
|
||||||
|
-MAN1 += mountpoint.1
|
||||||
|
+USRBIN += mesg
|
||||||
|
+MAN1 += mountpoint.1 mesg.1
|
||||||
|
MAN8 += sulogin.8 bootlogd.8
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DISTRO),Owl)
|
||||||
|
-USRBIN += wall
|
||||||
|
-MAN1 += wall.1
|
||||||
|
+USRBIN += wall mesg
|
||||||
|
+MAN1 += wall.1 mesg.1
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+ifeq ($(DISTRO),SuSE)
|
||||||
|
+BIN += mountpoint
|
||||||
|
+SBIN += sulogin
|
||||||
|
+USRBIN += utmpdump
|
||||||
|
+MAN1 += mountpoint.1
|
||||||
|
+MAN8 += sulogin.8
|
||||||
|
endif
|
||||||
|
|
||||||
|
BIN_OWNER = root
|
||||||
|
BIN_GROUP = root
|
||||||
|
BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
|
||||||
|
-INSTALL = install -o $(BIN_OWNER) -g $(BIN_GROUP)
|
||||||
|
+INSTALL = install
|
||||||
|
MANDIR = /usr/share/man
|
||||||
|
|
||||||
|
# Additional libs for GNU libc.
|
||||||
|
@@ -78,7 +90,7 @@ runlevel: runlevel.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ runlevel.o
|
||||||
|
|
||||||
|
sulogin: sulogin.o
|
||||||
|
- $(CC) $(LDFLAGS) $(STATIC) -o $@ sulogin.o $(LCRYPT)
|
||||||
|
+ $(CC) $(LDFLAGS) -o $@ sulogin.o $(LCRYPT)
|
||||||
|
|
||||||
|
wall: dowall.o wall.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ dowall.o wall.o
|
||||||
|
@@ -90,13 +102,13 @@ bootlogd: bootlogd.o
|
||||||
|
$(CC) $(LDFLAGS) -o $@ bootlogd.o -lutil
|
||||||
|
|
||||||
|
init.o: init.c init.h set.h reboot.h initreq.h
|
||||||
|
- $(CC) -c $(CFLAGS) init.c
|
||||||
|
+ $(CC) -c $(CFLAGS) $(IFLAGS) init.c
|
||||||
|
|
||||||
|
utmp.o: utmp.c init.h
|
||||||
|
$(CC) -c $(CFLAGS) utmp.c
|
||||||
|
|
||||||
|
init_utmp.o: utmp.c init.h
|
||||||
|
- $(CC) -c $(CFLAGS) -DINIT_MAIN utmp.c -o init_utmp.o
|
||||||
|
+ $(CC) -c $(CFLAGS) -DINIT_MAIN $(IFLAGS) utmp.c -o init_utmp.o
|
||||||
|
|
||||||
|
cleanobjs:
|
||||||
|
rm -f *.o *.bak
|
||||||
|
@@ -119,10 +131,10 @@ install:
|
||||||
|
for i in $(USRBIN); do \
|
||||||
|
$(INSTALL) -m 755 $$i $(ROOT)/usr/bin/; \
|
||||||
|
done
|
||||||
|
- # $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc/
|
||||||
|
- ln -sf halt $(ROOT)/sbin/reboot
|
||||||
|
- ln -sf halt $(ROOT)/sbin/poweroff
|
||||||
|
- ln -sf init $(ROOT)/sbin/telinit
|
||||||
|
+ ln -sf halt $(ROOT)/sbin/reboot
|
||||||
|
+ ln -sf halt $(ROOT)/sbin/poweroff
|
||||||
|
+ ln -sf init $(ROOT)/sbin/telinit
|
||||||
|
+ ln -sf killall5 $(ROOT)/sbin/pidof
|
||||||
|
ln -sf ../sbin/killall5 $(ROOT)/bin/pidof
|
||||||
|
if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
|
||||||
|
ln -sf last $(ROOT)/usr/bin/lastb; \
|
||||||
|
--- src/bootlogd.c
|
||||||
|
+++ src/bootlogd.c 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -210,7 +210,7 @@ int isconsole(char *s, char *res, int rl
|
||||||
|
int consolename(char *res, int rlen)
|
||||||
|
{
|
||||||
|
#ifdef TIOCGDEV
|
||||||
|
- unsigned int kdev;
|
||||||
|
+ kdev_t kdev;
|
||||||
|
#endif
|
||||||
|
struct stat st, st2;
|
||||||
|
char buf[256];
|
||||||
|
@@ -506,7 +506,7 @@ int main(int argc, char **argv)
|
||||||
|
}
|
||||||
|
|
||||||
|
(void)ioctl(0, TIOCCONS, NULL);
|
||||||
|
-#if 1
|
||||||
|
+#if 0
|
||||||
|
/* Work around bug in 2.1/2.2 kernels. Fixed in 2.2.13 and 2.3.18 */
|
||||||
|
if ((n = open("/dev/tty0", O_RDWR)) >= 0) {
|
||||||
|
(void)ioctl(n, TIOCCONS, NULL);
|
||||||
|
--- src/dowall.c
|
||||||
|
+++ src/dowall.c 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -65,7 +65,7 @@ static void getuidtty(char **userp, char
|
||||||
|
uid_t uid;
|
||||||
|
char *tty;
|
||||||
|
static char uidbuf[32];
|
||||||
|
- static char ttynm[32];
|
||||||
|
+ static char ttynm[UT_LINESIZE + 4];
|
||||||
|
static int init = 0;
|
||||||
|
|
||||||
|
if (!init) {
|
||||||
|
@@ -79,9 +79,13 @@ static void getuidtty(char **userp, char
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tty = ttyname(0)) != NULL) {
|
||||||
|
- if (strncmp(tty, "/dev/", 5) == 0)
|
||||||
|
- tty += 5;
|
||||||
|
- sprintf(ttynm, "(%.28s) ", tty);
|
||||||
|
+ if (strncmp(tty, _PATH_DEV, strlen(_PATH_DEV)) == 0) {
|
||||||
|
+ tty += strlen(_PATH_DEV);
|
||||||
|
+ if (tty[0] == '/')
|
||||||
|
+ tty ++;
|
||||||
|
+ }
|
||||||
|
+ snprintf(ttynm, sizeof(ttynm), "(%.*s) ",
|
||||||
|
+ UT_LINESIZE, tty);
|
||||||
|
} else
|
||||||
|
ttynm[0] = 0;
|
||||||
|
init++;
|
||||||
|
@@ -129,7 +133,7 @@ void wall(char *text, int fromshutdown,
|
||||||
|
struct sigaction sa;
|
||||||
|
struct utmp *utmp;
|
||||||
|
time_t t;
|
||||||
|
- char term[UT_LINESIZE+6];
|
||||||
|
+ char term[UT_LINESIZE + strlen(_PATH_DEV) + 1];
|
||||||
|
char line[81];
|
||||||
|
char *date, *p;
|
||||||
|
char *user, *tty;
|
||||||
|
@@ -178,11 +182,11 @@ void wall(char *text, int fromshutdown,
|
||||||
|
while ((utmp = getutent()) != NULL) {
|
||||||
|
if(utmp->ut_type != USER_PROCESS ||
|
||||||
|
utmp->ut_user[0] == 0) continue;
|
||||||
|
- if (strncmp(utmp->ut_line, "/dev/", 5) == 0) {
|
||||||
|
+ if (strncmp(utmp->ut_line, _PATH_DEV, strlen(_PATH_DEV)) == 0) {
|
||||||
|
term[0] = 0;
|
||||||
|
- strncat(term, utmp->ut_line, UT_LINESIZE);
|
||||||
|
+ strncat(term, utmp->ut_line, sizeof(term)-1);
|
||||||
|
} else
|
||||||
|
- snprintf(term, sizeof(term), "/dev/%.*s",
|
||||||
|
+ snprintf(term, sizeof(term), _PATH_DEV "%.*s",
|
||||||
|
UT_LINESIZE, utmp->ut_line);
|
||||||
|
if (strstr(term, "/../")) continue;
|
||||||
|
|
||||||
|
--- src/init.c
|
||||||
|
+++ src/init.c 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -52,12 +52,12 @@
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
-# if (__GLIBC__ >= 2)
|
||||||
|
- /* GNU libc 2.x */
|
||||||
|
+# if defined (__GLIBC__)
|
||||||
|
# define STACK_DEBUG 1
|
||||||
|
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
|
||||||
|
- /* Only glibc 2.0 needs this */
|
||||||
|
# include <sigcontext.h>
|
||||||
|
+# elif ( __GLIBC__ > 2) && ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
|
||||||
|
+# include <bits/sigcontext.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
@@ -68,6 +68,12 @@
|
||||||
|
#include "reboot.h"
|
||||||
|
#include "set.h"
|
||||||
|
|
||||||
|
+#ifdef __GNUC__
|
||||||
|
+ __attribute__ ((format (printf, 2, 3)))
|
||||||
|
+#endif
|
||||||
|
+static void initlog(int loglevel, char *fmt, ...);
|
||||||
|
+static void print(char *fmt);
|
||||||
|
+
|
||||||
|
#ifndef SIGPWR
|
||||||
|
# define SIGPWR SIGUSR2
|
||||||
|
#endif
|
||||||
|
@@ -82,11 +88,15 @@
|
||||||
|
/* Set a signal handler. */
|
||||||
|
#define SETSIG(sa, sig, fun, flags) \
|
||||||
|
do { \
|
||||||
|
+ memset(&sa, 0, sizeof(sa)); \
|
||||||
|
sa.sa_handler = fun; \
|
||||||
|
sa.sa_flags = flags; \
|
||||||
|
sigemptyset(&sa.sa_mask); \
|
||||||
|
sigaction(sig, &sa, NULL); \
|
||||||
|
} while(0)
|
||||||
|
+#ifndef mem_barrier
|
||||||
|
+# define mem_barrier() __asm__ __volatile__("": : :"memory")
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Version information */
|
||||||
|
char *Version = "@(#) init " VERSION " " DATE " miquels@cistron.nl";
|
||||||
|
@@ -208,6 +218,7 @@ char *extra_env[NR_EXTRA_ENV];
|
||||||
|
* This only works correctly because the linux select updates
|
||||||
|
* the elapsed time in the struct timeval passed to select!
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void do_sleep(int sec)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
@@ -216,13 +227,14 @@ void do_sleep(int sec)
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
while(select(0, NULL, NULL, NULL, &tv) < 0 && errno == EINTR)
|
||||||
|
- ;
|
||||||
|
+ mem_barrier();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Non-failing allocation routines (init cannot fail).
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void *imalloc(size_t size)
|
||||||
|
{
|
||||||
|
void *m;
|
||||||
|
@@ -235,7 +247,7 @@ void *imalloc(size_t size)
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
+static
|
||||||
|
char *istrdup(char *s)
|
||||||
|
{
|
||||||
|
char *m;
|
||||||
|
@@ -252,6 +264,7 @@ char *istrdup(char *s)
|
||||||
|
* Send the state info of the previous running init to
|
||||||
|
* the new one, in a version-independant way.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void send_state(int fd)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
@@ -316,7 +329,7 @@ static int get_void(FILE *f)
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while ((c = getc(f)) != EOF && c != '\n')
|
||||||
|
- ;
|
||||||
|
+ mem_barrier();
|
||||||
|
|
||||||
|
return (c != EOF);
|
||||||
|
}
|
||||||
|
@@ -333,7 +346,7 @@ static int get_cmd(FILE *f)
|
||||||
|
return C_EOF;
|
||||||
|
|
||||||
|
for(i = 0; cmds[i].cmd && strcmp(cmds[i].name, cmd) != 0; i++)
|
||||||
|
- ;
|
||||||
|
+ mem_barrier();
|
||||||
|
return cmds[i].cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -438,6 +451,7 @@ static CHILD *get_record(FILE *f)
|
||||||
|
* Read the complete state info from the state pipe.
|
||||||
|
* Returns 0 on success
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int receive_state(int fd)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
@@ -451,7 +465,7 @@ int receive_state(int fd)
|
||||||
|
get_string(old_version, sizeof(old_version), f);
|
||||||
|
oops_error = 0;
|
||||||
|
for (pp = &family; (*pp = get_record(f)) != NULL; pp = &((*pp)->next))
|
||||||
|
- ;
|
||||||
|
+ mem_barrier();
|
||||||
|
fclose(f);
|
||||||
|
return oops_error;
|
||||||
|
}
|
||||||
|
@@ -485,6 +499,7 @@ static int setproctitle(char *fmt, ...)
|
||||||
|
/*
|
||||||
|
* Set console_dev to a working console.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void console_init(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
@@ -524,6 +539,7 @@ void console_init(void)
|
||||||
|
/*
|
||||||
|
* Open the console with retries.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int console_open(int mode)
|
||||||
|
{
|
||||||
|
int f, fd = -1;
|
||||||
|
@@ -553,6 +569,7 @@ int console_open(int mode)
|
||||||
|
/*
|
||||||
|
* We got a signal (HUP PWR WINCH ALRM INT)
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void signal_handler(int sig)
|
||||||
|
{
|
||||||
|
ADDSET(got_signals, sig);
|
||||||
|
@@ -561,6 +578,7 @@ void signal_handler(int sig)
|
||||||
|
/*
|
||||||
|
* SIGCHLD: one of our children has died.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void chld_handler()
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -600,7 +618,8 @@ void chld_handler()
|
||||||
|
*
|
||||||
|
* The SIGCONT handler
|
||||||
|
*/
|
||||||
|
-void cont_handler()
|
||||||
|
+static
|
||||||
|
+void cont_handler(int sig)
|
||||||
|
{
|
||||||
|
got_cont = 1;
|
||||||
|
}
|
||||||
|
@@ -608,6 +627,7 @@ void cont_handler()
|
||||||
|
/*
|
||||||
|
* Fork and dump core in /.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void coredump(void)
|
||||||
|
{
|
||||||
|
static int dumped = 0;
|
||||||
|
@@ -641,6 +661,7 @@ void coredump(void)
|
||||||
|
* If we have the info, print where it occured.
|
||||||
|
* Then sleep 30 seconds and try to continue.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
#if defined(STACK_DEBUG) && defined(__linux__)
|
||||||
|
void segv_handler(int sig, struct sigcontext ctx)
|
||||||
|
{
|
||||||
|
@@ -657,7 +678,7 @@ void segv_handler(int sig, struct sigcon
|
||||||
|
errno = saved_errno;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
-void segv_handler()
|
||||||
|
+void segv_handler(int sig)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
|
||||||
|
@@ -672,7 +693,8 @@ void segv_handler()
|
||||||
|
/*
|
||||||
|
* The SIGSTOP & SIGTSTP handler
|
||||||
|
*/
|
||||||
|
-void stop_handler()
|
||||||
|
+static
|
||||||
|
+void stop_handler(int sig)
|
||||||
|
{
|
||||||
|
int saved_errno = errno;
|
||||||
|
|
||||||
|
@@ -685,6 +707,7 @@ void stop_handler()
|
||||||
|
/*
|
||||||
|
* Set terminal settings to reasonable defaults
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void console_stty(void)
|
||||||
|
{
|
||||||
|
struct termios tty;
|
||||||
|
@@ -700,16 +723,23 @@ void console_stty(void)
|
||||||
|
tty.c_cflag &= CBAUD|CBAUDEX|CSIZE|CSTOPB|PARENB|PARODD;
|
||||||
|
tty.c_cflag |= HUPCL|CLOCAL|CREAD;
|
||||||
|
|
||||||
|
- tty.c_cc[VINTR] = 3; /* ctrl('c') */
|
||||||
|
- tty.c_cc[VQUIT] = 28; /* ctrl('\\') */
|
||||||
|
- tty.c_cc[VERASE] = 127;
|
||||||
|
- tty.c_cc[VKILL] = 24; /* ctrl('x') */
|
||||||
|
- tty.c_cc[VEOF] = 4; /* ctrl('d') */
|
||||||
|
- tty.c_cc[VTIME] = 0;
|
||||||
|
- tty.c_cc[VMIN] = 1;
|
||||||
|
- tty.c_cc[VSTART] = 17; /* ctrl('q') */
|
||||||
|
- tty.c_cc[VSTOP] = 19; /* ctrl('s') */
|
||||||
|
- tty.c_cc[VSUSP] = 26; /* ctrl('z') */
|
||||||
|
+ tty.c_cc[VTIME] = 0;
|
||||||
|
+ tty.c_cc[VMIN] = 1;
|
||||||
|
+ tty.c_cc[VINTR] = CINTR;
|
||||||
|
+ tty.c_cc[VQUIT] = CQUIT;
|
||||||
|
+ tty.c_cc[VERASE] = CERASE; /* ASCII DEL (0177) */
|
||||||
|
+ tty.c_cc[VKILL] = CKILL;
|
||||||
|
+ tty.c_cc[VEOF] = CEOF;
|
||||||
|
+ tty.c_cc[VSWTC] = _POSIX_VDISABLE;
|
||||||
|
+ tty.c_cc[VSTART] = CSTART;
|
||||||
|
+ tty.c_cc[VSTOP] = CSTOP;
|
||||||
|
+ tty.c_cc[VSUSP] = CSUSP;
|
||||||
|
+ tty.c_cc[VEOL] = _POSIX_VDISABLE;
|
||||||
|
+ tty.c_cc[VREPRINT] = CREPRINT;
|
||||||
|
+ tty.c_cc[VDISCARD] = CDISCARD;
|
||||||
|
+ tty.c_cc[VWERASE] = CWERASE;
|
||||||
|
+ tty.c_cc[VLNEXT] = CLNEXT;
|
||||||
|
+ tty.c_cc[VEOL2] = _POSIX_VDISABLE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set pre and post processing
|
||||||
|
@@ -719,6 +749,14 @@ void console_stty(void)
|
||||||
|
tty.c_lflag = ISIG|ICANON|ECHO|ECHOCTL|ECHOPRT|ECHOKE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
+ * Setting for SuSE: No flow control (-ixon), ignore break (ignbrk),
|
||||||
|
+ * and make nl/cr more usable (sane).
|
||||||
|
+ */
|
||||||
|
+ tty.c_iflag |= IGNBRK;
|
||||||
|
+ tty.c_iflag &= ~(BRKINT|INLCR|IGNCR|IXON);
|
||||||
|
+ tty.c_oflag &= ~(OCRNL|ONLRET);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
* Now set the terminal line.
|
||||||
|
* We don't care about non-transmitted output data
|
||||||
|
* and non-read input data.
|
||||||
|
@@ -731,6 +769,7 @@ void console_stty(void)
|
||||||
|
/*
|
||||||
|
* Print to the system console
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void print(char *s)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
@@ -747,6 +786,7 @@ void print(char *s)
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__attribute__ ((format (printf, 2, 3)))
|
||||||
|
#endif
|
||||||
|
+static
|
||||||
|
void initlog(int loglevel, char *s, ...)
|
||||||
|
{
|
||||||
|
va_list va_alist;
|
||||||
|
@@ -789,6 +829,7 @@ char **init_buildenv(int child)
|
||||||
|
char i_lvl[] = "RUNLEVEL=x";
|
||||||
|
char i_prev[] = "PREVLEVEL=x";
|
||||||
|
char i_cons[32];
|
||||||
|
+ char i_shell[] = "SHELL=" SHELL;
|
||||||
|
char **e;
|
||||||
|
int n, i;
|
||||||
|
|
||||||
|
@@ -808,6 +849,7 @@ char **init_buildenv(int child)
|
||||||
|
snprintf(i_cons, sizeof(i_cons), "CONSOLE=%s", console_dev);
|
||||||
|
i_lvl[9] = thislevel;
|
||||||
|
i_prev[10] = prevlevel;
|
||||||
|
+ e[n++] = istrdup(i_shell);
|
||||||
|
e[n++] = istrdup(i_lvl);
|
||||||
|
e[n++] = istrdup(i_prev);
|
||||||
|
e[n++] = istrdup(i_cons);
|
||||||
|
@@ -836,6 +878,7 @@ void init_freeenv(char **e)
|
||||||
|
* This function is too long and indents too deep.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int spawn(CHILD *ch, int *res)
|
||||||
|
{
|
||||||
|
char *args[16]; /* Argv array */
|
||||||
|
@@ -978,7 +1021,7 @@ int spawn(CHILD *ch, int *res)
|
||||||
|
}
|
||||||
|
SETSIG(sa, SIGCHLD, SIG_DFL, SA_RESTART);
|
||||||
|
if ((pid = fork()) < 0) {
|
||||||
|
- initlog(L_VB, "cannot fork");
|
||||||
|
+ initlog(L_VB, "cannot fork: %s", strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (pid > 0) {
|
||||||
|
@@ -1007,7 +1050,7 @@ int spawn(CHILD *ch, int *res)
|
||||||
|
* this with a temporary process.
|
||||||
|
*/
|
||||||
|
if ((pid = fork()) < 0) {
|
||||||
|
- initlog(L_VB, "cannot fork");
|
||||||
|
+ initlog(L_VB, "cannot fork: %s", strerror(errno));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (pid == 0) {
|
||||||
|
@@ -1073,6 +1116,7 @@ int spawn(CHILD *ch, int *res)
|
||||||
|
/*
|
||||||
|
* Start a child running!
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void startup(CHILD *ch)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
@@ -1115,6 +1159,7 @@ void startup(CHILD *ch)
|
||||||
|
/*
|
||||||
|
* Read the inittab file.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void read_inittab(void)
|
||||||
|
{
|
||||||
|
FILE *fp; /* The INITTAB file */
|
||||||
|
@@ -1172,7 +1217,7 @@ void read_inittab(void)
|
||||||
|
* Skip comments and empty lines
|
||||||
|
*/
|
||||||
|
for(p = buf; *p == ' ' || *p == '\t'; p++)
|
||||||
|
- ;
|
||||||
|
+ mem_barrier();
|
||||||
|
if (*p == '#' || *p == '\n') continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -1495,6 +1540,7 @@ void read_inittab(void)
|
||||||
|
* The entries that do not belong here at all are removed
|
||||||
|
* from the list.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void start_if_needed(void)
|
||||||
|
{
|
||||||
|
CHILD *ch; /* Pointer to child */
|
||||||
|
@@ -1540,6 +1586,7 @@ void start_if_needed(void)
|
||||||
|
/*
|
||||||
|
* Ask the user on the console for a runlevel
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int ask_runlevel(void)
|
||||||
|
{
|
||||||
|
const char prompt[] = "\nEnter runlevel: ";
|
||||||
|
@@ -1568,6 +1615,7 @@ int ask_runlevel(void)
|
||||||
|
* Search the INITTAB file for the 'initdefault' field, with the default
|
||||||
|
* runlevel. If this fails, ask the user to supply a runlevel.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int get_init_default(void)
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -1616,6 +1664,7 @@ int get_init_default(void)
|
||||||
|
* the "old" INITLVL and arg == 0, try to read the new
|
||||||
|
* runlevel from that file first.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int read_level(int arg)
|
||||||
|
{
|
||||||
|
CHILD *ch; /* Walk through list */
|
||||||
|
@@ -1684,7 +1733,16 @@ int read_level(int arg)
|
||||||
|
initlog(L_VB, "Switching to runlevel: %c", foo);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (foo == 'Q') return runlevel;
|
||||||
|
+ if (foo == 'Q') {
|
||||||
|
+ struct sigaction sa;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Re-enable SIGINT's, which may disabled by
|
||||||
|
+ * an former Ctrl-Alt-Del action in process_signals().
|
||||||
|
+ */
|
||||||
|
+ SETSIG(sa, SIGINT, signal_handler, 0);
|
||||||
|
+ return(runlevel);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* Check if this is a runlevel a, b or c */
|
||||||
|
if (strchr("ABC", foo)) {
|
||||||
|
@@ -1723,6 +1781,7 @@ int read_level(int arg)
|
||||||
|
* longer than 5 minutes, or inittab was read again due
|
||||||
|
* to user interaction.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void fail_check(void)
|
||||||
|
{
|
||||||
|
CHILD *ch; /* Pointer to child structure */
|
||||||
|
@@ -1755,6 +1814,7 @@ void fail_check(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set all 'Fail' timers to 0 */
|
||||||
|
+static
|
||||||
|
void fail_cancel(void)
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -1769,6 +1829,7 @@ void fail_cancel(void)
|
||||||
|
/*
|
||||||
|
* Start up powerfail entries.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void do_power_fail(int pwrstat)
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -1802,6 +1863,7 @@ void do_power_fail(int pwrstat)
|
||||||
|
/*
|
||||||
|
* Check for state-pipe presence
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int check_pipe(int fd)
|
||||||
|
{
|
||||||
|
struct timeval t;
|
||||||
|
@@ -1822,6 +1884,7 @@ int check_pipe(int fd)
|
||||||
|
/*
|
||||||
|
* Make a state-pipe.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
int make_pipe(int fd)
|
||||||
|
{
|
||||||
|
int fds[2];
|
||||||
|
@@ -1839,6 +1902,7 @@ int make_pipe(int fd)
|
||||||
|
/*
|
||||||
|
* Attempt to re-exec.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void re_exec(void)
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -1896,7 +1960,7 @@ void re_exec(void)
|
||||||
|
* The existing init process execs a new init binary.
|
||||||
|
*/
|
||||||
|
env = init_buildenv(0);
|
||||||
|
- execl(myname, myname, "--init", NULL, env);
|
||||||
|
+ execle(myname, myname, "--init", NULL, env);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We shouldn't be here, something failed.
|
||||||
|
@@ -1914,6 +1978,7 @@ void re_exec(void)
|
||||||
|
* We got a change runlevel request through the
|
||||||
|
* init.fifo. Process it.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void fifo_new_level(int level)
|
||||||
|
{
|
||||||
|
#if CHANGE_WAIT
|
||||||
|
@@ -1942,7 +2007,7 @@ void fifo_new_level(int level)
|
||||||
|
runlevel == '1') console_stty();
|
||||||
|
read_inittab();
|
||||||
|
fail_cancel();
|
||||||
|
- setproctitle("init [%c]", runlevel);
|
||||||
|
+ setproctitle("init [%c]", (int)runlevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -2010,6 +2075,7 @@ void initcmd_setenv(char *data, int size
|
||||||
|
* the 2.2 kernel credential stuff to see who we're talking to.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void check_init_fifo(void)
|
||||||
|
{
|
||||||
|
struct init_request request;
|
||||||
|
@@ -2075,7 +2141,7 @@ void check_init_fifo(void)
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
n = select(pipe_fd + 1, &fds, NULL, NULL, &tv);
|
||||||
|
if (n <= 0) {
|
||||||
|
- if (n == 0 || errno == EINTR) return;
|
||||||
|
+ if (n == 0 || errno == EINTR || errno == EAGAIN) return;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2092,7 +2158,7 @@ void check_init_fifo(void)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (n <= 0) {
|
||||||
|
- if (errno == EINTR) return;
|
||||||
|
+ if (errno == EINTR || errno == EAGAIN) return;
|
||||||
|
initlog(L_VB, "error reading initrequest");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
@@ -2164,6 +2230,7 @@ void check_init_fifo(void)
|
||||||
|
* This function is used in the transition
|
||||||
|
* sysinit (-> single user) boot -> multi-user.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void boot_transitions()
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -2240,7 +2307,7 @@ void boot_transitions()
|
||||||
|
write_utmp_wtmp("runlevel", "~~", runlevel + 256 * oldlevel, RUN_LVL, "~");
|
||||||
|
thislevel = runlevel;
|
||||||
|
prevlevel = oldlevel;
|
||||||
|
- setproctitle("init [%c]", runlevel);
|
||||||
|
+ setproctitle("init [%c]", (int)runlevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -2249,6 +2316,7 @@ void boot_transitions()
|
||||||
|
* Init got hit by a signal. See which signal it is,
|
||||||
|
* and act accordingly.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void process_signals()
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
@@ -2273,7 +2341,12 @@ void process_signals()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ISMEMBER(got_signals, SIGINT)) {
|
||||||
|
+ struct sigaction sa;
|
||||||
|
INITDBG(L_VB, "got SIGINT");
|
||||||
|
+
|
||||||
|
+ /* we don't want any more SIGINT's */
|
||||||
|
+ SETSIG(sa, SIGINT, SIG_IGN, SA_RESTART);
|
||||||
|
+
|
||||||
|
/* Tell ctrlaltdel entry to start up */
|
||||||
|
for(ch = family; ch; ch = ch->next)
|
||||||
|
if (ch->action == CTRLALTDEL)
|
||||||
|
@@ -2335,7 +2408,7 @@ void process_signals()
|
||||||
|
runlevel == '1') console_stty();
|
||||||
|
read_inittab();
|
||||||
|
fail_cancel();
|
||||||
|
- setproctitle("init [%c]", runlevel);
|
||||||
|
+ setproctitle("init [%c]", (int)runlevel);
|
||||||
|
DELSET(got_signals, SIGHUP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -2354,7 +2427,8 @@ void process_signals()
|
||||||
|
/*
|
||||||
|
* The main loop
|
||||||
|
*/
|
||||||
|
-int init_main()
|
||||||
|
+static
|
||||||
|
+void init_main(void)
|
||||||
|
{
|
||||||
|
CHILD *ch;
|
||||||
|
struct sigaction sa;
|
||||||
|
@@ -2507,6 +2581,7 @@ int init_main()
|
||||||
|
/*
|
||||||
|
* Tell the user about the syntax we expect.
|
||||||
|
*/
|
||||||
|
+static
|
||||||
|
void usage(char *s)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s 0123456SsQqAaBbCcUu\n", s);
|
||||||
|
@@ -2564,12 +2639,38 @@ int telinit(char *progname, int argc, ch
|
||||||
|
request.sleeptime = sltime;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Catch some common signals. */
|
||||||
|
+ signal(SIGQUIT, SIG_IGN);
|
||||||
|
+ signal(SIGCHLD, SIG_IGN);
|
||||||
|
+ signal(SIGHUP, SIG_IGN);
|
||||||
|
+ signal(SIGTSTP, SIG_IGN);
|
||||||
|
+ signal(SIGTTIN, SIG_IGN);
|
||||||
|
+ signal(SIGTTOU, SIG_IGN);
|
||||||
|
+ signal(SIGINT, SIG_IGN);
|
||||||
|
+
|
||||||
|
+ /* Go to the root directory. */
|
||||||
|
+ chdir("/");
|
||||||
|
+
|
||||||
|
/* Open the fifo and write a command. */
|
||||||
|
+
|
||||||
|
/* Make sure we don't hang on opening /dev/initctl */
|
||||||
|
SETSIG(sa, SIGALRM, signal_handler, 0);
|
||||||
|
alarm(3);
|
||||||
|
- if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0 &&
|
||||||
|
- write(fd, &request, sizeof(request)) == sizeof(request)) {
|
||||||
|
+ if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0) {
|
||||||
|
+ ssize_t p = 0;
|
||||||
|
+ size_t s = sizeof(request);
|
||||||
|
+ void *ptr = &request;
|
||||||
|
+
|
||||||
|
+ while (s > 0) {
|
||||||
|
+ p = write(fd, ptr, s);
|
||||||
|
+ if (p < 0) {
|
||||||
|
+ if (errno == EINTR || errno == EAGAIN)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ptr += p;
|
||||||
|
+ s -= p;
|
||||||
|
+ }
|
||||||
|
close(fd);
|
||||||
|
alarm(0);
|
||||||
|
return 0;
|
||||||
|
@@ -2619,6 +2720,8 @@ int main(int argc, char **argv)
|
||||||
|
p++;
|
||||||
|
else
|
||||||
|
p = argv[0];
|
||||||
|
+
|
||||||
|
+ /* Common umask */
|
||||||
|
umask(022);
|
||||||
|
|
||||||
|
/* Quick check */
|
||||||
|
@@ -2651,7 +2754,7 @@ int main(int argc, char **argv)
|
||||||
|
for (f = 0; f < argc; f++)
|
||||||
|
maxproclen += strlen(argv[f]) + 1;
|
||||||
|
reload = 1;
|
||||||
|
- setproctitle("init [%c]",runlevel);
|
||||||
|
+ setproctitle("init [%c]", (int)runlevel);
|
||||||
|
|
||||||
|
init_main();
|
||||||
|
}
|
||||||
|
@@ -2680,7 +2783,7 @@ int main(int argc, char **argv)
|
||||||
|
argv0 = argv[0];
|
||||||
|
argv[1] = NULL;
|
||||||
|
setproctitle("init boot");
|
||||||
|
- init_main(dfl_level);
|
||||||
|
+ init_main();
|
||||||
|
|
||||||
|
/*NOTREACHED*/
|
||||||
|
return 0;
|
||||||
|
--- src/init.h
|
||||||
|
+++ src/init.h 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -30,12 +30,6 @@
|
||||||
|
/* Prototypes. */
|
||||||
|
void write_utmp_wtmp(char *user, char *id, int pid, int type, char *line);
|
||||||
|
void write_wtmp(char *user, char *id, int pid, int type, char *line);
|
||||||
|
-#ifdef __GNUC__
|
||||||
|
-__attribute__ ((format (printf, 2, 3)))
|
||||||
|
-#endif
|
||||||
|
-void initlog(int loglevel, char *fmt, ...);
|
||||||
|
-void set_term(int how);
|
||||||
|
-void print(char *fmt);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
# define INITDBG(level, fmt, args...) initlog(level, fmt, ##args)
|
||||||
|
--- src/shutdown.c
|
||||||
|
+++ src/shutdown.c 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -60,6 +60,7 @@ char *clean_env[] = {
|
||||||
|
"HOME=/",
|
||||||
|
"PATH=/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
|
"TERM=dumb",
|
||||||
|
+ "SHELL=/bin/sh",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -159,11 +160,24 @@ int init_setenv(char *name, char *value)
|
||||||
|
sigaction(SIGALRM, &sa, NULL);
|
||||||
|
got_alrm = 0;
|
||||||
|
alarm(3);
|
||||||
|
- if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0 &&
|
||||||
|
- write(fd, &request, sizeof(request)) == sizeof(request)) {
|
||||||
|
- close(fd);
|
||||||
|
- alarm(0);
|
||||||
|
- return 0;
|
||||||
|
+ if ((fd = open(INIT_FIFO, O_WRONLY)) >= 0) {
|
||||||
|
+ ssize_t p = 0;
|
||||||
|
+ size_t s = sizeof(request);
|
||||||
|
+ void *ptr = &request;
|
||||||
|
+
|
||||||
|
+ while (s > 0) {
|
||||||
|
+ p = write(fd, ptr, s);
|
||||||
|
+ if (p < 0) {
|
||||||
|
+ if (errno == EINTR || errno == EAGAIN)
|
||||||
|
+ continue;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ptr += p;
|
||||||
|
+ s -= p;
|
||||||
|
+ }
|
||||||
|
+ close(fd);
|
||||||
|
+ alarm(0);
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "shutdown: ");
|
||||||
|
--- src/utmp.c
|
||||||
|
+++ src/utmp.c 2006-08-18 14:45:28.000000000 +0200
|
||||||
|
@@ -47,6 +47,9 @@ char *line) /* Which line is this */
|
||||||
|
int fd;
|
||||||
|
struct utmp utmp;
|
||||||
|
struct utsname uname_buf;
|
||||||
|
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
|
||||||
|
+ struct timeval tv;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Can't do much if WTMP_FILE is not present or not writable.
|
||||||
|
@@ -99,7 +102,13 @@ char *line) /* Which line is this */
|
||||||
|
*/
|
||||||
|
memset(&utmp, 0, sizeof(utmp));
|
||||||
|
#if defined(__GLIBC__)
|
||||||
|
+# if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
|
||||||
|
+ gettimeofday(&tv, NULL);
|
||||||
|
+ utmp.ut_tv.tv_sec = (int32_t)tv.tv_sec;
|
||||||
|
+ utmp.ut_tv.tv_usec = (int32_t)tv.tv_usec;
|
||||||
|
+# else
|
||||||
|
gettimeofday(&utmp.ut_tv, NULL);
|
||||||
|
+# endif
|
||||||
|
#else
|
||||||
|
time(&utmp.ut_time);
|
||||||
|
#endif
|
||||||
|
@@ -136,6 +145,9 @@ char *oldline) /* Line of old utmp ent
|
||||||
|
struct utmp utmp;
|
||||||
|
struct utmp tmp;
|
||||||
|
struct utmp *utmptr;
|
||||||
|
+#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
|
||||||
|
+ struct timeval tv;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Can't do much if UTMP_FILE is not present or not writable.
|
||||||
|
@@ -184,7 +196,13 @@ char *oldline) /* Line of old utmp ent
|
||||||
|
utmp.ut_pid = pid;
|
||||||
|
strncpy(utmp.ut_id, id, sizeof(utmp.ut_id));
|
||||||
|
#if defined(__GLIBC__)
|
||||||
|
+# if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
|
||||||
|
+ gettimeofday(&tv, NULL);
|
||||||
|
+ utmp.ut_tv.tv_sec = (int32_t)tv.tv_sec;
|
||||||
|
+ utmp.ut_tv.tv_usec = (int32_t)tv.tv_usec;
|
||||||
|
+# else
|
||||||
|
gettimeofday(&utmp.ut_tv, NULL);
|
||||||
|
+# endif
|
||||||
|
#else
|
||||||
|
time(&utmp.ut_time);
|
||||||
|
#endif
|
3
sysvinit-2.86.tar.bz2
Normal file
3
sysvinit-2.86.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2e2357e6449737b0ca2fe2d727b709e722dda8d64428e1266ad7da28d25ddc2b
|
||||||
|
size 84163
|
1149
sysvinit.changes
Normal file
1149
sysvinit.changes
Normal file
File diff suppressed because it is too large
Load Diff
846
sysvinit.spec
Normal file
846
sysvinit.spec
Normal file
@ -0,0 +1,846 @@
|
|||||||
|
#
|
||||||
|
# spec file for package sysvinit (Version 2.86)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||||
|
# This file and all modifications and additions to the pristine
|
||||||
|
# package are under the same license as the package itself.
|
||||||
|
#
|
||||||
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
# norootforbuild
|
||||||
|
|
||||||
|
Name: sysvinit
|
||||||
|
%define MGVER 0.9.6s
|
||||||
|
%define PDVER 2.0.2
|
||||||
|
%define KPVER 2.12
|
||||||
|
%define SCVER 1.08
|
||||||
|
%define SIVER 2.86
|
||||||
|
%define START 0.49
|
||||||
|
License: GNU General Public License (GPL), Other License(s), see package
|
||||||
|
Group: System/Base
|
||||||
|
PreReq: coreutils
|
||||||
|
Autoreqprov: on
|
||||||
|
Version: 2.86
|
||||||
|
Release: 49
|
||||||
|
Summary: SysV-Style init
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
Source: sysvinit-2.86.tar.bz2
|
||||||
|
Source2: killproc-2.12.tar.bz2
|
||||||
|
Source3: powerd-2.0.2.tar.bz2
|
||||||
|
Source4: showconsole-1.08.tar.bz2
|
||||||
|
Source5: startpar-0.49.tar.bz2
|
||||||
|
Source6: rc.powerd
|
||||||
|
Patch: sysvinit-2.86.dif
|
||||||
|
Patch1: sysvinit-2.86-nfs4pidof.patch
|
||||||
|
Patch2: powerd-2.0.2.dif
|
||||||
|
Patch3: killproc-2.12.dif
|
||||||
|
Patch4: swsusp-for-sysvinit-2.86.diff
|
||||||
|
Patch5: sysvinit-2.86-sulogin.patch
|
||||||
|
Patch6: sysvinit-2.82-startstop.patch
|
||||||
|
Patch7: sysvinit-2.85-suse.patch
|
||||||
|
Patch8: sysvinit-2.85-paths.patch
|
||||||
|
Patch9: sysvinit-2.86-utmp.patch
|
||||||
|
Patch10: showconsole-1.08.dif
|
||||||
|
Patch11: sysvinit-2.86-race.patch
|
||||||
|
Patch12: sysvinit-2.86-lib64.patch
|
||||||
|
Patch13: sysvinit-2.82-multiline.patch
|
||||||
|
Patch14: startpar-0.49.dif
|
||||||
|
Patch15: sysvinit-2.86-usage-message.patch
|
||||||
|
Patch16: sysvinit-2.86-full-time.patch
|
||||||
|
|
||||||
|
%description
|
||||||
|
System V style init programs by Miquel van Smoorenburg that control the
|
||||||
|
booting and shutdown of your system. These support a number of system
|
||||||
|
runlevels, each one associated with a specific set of utilities. For
|
||||||
|
example, the normal system runlevel is 3, which starts a getty on
|
||||||
|
virtual consoles tty1-tty6. Runlevel 5 starts xdm. Runlevel 0 shuts
|
||||||
|
down the system. See the individual man pages for inittab, initscript,
|
||||||
|
halt, init, killproc, killall5, powerd, reboot, runlevel, shutdown, and
|
||||||
|
telinit for more information.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
--------
|
||||||
|
Miquel van Smoorenburg <miquels@drinkel.ow.nl>
|
||||||
|
Florian La Roche <florian@suse.de>
|
||||||
|
Werner Fink <werner@suse.de>
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q -b 2 -b 3 -b 4 -b 5
|
||||||
|
%patch -P 1 -b .nfs4pidof
|
||||||
|
%patch -P 5 -b .sulogin
|
||||||
|
%patch -P 6 -b .ststdmn
|
||||||
|
%patch -P 7 -b .suse
|
||||||
|
%patch -P 8 -b .paths
|
||||||
|
%patch -P 9 -b .utmp
|
||||||
|
%patch -P 11 -b .race
|
||||||
|
%patch -P 12 -b .lib64
|
||||||
|
%patch -P 13 -b .multiline
|
||||||
|
%patch
|
||||||
|
%patch -P 4 -p 0 -b .swsusp
|
||||||
|
%patch -P 15 -b .usage
|
||||||
|
%patch -P 16 -b .fulltime
|
||||||
|
pushd ../powerd-%{PDVER}
|
||||||
|
%patch -P 2
|
||||||
|
popd
|
||||||
|
pushd ../killproc-%{KPVER}
|
||||||
|
%patch -P 3
|
||||||
|
popd
|
||||||
|
pushd ../showconsole-%{SCVER}
|
||||||
|
%patch -P 10
|
||||||
|
popd
|
||||||
|
pushd ../startpar-%{START}
|
||||||
|
%patch -P 14
|
||||||
|
popd
|
||||||
|
|
||||||
|
%_fixowner .
|
||||||
|
|
||||||
|
%_fixgroup .
|
||||||
|
/bin/chmod -Rf a+rX,g-w,o-w .
|
||||||
|
|
||||||
|
%build
|
||||||
|
RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -D_FILE_OFFSET_BITS=64"
|
||||||
|
export RPM_OPT_FLAGS
|
||||||
|
CFLAGS="-Wall ${RPM_OPT_FLAGS} -D_GNU_SOURCE -D__NO_STRING_INLINES -pipe"
|
||||||
|
CC=gcc
|
||||||
|
make -C src CFLAGS="$CFLAGS" CC="$CC"
|
||||||
|
pushd contrib/
|
||||||
|
$CC $CFLAGS -o start-stop-daemon start-stop-daemon.c
|
||||||
|
popd
|
||||||
|
pushd ../showconsole-%{SCVER}
|
||||||
|
make
|
||||||
|
popd
|
||||||
|
pushd ../killproc-%{KPVER}
|
||||||
|
make INC="-I../showconsole-%{SCVER} -L../showconsole-%{SCVER}"
|
||||||
|
popd
|
||||||
|
pushd ../powerd-%{PDVER}
|
||||||
|
%ifnarch s390 s390x
|
||||||
|
./configure --prefix= --bindir='$(DESTDIR)/sbin' \
|
||||||
|
--mandir='$(DESTDIR)%{_mandir}' \
|
||||||
|
--sbindir='$(DESTDIR)/sbin'
|
||||||
|
make CFLAGS="-I../sysvinit-%{version}/src $CFLAGS"
|
||||||
|
%endif
|
||||||
|
popd
|
||||||
|
pushd ../startpar-%{START}
|
||||||
|
make CFLAGS="$CFLAGS"
|
||||||
|
popd
|
||||||
|
|
||||||
|
%install
|
||||||
|
rm -rf ${RPM_BUILD_ROOT}
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/bin
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/dev
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/etc
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/sbin
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/usr/bin
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}/usr/include
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}%{_mandir}/man1
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}%{_mandir}/man5
|
||||||
|
mkdir -m 755 -p ${RPM_BUILD_ROOT}%{_mandir}/man8
|
||||||
|
make install -C src MANPATH=%{_mandir} ROOT=${RPM_BUILD_ROOT}
|
||||||
|
install contrib/start-stop-daemon ${RPM_BUILD_ROOT}/sbin/
|
||||||
|
test -p ${RPM_BUILD_ROOT}/dev/initctl || {
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/dev/initctl
|
||||||
|
mknod ${RPM_BUILD_ROOT}/dev/initctl p
|
||||||
|
chmod 600 ${RPM_BUILD_ROOT}/dev/initctl
|
||||||
|
}
|
||||||
|
pushd ../showconsole-%{SCVER}
|
||||||
|
make install MANPATH=%{_mandir} INSTBINFLAGS="-m 0700" DESTDIR=${RPM_BUILD_ROOT}
|
||||||
|
popd
|
||||||
|
pushd ../killproc-%{KPVER}
|
||||||
|
make install MANPATH=%{_mandir} INSTBINFLAGS="-m 0755" DESTDIR=${RPM_BUILD_ROOT}
|
||||||
|
popd
|
||||||
|
pushd ../powerd-%{PDVER}
|
||||||
|
%ifnarch s390 s390x
|
||||||
|
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||||
|
cp README README.powerd
|
||||||
|
cp SUPPORTED SUPPORTED.powerd
|
||||||
|
cp FAQ FAQ.powerd
|
||||||
|
echo '# ' > ${RPM_BUILD_ROOT}/etc/powerd.conf
|
||||||
|
echo '# /etc/powerd.conf for powerd version-2.02' >> ${RPM_BUILD_ROOT}/etc/powerd.conf
|
||||||
|
echo '# ' >> ${RPM_BUILD_ROOT}/etc/powerd.conf
|
||||||
|
echo '# read manual page of detectups(8) and powerd(8) its self.' >> ${RPM_BUILD_ROOT}/etc/powerd.conf
|
||||||
|
echo '# ' >> ${RPM_BUILD_ROOT}/etc/powerd.conf
|
||||||
|
mkdir -p ${RPM_BUILD_ROOT}/etc/init.d
|
||||||
|
install -m 0744 %{SOURCE6} ${RPM_BUILD_ROOT}/etc/init.d/powerd
|
||||||
|
%endif
|
||||||
|
popd
|
||||||
|
pushd ../startpar-%{START}
|
||||||
|
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||||
|
popd
|
||||||
|
#
|
||||||
|
# Remove files not packed:
|
||||||
|
#
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/usr/include/{initreq.h,libblogger.h}
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/usr/lib/libblogger.a
|
||||||
|
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mesg.1*
|
||||||
|
%ifarch s390 s390x
|
||||||
|
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man8/swsusp.8*
|
||||||
|
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man8/powerd.8*
|
||||||
|
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man8/detectups.8*
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/sbin/powerd
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/sbin/detectups
|
||||||
|
rm -f ${RPM_BUILD_ROOT}/sbin/swsusp
|
||||||
|
%endif
|
||||||
|
chmod 444 ${RPM_BUILD_ROOT}%{_mandir}/man?/*
|
||||||
|
|
||||||
|
%post
|
||||||
|
if test ! -p dev/blog ; then
|
||||||
|
mknod -m 0640 dev/blog p
|
||||||
|
fi
|
||||||
|
if test -x /sbin/telinit -a -p /dev/initctl -a -f /proc/1/exe -a -d /proc/1/root ; then
|
||||||
|
if test $(stat -Lc '%%i' /) -eq $(stat -Lc '%%i' /proc/1/root) ; then
|
||||||
|
/sbin/telinit u
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf ${RPM_BUILD_ROOT}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr (-,root,root,755)
|
||||||
|
%ifnarch s390 s390x
|
||||||
|
%config /etc/powerd.conf
|
||||||
|
%config /etc/init.d/powerd
|
||||||
|
%doc ../powerd-%{PDVER}/README.powerd
|
||||||
|
%doc ../powerd-%{PDVER}/SUPPORTED.powerd
|
||||||
|
%doc ../powerd-%{PDVER}/FAQ.powerd
|
||||||
|
%doc ../powerd-%{PDVER}/powerd.conf.monitor
|
||||||
|
%doc ../powerd-%{PDVER}/powerd.conf.peer
|
||||||
|
%doc README.swsusp
|
||||||
|
%endif
|
||||||
|
%doc contrib/start-stop-daemon.README
|
||||||
|
# %doc contrib/bootlogd.README
|
||||||
|
/dev/initctl
|
||||||
|
/bin/mountpoint
|
||||||
|
/bin/pidof
|
||||||
|
/bin/usleep
|
||||||
|
# /sbin/bootlogd
|
||||||
|
/sbin/blogger
|
||||||
|
/sbin/blogd
|
||||||
|
/sbin/showconsole
|
||||||
|
/sbin/setconsole
|
||||||
|
/sbin/isserial
|
||||||
|
/sbin/checkproc
|
||||||
|
/sbin/pidofproc
|
||||||
|
/sbin/halt
|
||||||
|
/sbin/init
|
||||||
|
# /sbin/intr
|
||||||
|
/sbin/killproc
|
||||||
|
/sbin/killall5
|
||||||
|
/sbin/pidof
|
||||||
|
%ifnarch s390 s390x
|
||||||
|
/sbin/powerd
|
||||||
|
/sbin/detectups
|
||||||
|
/sbin/swsusp
|
||||||
|
%endif
|
||||||
|
/sbin/poweroff
|
||||||
|
/sbin/reboot
|
||||||
|
/sbin/runlevel
|
||||||
|
/sbin/startproc
|
||||||
|
/sbin/start_daemon
|
||||||
|
/sbin/shutdown
|
||||||
|
/sbin/start-stop-daemon
|
||||||
|
/sbin/sulogin
|
||||||
|
/sbin/telinit
|
||||||
|
/sbin/startpar
|
||||||
|
/usr/bin/last
|
||||||
|
/usr/bin/lastb
|
||||||
|
/usr/bin/utmpdump
|
||||||
|
# /usr/include/libblogger.h
|
||||||
|
# /usr/lib/libblogger.a
|
||||||
|
%doc %{_mandir}/man1/last.1.gz
|
||||||
|
%doc %{_mandir}/man1/lastb.1.gz
|
||||||
|
%doc %{_mandir}/man1/usleep.1.gz
|
||||||
|
%doc %{_mandir}/man1/mountpoint.1.gz
|
||||||
|
# %doc %{_mandir}/man8/bootlogd.8.gz
|
||||||
|
%doc %{_mandir}/man8/blogger.8.gz
|
||||||
|
%doc %{_mandir}/man8/blogd.8.gz
|
||||||
|
%doc %{_mandir}/man8/showconsole.8.gz
|
||||||
|
%doc %{_mandir}/man8/setconsole.8.gz
|
||||||
|
%doc %{_mandir}/man8/isserial.8.gz
|
||||||
|
%doc %{_mandir}/man8/checkproc.8.gz
|
||||||
|
%doc %{_mandir}/man8/pidofproc.8.gz
|
||||||
|
%doc %{_mandir}/man8/halt.8.gz
|
||||||
|
%doc %{_mandir}/man5/initscript.5.gz
|
||||||
|
%doc %{_mandir}/man5/inittab.5.gz
|
||||||
|
%doc %{_mandir}/man8/init.8.gz
|
||||||
|
#%doc %{_mandir}/man8/intr.8.gz
|
||||||
|
%doc %{_mandir}/man8/killall5.8.gz
|
||||||
|
%doc %{_mandir}/man8/killproc.8.gz
|
||||||
|
%doc %{_mandir}/man8/pidof.8.gz
|
||||||
|
%ifnarch s390 s390x
|
||||||
|
%doc %{_mandir}/man8/swsusp.8.gz
|
||||||
|
%doc %{_mandir}/man8/powerd.8.gz
|
||||||
|
%doc %{_mandir}/man8/detectups.8.gz
|
||||||
|
%endif
|
||||||
|
%doc %{_mandir}/man8/poweroff.8.gz
|
||||||
|
%doc %{_mandir}/man8/reboot.8.gz
|
||||||
|
%doc %{_mandir}/man8/runlevel.8.gz
|
||||||
|
%doc %{_mandir}/man8/startproc.8.gz
|
||||||
|
%doc %{_mandir}/man8/start_daemon.8.gz
|
||||||
|
%doc %{_mandir}/man8/shutdown.8.gz
|
||||||
|
%doc %{_mandir}/man8/sulogin.8.gz
|
||||||
|
%doc %{_mandir}/man8/telinit.8.gz
|
||||||
|
%doc %{_mandir}/man8/startpar.8.gz
|
||||||
|
|
||||||
|
%changelog -n sysvinit
|
||||||
|
* Thu Dec 14 2006 - werner@suse.de
|
||||||
|
- New killproc 2.12 with new option -N better handling for NFS
|
||||||
|
based programs which is not to stat(2) the binary with -N
|
||||||
|
- Make killall5 and pidof not to stat(2) binaries which are
|
||||||
|
loacted on NFS partitions (#224563)
|
||||||
|
* Tue Aug 22 2006 - werner@suse.de
|
||||||
|
- More on delayed utmp write: redo the write on telinit q (#148038)
|
||||||
|
* Mon Aug 21 2006 - werner@suse.de
|
||||||
|
- Make installation work even within chroot and new kernel 2.6.18+
|
||||||
|
* Fri Aug 18 2006 - werner@suse.de
|
||||||
|
- Check if utmp not only exists but is writable (#199412, #148038)
|
||||||
|
- Delay of utmp runlevel record if utmp is not writable (#148038)
|
||||||
|
* Thu Aug 10 2006 - werner@suse.de
|
||||||
|
- Enable showconsole to provide the major and minor device number
|
||||||
|
instead of the device file name.
|
||||||
|
* Fri Jun 09 2006 - werner@suse.de
|
||||||
|
- killproc: Allow relocated binary paths and several hard links
|
||||||
|
on binaries (bug #183251)
|
||||||
|
* Tue May 16 2006 - werner@suse.de
|
||||||
|
- Reduce buffer usage for reading /proc/stat
|
||||||
|
* Mon May 15 2006 - werner@suse.de
|
||||||
|
- Double buffer for /proc/stat for super large systems (#175385)
|
||||||
|
* Fri May 12 2006 - olh@suse.de
|
||||||
|
- do not strip startpar and start-stop-daemon binaries
|
||||||
|
* Thu Mar 16 2006 - werner@suse.de
|
||||||
|
- Do not rely on timeout after EINTR of select()
|
||||||
|
* Mon Mar 06 2006 - werner@suse.de
|
||||||
|
- Handle a second system console from kernel command line (#155292)
|
||||||
|
- Handle interrupted fifo writes even in shutdown
|
||||||
|
* Wed Feb 08 2006 - werner@suse.de
|
||||||
|
- Close high file descriptors even for single jobs (bug #148668)
|
||||||
|
* Tue Feb 07 2006 - werner@suse.de
|
||||||
|
- Add boot script for powerd (bug #147660)
|
||||||
|
- Make powerd handling a pid file
|
||||||
|
* Wed Jan 25 2006 - mls@suse.de
|
||||||
|
- converted neededforbuild to BuildRequires
|
||||||
|
* Wed Dec 21 2005 - werner@suse.de
|
||||||
|
- Remove not needed binaries on s390
|
||||||
|
* Mon Dec 05 2005 - od@suse.de
|
||||||
|
- Created/added patch for option -F (full time) (bug #136978)
|
||||||
|
* Mon Dec 05 2005 - od@suse.de
|
||||||
|
- Added options -a, -d and -i to usage message
|
||||||
|
* Tue Nov 08 2005 - werner@suse.de
|
||||||
|
- Move version of killproc to 2.11
|
||||||
|
* Allow to set a prefix and to disable usleep
|
||||||
|
* Wed Nov 02 2005 - dmueller@suse.de
|
||||||
|
- don't build as root
|
||||||
|
* Wed Nov 02 2005 - werner@suse.de
|
||||||
|
- Move version of killporc to 2.10
|
||||||
|
* Let checkproc really work like killproc if -k is specified.
|
||||||
|
This is that if the pid file provided with option -p does
|
||||||
|
not fit to a running process checkproc returns 7 for program
|
||||||
|
is not running.
|
||||||
|
* Wed Oct 19 2005 - werner@suse.de
|
||||||
|
- Update to sysvinit 2.86
|
||||||
|
* Tue Sep 20 2005 - werner@suse.de
|
||||||
|
- Make it build even on s390
|
||||||
|
* Thu Sep 15 2005 - werner@suse.de
|
||||||
|
- Bounce version of killporc to 2.09
|
||||||
|
- Add patch of Petter Reinholdtsen for startpar
|
||||||
|
- Move version of startpar to 0.49
|
||||||
|
* Thu Sep 01 2005 - mls@suse.de
|
||||||
|
- do not leak stdout fd to splash process (bug #105999)
|
||||||
|
* Thu Aug 25 2005 - werner@suse.de
|
||||||
|
- Apply the new LSB rule for optional pid files only (bug #105845)
|
||||||
|
* Tue Aug 23 2005 - werner@suse.de
|
||||||
|
- Enable patch for killproc
|
||||||
|
* Mon Aug 22 2005 - werner@suse.de
|
||||||
|
- Avoid zombie processes using startpar to get the next free
|
||||||
|
process slot as fast as possible.
|
||||||
|
- Make killproc be compliant with the newest LSB specs in case if
|
||||||
|
the specified pid file does not exist that the daemon is not
|
||||||
|
running (bug #105845).
|
||||||
|
- Add the possibility of using pid numbers instead of a pid file.
|
||||||
|
* Tue Jun 28 2005 - schwab@suse.de
|
||||||
|
- Fix typo.
|
||||||
|
* Wed May 25 2005 - werner@suse.de
|
||||||
|
- Bounce showconsole to version 1.08
|
||||||
|
- Bounce killproc to version 2.08
|
||||||
|
- Avoid signess warning of gcc4
|
||||||
|
- Use sysv_log() instead of log() to avoid builtin log() of gcc4
|
||||||
|
* Mon May 23 2005 - werner@suse.de
|
||||||
|
- Make blogd work even with new root file system behaviour
|
||||||
|
* Thu May 19 2005 - werner@suse.de
|
||||||
|
- More fixes for startpar: do not forget active jobs and correct
|
||||||
|
exit status handling for the case of stopping jobs.
|
||||||
|
* Mon Apr 25 2005 - werner@suse.de
|
||||||
|
- Showconsole: more names no belonging to terminals (bug #80304)
|
||||||
|
* Tue Apr 05 2005 - werner@suse.de
|
||||||
|
- startpar: fix endless loop and race condition (bug #74256)
|
||||||
|
* Sun Apr 03 2005 - aj@suse.de
|
||||||
|
- Further fixes for GCC4.
|
||||||
|
* Thu Mar 24 2005 - uli@suse.de
|
||||||
|
- fixed to build with GCC4
|
||||||
|
* Wed Mar 09 2005 - mls@suse.de
|
||||||
|
- startpar: fix splash progress bar if "make" mode is enabled
|
||||||
|
* Thu Jan 27 2005 - coolo@suse.de
|
||||||
|
- catch the case the clock moves back in time during boot
|
||||||
|
* Tue Jan 18 2005 - coolo@suse.de
|
||||||
|
- adding patch by Takashi to sort the services before inserting them
|
||||||
|
in the queue to allow predictable boot orders
|
||||||
|
- adding patch by me to update the limit more often in case the load
|
||||||
|
is too high (30s is just too long)
|
||||||
|
* Mon Dec 13 2004 - werner@suse.de
|
||||||
|
- Update to killproc 2.07 which includes the new ignore file
|
||||||
|
feature which works like a pid file but the pid found therein
|
||||||
|
will be used to ignore all processes and session with that id.
|
||||||
|
* Fri Dec 10 2004 - werner@suse.de
|
||||||
|
- Fix bottle neck in startpar calculation of number of parallel
|
||||||
|
processes. Now the number of really active processes are used.
|
||||||
|
* Wed Oct 13 2004 - werner@suse.de
|
||||||
|
- Do the real fix for the busy loop problem
|
||||||
|
- Add a dynamic load balance based on the current process load
|
||||||
|
and the current memory usage (bug #45191).
|
||||||
|
* Mon Oct 04 2004 - mls@suse.de
|
||||||
|
- don't call /sbin/splash if proc was unmounted
|
||||||
|
* Thu Sep 23 2004 - mls@suse.de
|
||||||
|
- call splash with $pos:$delta for animated progress bar
|
||||||
|
- serialize calls to splash program
|
||||||
|
* Mon Sep 20 2004 - mls@suse.de
|
||||||
|
- change bootsplash 'S' option handling to new bootsplash design
|
||||||
|
- also set progressbar on the fly
|
||||||
|
* Mon Sep 20 2004 - werner@suse.de
|
||||||
|
- Add some more information about the new make like scheme of
|
||||||
|
startpar into its own manual page.
|
||||||
|
* Thu Sep 09 2004 - werner@suse.de
|
||||||
|
- startproc: get wait status of already terminated parents on very
|
||||||
|
fast systems with high load during boot.
|
||||||
|
* Thu Sep 02 2004 - werner@suse.de
|
||||||
|
- Switch to Takashi's startpar version which is fully compatible
|
||||||
|
to previous version.
|
||||||
|
- Fix startpar to not to loop around if global timeout is expired.
|
||||||
|
- Fix struct timeval asignment in startpar for big endian.
|
||||||
|
- Add simple loadavg and memory check in startpar to make it
|
||||||
|
compatible with UP system with less memory.
|
||||||
|
* Tue Jun 01 2004 - werner@suse.de
|
||||||
|
- Remove any other workaround for hanging write
|
||||||
|
* Tue Jun 01 2004 - werner@suse.de
|
||||||
|
- Remove ioctl workaround in blogd due it does not work
|
||||||
|
* Tue Jun 01 2004 - werner@suse.de
|
||||||
|
- Change signal behaviour of blogd (try to fix bug #40474)
|
||||||
|
- Add ioctl workaround to blogd for IA64 serial console
|
||||||
|
- Do not overwrite environment of /sbin/init with comandline
|
||||||
|
* Fri May 14 2004 - werner@suse.de
|
||||||
|
- Catch negative return values of safein which may fix bug #34840
|
||||||
|
* Thu Mar 25 2004 - werner@suse.de
|
||||||
|
- showconsole:
|
||||||
|
* Do not trap into recursive symlink pointers (bug #36918)
|
||||||
|
* Do not scan directories in /dev/ with no terminals
|
||||||
|
* Mon Mar 22 2004 - werner@suse.de
|
||||||
|
- Fix cut&paste error
|
||||||
|
* Mon Mar 22 2004 - werner@suse.de
|
||||||
|
- Support udev within blogd
|
||||||
|
* Wed Mar 17 2004 - werner@suse.de
|
||||||
|
- Make clear descritption of -k option of checkproc and fix
|
||||||
|
LSB behaviour of killproc (bug #35851)
|
||||||
|
* Fri Mar 12 2004 - werner@suse.de
|
||||||
|
- Update of sysvinit 2.85 due better support of kernel 2.6
|
||||||
|
- Ensure that startpar close the allocated pty's (bug #35763)
|
||||||
|
* Thu Mar 04 2004 - werner@suse.de
|
||||||
|
- Command back: use unsigned int for device numbers which works
|
||||||
|
on both 32 and 64bit architectures and with old kernels
|
||||||
|
* Wed Mar 03 2004 - werner@suse.de
|
||||||
|
- Use largest int type for device numbers
|
||||||
|
* Fri Feb 27 2004 - werner@suse.de
|
||||||
|
- Be sure not to fail if startproc is called on fast systems
|
||||||
|
* Thu Feb 26 2004 - werner@suse.de
|
||||||
|
- Add waiting routine on inode/dev compare of startproc binary
|
||||||
|
and the forked off service (may fix bug #35008)
|
||||||
|
* Mon Feb 23 2004 - werner@suse.de
|
||||||
|
- Wait on write if kernel returns with EAGAIN
|
||||||
|
* Sun Feb 22 2004 - schwab@suse.de
|
||||||
|
- Fix use of uninitialized variable.
|
||||||
|
* Tue Jan 13 2004 - werner@suse.de
|
||||||
|
- Update to showconsole 1.07 now with warn message if /var is ro
|
||||||
|
- Fix bug #33798: remove group write flag from package docs
|
||||||
|
* Sat Oct 18 2003 - kukuk@suse.de
|
||||||
|
- Move mingetty in extra package
|
||||||
|
* Wed Oct 08 2003 - werner@suse.de
|
||||||
|
- Use struct ut_tv on 64 bit also for utmp and not only for wtmp
|
||||||
|
* Wed Oct 08 2003 - werner@suse.de
|
||||||
|
- Redo the rename of barrier define to mem_barrier.
|
||||||
|
* Tue Oct 07 2003 - werner@suse.de
|
||||||
|
- Use the not document struct ut_tv on 64 bit for utmp (bug #32086)
|
||||||
|
- blogd: Small optimization at ring buffer handling
|
||||||
|
* Tue Sep 30 2003 - kukuk@suse.de
|
||||||
|
- Rename barrier define to mem_barrier (to avoid clash with kernel
|
||||||
|
headers)
|
||||||
|
* Tue Sep 09 2003 - werner@suse.de
|
||||||
|
- Reenable fdatasync in blogd because linuxpthreads are fixed now
|
||||||
|
* Mon Sep 08 2003 - werner@suse.de
|
||||||
|
- blogd: Be sure that _REENTRANT is defined for libconsole.c
|
||||||
|
* Mon Sep 08 2003 - werner@suse.de
|
||||||
|
- blogd: Simply use locking information on broadcast lock, use
|
||||||
|
thread join lock only if the writing thread is going to sleep.
|
||||||
|
* Fri Sep 05 2003 - werner@suse.de
|
||||||
|
- Add simple program to check for serial lines on /dev/console to
|
||||||
|
replace the wrong serial check during boot with newer kernels
|
||||||
|
* Tue Sep 02 2003 - werner@suse.de
|
||||||
|
- Add workaround for blogd crash on x86_64 (bug #29750,29249,29545)
|
||||||
|
* Be paranoid and use SysV signal handling to ensure restart
|
||||||
|
* Be paranoid and check always the value of FILE pointer flog
|
||||||
|
* Wed Aug 06 2003 - werner@suse.de
|
||||||
|
- Change detection of serial versus terminal lines (bug #28490)
|
||||||
|
* Thu Jul 24 2003 - uli@suse.de
|
||||||
|
- fixed to build on s390x
|
||||||
|
* Thu Jul 03 2003 - werner@suse.de
|
||||||
|
- Make flags transparent in startproc.c
|
||||||
|
* Thu Jul 03 2003 - werner@suse.de
|
||||||
|
- Make killproc compliant with newest LSB spec (bug #24909)
|
||||||
|
* Tue Jun 24 2003 - werner@suse.de
|
||||||
|
- Ditto
|
||||||
|
* Mon Jun 23 2003 - werner@suse.de
|
||||||
|
- Make it build even on s390/s390x
|
||||||
|
* Mon Jun 23 2003 - kukuk@suse.de
|
||||||
|
- Remove not packaged files from buildroot.
|
||||||
|
* Mon Jun 23 2003 - kukuk@suse.de
|
||||||
|
- Remove compat link for old SPARC kernel
|
||||||
|
* Tue Jun 17 2003 - werner@suse.de
|
||||||
|
- Use BuildRoot
|
||||||
|
- Add startproc (0.42), thanks to Michael
|
||||||
|
- showconsole: check for environment variable NOTIOCGDEV
|
||||||
|
* Fri Jun 06 2003 - mfabian@suse.de
|
||||||
|
- also set the scroll region to the full window (ESC [ r) when
|
||||||
|
--noclear is not set.
|
||||||
|
* Thu Jun 05 2003 - mfabian@suse.de
|
||||||
|
- if the option "--noclear" is not set, don't write a full reset
|
||||||
|
because this leaves the unicode mode again if the terminal was in
|
||||||
|
unicode mode and it also undos the ESC sequences in CONSOLE_MAGIC
|
||||||
|
which are needed for some languages/console-fonts.
|
||||||
|
Just put the cursor the home position (ESC [ H) and erase
|
||||||
|
everything below the cursor (ESC [ J).
|
||||||
|
* Thu May 15 2003 - werner@suse.de
|
||||||
|
- New showconsole/blogd version 1.06
|
||||||
|
* Threaded I/O stuff
|
||||||
|
* Tue Apr 29 2003 - werner@suse.de
|
||||||
|
- New showconsole/blogd version 1.05
|
||||||
|
* Do not overwrite ring buffer memory in case of the fifo
|
||||||
|
* Avoid not needed new line in case of carriage return.
|
||||||
|
* Read at least 3 seconds at blogd close and flush all I/O
|
||||||
|
* Mon Apr 14 2003 - werner@suse.de
|
||||||
|
- Fix script handling of killproc for several kernel versions
|
||||||
|
(bug #25767)
|
||||||
|
* Tue Mar 04 2003 - werner@suse.de
|
||||||
|
- Correct exit codes of killproc and update manual page about this
|
||||||
|
* Fri Nov 22 2002 - werner@suse.de
|
||||||
|
- Be less memory consuming with showconsole 1.04
|
||||||
|
* Thu Nov 21 2002 - werner@suse.de
|
||||||
|
- New showconsole 1.03
|
||||||
|
* be able to scan dirs under /dev/ in fallback case
|
||||||
|
* Thu Nov 14 2002 - werner@suse.de
|
||||||
|
- Update to mingetty 0.9.6s
|
||||||
|
* Be sure to get controlling tty
|
||||||
|
* Avoid overruns in string handling
|
||||||
|
* Wed Nov 13 2002 - werner@suse.de
|
||||||
|
- Update to showconsole 1.02 (a cleanup version)
|
||||||
|
- Update to mingetty 0.9.5s (s stand for SuSE)
|
||||||
|
* New old option for avoiding vcs/vcsa hangup, terminal
|
||||||
|
reset, and the usage of the glibc for updating wtmp.
|
||||||
|
* Now the default terminal type can be set at compile
|
||||||
|
time as an make option.
|
||||||
|
* Wed Nov 13 2002 - werner@suse.de
|
||||||
|
- Update to killproc 2.05:
|
||||||
|
* Change usleep which now calls sched_yield() for 0 microseconds
|
||||||
|
* Tue Nov 12 2002 - werner@suse.de
|
||||||
|
- Update to killproc 2.04:
|
||||||
|
* Better symlink handling
|
||||||
|
* New dialog prompt handling for services
|
||||||
|
* New chroot option.
|
||||||
|
* Mon Nov 11 2002 - ro@suse.de
|
||||||
|
- fixed deprecated multiline string literal
|
||||||
|
* Mon Nov 04 2002 - werner@suse.de
|
||||||
|
- Use usleep(1) in startproc/killproc/killall5 to force the
|
||||||
|
kernel to run the scheduler.
|
||||||
|
* Fri Aug 16 2002 - werner@suse.de
|
||||||
|
- Add PreReq (bug #18005)
|
||||||
|
- Not only blogger and blogd but also set and showconsole together
|
||||||
|
with their manual pages.
|
||||||
|
* Thu Aug 08 2002 - ihno@suse.de
|
||||||
|
- adding blogger and blogd to s390/s390x
|
||||||
|
* Fri Aug 02 2002 - froh@suse.de
|
||||||
|
- removed blogger from s390&s390x package lists
|
||||||
|
- changed 'ifarch s390' and 'ifarch s390x' to 'ifarch s390 s390x'
|
||||||
|
* Tue Jul 16 2002 - werner@suse.de
|
||||||
|
- Expand possible pid string length from 22 to 255
|
||||||
|
* Fri Jul 05 2002 - werner@suse.de
|
||||||
|
- Re-enable SIGINT in case or re-reading inittab (bug #16469)
|
||||||
|
* Thu Jul 04 2002 - werner@suse.de
|
||||||
|
- Update to killproc 2.03
|
||||||
|
- Fix pointer for ioctl in libconsole of showconsole
|
||||||
|
* Tue Apr 30 2002 - werner@suse.de
|
||||||
|
- Even if no blogd is used on S390x, the libblogger is required
|
||||||
|
* Mon Apr 29 2002 - werner@suse.de
|
||||||
|
- Avoid trouble with stupid gcc 3.1 parser and inlined macros.
|
||||||
|
* Thu Apr 25 2002 - werner@suse.de
|
||||||
|
- changes on mingetty (new version 0.9.4c)
|
||||||
|
* Add support for other TTY devices than virtual console
|
||||||
|
* Add nohost patch from Anders ??
|
||||||
|
* Mon Apr 22 2002 - sf@suse.de
|
||||||
|
- changed path to libcrypt in Makefile to also compile
|
||||||
|
on lib64-archs
|
||||||
|
* Tue Feb 12 2002 - ro@suse.de
|
||||||
|
- fix owner/group
|
||||||
|
* Tue Jan 15 2002 - werner@suse.de
|
||||||
|
- Different usage messages for startproc and start_daemon (#12692)
|
||||||
|
* Fri Dec 14 2001 - werner@suse.de
|
||||||
|
- Skip spinner of fsck/e2fsck in boot logging file
|
||||||
|
* Mon Oct 01 2001 - werner@suse.de
|
||||||
|
- Build and install utmpdump
|
||||||
|
* Mon Oct 01 2001 - werner@suse.de
|
||||||
|
- Move to SysVinit 2.82 and migrate our patches to 2.82
|
||||||
|
* Tue Sep 25 2001 - werner@suse.de
|
||||||
|
- Fix race on waiting on console I/O: just try open log file first
|
||||||
|
* Thu Sep 20 2001 - werner@suse.de
|
||||||
|
- Ignore interrupted waitpid(2) calls
|
||||||
|
* Wed Sep 19 2001 - werner@suse.de
|
||||||
|
- Add forgotten configuration of powerd
|
||||||
|
* Wed Sep 19 2001 - werner@suse.de
|
||||||
|
- Update to powerd 2.0.2 because this version initialize the
|
||||||
|
serial interface which seems to be required for kernel 2.4.x
|
||||||
|
* Fri Sep 07 2001 - werner@suse.de
|
||||||
|
- startproc: close boot logging FIFO before executing a daemon.
|
||||||
|
* Wed Sep 05 2001 - werner@suse.de
|
||||||
|
- blogd: really read the console a half second (bug #9899)
|
||||||
|
* Tue Sep 04 2001 - werner@suse.de
|
||||||
|
- Add waitpid() loop nodead lock patch of Andrea
|
||||||
|
- Add a check in the waitpid() loop to exit on failure
|
||||||
|
* Thu Aug 30 2001 - werner@suse.de
|
||||||
|
- Make blogd/showconsole more robustly against errors
|
||||||
|
- Add some fixes of bug #9898
|
||||||
|
* Fri Aug 24 2001 - werner@suse.de
|
||||||
|
- Activate 64 bit file handling interface (large file support)
|
||||||
|
* Thu Aug 23 2001 - werner@suse.de
|
||||||
|
- Do not reset terminal device of /dev/console if on a serial line
|
||||||
|
* Tue Jun 26 2001 - cstein@suse.de
|
||||||
|
- added a patch for the shutdown messages (see bug #8076)
|
||||||
|
(also changed some other strings in shutdown.c)
|
||||||
|
* Mon Jun 25 2001 - bk@suse.de
|
||||||
|
- back out read return 0 patch and don't build showconsole on s390x
|
||||||
|
* Mon Jun 25 2001 - bk@suse.de
|
||||||
|
- don't include showconsole programs in filelist on s390x
|
||||||
|
* Fri Jun 22 2001 - bk@suse.de
|
||||||
|
- blogd: when read return 0, this means EOF - don't loop in this case.
|
||||||
|
* Tue Jun 12 2001 - bk@suse.de
|
||||||
|
- don't try to build showconsole on s390x(not supported by kernel)
|
||||||
|
* Wed May 23 2001 - werner@suse.de
|
||||||
|
- Do not eat up argv and environ at boot logging in startproc
|
||||||
|
* Wed May 23 2001 - werner@suse.de
|
||||||
|
- New killproc version 2.01: now we're able again to find deamons
|
||||||
|
based on scripts.
|
||||||
|
- Make fifo /dev/blog after installation if not exist.
|
||||||
|
* Tue May 08 2001 - werner@suse.de
|
||||||
|
- Remove previous barrier() calls but use them on empty loops.
|
||||||
|
* Wed May 02 2001 - werner@suse.de
|
||||||
|
- Call umask only once for all init processes (pid 1 and others)
|
||||||
|
- Add some barrier() against officious compiler
|
||||||
|
- Rename cpp macro TEST to SYSVINIT_TEST
|
||||||
|
* Tue Apr 24 2001 - werner@suse.de
|
||||||
|
- Add default umask 022 at boot time
|
||||||
|
* Tue Apr 17 2001 - werner@suse.de
|
||||||
|
- Few minor changes to killproc and co.
|
||||||
|
* Thu Apr 12 2001 - werner@suse.de
|
||||||
|
- Disable boot logging and boot message redirection at common
|
||||||
|
runlevels if TIOCGDEV is missed.
|
||||||
|
* Wed Apr 11 2001 - werner@suse.de
|
||||||
|
- blogd: complain about missing ioctl TIOCGDEV at compile
|
||||||
|
and run time
|
||||||
|
* Wed Apr 04 2001 - werner@suse.de
|
||||||
|
- After fork reset signal handling of startproc to default for
|
||||||
|
common signals
|
||||||
|
* Thu Mar 22 2001 - werner@suse.de
|
||||||
|
- Startproc/killproc: handle by RPM moved and deleted exe links
|
||||||
|
* Wed Mar 21 2001 - werner@suse.de
|
||||||
|
- Add patch for rlstat() of schowconsole (Andreas Schwab)
|
||||||
|
* Mon Mar 19 2001 - werner@suse.de
|
||||||
|
- Startproc/killproc: handle deleted exe links
|
||||||
|
* Fri Mar 09 2001 - werner@suse.de
|
||||||
|
- Add forgotten usleep to file list
|
||||||
|
* Wed Feb 14 2001 - werner@suse.de
|
||||||
|
- Use sysvinit 2.78.4
|
||||||
|
- Spilt dif into several patches
|
||||||
|
- Use static on the most functions of init.c
|
||||||
|
- Integrate showconsole
|
||||||
|
- bzip tar's
|
||||||
|
* Mon Feb 05 2001 - werner@suse.de
|
||||||
|
- Update of killproc to version 2.00
|
||||||
|
* LSB conform exit values
|
||||||
|
* Use boot logging provided by showconsole-0.9.tar.gz of aaa_base
|
||||||
|
* New program usleep
|
||||||
|
* Mon Jan 15 2001 - werner@suse.de
|
||||||
|
- Make strncmp of exe link and fullname working upto MAXNAMLEN
|
||||||
|
* Tue Jan 09 2001 - werner@suse.de
|
||||||
|
- Use int instead of kdev_t in bootlogd.c
|
||||||
|
* Wed Nov 29 2000 - werner@suse.de
|
||||||
|
- Make tty settings for sulogin working, and enable job control.
|
||||||
|
- Workaround vor sigfholder (may kernel bug)
|
||||||
|
* Tue Nov 28 2000 - werner@suse.de
|
||||||
|
- New and fixed killproc version 1.17
|
||||||
|
- Change some man pages of sysvinit to fit our new boot scheme
|
||||||
|
- Enable tty settings for sulogin, should be checked on
|
||||||
|
serial console (BTW: SHOULD we DO that?).
|
||||||
|
* Thu Nov 16 2000 - ro@suse.de
|
||||||
|
- fixed install for killproc
|
||||||
|
* Wed Nov 15 2000 - werner@suse.de
|
||||||
|
- New killproc version (1.16)
|
||||||
|
* base name allowed
|
||||||
|
* protected the parent of the parent
|
||||||
|
* provide pidofproc (a link to checkproc for a verbose checkproc)
|
||||||
|
* provide stat_daemon (a link to statproc)
|
||||||
|
* Mon Oct 23 2000 - werner@suse.de
|
||||||
|
- changes on mingetty (new version 0.9.4b)
|
||||||
|
* On ro files systems chmod/chown shouldn't force an exit.
|
||||||
|
* Therefore we need a warn message.
|
||||||
|
* Due to the lack of a revoke system call we signal
|
||||||
|
all file holders including the mmaping processes.
|
||||||
|
* Wed Jun 28 2000 - bk@suse.de
|
||||||
|
- enabled reboot on s390
|
||||||
|
* Sun Jun 25 2000 - bk@suse.de
|
||||||
|
- removed some not needed files on s390
|
||||||
|
* Tue May 30 2000 - werner@suse.de
|
||||||
|
- Correct path of powerstatus (/var/run/powerstatus) of powerd
|
||||||
|
* Wed May 24 2000 - garloff@suse.de
|
||||||
|
- Added minimal docu for swsusp.
|
||||||
|
* Tue May 23 2000 - werner@suse.de
|
||||||
|
- New killproc version 1.15 reading exe link for kernel 2.2
|
||||||
|
* Wed May 17 2000 - garloff@suse.de
|
||||||
|
- Added software-suspend support to init.
|
||||||
|
- login option of mingetty limits logname to 42 chars.
|
||||||
|
* Wed May 10 2000 - garloff@suse.de
|
||||||
|
- Working patch for mingetty to support devfs.
|
||||||
|
* Wed May 10 2000 - garloff@suse.de
|
||||||
|
- Preliminary patch for devfs.
|
||||||
|
* Wed May 10 2000 - garloff@suse.de
|
||||||
|
- Make it more secure by passing the logname as one arg and by
|
||||||
|
checking for a leading '-'. The manpage tells the sysadmin
|
||||||
|
about possible risks now.
|
||||||
|
* Tue May 09 2000 - garloff@suse.de
|
||||||
|
- Added new options --login and --logopts to mingetty, so you may
|
||||||
|
create an inittab entry using ssh for login or similar
|
||||||
|
* Tue Mar 07 2000 - werner@suse.de
|
||||||
|
- Ignore SIGTERM for syslogd because this daemon use that signal
|
||||||
|
to control the parent process.
|
||||||
|
- Make read/write of /etc/ioctrl.save EINTR safe
|
||||||
|
- Use defined special character given from <termios.h>
|
||||||
|
- No flow control (-ixon), ignore break (ignbrk), and make nl/cr
|
||||||
|
more usable (sane).
|
||||||
|
- Set the terminal line immediately
|
||||||
|
* Mon Mar 06 2000 - werner@suse.de
|
||||||
|
- Avoid script handling for kernel threads
|
||||||
|
* Sun Mar 05 2000 - werner@suse.de
|
||||||
|
- If open fails -1 is returned (close bug #2200)
|
||||||
|
* Fri Mar 03 2000 - kukuk@suse.de
|
||||||
|
- Create /usr/bin/shutdown link for UltraSPARC kernel
|
||||||
|
* Mon Feb 21 2000 - werner@suse.de
|
||||||
|
- New version of killproc (1.1.4): fix of script handling
|
||||||
|
- New version of sysvinit (2.78) with some bug fixes
|
||||||
|
* Thu Dec 16 1999 - werner@suse.de
|
||||||
|
- New version of killproc 1.13
|
||||||
|
* Bug fix in handling hard links for daemons using pid files
|
||||||
|
* Bug fix: PROC pointers should not be volatile
|
||||||
|
* Shorten nonsleeps for none daemon programs
|
||||||
|
* Tue Nov 09 1999 - werner@suse.de
|
||||||
|
- Avoid trouble with hard links of binaries
|
||||||
|
* Sun Nov 07 1999 - kukuk@suse.de
|
||||||
|
- mingetty: Add 1900 to tm_year, it contains the years since 1900.
|
||||||
|
* Wed Nov 03 1999 - werner@suse.de
|
||||||
|
- New killproc 1.12
|
||||||
|
* Fix option -q of startproc
|
||||||
|
* Fix Bug in wait4 handling of startproc
|
||||||
|
* Fix script detection: do not handle startproc, killproc, and
|
||||||
|
checkproc as script interpreters
|
||||||
|
* Mon Nov 01 1999 - werner@suse.de
|
||||||
|
- Add a patch from Marius
|
||||||
|
* Fri Oct 29 1999 - werner@suse.de
|
||||||
|
- powerd should tell init if status is OK again
|
||||||
|
* Thu Sep 30 1999 - werner@suse.de
|
||||||
|
- New killproc version 1.11
|
||||||
|
* Some small speedups
|
||||||
|
* Minor spell correction in the manual pages
|
||||||
|
* Allow login onto tty's
|
||||||
|
- Use RPM_OPT_FLAGS throughout
|
||||||
|
* Mon Sep 13 1999 - bs@suse.de
|
||||||
|
- ran old prepare_spec on spec file to switch to new prepare_spec.
|
||||||
|
* Tue Sep 07 1999 - werner@suse.de
|
||||||
|
- Enable mingetty resetting the terminal
|
||||||
|
* Fri Aug 06 1999 - werner@suse.de
|
||||||
|
- New killproc-1.10
|
||||||
|
* startproc which is able to sleep
|
||||||
|
* better zombie handling
|
||||||
|
- killproc doesn't ignore zombies
|
||||||
|
- checkproc ignores zombies without `-z' by default
|
||||||
|
- startproc checks zombie state of child while sleeping
|
||||||
|
* Tue Jul 06 1999 - werner@suse.de
|
||||||
|
- Fix pts problem of shutdown (dowall.c)
|
||||||
|
* Thu Jun 24 1999 - werner@suse.de
|
||||||
|
- Add lastb and its manual page
|
||||||
|
* Wed Jun 23 1999 - werner@suse.de
|
||||||
|
- Integrate newest mingetty patch of jurix
|
||||||
|
- Update killproc version 1.9
|
||||||
|
* be more sufficient in setting user and/or group id
|
||||||
|
- Update to sysvinit 2.76
|
||||||
|
* Integrate newest sysvinit patch of jurix into
|
||||||
|
our patch. The command last is part of sysvinit.
|
||||||
|
* Tue Jun 22 1999 - werner@suse.de
|
||||||
|
- Update to new killproc version 1.8
|
||||||
|
* startproc knows about setsid to set up a new process session
|
||||||
|
for the new task (option -s)
|
||||||
|
* startproc can change the effective uid and/or gid for a process
|
||||||
|
(option -u uid and/or -g gid)
|
||||||
|
- Make spec file more handy for newer versions.
|
||||||
|
* Mon May 03 1999 - werner@suse.de
|
||||||
|
- Enable killproc-1.7.dif in specs file
|
||||||
|
* Mon May 03 1999 - werner@suse.de
|
||||||
|
- killproc shouldn't complain a disappeared job/thread
|
||||||
|
* Mon Apr 19 1999 - werner@suse.de
|
||||||
|
- mingetty: reset not only /dev/tty<line> but /dev/vcs<line> and
|
||||||
|
/dev/vcsa<line> also
|
||||||
|
* Fri Feb 26 1999 - werner@suse.de
|
||||||
|
- New killproc vesion 1.7
|
||||||
|
* read of /proc/ is secure against EINTR
|
||||||
|
* handle script names ala `bash -x /usr/bin/myscript -y'
|
||||||
|
* Mon Jan 18 1999 - werner@suse.de
|
||||||
|
- Make killproc more smart, e.g. faster
|
||||||
|
- Make startproc alpah compatible
|
||||||
|
* Thu Dec 10 1998 - ro@suse.de
|
||||||
|
- added last manpage
|
||||||
|
- link init static
|
||||||
|
* Tue Dec 08 1998 - ro@suse.de
|
||||||
|
- use last from sysvinit-2.75
|
||||||
|
* Mon Nov 30 1998 - werner@suse.de
|
||||||
|
- Close some races, unknowns, and difficulties in killproc tools
|
||||||
|
* Tue Nov 24 1998 - werner@suse.de
|
||||||
|
- Don't blame boot script with killproc having same name as the
|
||||||
|
controlled daemon ... new kernel doesn't need this.
|
||||||
|
* Mon Nov 16 1998 - ro@suse.de
|
||||||
|
- install man-page for powerd
|
||||||
|
* Fri Nov 13 1998 - werner@suse.de
|
||||||
|
- Integrate powerd-2.0 for a replacment of the obsolate old one
|
||||||
|
* Mon Nov 02 1998 - ro@suse.de
|
||||||
|
- update to killproc-1.6
|
||||||
|
* Thu Oct 22 1998 - ro@suse.de
|
||||||
|
- update to killproc-1.5 (take 2)
|
||||||
|
* Thu Oct 08 1998 - ro@suse.de
|
||||||
|
- killproc: libinit.c output of "can't open pid file" only "#if DEBUG"
|
||||||
|
* Tue Oct 06 1998 - ro@suse.de
|
||||||
|
- updated killproc to get rid of a memleak
|
||||||
|
* Mon Oct 05 1998 - ro@suse.de
|
||||||
|
- new version: killproc-1.4
|
||||||
|
* Fri Jul 03 1998 - werner@suse.de
|
||||||
|
- added killproc-1.2, a replacement of the old killproc
|
||||||
|
* Wed May 06 1998 - florian@suse.de
|
||||||
|
- added an option to killproc to also kill process groups:
|
||||||
|
killproc [-SIG] [-g] prog
|
||||||
|
* Tue Nov 04 1997 - mantel@suse.de
|
||||||
|
- creation of dev/initctl fixed
|
||||||
|
* Thu Oct 23 1997 - ro@suse.de
|
||||||
|
- ready for autobuild
|
Loading…
x
Reference in New Issue
Block a user