Re: patches
On Sun, Feb 03, 2002 at 06:53:28PM -0500, utsl@quic.net wrote:
> Excellent. Mind sending me a diff against my patch, so I can merge it together,
> and send upstream?
Modified now that Matthew's pointed out that RB_POWERDOWN exists.
--
Matthew Garrett | mjg59@srcf.ucam.org
diff -u -r ./debian/control ../sysvinit-2.84/debian/control
--- ./debian/control Sun Feb 3 23:50:09 2002
+++ ../sysvinit-2.84/debian/control Sun Feb 3 23:51:04 2002
@@ -6,7 +6,7 @@
Package: sysvinit
Essential: yes
-Architecture: freebsd-i386
+Architecture: netbsd-i386
Pre-depends: ${shlibs:Depends}
Depends: dpkg (>= 1.4.0.21)
Description: System-V like init.
diff -u -r ./debian/rules ../sysvinit-2.84/debian/rules
--- ./debian/rules Sun Feb 3 23:50:09 2002
+++ ../sysvinit-2.84/debian/rules Sun Feb 3 23:51:04 2002
@@ -18,7 +18,7 @@
build:
# Builds the binary package.
$(checkdir)
- (cd src; make DEBIAN=cool FREEBSD=1)
+ (cd src; make DEBIAN=cool NETBSD=1)
touch build
# Architecture independant files.
@@ -57,7 +57,7 @@
install -d -g root -m 755 -o root $(tmp)/usr/share/man/fr/man8
install -d -g root -m 755 -o root $(tmp)/var/lib/urandom
install -g root -m 755 debian/fsck.nfs $(tmp)/sbin/fsck.nfs
- (cd src; make ROOT=$(tmp) DEBIAN=cool FREEBSD=1 install )
+ (cd src; make ROOT=$(tmp) DEBIAN=cool NETBSD=1 install )
install -g root -m 644 debian/rc.boot.5 $(tmp)/usr/share/man/man5
install -g root -m 644 debian/rcS.5 $(tmp)/usr/share/man/man5
install -g root -m 644 debian/extra/*.8 \
diff -u -r ./src/Makefile ../sysvinit-2.84/src/Makefile
--- ./src/Makefile Sun Feb 3 23:50:09 2002
+++ ../sysvinit-2.84/src/Makefile Sun Feb 3 23:51:04 2002
@@ -18,7 +18,7 @@
PROGS = init halt shutdown killall5 runlevel sulogin utmpdump \
last mesg wall
else
- ifeq ($(FREEBSD),)
+ ifeq ($(NETBSD),)
PROGS = init halt shutdown killall5 runlevel sulogin last mesg
else
PROGS = init halt shutdown killall5 sulogin
@@ -102,7 +102,7 @@
$(INSTALL) -m 555 utmpdump wall $(ROOT)/usr/bin
endif
# $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc
-ifeq ($FREEBSD,)
+ifeq ($NETBSD,)
$(INSTALL) -m 755 mesg last $(ROOT)/usr/bin
endif
cd $(ROOT)/sbin; ln -sf halt reboot; chown $(BIN_COMBO) reboot
diff -u -r ./src/dowall.c ../sysvinit-2.84/src/dowall.c
--- ./src/dowall.c Sun Feb 3 23:50:09 2002
+++ ../sysvinit-2.84/src/dowall.c Sun Feb 3 23:51:04 2002
@@ -25,7 +25,7 @@
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#include "utent.h"
#endif
@@ -129,7 +129,7 @@
siginterrupt (SIGALRM, 1);
while ((utmp = getutent()) != NULL) {
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
if(utmp->ut_type != USER_PROCESS ||
utmp->ut_user[0] == 0) continue;
#else
diff -u -r ./src/halt.c ../sysvinit-2.84/src/halt.c
--- ./src/halt.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/halt.c Sun Feb 3 23:51:04 2002
@@ -55,7 +55,7 @@
#define RUNLVL_PICKY 0 /* Be picky about the runlevel */
extern int ifdown(void);
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
extern int hddown(void);
#endif
extern void write_wtmp(char *user, char *id, int pid, int type, char *line);
@@ -98,7 +98,7 @@
boottime -= (times(NULL) / HZ);
#endif
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
/*
* Find runlevel in utmp.
*/
@@ -251,7 +251,7 @@
if (do_ifdown)
(void)ifdown();
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
if (do_hddown)
(void)hddown();
#endif
@@ -262,7 +262,7 @@
/*
* Turn on hard reboot, CTRL-ALT-DEL will reboot now
*/
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
init_reboot(BMAGIC_HARD);
#endif
@@ -286,7 +286,7 @@
/*
* If we return, we (c)ontinued from the kernel monitor.
*/
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
init_reboot(BMAGIC_SOFT);
#endif
kill(1, SIGCONT);
diff -u -r ./src/hddown.c ../sysvinit-2.84/src/hddown.c
--- ./src/hddown.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/hddown.c Sun Feb 3 23:51:04 2002
@@ -15,7 +15,7 @@
#include <sys/ioctl.h>
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
#include <linux/hdreg.h>
#define MAX_DISKS 64
diff -u -r ./src/init.c ../sysvinit-2.84/src/init.c
--- ./src/init.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/init.c Sun Feb 3 23:51:04 2002
@@ -32,7 +32,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
#include <sys/kd.h>
#endif
#include <sys/resource.h>
@@ -45,7 +45,7 @@
#include <string.h>
#include <signal.h>
#include <termios.h>
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#define CBAUD 0010017
#define CBAUDEX 0010000
#endif
@@ -421,7 +421,7 @@
return oops_error;
}
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
/*
* Set the process title.
*/
@@ -1178,7 +1178,7 @@
if (!process) strcpy(err, "missing process field");
if (!action || !*action)
strcpy(err, "missing action field");
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
if (id && strlen(id) > sizeof(utproto.ut_id))
sprintf(err, "id field too long (max %d characters)",
(int)sizeof(utproto.ut_id));
@@ -1237,7 +1237,7 @@
* And fill it in.
*/
ch->action = actionNo;
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); /* Hack for different libs. */
#else
strncpy(ch->id, id, 8); /* Have no ut_id in utmp */
@@ -2333,7 +2333,7 @@
* Tell the kernel to send us SIGINT when CTRL-ALT-DEL
* is pressed, and that we want to handle keyboard signals.
*/
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
init_reboot(BMAGIC_SOFT);
if ((f = open(VT_MASTER, O_RDWR | O_NOCTTY)) >= 0) {
(void) ioctl(f, KDSIGACCEPT, SIGWINCH);
diff -u -r ./src/init.h ../sysvinit-2.84/src/init.h
--- ./src/init.h Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/init.h Sun Feb 3 23:51:04 2002
@@ -113,8 +113,8 @@
#define D_SLTIME -8
#define D_DIDBOOT -9
-#ifdef __FreeBSD__
-/* Values for the `ut_type' field of a `struct utmp', which FreeBSD doesn't have */
+#ifdef __NetBSD__
+/* Values for the `ut_type' field of a `struct utmp', which NetBSD doesn't have */
#define EMPTY 0 /* No valid user accounting information. */
#define RUN_LVL 1 /* The system's runlevel. */
diff -u -r ./src/killall5.c ../sysvinit-2.84/src/killall5.c
--- ./src/killall5.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/killall5.c Sun Feb 3 23:51:04 2002
@@ -37,7 +37,7 @@
#include <signal.h>
#include <dirent.h>
#include <syslog.h>
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
#include <getopt.h>
#else
#include "getopt.h"
diff -u -r ./src/last.c ../sysvinit-2.84/src/last.c
--- ./src/last.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/last.c Sun Feb 3 23:51:04 2002
@@ -30,7 +30,7 @@
#include <unistd.h>
#include <string.h>
#include <signal.h>
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#include "getopt.h"
#else
#include <getopt.h>
diff -u -r ./src/reboot.h ../sysvinit-2.84/src/reboot.h
--- ./src/reboot.h Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/reboot.h Sun Feb 3 23:51:04 2002
@@ -10,12 +10,12 @@
# include <sys/reboot.h>
#endif
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#include <sys/reboot.h>
#define BMAGIC_REBOOT RB_AUTOBOOT
#define BMAGIC_HALT RB_HALT
-#define BMAGIC_POWEROFF RB_POWEROFF
-#define init_reboot(magic) reboot(magic)
+#define BMAGIC_POWEROFF RB_POWERDOWN
+#define init_reboot(magic) reboot(magic,NULL)
#else
#define BMAGIC_HARD 0x89ABCDEF
#define BMAGIC_SOFT 0
diff -u -r ./src/runlevel.c ../sysvinit-2.84/src/runlevel.c
--- ./src/runlevel.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/runlevel.c Sun Feb 3 23:51:04 2002
@@ -24,7 +24,7 @@
struct utmp *ut;
char prev;
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
if (argc > 1) utmpname(argv[1]);
setutent();
diff -u -r ./src/shutdown.c ../sysvinit-2.84/src/shutdown.c
--- ./src/shutdown.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/shutdown.c Sun Feb 3 23:51:04 2002
@@ -38,7 +38,7 @@
#include <utmp.h>
#include "paths.h"
#include "reboot.h"
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#include "init.h"
#include "utent.h"
#endif
@@ -438,7 +438,7 @@
}
}
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
/* Do we need to use the shutdown.allow file ? */
if (useacl && (fp = fopen(SDALLOW, "r")) != NULL) {
diff -u -r ./src/sulogin.c ../sysvinit-2.84/src/sulogin.c
--- ./src/sulogin.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/sulogin.c Sun Feb 3 23:51:04 2002
@@ -21,7 +21,7 @@
#include <fcntl.h>
#include <signal.h>
#include <pwd.h>
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
#include <shadow.h>
#endif
#include <termios.h>
@@ -154,7 +154,7 @@
* First, we try to get the password the standard
* way using normal library calls.
*/
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
if ((pw = getpwnam("root")) &&
!strcmp(pw->pw_passwd, "x") &&
(spw = getspnam("root")))
@@ -260,7 +260,7 @@
tcgetattr(0, &old);
tcgetattr(0, &tty);
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
tty.c_iflag &= ~(IXON|IXOFF|IXANY);
#else
tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
diff -u -r ./src/utmp.c ../sysvinit-2.84/src/utmp.c
--- ./src/utmp.c Sun Feb 3 23:50:10 2002
+++ ../sysvinit-2.84/src/utmp.c Sun Feb 3 23:51:04 2002
@@ -21,7 +21,7 @@
#include "init.h"
#include "initreq.h"
#include "paths.h"
-#ifdef __FreeBSD__
+#ifdef __NetBSD__
#include "utent.h"
#endif
@@ -82,7 +82,7 @@
#else
time(&utmp.ut_time);
#endif
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
utmp.ut_pid = pid;
utmp.ut_type = type;
strncpy(utmp.ut_id , id , sizeof(utmp.ut_id ));
@@ -144,7 +144,7 @@
* Fill out an utmp struct.
*/
memset(&utmp, 0, sizeof(utmp));
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
utmp.ut_type = type;
utmp.ut_pid = pid;
strncpy(utmp.ut_id, id, sizeof(utmp.ut_id));
@@ -157,7 +157,7 @@
#endif
if (line) strncpy(utmp.ut_line, line, UT_LINESIZE);
-#ifndef __FreeBSD__
+#ifndef __NetBSD__
/*
* We might need to find the existing entry first, to
* find the tty of the process (for wtmp accounting).
Reply to: