Print this page
OS-3280 need a way to specify the root of a native system in the lx brand
OS-3279 lx brand should allow delegated datasets
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

*** 21,32 **** /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdio_ext.h> #include <ctype.h> #include <stdlib.h> #include <unistd.h> --- 21,30 ----
*** 37,46 **** --- 35,46 ---- #include <sys/types.h> #include <stropts.h> #include <poll.h> #include <procfs.h> #include <sys/resource.h> + #include <limits.h> + #include "ptools_common.h" static int count_my_files(); static char *command; /* slop to account for extra file descriptors opened by libraries we call */
*** 47,56 **** --- 47,57 ---- #define SLOP 5 int main(int argc, char **argv) { + char buf[PATH_MAX]; unsigned long remain = 0; struct pollfd *pollfd; struct pollfd *pfd; struct rlimit rlim; char *arg;
*** 77,86 **** --- 78,89 ---- (void) fprintf(stderr, " -v: verbose; report terminations to standard out\n"); return (2); } + (void) proc_snprintf(buf, sizeof (buf), "/proc/"); + /* make sure we have enough file descriptors */ if (getrlimit(RLIMIT_NOFILE, &rlim) == 0) { int nfiles = count_my_files(); if (rlim.rlim_cur < argc + nfiles + SLOP) {
*** 106,116 **** arg = argv[i]; if (strchr(arg, '/') != NULL) (void) strncpy(psinfofile, arg, sizeof (psinfofile)); else { ! (void) strcpy(psinfofile, "/proc/"); (void) strncat(psinfofile, arg, sizeof (psinfofile)-6); } (void) strncat(psinfofile, "/psinfo", sizeof (psinfofile)-strlen(psinfofile)); --- 109,119 ---- arg = argv[i]; if (strchr(arg, '/') != NULL) (void) strncpy(psinfofile, arg, sizeof (psinfofile)); else { ! (void) strcpy(psinfofile, buf); (void) strncat(psinfofile, arg, sizeof (psinfofile)-6); } (void) strncat(psinfofile, "/psinfo", sizeof (psinfofile)-strlen(psinfofile));
*** 158,169 **** psinfo_t psinfo; if (pread(pfd->fd, &psinfo, sizeof (psinfo), (off_t)0) == sizeof (psinfo)) { ! (void) printf( ! "%s: terminated, wait status 0x%.4x\n", arg, psinfo.pr_wstat); } else { (void) printf( "%s: terminated\n", arg); } --- 161,172 ---- psinfo_t psinfo; if (pread(pfd->fd, &psinfo, sizeof (psinfo), (off_t)0) == sizeof (psinfo)) { ! (void) printf("%s: terminated, " ! "wait status 0x%.4x\n", arg, psinfo.pr_wstat); } else { (void) printf( "%s: terminated\n", arg); }