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>
*** 22,34 ****
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <libc.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
--- 22,33 ----
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "lint.h"
+ #include "thr_uberdata.h"
#include <libc.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
*** 36,45 ****
--- 35,45 ----
#include <sys/auxv.h>
#include <mtlib.h>
#include <thread.h>
#include <synch.h>
#include <atomic.h>
+ #include <limits.h>
static mutex_t auxlock = DEFAULTMUTEX;
/*
* Get auxiliary entry.
*** 57,71 ****
* passed to the process at exec(2). Only do this once.
*/
if (auxb == NULL) {
lmutex_lock(&auxlock);
if (auxb == NULL) {
struct stat statb;
auxv_t *buf = NULL;
int fd;
! if ((fd = open("/proc/self/auxv", O_RDONLY)) != -1 &&
fstat(fd, &statb) != -1)
buf = libc_malloc(
statb.st_size + sizeof (auxv_t));
if (buf != NULL) {
--- 57,80 ----
* passed to the process at exec(2). Only do this once.
*/
if (auxb == NULL) {
lmutex_lock(&auxlock);
if (auxb == NULL) {
+ uberdata_t *udp = curthread->ul_uberdata;
struct stat statb;
auxv_t *buf = NULL;
+ char *path = "/proc/self/auxv";
+ char pbuf[PATH_MAX];
int fd;
! if (udp->ub_broot != NULL) {
! (void) snprintf(pbuf, sizeof (pbuf),
! "%s/proc/self/auxv", udp->ub_broot);
! path = pbuf;
! }
!
! if ((fd = open(path, O_RDONLY)) != -1 &&
fstat(fd, &statb) != -1)
buf = libc_malloc(
statb.st_size + sizeof (auxv_t));
if (buf != NULL) {