Shared Code under UNIX System V
chris at umcp-cs.UUCP
chris at umcp-cs.UUCP
Mon Dec 17 22:52:41 AEST 1984
> I sure wish that there was a system call that would return the full
> path name of the text file of a process. Perhaps there is? Any
> kobolds know of any?
Well, I'm no kobold (more of a Sindarin Elf myself) but in the 8th
Edition system, with /proc, you can always use this:
#include <sys/ioctl.h>
int
gettextfd() {
char buf[12];
int fd, tfd;
char *sprintf();
(void) sprintf(buf, "/proc/%05d", getpid ());
if ((fd = open(buf, 0)) < 0)
return (-1);
tfd = ioctl(fd, PIOCOPENT, 0); /* is this right? seems
like it would be more
reasonable to use &tfd */
(void) close(fd);
return (tfd);
}
Thinking about writing /proc for 4.2BSD,
--
(This line accidently left nonblank.)
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (301) 454-7690
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.unix.wizards
mailing list