Portable mknod ?? does it exist?
Darrell Schiebel
drs at cerc.wvu.wvnet.edu
Sat Jul 29 04:39:22 AEST 1989
I have been attempting to write software utilizing named pipes on
several hardware platforms. The same code seems to behave differently
on each different platform.
Sun (SunOS Release 4.0):
mknod works fine
read blocks
Silicon Graphics (Iris 4D1-3.1D IP6):
mknod works fine
read does not block
DEC (Ultrix-32 V3.0):
mknod works fine
open fails with error "No such device or address" (ERRNO: 6)
HP (HP-UX):
mknod fails with error "Invalid argument" (ERRNO: 22)
Does anyone have any suggestions on how to make this portable ?
Or an alternative to named pipes which is portable?
Here is the code snippet:
#include <errno.h>
#ifdef ULTRIX
#include <fcntl.h>
#else
#include <sys/fcntl.h>
#endif
#define FIFONAME "myfifo"
#define PERMS 0000666
#define FIFO 0010000 /* = S_IFIFO */
main(){
char buffer[200];
int pipe;
if (mknod(FIFONAME, FIFO | PERMS, 0) == -1) {
printf("ERRNO: %d\n",errno);
perror("writer: mknod failed");
exit(1);}
else printf("myfifo created\n");
if ((pipe = open(FIFONAME,O_RDWR)) == -1){
printf("ERRNO: %d\n",errno);
perror("Open Failed");
exit(1);}
if (read(pipe, buffer, 20)< 0){
printf("ERRNO: %d\n",errno);
perror("Read Failed");}}
Any Responses Would be Appreciated.
Darrell Schiebel
--------------------------------------
Concurrent Engineering Research Center
West Virginia University
drs at cerc.wvu.wvnet.edu
drs at g.cs.wvu.wvnet.edu
drs at baks.com
More information about the Comp.unix.questions
mailing list