Find path of executable having problem


 
Thread Tools Search this Thread
Operating Systems Solaris Find path of executable having problem
# 8  
Old 07-11-2013
Quote:
Originally Posted by jlliagre
pwdx is definitely a standard Solaris command and shows the current directory of a process. This is enough to answer your question given the relative PATH used to run your command.

...
That will only be true if the process didn't change its current directory after starting.

The pmap utility will show you the executable:
Code:
bash-3.2$ pmap $$
22255:    bash
08044000      16K rw---    [ stack ]
08050000     644K r-x--  /usr/bin/bash
08100000      80K rwx--  /usr/bin/bash
08114000     180K rwx--    [ heap ]
FE980000      56K r-x--  /lib/libsocket.so.1
FE99E000       4K rw---  /lib/libsocket.so.1
FEBE0000    1280K r-x--  /usr/lib/libc/libc_hwcap1.so.1
FED20000      28K rwx--  /usr/lib/libc/libc_hwcap1.so.1
FED27000       8K rwx--  /usr/lib/libc/libc_hwcap1.so.1
FED30000     624K r-x--  /lib/libnsl.so.1
FEDDC000      16K rw---  /lib/libnsl.so.1
FEDE0000      20K rw---  /lib/libnsl.so.1
FEEE0000      64K rwx--    [ anon ]
FEEF8000       4K rwxs-    [ anon ]
FEF00000      24K rwx--    [ anon ]
FEF10000       4K rwx--    [ anon ]
FEF20000       4K r-x--  /lib/libdl.so.1
FEF30000       4K rwx--    [ anon ]
FEF40000     180K r-x--  /lib/libcurses.so.1
FEF7D000      28K rw---  /lib/libcurses.so.1
FEF84000       8K rw---  /lib/libcurses.so.1
FEF90000       4K rwx--    [ anon ]
FEFA0000       4K rw---    [ anon ]
FEFB0000       4K rw---    [ anon ]
FEFBE000     180K r-x--  /lib/ld.so.1
FEFFB000       8K rwx--  /lib/ld.so.1
FEFFD000       4K rwx--  /lib/ld.so.1
 total      3480K

# 9  
Old 07-12-2013
Quote:
Originally Posted by achenle
That will only be true if the process didn't change its current directory after starting.
Good point.
Quote:
The pmap utility will show you the executable:
Indeed, there are many ways to skin a cat !
# 10  
Old 07-16-2013
The lsof tool is open source written at Perdue originally, so you can port it in if the local security model allows. Vic Abell's Home Page

Since all executables are sym linked into /proc as a.out on Solaris, that is the native solution. The ls -l of the sym link shows the ortiginal position. It might get funny if the executable is deleted, as in sent to */lost+found/ until all fd are closed.
# 11  
Old 07-16-2013
Quote:
Originally Posted by DGPickett
The lsof tool is open source written at Perdue originally, so you can port it in if the local security model allows. Vic Abell's Home Page

Since all executables are sym linked into /proc as a.out on Solaris, that is the native solution. The ls -l of the sym link shows the ortiginal position. It might get funny if the executable is deleted, as in sent to */lost+found/ until all fd are closed.
/proc/[pid]/object/a.out is not a soft link in Solaris 10:
Code:
-bash-3.00$ ls -la /proc/$$/object/a.out
-r-xr-xr-x   1 root     bin       611132 May  2  2007 /proc/5181/object/a.out

Nor Solaris 11:
Code:
-bash-4.1$ ls -la /proc/$$/object/a.out
-r-xr-xr-x   1 root     bin      1377712 Sep 19  2012 /proc/7275/object/a.out

If it were a soft link as it is on Linux, finding the actual binary would be trivial in all cases.
# 12  
Old 07-17-2013
@achenle, it is trivial and it is a soft link on Solaris too. You misread my answer, I'm not suggesting the "object" subdirectory but the "path" one:

Code:
# uname -a
SunOS s10u10.local.net 5.10 Generic_147441-01 i86pc i386 i86pc
# ls -l /proc/$$/object/a.out
-r-xr-xr-x   3 root     bin       171412 May  2  2011 /proc/2059/object/a.out
# ls -l /proc/$$/path/a.out
lrwxrwxrwx   1 root     root           0 Jul 17 08:22 /proc/2059/path/a.out -> /usr/bin/ksh

Code:
$ uname -a
SunOS s11-1 5.11 11.1 i86pc i386 i86pc
$ ls -l /proc/$$/object/a.out
-r-xr-xr-x   4 root     bin      2558000 Sep 19  2012 /proc/3390/object/a.out
$ ls -l /proc/$$/path/a.out
lrwxrwxrwx   1 jlliagre staff          0 Jul 17 08:26 /proc/3390/path/a.out -> /usr/bin/amd64/ksh

