Subject: Re: rfc: socketing it to gre
To: None <tech-net@netbsd.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 09/19/2007 13:50:32
On Wed, Sep 19, 2007 at 08:18:24PM +0900, YAMAMOTO Takashi wrote:
> > I have also added a new subroutine, fsocreate(), that creates a socket
> > a la socreate(9) and sticks it into a process's file descriptor table.
> > I use it in both gre(4) and sys_socket().  gre sticks the sockets it owns
> > into process 0's file table, so it's clear which socket belongs to who.
> 
> why you want to use file descriptors, rather than pointers?
> using process 0's file table for gre sounds weird to me.

Using file descriptors lets us see who owns/shares a socket using
fstat(1).  It is especially helpful for seeing if userland and the kernel
share a socket, just in case userland has delegated its socket to the
kernel using GRESSOCK.

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933 ext 24