Re: patches and responses...



On 23 August, 2000 - Brandon S. Allbery KF8NH sent me these 1.4K bytes:

> 
> On 08/23/00 14:01:58 +0100, kevin lyda <kevin@suberic.net> wrote:
> +-----
> | i peek in the term variable to get the child's pid (the shell).  i
> | then do a readlink on /proc/<pid>/cwd to get the cwd.  obviously on
> | systems that don't support /proc/<pid>/cwd this call will fail and this
> | bit of info won't be stored.  i hope a solaris person can tweak this for
> | their systems, etc.
> +--->8
> 
> Works as is on Solaris 7 and later... with a caveat:
> 
> 3@hilfy:217 Z# ls -l /proc/12079/cwd
> lr-x------   1 root     other           0 Aug 23 09:21 /proc/12079/cwd -> /

Actually...
khan% \ls -l /proc/self/cwd
lr-x------    1 stric    adm             0 Aug 23 22:36 /proc/self/cwd ->
khan% \ls -lF /proc/self/cwd
lr-x------    1 stric    adm             0 Aug 23 22:36 /proc/self/cwd -> /
khan% pwd
/home/adm/stric

So.. it's a symlink that doesn't point at anything (thus 0 bytes)..
Dunno why they've done it like this.. but they have..

AIX has no /proc and IRIX' /proc has no such direct thingie.

> 3@hilfy:218 Z# /usr/proc/bin/pwdx 12079
> 12079:	/home/allbery/bld/gnome-network/network-utilities/CVS
> 
> It's more like linux 2.0 cwd symlinks than linux 2.2 cwd symlinks; you need 
> to actually follow it to find its target.  Or use /usr/proc/bin/pwdx as 
> above (which works on all versions of Solaris from 2.4 (I think) on, so is 
> maximally compatible).

They've moved the p* utils to /bin now (compability symlinks in
/usr/proc/bin though) in Solaris 8...

/Tomas
-- 
Tomas Ögren, stric@ing.umu.se, http://www.ing.umu.se/~stric/
|- Student at Computing Science, University of Umeå
`- Sysadmin at {cs,ing,acc}.umu.se





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]