Home | History | Annotate | Line # | Download | only in dist
cmd-kill-server.c revision 1.1.1.2
      1  1.1.1.2  jmmv /* $Id: cmd-kill-server.c,v 1.1.1.2 2011/08/17 18:40:04 jmmv Exp $ */
      2      1.1  jmmv 
      3      1.1  jmmv /*
      4      1.1  jmmv  * Copyright (c) 2007 Nicholas Marriott <nicm (at) users.sourceforge.net>
      5      1.1  jmmv  *
      6      1.1  jmmv  * Permission to use, copy, modify, and distribute this software for any
      7      1.1  jmmv  * purpose with or without fee is hereby granted, provided that the above
      8      1.1  jmmv  * copyright notice and this permission notice appear in all copies.
      9      1.1  jmmv  *
     10      1.1  jmmv  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11      1.1  jmmv  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12      1.1  jmmv  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13      1.1  jmmv  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14      1.1  jmmv  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
     15      1.1  jmmv  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     16      1.1  jmmv  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17      1.1  jmmv  */
     18      1.1  jmmv 
     19      1.1  jmmv #include <sys/types.h>
     20      1.1  jmmv 
     21      1.1  jmmv #include <signal.h>
     22      1.1  jmmv #include <unistd.h>
     23      1.1  jmmv 
     24      1.1  jmmv #include "tmux.h"
     25      1.1  jmmv 
     26      1.1  jmmv /*
     27      1.1  jmmv  * Kill the server and do nothing else.
     28      1.1  jmmv  */
     29      1.1  jmmv 
     30      1.1  jmmv int	cmd_kill_server_exec(struct cmd *, struct cmd_ctx *);
     31      1.1  jmmv 
     32      1.1  jmmv const struct cmd_entry cmd_kill_server_entry = {
     33      1.1  jmmv 	"kill-server", NULL,
     34  1.1.1.2  jmmv 	"", 0, 0,
     35      1.1  jmmv 	"",
     36  1.1.1.2  jmmv 	0,
     37      1.1  jmmv 	NULL,
     38      1.1  jmmv 	NULL,
     39  1.1.1.2  jmmv 	cmd_kill_server_exec
     40      1.1  jmmv };
     41      1.1  jmmv 
     42      1.1  jmmv /* ARGSUSED */
     43      1.1  jmmv int
     44      1.1  jmmv cmd_kill_server_exec(unused struct cmd *self, unused struct cmd_ctx *ctx)
     45      1.1  jmmv {
     46      1.1  jmmv 	kill(getpid(), SIGTERM);
     47      1.1  jmmv 
     48      1.1  jmmv 	return (0);
     49      1.1  jmmv }
     50