I have the following code which I call from a Swift main program in Xcode and when running it in the Simulator in a virtual iPhone for example, it works. It creates /tmp/MYFIFO
.
int32_t init_udpC(void) {
static char *filename="/tmp/MYFIFO";
umask(0);
unlink(filename);
if((mkfifo(filename, 0666)) == -1){
perror("mkfifo");
exit(2);
}
if((fd=open("/tmp/MYFIFO",O_RDWR|O_APPEND)) == -1) {
perror("open");
exit(2);
}
return fd;
}
Running it on the physical device the code fails with
mkfifo: Operation not permitted