SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

This is a small utility to redirect file descriptors of running processes and more generally tweak them.
You can run a program (eg: wget) and then later decide to put wget output in a file with the following command (support the pid of wget is 3456):

$ fdmess 3456 "1>*/home/myfile" "2>&1"

the first option tells to redirect the file descriptor 1 (stdout) to the file /home/myfile in overwrite mode, while the second option tells to put the stderr equal to the stdout. See fdmess --help to get a full list of the avalable options.

You can query the position of a file descriptor (if for instance you are running dd and you want to know how much work it has done), close a file descritor, connect two file descriptors of 2 different running processes with a unix socket, or set a file descriptor equal to be a duplicate of another file descriptor of another process. You can also change the working directory, force the process to ignore some signals, or force it to drop privilges by changing its uid. Some effort is done to copy descriptor flags (like non-blocking flags).

Hake Fun!
Maurizio Monge <monge@sns.it>

WARNING: use at your own risk, it is VERY likely that the process crashes or data are lost. If you decide to use it, remember that signals may be lost, that if a file opened readonly is passed and the second program tryies to write in the file it will very likely crash, the same if you replace a device with a non-device or a socket with a non-socket; that for a socket the file state could not be exactly the same and that you cannot change fd's of a running 32bits process with the 64bits compiled version of this program on an x86_64 machine. JUST SIMPLY NEVER USE THIS PROGRAM ON EVEN REMOTELY IMPORTANT APPS.


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.