This commit is contained in:
parent
13600661e1
commit
4b941f60e3
172
killproc-2.13.dif
Normal file
172
killproc-2.13.dif
Normal file
@ -0,0 +1,172 @@
|
||||
--- Makefile
|
||||
+++ Makefile 2008-12-04 18:59:57.812644400 +0100
|
||||
@@ -54,9 +54,10 @@ UBINPRG =
|
||||
ifeq ($(DISTRO),SuSE)
|
||||
UBINPRG += usleep
|
||||
UBINPRG += fsync
|
||||
+ VBINPRG += vhangup
|
||||
endif
|
||||
|
||||
-all: $(SBINPRG) $(UBINPRG)
|
||||
+all: $(SBINPRG) $(UBINPRG) $(VBINPRG)
|
||||
|
||||
libinit.o: libinit.c libinit.h
|
||||
$(CC) $(CFLAGS) $(CLOOP) -DINITDIR=\"$(INITDIR)\" -c $<
|
||||
@@ -104,6 +105,10 @@ install: $(TODO)
|
||||
$(INSTBIN) $$p $(UBINDIR)/; \
|
||||
$(INSTDOC) $$p.1 $(UDOCDIR)/; \
|
||||
done
|
||||
+ for p in $(VBINPRG); do \
|
||||
+ $(INSTBIN) $$p $(SBINDIR)/; \
|
||||
+ $(INSTDOC) $$p.8 $(SDOCDIR)/; \
|
||||
+ done
|
||||
#
|
||||
# Make distribution
|
||||
#
|
||||
@@ -120,8 +125,10 @@ FILES = README \
|
||||
libinit.h \
|
||||
usleep.c \
|
||||
usleep.1 \
|
||||
- fsync.c \
|
||||
- fsync.1 \
|
||||
+ fsync.c \
|
||||
+ fsync.1 \
|
||||
+ vhangup.c \
|
||||
+ vhangup.8 \
|
||||
killproc-$(VERSION).lsm
|
||||
|
||||
dest:
|
||||
--- vhangup.8
|
||||
+++ vhangup.8 2008-12-05 11:29:05.893545808 +0100
|
||||
@@ -0,0 +1,51 @@
|
||||
+.\"
|
||||
+.\" Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
|
||||
+.\"
|
||||
+.\" This program is free software; you can redistribute it and/or modify
|
||||
+.\" it under the terms of the GNU General Public License as published by
|
||||
+.\" the Free Software Foundation; either version 2 of the License, or
|
||||
+.\" (at your option) any later version.
|
||||
+.\"
|
||||
+.TH VHANGUP 1 "Jan 31, 2008" "Version 1.16" "The SuSE boot concept"
|
||||
+.UC 1
|
||||
+.SH NAME
|
||||
+Vhangup \- Cause a virtually hangup on the specified terminals
|
||||
+.\"
|
||||
+.SH SYNOPSIS
|
||||
+.\"
|
||||
+.B vhangup [
|
||||
+.I /dev/<terminal>
|
||||
+.B [
|
||||
+.I /dev/<terminal>
|
||||
+.B ]
|
||||
+.B ]
|
||||
+.\"
|
||||
+.SH DESCRIPTION
|
||||
+.B vhangup
|
||||
+simulates a hangup on the specified terminals. Not existing
|
||||
+device files or devices will be ignored.
|
||||
+\."
|
||||
+.SH EXAMPLES
|
||||
+.nf
|
||||
+.B vhangup /dev/tty1 /dev/tty2 /dev/tty3 /dev/tty4 /dev/tty5 /dev/tty6 /dev/ttyS1
|
||||
+
|
||||
+.fi
|
||||
+This will replace all open file descriptors in the kernel that points
|
||||
+to the listed ttys by a dummy that will deny further reading/writing
|
||||
+to the device. It also send the signals SIGHUP/SIGCONT to the processes
|
||||
+which have file descriptors open on the listed ttys.
|
||||
+\."
|
||||
+.SH RETURN VALUE
|
||||
+On success, zero is returned. On error, 1 is returned.
|
||||
+\."
|
||||
+.SH SEE ALSO
|
||||
+.BR vhangup (2),
|
||||
+.BR tty (4),
|
||||
+.BR ttyS (4),
|
||||
+.BR pts (4).
|
||||
+\."
|
||||
+.SH COPYRIGHT
|
||||
+2008 Werner Fink,
|
||||
+2008 SUSE LINUX Products GmbH, Germany.
|
||||
+.SH AUTHOR
|
||||
+Werner Fink <werner@suse.de>
|
||||
--- vhangup.c
|
||||
+++ vhangup.c 2008-12-05 11:47:35.881479139 +0100
|
||||
@@ -0,0 +1,77 @@
|
||||
+/*
|
||||
+ * vhangup.c Cause a hangup on the specified terminals
|
||||
+ *
|
||||
+ * Usage: vhangup /dev/tty1 ...
|
||||
+ *
|
||||
+ * Copyright 2008 Werner Fink, 2008 SUSE LINUX Products GmbH, Germany.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * Author: Werner Fink <werner@suse.de>
|
||||
+ */
|
||||
+
|
||||
+#ifndef _GNU_SOURCE
|
||||
+# define _GNU_SOURCE
|
||||
+#endif
|
||||
+#include <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/wait.h>
|
||||
+#include <termios.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int main(int argc, char* argv[])
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ switch (fork()) {
|
||||
+ case -1:
|
||||
+ fprintf(stderr, "vhangup: %s\n", strerror(errno));
|
||||
+ return 1;
|
||||
+ case 0: {
|
||||
+ struct sigaction sa, sa_old;
|
||||
+ int num;
|
||||
+
|
||||
+ setsid();
|
||||
+
|
||||
+ sa.sa_flags = 0;
|
||||
+ sa.sa_handler = SIG_IGN;
|
||||
+ sigemptyset (&sa.sa_mask);
|
||||
+ sigaction (SIGHUP, &sa, &sa_old);
|
||||
+
|
||||
+ for (ret = num = 1; num < argc; num++) {
|
||||
+ int fd = open(argv[num], O_RDWR|O_NONBLOCK|O_NOCTTY, 0);
|
||||
+ if (fd < 0) {
|
||||
+ switch (errno) {
|
||||
+ case ENOENT:
|
||||
+ case ENODEV:
|
||||
+ case ENXIO:
|
||||
+ ret++;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+ if ((ioctl (fd, TIOCSCTTY, 1) == 0) && (vhangup() == 0))
|
||||
+ ret++;
|
||||
+ close(fd);
|
||||
+ }
|
||||
+
|
||||
+ sigaction (SIGHUP, &sa_old, NULL);
|
||||
+ exit(ret != num);
|
||||
+ }
|
||||
+ default:
|
||||
+ waitpid(-1, &ret, 0);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return (WIFEXITED(ret)) ? WEXITSTATUS(ret) : 1;
|
||||
+}
|
@ -1,6 +1,6 @@
|
||||
--- .pkgextract
|
||||
+++ .pkgextract 2006-08-18 14:45:28.000000000 +0200
|
||||
@@ -0,0 +1,12 @@
|
||||
@@ -0,0 +1,14 @@
|
||||
+patch -p0 -b -s --suffix=.nfs4pidof < ../sysvinit-2.86-nfs4pidof.patch
|
||||
+patch -p0 -b -s --suffix=.sulogin < ../sysvinit-2.86-sulogin.patch
|
||||
+patch -p0 -b -s --suffix=.ststdmn < ../sysvinit-2.82-startstop.patch
|
||||
@ -13,6 +13,8 @@
|
||||
+patch -p0 -b -s --suffix=.usage < ../sysvinit-2.86-usage-message.patch
|
||||
+patch -p0 -b -s --suffix=.fulltime < ../sysvinit-2.86-full-time.patch
|
||||
+patch -p0 -b -s --suffix=.hddown < ../sysvinit-2.86-hddown.patch
|
||||
+patch -p0 -b -s --suffix=.selinux < ../sysvinit-2.86-selinux.patch
|
||||
+patch -p0 -b -s --suffix=.fuse < ../sysvinit-2.86-fuse-no-kill.patch
|
||||
--- src/Makefile
|
||||
+++ src/Makefile 2006-08-18 14:45:28.000000000 +0200
|
||||
@@ -8,17 +8,20 @@
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 5 11:55:13 CET 2008 - werner@suse.de
|
||||
|
||||
- New tool in killproc source tree: vhangup(8) for hanging up
|
||||
programs on terminal and sending SIGHUP, this avoids fuser.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 19 14:07:33 CET 2008 - werner@suse.de
|
||||
|
||||
|
@ -30,7 +30,7 @@ Group: System/Base
|
||||
PreReq: coreutils
|
||||
AutoReqProv: on
|
||||
Version: 2.86
|
||||
Release: 186
|
||||
Release: 187
|
||||
Summary: SysV-Style init
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: libselinux-devel libsepol-devel
|
||||
@ -47,7 +47,7 @@ Source10: mkinitrd-kill2.sh
|
||||
Patch: sysvinit-2.86.dif
|
||||
Patch1: sysvinit-2.86-nfs4pidof.patch
|
||||
Patch2: powerd-2.0.2.dif
|
||||
#Patch3: killproc-2.13.dif
|
||||
Patch3: killproc-2.13.dif
|
||||
Patch5: sysvinit-2.86-sulogin.patch
|
||||
Patch6: sysvinit-2.82-startstop.patch
|
||||
Patch7: sysvinit-2.85-suse.patch
|
||||
@ -103,7 +103,7 @@ pushd ../powerd-%{PDVER}
|
||||
%patch -P 2
|
||||
popd
|
||||
pushd ../killproc-%{KPVER}
|
||||
#%patch -P 3
|
||||
%patch -P 3
|
||||
popd
|
||||
pushd ../showconsole-%{SCVER}
|
||||
%patch -P 10
|
||||
@ -276,6 +276,7 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
/sbin/sulogin
|
||||
/sbin/telinit
|
||||
/sbin/startpar
|
||||
/sbin/vhangup
|
||||
/usr/bin/last
|
||||
/usr/bin/lastb
|
||||
/usr/bin/utmpdump
|
||||
@ -315,8 +316,12 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%doc %{_mandir}/man8/sulogin.8.gz
|
||||
%doc %{_mandir}/man8/telinit.8.gz
|
||||
%doc %{_mandir}/man8/startpar.8.gz
|
||||
%doc %{_mandir}/man8/vhangup.8.gz
|
||||
|
||||
%changelog
|
||||
* Fri Dec 05 2008 werner@suse.de
|
||||
- New tool in killproc source tree: vhangup(8) for hanging up
|
||||
programs on terminal and sending SIGHUP, this avoids fuser.
|
||||
* Wed Nov 19 2008 werner@suse.de
|
||||
- Avoid error messages if blogd is closed premature
|
||||
* Tue Nov 18 2008 werner@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user