From: Ben Pfaff Date: Wed, 23 Feb 2011 20:56:31 +0000 (-0800) Subject: ovs-kill: Remove. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbca1e20e84bc34537f0a3db073195f6783fb373;p=openvswitch ovs-kill: Remove. This utility isn't used anywhere (except INSTALL.Linux), so remove it. Signed-off-by: Ben Pfaff Coverity #10708. --- diff --git a/INSTALL.Linux b/INSTALL.Linux index 103805ae..c46ab555 100644 --- a/INSTALL.Linux +++ b/INSTALL.Linux @@ -292,7 +292,7 @@ also upgrade the database schema: 1. Stop the Open vSwitch daemons, e.g.: - % ovs-kill ovsdb-server.pid ovs-vswitchd.pid + % kill `cd /usr/local/var/run && cat ovsdb-server.pid ovs-vswitchd.pid` 2. Install the new Open vSwitch release. diff --git a/debian/openvswitch-switch.install b/debian/openvswitch-switch.install index c38cdd46..829d5c63 100644 --- a/debian/openvswitch-switch.install +++ b/debian/openvswitch-switch.install @@ -1,7 +1,6 @@ _debian/ovsdb/ovsdb-server usr/bin _debian/utilities/ovs-discover usr/sbin _debian/utilities/ovs-dpctl usr/sbin -_debian/utilities/ovs-kill usr/sbin _debian/utilities/ovs-vsctl usr/sbin _debian/utilities/ovs-pcap usr/bin _debian/utilities/ovs-tcpundump usr/bin diff --git a/debian/openvswitch-switch.manpages b/debian/openvswitch-switch.manpages index 267b1529..399cdda2 100644 --- a/debian/openvswitch-switch.manpages +++ b/debian/openvswitch-switch.manpages @@ -1,7 +1,6 @@ _debian/ovsdb/ovsdb-server.1 _debian/utilities/ovs-discover.8 _debian/utilities/ovs-dpctl.8 -_debian/utilities/ovs-kill.8 _debian/utilities/ovs-pcap.1 _debian/utilities/ovs-tcpundump.1 _debian/utilities/ovs-vlan-test.8 diff --git a/utilities/.gitignore b/utilities/.gitignore index 739dcefc..56b3e73b 100644 --- a/utilities/.gitignore +++ b/utilities/.gitignore @@ -11,8 +11,6 @@ /ovs-discover.8 /ovs-dpctl /ovs-dpctl.8 -/ovs-kill -/ovs-kill.8 /ovs-ofctl /ovs-ofctl.8 /ovs-openflowd diff --git a/utilities/automake.mk b/utilities/automake.mk index 36b2b91b..984b47a9 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -3,7 +3,6 @@ bin_PROGRAMS += \ utilities/ovs-controller \ utilities/ovs-discover \ utilities/ovs-dpctl \ - utilities/ovs-kill \ utilities/ovs-ofctl \ utilities/ovs-openflowd \ utilities/ovs-vsctl @@ -21,7 +20,6 @@ EXTRA_DIST += \ utilities/ovs-controller.8.in \ utilities/ovs-discover.8.in \ utilities/ovs-dpctl.8.in \ - utilities/ovs-kill.8.in \ utilities/ovs-ofctl.8.in \ utilities/ovs-openflowd.8.in \ utilities/ovs-parse-leaks.8 \ @@ -42,7 +40,6 @@ DISTCLEANFILES += \ utilities/ovs-controller.8 \ utilities/ovs-discover.8 \ utilities/ovs-dpctl.8 \ - utilities/ovs-kill.8 \ utilities/ovs-ofctl.8 \ utilities/ovs-openflowd.8 \ utilities/ovs-parse-leaks \ @@ -62,7 +59,6 @@ man_MANS += \ utilities/ovs-controller.8 \ utilities/ovs-discover.8 \ utilities/ovs-dpctl.8 \ - utilities/ovs-kill.8 \ utilities/ovs-ofctl.8 \ utilities/ovs-openflowd.8 \ utilities/ovs-parse-leaks.8 \ @@ -84,9 +80,6 @@ utilities_ovs_discover_LDADD = lib/libopenvswitch.a utilities_ovs_dpctl_SOURCES = utilities/ovs-dpctl.c utilities_ovs_dpctl_LDADD = lib/libopenvswitch.a -utilities_ovs_kill_SOURCES = utilities/ovs-kill.c -utilities_ovs_kill_LDADD = lib/libopenvswitch.a - utilities_ovs_ofctl_SOURCES = utilities/ovs-ofctl.c utilities_ovs_ofctl_LDADD = lib/libopenvswitch.a $(SSL_LIBS) diff --git a/utilities/ovs-kill.8.in b/utilities/ovs-kill.8.in deleted file mode 100644 index e8fef368..00000000 --- a/utilities/ovs-kill.8.in +++ /dev/null @@ -1,60 +0,0 @@ -.TH ovs\-kill 8 "May 2008" "Open vSwitch" "Open vSwitch Manual" -.ds PN ovs\-kill - -.SH NAME -ovs\-kill \- kills processes given their pidfiles - -.SH SYNOPSIS -.B ovs\-kill -[\fIoptions\fR] \fIpidfile\fR [\fIpidfile\fR...] - -.SH DESCRIPTION -The \fBovs\-kill\fR program reads each \fIpidfile\fR specified on the -command line and sends a signal to the program associated with it, if -any. It reads one line of text from \fIpidfile\fR, which must contain -the PID of the process to kill as a text string. It then uses -\fBfcntl\fR(2) to verify that a process with the PID from the file -owns a lock on \fIpidfile\fR before it sends the signal. - -A \fIpidfile\fR whose name begins with \fB/\fR is used literally. -Otherwise, \fB@RUNDIR@/\fR is prefixed. - -This program exists for use by \fBovs\-switch\-setup\fR, which cannot -easily implement its functionality since Perl has no portable -interface to \fBfcntl\fR-based file locking. - -.SH OPTIONS -.TP -\fB\-s \fInumber\fR|\fIname\fR, \fB\-\^\-signal=\fInumber\fR|\fIname\fR -Sets the signal to be sent to each process. Signals may be given by -number (e.g. \fB1\fR) or by name (e.g. \fBHUP\fR or \fBSIGHUP\fR). -By default, \fBSIGTERM\fR is sent. - -.TP -\fB\-f\fR, \fB\-\^\-force\fR -Causes \fBovs\-kill\fR to ignore all errors without printing a message -to \fBstderr\fR, and to exit with return code 0. - -.so lib/common.man - -.SH "EXIT CODE" - -Without \fB\-f\fR or \fB\-\^\-force\fR, \fBovs\-kill\fR exits with -status 0 if at least one \fIpidfile\fR was given and the process -represented by every \fIpidfile\fR was signaled successfully, -otherwise with status 1. - -With \fB\-f\fR or \fB\-\^\-force\fR, \fBovs\-kill\fR always exits with -status 0. - -.SH BUGS - -There is a race between verifying the lock on \fIpidfile\fR and -actually killing the process. - -\fBovs\-kill\fR does not wait for the signaled processes to die before -exiting. - -.SH "SEE ALSO" - -.BR ovs\-switch\-setup (8) diff --git a/utilities/ovs-kill.c b/utilities/ovs-kill.c deleted file mode 100644 index f230962b..00000000 --- a/utilities/ovs-kill.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "command-line.h" -#include "daemon.h" -#include "timeval.h" -#include "util.h" -#include "vlog.h" - -/* -s, --signal: signal to send. */ -static int sig_nr = SIGTERM; - -/* -f, --force: ignore errors. */ -static bool force; - -static void cond_error(int err_no, const char *, ...) PRINTF_FORMAT(2, 3); - -static void parse_options(int argc, char *argv[]); -static void usage(void); - -int -main(int argc, char *argv[]) -{ - bool ok = true; - int i; - - set_program_name(argv[0]); - parse_options(argc, argv); - - argc -= optind; - argv += optind; - if (argc < 1) { - if (!force) { - ovs_fatal(0, "need at least one non-option argument; " - "use --help for usage"); - } - } - - for (i = 0; i < argc; i++) { - char *pidfile; - pid_t pid; - - pidfile = make_pidfile_name(argv[i]); - pid = read_pidfile(pidfile); - if (pid >= 0) { - if (kill(pid, sig_nr) < 0) { - cond_error(errno, "%s: kill(%ld)", pidfile, (long int) pid); - } - } else { - cond_error(-pid, "could not read %s", pidfile); - } - free(pidfile); - } - - return ok || force ? EXIT_SUCCESS : EXIT_FAILURE; -} - -static void -parse_options(int argc, char *argv[]) -{ - static struct option long_options[] = { - {"signal", required_argument, 0, 's'}, - {"force", no_argument, 0, 'f'}, - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {0, 0, 0, 0}, - }; - char *short_options = long_options_to_short_options(long_options); - - for (;;) { - int c; - - c = getopt_long(argc, argv, short_options, long_options, NULL); - if (c == -1) { - break; - } - - switch (c) { - case 's': - if (atoi(optarg) || !strcmp(optarg, "0")) { - sig_nr = atoi(optarg); - } else { - struct signal_name { - const char *name; - int number; - }; - - static const struct signal_name signals[] = { -#define SIGNAL(NAME) { #NAME, NAME } - SIGNAL(SIGABRT), - SIGNAL(SIGALRM), - SIGNAL(SIGBUS), - SIGNAL(SIGCHLD), - SIGNAL(SIGCONT), - SIGNAL(SIGFPE), - SIGNAL(SIGHUP), - SIGNAL(SIGILL), - SIGNAL(SIGINT), - SIGNAL(SIGKILL), - SIGNAL(SIGPIPE), - SIGNAL(SIGQUIT), - SIGNAL(SIGSEGV), - SIGNAL(SIGSTOP), - SIGNAL(SIGTERM), - SIGNAL(SIGTSTP), - SIGNAL(SIGTTIN), - SIGNAL(SIGTTOU), - SIGNAL(SIGUSR1), - SIGNAL(SIGUSR2), -#ifdef SIGPOLL - SIGNAL(SIGPOLL), -#endif - SIGNAL(SIGPROF), - SIGNAL(SIGSYS), - SIGNAL(SIGTRAP), - SIGNAL(SIGURG), - SIGNAL(SIGVTALRM), - SIGNAL(SIGXCPU), - SIGNAL(SIGXFSZ), -#undef SIGNAL - }; - int i; - - for (i = 0; i < ARRAY_SIZE(signals); i++) { - const struct signal_name *s = &signals[i]; - if (!strcmp(optarg, s->name) - || !strcmp(optarg, s->name + 3)) { - sig_nr = s->number; - goto got_name; - } - } - ovs_fatal(0, "unknown signal \"%s\"", optarg); - got_name: ; - } - break; - - case 'f': - force = true; - break; - - case 'h': - usage(); - - case 'V': - OVS_PRINT_VERSION(0, 0); - exit(EXIT_SUCCESS); - - case '?': - exit(EXIT_FAILURE); - - default: - abort(); - } - } - free(short_options); -} - -static void -usage(void) -{ - printf("%s: kills a program using a pidfile\n" - "usage: %s [OPTIONS] PIDFILE [PIDFILE...]\n" - "where PIDFILE is a pidfile created by an Open vSwitch daemon.\n" - "\nOptions:\n" - " -s, --signal=NUMBER|NAME signal to send (default: TERM)\n" - " -f, --force ignore errors\n" - " -h, --help display this help message\n" - " -V, --version display version information\n", - program_name, program_name); - exit(EXIT_SUCCESS); -} - -static void -cond_error(int err_no, const char *format, ...) -{ - if (!force) { - va_list args; - - fprintf(stderr, "%s: ", program_name); - va_start(args, format); - vfprintf(stderr, format, args); - va_end(args); - if (err_no != 0) - fprintf(stderr, " (%s)", strerror(err_no)); - putc('\n', stderr); - } -} diff --git a/xenserver/openvswitch-xen.spec b/xenserver/openvswitch-xen.spec index 05229de5..ab2134e2 100644 --- a/xenserver/openvswitch-xen.spec +++ b/xenserver/openvswitch-xen.spec @@ -117,12 +117,10 @@ install xenserver/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python rm \ $RPM_BUILD_ROOT/usr/bin/ovs-controller \ $RPM_BUILD_ROOT/usr/bin/ovs-discover \ - $RPM_BUILD_ROOT/usr/bin/ovs-kill \ $RPM_BUILD_ROOT/usr/bin/ovs-openflowd \ $RPM_BUILD_ROOT/usr/bin/ovs-pki \ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-controller.8 \ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-discover.8 \ - $RPM_BUILD_ROOT/usr/share/man/man8/ovs-kill.8 \ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-openflowd.8 \ $RPM_BUILD_ROOT/usr/share/man/man8/ovs-pki.8