On Wed, Apr 22, 2009 at 3:38 PM, Rohit Sharma <imreckless@xxxxxxxxx> wrote: > Arun, i suggest that if you are using this for IPC then , better use pipes. > > And if you really want to use fd in another application then > pass the file descriptor to exec after doing a fork. > > something like this. > > in application_1 > > ret = fork(); > > if(ret == 0){ > sprintf(buff, "%d", fd_1); > (void)exec("application_2","application_2", buff, (char*)0); > } > > ....... > ......... > > in application_2 > > int fd_1; > sscanf(argv[1],"%d", &fd_1); > > read(fd_1, buff, BUFFSIZE); > > .... > ..... > > I hope that helps. Decided to back and refresh my memory. I was not thinking of passing a FD via a pipe. I was thinking of doing it through sendmsg(). I don't think I ever did that in Linux, so it may or may not work with a linux kernel. See http://archives.neohapsis.com/archives/postfix/2000-09/1476.html for a write-up of how it worked in at least some environments. I don't even remember what flavor of Unix I was using when I did the sendmsg() trick to pass a FD. Greg -- Greg Freemyer Head of EDD Tape Extraction and Processing team Litigation Triage Solutions Specialist http://www.linkedin.com/in/gregfreemyer First 99 Days Litigation White Paper - http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf The Norcross Group The Intersection of Evidence & Technology http://www.norcrossgroup.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