From owner-freebsd-questions Wed Feb 20 22: 3:35 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail.viasoft.com.cn (unknown [61.153.1.177]) by hub.freebsd.org (Postfix) with ESMTP id 41D5637B405 for ; Wed, 20 Feb 2002 22:03:27 -0800 (PST) Received: from davidwnt (davidwnt.viasoft.com.cn [192.168.1.239]) by mail.viasoft.com.cn (8.9.3/8.9.3) with SMTP id OAA21209; Thu, 21 Feb 2002 14:13:00 +0800 Message-ID: <011501c1ba9d$a6af9080$ef01a8c0@davidwnt> From: "David Xu" To: "Haryadi Gunawi" , References: Subject: Re: /proc/pid/map (freeBSD vs Linux) Date: Thu, 21 Feb 2002 14:04:40 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----- Original Message -----=20 From: "Haryadi Gunawi" To: Sent: Thursday, February 21, 2002 1:42 PM Subject: /proc/pid/map (freeBSD vs Linux) >=20 > > From: Roman Neuhauser > > 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