Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Feb 1997 18:18:13 -0600
From:      Chris Csanady <ccsanady@nyx.pr.mcs.net>
To:        questions@freebsd.org
Subject:   dup(2) usage question...
Message-ID:  <199703010018.SAA03198@nyx.pr.mcs.net>

next in thread | raw e-mail | index | archive | help
If I dup a file descriptor, and close one, both will be closed, right?
Anyway, what I would like to do is just rename a file descriptor, and
then copy another one to the original.  It doesnt seem to be working, so
I assume it is being closed.  Is there a way around this?

Essentially, I'm trying to to squeeze a layer in to do intermediate
processing on data from a fd of another (forked) program.  Something like
this:

  fd=dup(4);
  socketpair(PF_LOCAL, SOCK_STREAM, 0, sv);
  dup2(sv[1], 4);

Is this possible?  If not, is there another way I may acheive this effect?

Thanks,
Chris Csanady






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703010018.SAA03198>