I'm struggling to understand if I'm able to do something.

In my very odd use case we are writing a websever that handles connections 
via a forked process.

I have a listener process that listens for TCP connections.

So each net.Conn that comes in we pull off its file descriptor:

*fd, err := conn.(*net.TCPConn).File()*

duplicate that file descriptor and then fork off a process passing in that 
file descriptor.

In my forked handler I'll reconstruct the HTTP connection and "do stuff".

The concern I'm having is that it appears when I fork a process I inherit 
all of the parent file descriptors so if I have say 5 incoming connections 
and then I fork my child process *technically* could write to a different 
connection.

I've played around with the various options:

cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: false,}

and using cmd.ExtraFiles

No matter what I do I seem unable to limit the sub process to ONLY using 
the specific File Descriptor I want it to have access to.

I believe this is doable in C - but I'm not sure if I can do this in GoLang 
as-is without mods .

Thanks!!!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9fa5efac-8270-464d-b93a-26d539ed6be6n%40googlegroups.com.

Reply via email to