barjunk wrote:
> Is there a way to duplicate this code using C?

A very probably yes. Passenger does it. Others (mongrel, etc..) do it. 
So can you ;)

kaspar