title: linux prevent file descriptor from closing on program exit
body: <p>I have a peculiar use case where on linux when using uinput <a href="http://thiemonge.org/getting-started-with-uinput" rel="nofollow noreferrer">http://thiemonge.org/getting-started-with-uinput</a>, the process that creates the virtual input device, if it dies by default releases all open file descriptors.</p>
  
  <p>In this case it also releases the created virtual input device and the device flat out disappears from /dev/input.  </p>
  
  <p>I am wondering if there is a simple solution to this problem, the most obvious being to not release the open file descriptor upon program termination. The more annoying one to spawn a proxy process to simply hold the FD.</p>