diff options
author | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
---|---|---|
committer | nn35248 <none@none> | 2006-09-11 22:51:59 -0700 |
commit | 9acbbeaf2a1ffe5c14b244867d427714fab43c5c (patch) | |
tree | d1ecd54896325c19a463220e9cbc50864874fc82 /usr/src/lib/libproc/common/proc_get_info.c | |
parent | da51466dc253d7c98dda4956059042bd0c476328 (diff) | |
download | illumos-joyent-9acbbeaf2a1ffe5c14b244867d427714fab43c5c.tar.gz |
PSARC/2005/471 BrandZ: Support for non-native zones
6374606 ::nm -D without an object may not work on processes in zones
6409350 BrandZ project integration into Solaris
6455289 pthread_setschedparam() should return EPERM rather than panic libc
6455591 setpriority(3C) gets errno wrong for deficient privileges failure
6458178 fifofs doesn't support lofs mounts of fifos
6460380 Attempted open() of a symlink with the O_NOFOLLOW flag set returns EINVAL, not ELOOP
6463857 renice(1) errors erroneously
--HG--
rename : usr/src/lib/libzonecfg/zones/SUNWblank.xml => usr/src/lib/brand/native/zone/SUNWblank.xml
rename : usr/src/lib/libzonecfg/zones/SUNWdefault.xml => usr/src/lib/brand/native/zone/SUNWdefault.xml
Diffstat (limited to 'usr/src/lib/libproc/common/proc_get_info.c')
-rw-r--r-- | usr/src/lib/libproc/common/proc_get_info.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/usr/src/lib/libproc/common/proc_get_info.c b/usr/src/lib/libproc/common/proc_get_info.c index d4426f7cc0..7fb88c4212 100644 --- a/usr/src/lib/libproc/common/proc_get_info.c +++ b/usr/src/lib/libproc/common/proc_get_info.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,7 +30,9 @@ #include <unistd.h> #include <fcntl.h> #include <string.h> -#include "libproc.h" +#include <limits.h> + +#include "Pcontrol.h" /* * These several routines simply get the indicated /proc structures @@ -50,13 +51,14 @@ int proc_get_cred(pid_t pid, prcred_t *credp, int ngroups) { - char fname[64]; + char fname[PATH_MAX]; int fd; int rv = -1; ssize_t minsize = sizeof (*credp) - sizeof (gid_t); size_t size = minsize + ngroups * sizeof (gid_t); - (void) snprintf(fname, sizeof (fname), "/proc/%d/cred", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/cred", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) >= 0) { if (read(fd, credp, size) >= minsize) rv = 0; @@ -71,12 +73,13 @@ proc_get_cred(pid_t pid, prcred_t *credp, int ngroups) prpriv_t * proc_get_priv(pid_t pid) { - char fname[64]; + char fname[PATH_MAX]; int fd; struct stat statb; prpriv_t *rv = NULL; - (void) snprintf(fname, sizeof (fname), "/proc/%d/priv", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/priv", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) >= 0) { if (fstat(fd, &statb) != 0 || (rv = malloc(statb.st_size)) == NULL || @@ -99,13 +102,14 @@ proc_get_priv(pid_t pid) int proc_get_ldt(pid_t pid, struct ssd *pldt, int nldt) { - char fname[64]; + char fname[PATH_MAX]; int fd; struct stat statb; size_t size; ssize_t ssize; - (void) snprintf(fname, sizeof (fname), "/proc/%d/ldt", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/ldt", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) < 0) return (-1); @@ -131,11 +135,12 @@ proc_get_ldt(pid_t pid, struct ssd *pldt, int nldt) int proc_get_psinfo(pid_t pid, psinfo_t *psp) { - char fname[64]; + char fname[PATH_MAX]; int fd; int rv = -1; - (void) snprintf(fname, sizeof (fname), "/proc/%d/psinfo", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/psinfo", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) >= 0) { if (read(fd, psp, sizeof (*psp)) == sizeof (*psp)) rv = 0; @@ -147,11 +152,12 @@ proc_get_psinfo(pid_t pid, psinfo_t *psp) int proc_get_status(pid_t pid, pstatus_t *psp) { - char fname[64]; + char fname[PATH_MAX]; int fd; int rv = -1; - (void) snprintf(fname, sizeof (fname), "/proc/%d/status", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/status", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) >= 0) { if (read(fd, psp, sizeof (*psp)) == sizeof (*psp)) rv = 0; @@ -169,11 +175,12 @@ proc_get_status(pid_t pid, pstatus_t *psp) int proc_get_auxv(pid_t pid, auxv_t *pauxv, int naux) { - char fname[64]; + char fname[PATH_MAX]; int fd; int rv = -1; - (void) snprintf(fname, sizeof (fname), "/proc/%d/auxv", (int)pid); + (void) snprintf(fname, sizeof (fname), "%s/%d/auxv", + procfs_path, (int)pid); if ((fd = open(fname, O_RDONLY)) >= 0) { if ((rv = read(fd, pauxv, naux * sizeof (auxv_t))) >= 0) rv /= sizeof (auxv_t); |