Constraints:
- Linux semants require that a named pipe/socket be persistent across reboots, and be visible over NFS
- implication is that you create the named object, then when an open stumbles across it the internal service (socket or pipe) is created as a side effect.
- the actual creation of the object is specific to a file system, but the use of a previously created object seems to be generic,
Solution:
- have a FSFile object in name space of file system where the name exists
- request to open file (getObj) ends up turning into some request to create/access object in the real sererss address space (e.g., pipe or socket) i.e., we never instantiate a server object in the file system where the name is.
So things we need to do:
- add mknod call to nametree, comes into dir object
- in directory object in fslib, translates mknod it into a call on the directory object (FSFile) so that the operation is FS specific, creating a object in the underlying persistent media...
- for first implementation, just do a generic implementation in base FSFile, which creates the appropriate FSFile for pipe... and in the code in mknod in directory object, have that code insert the FSFile in a nameholder, so we don't initially have to modify all the specific file systems.
- in an operation that looks up a name, it will call FSFile method getFSFileOrServerFile, in this method, for each of the file systems, we should stat the file, find out if socket or pipe, and if so create a new FSFile object specific to socket or pipe
- write a new FSFile object for socket, and one for pipe
- on a stat call, or other such operation, just return something reasonable
- on operations taht should return a server object
- in locked_convert... does not convert to an object if symlink, fifo...
- get rid of FIFO flag, have somethign that says nameholder is caching a special object (which only it knows if pipe, or socket..)
- in switch in locked_convert, do nothing, i.e., keep it FSFile just like pipe does now
- add an open call to FSFile which doesn't create a real object, but does something appropriate for pipe or socket... e.g., forwards call to pipe server to open half, this will return an OH to a server object in the pipe servers address space, thats the oh you return back on the getObj call
- in getObj if is special (socket, pipe) then make a open call on that object, with oflags...
Cleanup:
- pipes
- get rid of openCreateServerFile
- check logic for isFSFile
Issues:
- pipe open for read will bock until pipe open for write, and we must make sure we don't block server thread
Socket Solution:
subclass FileLinuxSockets for uds and overwrite the bind and connect methods (at the very least)
- make sure that socket and socket pair create the same object and that everything that works so far continues to work (sockets ip, uds, pipes)
- implemement bind
- find out exactly what soreuseaddr does to uds
- implement the symlink loop for mknod
to do bind: looks like open up to GetObj, the invokes giveAccess on the server socket object give access to the fs to the socket objecy; then ivoke a new thing on the fs for bind. The job of the filesystem is to locate the file or decide that the files is new (in this case the file system mknods with correct stats) or if the file exists it forwards stats to the socket server. To be determined is who exactly will check things like does the fs name have the correct stats? is the socket already bound? and so on.
Still TODO:
- packets protocol (must store domain/type/protocol) for sshd
