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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/ptools/pmap/pmap_common.c
          +++ new/usr/src/cmd/ptools/pmap/pmap_common.c
↓ open down ↓ 29 lines elided ↑ open up ↑
  30   30  #include <fcntl.h>
  31   31  #include <libproc.h>
  32   32  #include <limits.h>
  33   33  #include <stdio.h>
  34   34  #include <strings.h>
  35   35  #include <sys/mkdev.h>
  36   36  #include <sys/stat.h>
  37   37  #include <sys/types.h>
  38   38  
  39   39  #include "pmap_common.h"
       40 +#include "ptools_common.h"
  40   41  
  41   42  /*
  42   43   * We compare the high memory addresses since stacks are faulted in from
  43   44   * high memory addresses to low memory addresses, and our prmap_t
  44   45   * structures identify only the range of addresses that have been faulted
  45   46   * in so far.
  46   47   */
  47   48  int
  48   49  cmpstacks(const void *ap, const void *bp)
  49   50  {
↓ open down ↓ 31 lines elided ↑ open up ↑
  81   82                                  buf[len] = '\0';
  82   83                                  return (buf);
  83   84                          }
  84   85                  }
  85   86          }
  86   87  
  87   88          if (Pstate(Pr) == PS_DEAD || *mapname == '\0')
  88   89                  return (NULL);
  89   90  
  90   91          /* first see if we can find a path via /proc */
  91      -        (void) snprintf(path, sizeof (path), "/proc/%d/path/%s",
       92 +        (void) proc_snprintf(path, sizeof (path), "/proc/%d/path/%s",
  92   93              (int)Psp->pr_pid, mapname);
  93   94          len = readlink(path, buf, bufsz - 1);
  94   95          if (len >= 0) {
  95   96                  buf[len] = '\0';
  96   97                  return (buf);
  97   98          }
  98   99  
  99  100          /* fall back to object information reported by /proc */
 100      -        (void) snprintf(path, sizeof (path),
      101 +        (void) proc_snprintf(path, sizeof (path),
 101  102              "/proc/%d/object/%s", (int)Psp->pr_pid, mapname);
 102  103          if (stat(path, &statb) == 0) {
 103  104                  dev_t dev = statb.st_dev;
 104  105                  ino_t ino = statb.st_ino;
 105  106                  (void) snprintf(buf, bufsz, "dev:%lu,%lu ino:%lu",
 106  107                      (ulong_t)major(dev), (ulong_t)minor(dev), ino);
 107  108                  return (buf);
 108  109          }
 109  110  
 110  111          return (NULL);
↓ open down ↓ 57 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX