Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Feb 2002 14:04:40 +0800
From:      "David Xu" <davidx@viasoft.com.cn>
To:        "Haryadi Gunawi" <haryadi@cs.wisc.edu>, <freebsd-questions@FreeBSD.ORG>
Subject:   Re: /proc/pid/map (freeBSD vs Linux)
Message-ID:  <011501c1ba9d$a6af9080$ef01a8c0@davidwnt>
References:  <Pine.GSO.4.21.0202202326210.16631-100000@nova11.cs.wisc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

----- Original Message -----=20
From: "Haryadi Gunawi" <haryadi@cs.wisc.edu>
To: <freebsd-questions@FreeBSD.ORG>
Sent: Thursday, February 21, 2002 1:42 PM
Subject: /proc/pid/map (freeBSD vs Linux)


>=20
> > From:      Roman Neuhauser <neuhauser@mobil.cz>
> > Subject:   Re: /proc/pid/map (freeBSD vs Linux)
> > Message-ID:  <20020220142036.GL418@roman.mobil.cz>
>=20
> >    I don't know if this is what you're looking for, but ldd(1) might
> >    help(?).
>=20
> --=20
>=20
> Thanks for the answer,
> ldd is not really what I'm looking for.
>=20
> Here is my project in detail.
> - I have a PID (from getpid)
> - Then I want to look what program has that PID (by looking at the
> /proc/pid/map)
> - next I must know what libraries are utilized, and their text =
segments
> (where the code are allocated)
>=20
> So looking at the /proc/pid/map (just the text segments,
> identified by 'r-x' mode):
>=20
> In FreeBSD:
> 0x8048000 0x8049000 1 0 0xc8776d20 r-x 2 0 0x0 COW NC vnode
> 0x28049000 0x2805a000 12 0 0xc03f9f80 r-x 73 34 0x0 COW NC vnode
> 0x28065000 0x280e5000 57 0 0xc03fad60 r-x 73 34 0x0 COW NC vnode
>=20
> In Linux:
> 8048000-08049000 r-xp 00000000 03:08 22408      =
/rdata/src/test/loop/a.out
> 40000000-40016000 r-xp 00000000 03:08 44178      /lib/ld-2.1.92.so
> 40022000-4013d000 r-xp 00000000 03:08 44185      /lib/libc-2.1.92.so
>=20
> I know the first one is the executable itself, the 2nd one should be =
the
> dynamic linker, and the third one is the C library. The first and 2nd
> column are the starting and ending text/code segment.
>=20
> Now the problem is:=20
>   I don't know what is the executable name, and the
>   libraries utilized from /proc/pid/map in FreeBSD.=20
>   In Linux I can easily get them from the last column.
>   Where can I get those names in FreeBSD?
>=20
> I assume the numbers in the third column (1, 12, 57) mean something, =
but
> I don't know what they are.
>=20
>=20
> Thank you very much,
> appreciate your time,
> hg
>=20

In fstat(1) manual has following sentences:
           Normally the name cannot be determined since there is no
            mapping from an open file back to the directory entry that =
was
            used to open that file.  Also, since different directory =
entries
            may reference the same file (via ln(1)), the name printed =
may not
            be the actual name that the process originally used to open =
that
            file.

I know Linux proc fs support the feature. but  I have never seen a =
program=20
under FreeBSD can map a fd to path name.

--
David Xu



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?011501c1ba9d$a6af9080$ef01a8c0>