killall.c (192896) | killall.c (194869) |
---|---|
1/*- 2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> 3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> 3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/usr.bin/killall/killall.c 192896 2009-05-27 14:30:26Z jamie $"); | 29__FBSDID("$FreeBSD: head/usr.bin/killall/killall.c 194869 2009-06-24 18:18:35Z jamie $"); |
30 31#include <sys/param.h> 32#include <sys/jail.h> 33#include <sys/stat.h> 34#include <sys/uio.h> 35#include <sys/user.h> 36#include <sys/sysctl.h> 37#include <fcntl.h> 38#include <dirent.h> | 30 31#include <sys/param.h> 32#include <sys/jail.h> 33#include <sys/stat.h> 34#include <sys/uio.h> 35#include <sys/user.h> 36#include <sys/sysctl.h> 37#include <fcntl.h> 38#include <dirent.h> |
39#include <jail.h> |
|
39#include <stdio.h> 40#include <stdlib.h> 41#include <string.h> 42#include <pwd.h> 43#include <signal.h> 44#include <regex.h> 45#include <ctype.h> 46#include <err.h> --- 49 unchanged lines hidden (view full) --- 96 warnx("unknown signal %s; valid signals:", name); 97 printsig(stderr); 98 exit(1); 99} 100 101int 102main(int ac, char **av) 103{ | 40#include <stdio.h> 41#include <stdlib.h> 42#include <string.h> 43#include <pwd.h> 44#include <signal.h> 45#include <regex.h> 46#include <ctype.h> 47#include <err.h> --- 49 unchanged lines hidden (view full) --- 97 warnx("unknown signal %s; valid signals:", name); 98 printsig(stderr); 99 exit(1); 100} 101 102int 103main(int ac, char **av) 104{ |
104 struct iovec jparams[2]; | |
105 struct kinfo_proc *procs = NULL, *newprocs; 106 struct stat sb; 107 struct passwd *pw; 108 regex_t rgx; 109 regmatch_t pmatch; 110 int i, j; 111 char buf[256]; 112 char *user = NULL; --- 44 unchanged lines hidden (view full) --- 157 ++*av; 158 if (**av == '\0') { 159 ++av; 160 --ac; 161 } 162 jflag++; 163 if (*av == NULL) 164 errx(1, "must specify jail"); | 105 struct kinfo_proc *procs = NULL, *newprocs; 106 struct stat sb; 107 struct passwd *pw; 108 regex_t rgx; 109 regmatch_t pmatch; 110 int i, j; 111 char buf[256]; 112 char *user = NULL; --- 44 unchanged lines hidden (view full) --- 157 ++*av; 158 if (**av == '\0') { 159 ++av; 160 --ac; 161 } 162 jflag++; 163 if (*av == NULL) 164 errx(1, "must specify jail"); |
165 jid = strtoul(*av, &ep, 10); 166 if (!**av || *ep) { 167 *(const void **)&jparams[0].iov_base = 168 "name"; 169 jparams[0].iov_len = sizeof("name"); 170 jparams[1].iov_base = *av; 171 jparams[1].iov_len = strlen(*av) + 1; 172 jid = jail_get(jparams, 2, 0); 173 if (jid < 0) 174 errx(1, "unknown jail: %s", 175 *av); 176 } | 165 jid = jail_getid(*av); 166 if (jid < 0) 167 errx(1, "%s", jail_errmsg); |
177 if (jail_attach(jid) == -1) 178 err(1, "jail_attach(%d)", jid); 179 break; 180 case 'u': 181 ++*av; 182 if (**av == '\0') { 183 ++av; 184 --ac; --- 247 unchanged lines hidden --- | 168 if (jail_attach(jid) == -1) 169 err(1, "jail_attach(%d)", jid); 170 break; 171 case 'u': 172 ++*av; 173 if (**av == '\0') { 174 ++av; 175 --ac; --- 247 unchanged lines hidden --- |