Wizard-level questions

Neil Rickert rickert at mp.cs.niu.edu
Sun Jan 27 01:24:03 AEST 1991


In article <16048 at sdcc6.ucsd.edu> cs163wcr at sdcc10.ucsd.edu (I support the U.N.) writes:
>[1] Can you access a file by its i-node number?  Something like
>	(for C code) FILE *iopen (int inode, char *mode) ?

 I hope not.  Otherwise permissions on directories wouldn't do much.  I
do think the system design would have been cleaner if you only accessed
by i-node number, and mapping filename to inode was done outside the kernel.
But I doubt that I have many supporters in this "keep the kernel small" view.

>[2] With Internet sockets, how does a machine accept()ing a
>	socket connection know what machine is calling it?  Does
>	it rely on the calling program to tell it?

 getpeername() should get you the internet address and port number of the
calling machine, and then gethostbyaddr() will attempt to map the Internet
address into a domain name.  There are added complexities due to the byte
order on the network being possibly different from that of your machine, but
there are standard library routines such as ntohl(3) to take care of this
problem too.

-- 
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  Neil W. Rickert, Computer Science               <rickert at cs.niu.edu>
  Northern Illinois Univ.
  DeKalb, IL 60115                                   +1-815-753-6940



More information about the Comp.unix.wizards mailing list