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>
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright (c) 2014, Joyent, Inc. All rights reserved.
*/
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
*** 40,49 ****
--- 41,51 ----
#include <sys/stat.h>
#include <sys/mkdev.h>
#include <sys/mman.h>
#include <sys/lgrp_user.h>
#include <libproc.h>
+ #include "ptools_common.h"
#include "pmap_common.h"
#define KILOBYTE 1024
#define MEGABYTE (KILOBYTE * KILOBYTE)
*** 197,207 ****
const char *bar8 = "-------";
const char *bar16 = "----------";
const char *bar;
struct rlimit rlim;
struct stat64 statbuf;
! char buf[128];
int mapfd;
int prg_gflags = PGRAB_RDONLY;
int prr_flags = 0;
boolean_t use_agent_lwp = B_FALSE;
--- 199,209 ----
const char *bar8 = "-------";
const char *bar16 = "----------";
const char *bar;
struct rlimit rlim;
struct stat64 statbuf;
! char buf[PATH_MAX];
int mapfd;
int prg_gflags = PGRAB_RDONLY;
int prr_flags = 0;
boolean_t use_agent_lwp = B_FALSE;
*** 356,366 ****
bar = addr_width == 8 ? bar8 : bar16;
(void) memcpy(&psinfo, Ppsinfo(Pr), sizeof (psinfo_t));
proc_unctrl_psinfo(&psinfo);
if (Pstate(Pr) != PS_DEAD) {
! (void) snprintf(buf, sizeof (buf),
"/proc/%d/map", (int)psinfo.pr_pid);
if ((mapfd = open(buf, O_RDONLY)) < 0) {
(void) fprintf(stderr, "%s: cannot "
"examine %s: lost control of "
"process\n", command, arg);
--- 358,368 ----
bar = addr_width == 8 ? bar8 : bar16;
(void) memcpy(&psinfo, Ppsinfo(Pr), sizeof (psinfo_t));
proc_unctrl_psinfo(&psinfo);
if (Pstate(Pr) != PS_DEAD) {
! (void) proc_snprintf(buf, sizeof (buf),
"/proc/%d/map", (int)psinfo.pr_pid);
if ((mapfd = open(buf, O_RDONLY)) < 0) {
(void) fprintf(stderr, "%s: cannot "
"examine %s: lost control of "
"process\n", command, arg);
*** 588,598 ****
int mapfd, nmap, i, rc;
struct stat st;
prmap_t *prmapp, *pmp;
ssize_t n;
! (void) snprintf(mapname, sizeof (mapname),
"/proc/%d/rmap", (int)Pstatus(Pr)->pr_pid);
if ((mapfd = open(mapname, O_RDONLY)) < 0 || fstat(mapfd, &st) != 0) {
if (mapfd >= 0)
(void) close(mapfd);
--- 590,600 ----
int mapfd, nmap, i, rc;
struct stat st;
prmap_t *prmapp, *pmp;
ssize_t n;
! (void) proc_snprintf(mapname, sizeof (mapname),
"/proc/%d/rmap", (int)Pstatus(Pr)->pr_pid);
if ((mapfd = open(mapname, O_RDONLY)) < 0 || fstat(mapfd, &st) != 0) {
if (mapfd >= 0)
(void) close(mapfd);
*** 629,639 ****
int mapfd, nmap, i, rc;
struct stat st;
prxmap_t *prmapp, *pmp;
ssize_t n;
! (void) snprintf(mapname, sizeof (mapname),
"/proc/%d/xmap", (int)Pstatus(Pr)->pr_pid);
if ((mapfd = open(mapname, O_RDONLY)) < 0 || fstat(mapfd, &st) != 0) {
if (mapfd >= 0)
(void) close(mapfd);
--- 631,641 ----
int mapfd, nmap, i, rc;
struct stat st;
prxmap_t *prmapp, *pmp;
ssize_t n;
! (void) proc_snprintf(mapname, sizeof (mapname),
"/proc/%d/xmap", (int)Pstatus(Pr)->pr_pid);
if ((mapfd = open(mapname, O_RDONLY)) < 0 || fstat(mapfd, &st) != 0) {
if (mapfd >= 0)
(void) close(mapfd);