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>
*** 39,48 ****
--- 39,50 ----
#include <signal.h>
#include <sys/types.h>
#include <sys/time.h>
#include <signal.h>
#include <libproc.h>
+ #include <limits.h>
+ #include "ptools_common.h"
static int look(pid_t);
static void hr_min_sec(char *, long);
static void prtime(char *, timestruc_t *);
static int perr(const char *);
*** 187,197 ****
}
static int
look(pid_t pid)
{
! char pathname[100];
int rval = 0;
int fd;
psinfo_t psinfo;
prusage_t prusage;
timestruc_t real, user, sys;
--- 189,199 ----
}
static int
look(pid_t pid)
{
! char pathname[PATH_MAX];
int rval = 0;
int fd;
psinfo_t psinfo;
prusage_t prusage;
timestruc_t real, user, sys;
*** 201,211 ****
pfirst++;
if (proc_get_psinfo(pid, &psinfo) < 0)
return (perr("read psinfo"));
! (void) sprintf(pathname, "/proc/%d/usage", (int)pid);
if ((fd = open(pathname, O_RDONLY)) < 0)
return (perr("open usage"));
if (read(fd, &prusage, sizeof (prusage)) != sizeof (prusage))
rval = perr("read usage");
--- 203,214 ----
pfirst++;
if (proc_get_psinfo(pid, &psinfo) < 0)
return (perr("read psinfo"));
! (void) proc_snprintf(pathname, sizeof (pathname), "/proc/%d/usage",
! (int)pid);
if ((fd = open(pathname, O_RDONLY)) < 0)
return (perr("open usage"));
if (read(fd, &prusage, sizeof (prusage)) != sizeof (prusage))
rval = perr("read usage");