Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-12

Cannot read symbolic link /proc/PID/exe: No such file or directory

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello All,

I need to assure, that my sub-application has started or to kill it, when not necessary.

I use to find out the process ID /proc/*/exe file, but strange is that my application is 'registered' into /proc in not readable way.

When I try to read out the content of /proc/"PID"/exe, then I receive this error message:

e.g.:

ls -l /proc/12415/exe

ls: cannot read symbolic link /proc/13415/exe: No such file or directory
lrwxrwxrwx 1 roland roland 0 2008-12-23 00:20 /proc/13415/exe

Why does it behave this way?

Thanks in advance.

Reply by email

Roland Turcan
to Roland Turcan

Hello All,

I am going to answer to my own question in hope, that it will help other people.

I wanted to decrease the size of executable and therefore I used UPX for get it smaller. It really got smaller, my original size was about 20MB and after UPX only 5MB.

But UPX causes the problem with symlink to /proc/*/exe. When original file is executed, then exe symlink points to correct exefile, but compressed one causes "cannot read symbolic link".

<<< 23.12.2008 0:29 - Roland Turcan "" >>>
RT> Hello All,

RT> I need to assure, that my sub-application has started or to kill it, RT> when not necessary.

RT> I use to find out the process ID /proc/*/exe file, but strange is RT> that my application is 'registered' into /proc in not readable way.

RT> When I try to read out the content of /proc/"PID"/exe, then I receive RT> this error message:

RT> e.g.:

RT> ls -l /proc/12415/exe

RT> ls: cannot read symbolic link /proc/13415/exe: No such file or RT> directory
RT> lrwxrwxrwx 1 roland roland 0 2008-12-23 00:20 /proc/13415/exe

RT> Why does it behave this way?

RT> Thanks in advance.

Reply by email

Henry Vermaak
to Roland Turcan

2008/12/23 Roland Turcan :

Show quoted text 8 lines
Hello All, I am going to answer to my own question in hope, that it will help other people. I wanted to decrease the size of executable and therefore I used UPX for get it smaller. It really got smaller, my original size was about 20MB and after UPX only 5MB.

20MB? that seems a bit excessive, try and compile with -XX -Xs and not with -g*.

read this: http://wiki.freepascal.org/Size_Matters

henry

Reply by email

Roland Turcan
to Henry Vermaak

Hello Henry,

I am pissed off too from the size, because that application is a bit bigger than HelloWorld. :-) but 20 MB is too big.

Many many thanks to you, because after applying that I've got 2.8MB what I like much more. It is more close to Delphi ones which is about half of megabyte only.

TRoland;

<<< 23.12.2008 10:47 - Henry Vermaak "" >>>
HV> 2008/12/23 Roland Turcan :

Show quoted text 8 lines
> Hello All, > > I am going to answer to my own question in hope, that it will help > other people. > > I wanted to decrease the size of executable and therefore I used UPX > for get it smaller. It really got smaller, my original size was > about 20MB and after UPX only 5MB.

HV> 20MB? that seems a bit excessive, try and compile with -XX -Xs and HV> not with -g*.

HV> read this: http://wiki.freepascal.org/Size_Matters

HV> henry

Reply by email

Mark Morgan Lloyd
to Roland Turcan: I need to assure, that my sub-application has started or to kill it, when not necessary.…
Show quoted text 8 lines
ls -l /proc/12415/exe ls: cannot read symbolic link /proc/13415/exe: No such file or directory lrwxrwxrwx 1 roland roland 0 2008-12-23 00:20 /proc/13415/exe Why does it behave this way?

Are you root?

$ ls -l /proc/1/exe
ls: cannot read symbolic link /proc/1/exe: Permission denied lrwxrwxrwx 1 root root 0 2008-12-23 07:30 /proc/1/exe

# ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 2008-12-23 07:30 /proc/1/exe -> /sbin/init

You'll probably find that it will work if the process you are trying to look at is owned by yourself or if you are root. I think that what the error message is telling you is that it can see the symlink but can't follow it.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email