Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: james DOT m DOT barker AT boeing DOT com Subject: mknod implementation clarification...thanks for the help To: cygwin AT cygwin DOT com Date: Mon, 24 Feb 2003 15:13:55 -0800 Message-ID: MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Here's the sample code that calls mknod. I always do a bad job of explaining in words what I'm trying to accomplish. Hopefully the sample code does a better job of it. I'm glad to hear that plans are in the work to include this capability. A series of "write" commands are made to gvFD to communicate with geomview. Thanks again Jim Barker int GVdriver::StartGeomview() { pipename = new char[40]; sprintf(pipename,"/tmp/geomview/GVU%0iP%0i",getuid(),getpid()); char *args[5]; args[0] = "geomview"; args[1] = "-Mcp"; args[2] = pipename; args[3] = "-nopanels"; args[4] = NULL; gvFD=-1; #ifndef __GNUC__ if(access("/tmp/geomview",W_ACC) <0) { #else if(access("/tmp/geomview",W_OK) <0) { #endif mkdir("/tmp/geomview",0777); chmod("/tmp/geomview",0777); //sometimes mkdir doesn't work!? } #ifndef __GNUC__ if(access(pipename,E_ACC)<0) { #else if(access(pipename,F_OK)<0) { #endif mknod(pipename, S_IFIFO | 0660 , 0); } gvFD = open(pipename, O_WRONLY | O_NONBLOCK); if(gvFD >= 0) { #ifndef __GNUC__ fcntl(gvFD, F_SETFL, fcntl(gvFD, F_GETFL, 0) & ~(FNDELAY|FNONBLOCK|O_NONBLOCK)); #else fcntl(gvFD, F_SETFL, fcntl(gvFD, F_GETFL, 0) & ~(FNDELAY|FNONBIO|O_NONBLOCK)); #endif } else if(errno == ENXIO) { gvPID=fork(); if(gvPID==0) { close(0); #ifndef __GNUC__ setpgrp(0,0); #else setpgrp(); #endif execvp("geomview",args); perror("couldn't start geomview"); kill(getppid(), SIGALRM); _exit(1); } alarm(60); gvFD = open(pipename, O_WRONLY); alarm(0); unlink(pipename); } if(gvFD<0) { fprintf(stderr,"Gotta give up trying to pipe to geomview: "); perror(pipename); } return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/