Conventional daemons

Joseph S. D. Yao jsdy at hadron.UUCP
Tue Apr 8 16:03:21 AEST 1986


In article <44 at rtgvax.UUCP> ksh at rtgvax.UUCP (Kent S. Harris) writes:
>In article <2177 at brl-smoke.ARPA>, bzs%bostonu.csnet at csnet-relay.arpa (Barry Shein) writes:
>> The real question was, why open anything? Surely there's
>> nothing functionally useful about opening stdin/stdout on
>> "/" and it could be a potential hazard if ported.

>some hard coded constants reguarding fd's < 3 (I know the kernel doesn't
>give two hoots about particular fd's).  The idea is to close
>all fd's, open "/", and dup this fd to 1 and 2 so any new opens will
>be allocated fd's >= 3.

/usr/include/stdio.h:
#define	stdin	(&_iob[0])
#define	stdout	(&_iob[1])
#define	stderr	(&_iob[2])



More information about the Comp.unix.wizards mailing list