# 13  
Old 07-17-2013
Well, thanks. Learn something new every day. Smilie

I wonder when that was added to Solaris. I'm guessing Solaris 10.
# 14  
Old 07-17-2013
No, 17 years old, but /proc is an area many try to stay out of! If nothing else, it is not UNIX portable. It is probably mostly fake, like /dev/fd/0 -- not really there, but intercepted and equivalents used, like dup( 0 ) for open( "/dev/fd/0", ... ). http://en.wikipedia.org/wiki/Procfs#Solaris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find exit with success with non executable directory

Hi there, I'm quite surprised by the following behavior of find. $ find -ls # I have a directory and a file in it 8145 4 drwxr-xr-x 3 me me 4096 May 10 09:36 . 87 4 drwxr-xr-x 2 me me 4096 May 10 09:36 ./dir 88 0 -rw-r--r-- 1 me me 0... (2 Replies)
Discussion started by: chebarbudo
2 Replies

2. Solaris

Finding the path to an executable , installed package

Hi all, Recently i wanted to see if i have openssl installed in my system (solaris 10), so i do this (not sure if this is the right way to do this) pkginfo -i | grep -i "ssl" system SUNWopenssl-commands OpenSSL Commands (Usr) system SUNWopenssl-include ... (3 Replies)
Discussion started by: javanoob
3 Replies

3. UNIX for Dummies Questions & Answers

Problem running executable with ./

Hey all, I'm trying to execute a program and despite it appearing to be there, I keep getting this: -bash: ./aisdispatcher: No such file or directoryTo run it, I'm going into the directory where it is stored and running ./aisdispatcher...the result of which should just be a listing of options... (10 Replies)
Discussion started by: pmd006
10 Replies

4. Shell Programming and Scripting

Question on tweaking the PATH variable to allow the world to run my executable script

All, I am pretty new to Unix and still in the learning curve :) I have a simple requirement for which I did not get an answer yet (Atleast I do not know how to keyword the search for my requirement!!!). I have an executable script my.script1 in a folder /data/misc/scripts/dev, which when... (5 Replies)
Discussion started by: bharath.gct
5 Replies

5. Shell Programming and Scripting

Problem with embedded FTP command in Ksh - System Cannot find the specified path.

I have the following FTP embedded in a Ksh script on AIX 5.3 ftp -n <<WHATEVER open 10.101.26.218 user hcistats ******* ascii put $thupdatefile put $thcollectfile quit WHATEVER Here is what my script returns: ... (3 Replies)
Discussion started by: troym72
3 Replies

6. Shell Programming and Scripting

problem in making Awk executable script

Guys I placed #!path/awk -f placed awk script and used $1 to call 1st inputfile inside the script. But some where I did mistake. Could you please help me run this script as executable I forgot to mention I also used BEGIN before placing awk script. But nothing worked out. Script ... (2 Replies)
Discussion started by: repinementer
2 Replies

7. Programming

gdb: problem while debug an executable file

I created one file (test.cpp)and complied it and get the executable file(test) and run it.It is giving the out put but when I am trying to debug that executable.I am getting the error -- please tell me the solutions?? Thanks in advance ..... (2 Replies)
Discussion started by: smartgupta
2 Replies

8. Shell Programming and Scripting

script to find latest executable in particular directory and start that particular ex

i have a directory in which there are executable files and these files are added at runtime. now i need a shell script which will be called at a certain interval. this shell script should find the latest executable file in that directory and start that executable. care should be taken that once the... (6 Replies)
Discussion started by: kvineeth
6 Replies

9. UNIX for Dummies Questions & Answers

cc path problem - no acceptable path found

Hello everyone, I'm a unix noob. I have a powerbook running mac os x 10.4 and for one of my classes I need to install the latest version of php (5.0.5). I'm following the instructions at http://developer.apple.com/internet/opensource/php.html to install but I've run into a problem. The... (2 Replies)
Discussion started by: kendokendokendo
2 Replies

10. UNIX for Advanced & Expert Users

process executable file full path

hi guys i give "ps -ef | grep some_executable_file" on the command line. this "some_executable_file" resides on many paths which r included in the PATH environment variable, so the output depicts only "some_executable_file" in the COMMAND column. how can i get the full path? thanx (3 Replies)
Discussion started by: xtrix
3 Replies
Login or Register to Ask a Question