Re^2: Functions pointers and stuff.

Arnold D. Robbins {EUCC} arnold at mathcs.emory.edu
Sat Apr 1 03:14:38 AEST 1989


This thread started with a question about mapping names in strings
to function addresses.

In article <1079 at vsi.COM> friedl at vsi.COM (Stephen J. Friedl) writes:
>When Sys V Rel 4 comes out, you'll be able to get a file descriptor
>to your own executable with an ioctl on a /proc/##### file, where
>##### is your pid.  If there is a symbol table there you will be able
>to reliably map a function name to an address at runtime.
>
>/proc is really cool.

Agreed, /proc is cool. Unfortunately, nlist(3) takes a path name, and
not a file descriptor.  There is a way around it, but what I want to know
is if it will be in SVR4. I have in mind using /dev/fd, like so:

	sprintf (myproc, "/proc/%05d", getpid());
	myprocfd = open (myproc, O_RDONLY);
	myimage = ioctl (myprocfd, PROC_GETIMAGEFD /* or whatever */, 0);
	sprintf (imagename, "/dev/fd/%d", myimage);
	nlist (imagename, nl);
	....

or will there be a new version of nlist?
-- 
Unix is a Registered   | Arnold Robbins -- Emory University Computing Center
Bell of AT&T Trademark | DOMAIN: arnold at unix.cc.emory.edu		
Laboratories.          | UUCP: gatech!emory!arnold	PHONE:	+1 404 727-7636
        -- Donn Seeley | BITNET: arnold at emoryu1		FAX:	+1 404 727-2599



More information about the Comp.lang.c mailing list