0

I wrote the following code:

First application

int   efd = eventfd(0,0);    
const char* pipeName="//dev//pipes//fifo_server";    
int ret = mkfifo(pipeName,0666);    
int fifo_server =  open(pipeName,O_WRONLY);    
int ret1 = ioctl(fifo_server, I_SENDFD, efd);

Second application

const char* pipeName="//dev//pipes//fifo_server";    
int fifo_server = open(pipeName,O_RDONLY);    
int ret1 = ioctl(fifo_server, I_RECVFD, &evfd);

The pipe is created and opened but when calling ioctl(), I get in errno the value ENOTTY in either of the applications.

Anyone has any idea why?

Rachid K.
  • 4,490
  • 3
  • 11
  • 30
S BI
  • 351
  • 1
  • 2
  • 12
  • 1
    See here as to why (Linux doesn't support those ioctls):http://stackoverflow.com/questions/11355552/ioctl-giving-invalid-argument , see here for how you pass file descriptors to another process: http://stackoverflow.com/questions/2358684/can-i-share-a-file-descriptor-to-another-process-on-linux-or-are-they-local-to-t – nos Oct 11 '14 at 20:00
  • Any particular reason why you want to pass the file descriptor between the two applications? It's a bit odd. – Rein Oct 12 '14 at 22:44
  • @Rein see this http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch15lev1sec7.html and this http://poincare.matf.bg.ac.rs/~ivana/courses/tos/sistemi_knjige/pomocno/apue/APUE/0201433079/ch17lev1sec4.html for the reasons – Bill Yan Jun 02 '17 at 22:39

0 Answers0