Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HELP - Redirect output of already running process?



[John Abreau: Wed, Jun 05, 2002 at 04:58:18PM -0400]
> 
> You said "under some circumstances"; can you expand on that? When
> would it *not* work?
> 

a couple things come to mind: 

* freopen(stdout) will update both stdout and fd=1 for you, but if
  you've done something like p=stdout, [.. freopen (stdout).. ]
  fwrite(p), you're sol. That's a weird thing to do, but you might
  unwittingly make a copy of it on a function stack that takes a FILE
  * as an arg, or tucked it away in a structure somewhere..

* this has nothing to do with freopen() but various mixtures of
  kernels, glibc, and gdb refuse to allow mulitthreaded programs to
  continue to run after you detach. Getting this right is sometimes
  like casino night.

and of course the general disclaimer that programs are just state
machines - so attaching with gdb and generating transitions that the
programmer didn't consider is just pretty darn undefined. But when
your're desparate, you're desparate!

-P




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org