linux-mips
[Top] [All Lists]

Re: Linux/SGI: Xsgi Shmiq/Qcntl

To: Miguel de Icaza <miguel@nuclecu.unam.mx>
Subject: Re: Linux/SGI: Xsgi Shmiq/Qcntl
From: "William J. Earl" <wje@fir.engr.sgi.com>
Date: Thu, 11 Sep 1997 17:55:16 -0700
Cc: linux@fir.engr.sgi.com
In-reply-to: <199709110303.WAA25810@athena.nuclecu.unam.mx>
References: <199709110303.WAA25810@athena.nuclecu.unam.mx>
Sender: owner-linux@cthulhu.engr.sgi.com
Miguel de Icaza writes:
 > 
 > Hello guys,
 > 
 >     Ok, 120 system calls after the last one, I need some more help.
 > If somebody can quickly look up the IRIX X sources, I would appreciate
 > if you could tell me how a little routine works.
 > 
 >     The source code should be in a directory called:
 > xc/programs/Xserver/hw/sgi 
 > 
 >     The code does an open on /dev/shmiq and then opens: sprintf (buf,
 > "/dev/qcntl%d", mistery_variable) I want to know how it computes
 > mistery_variable.  I am obviously screwing something in the shmiq
 > emulation code. 

        fd = open( SHMIQDEVNAME, O_EXCL | O_RDWR | O_NOCTTY ) ;
        if ( fd < 0 ) {
                perror( "Failed to open shmiq device." ) ;
                return 0 ;
        }

        /* Now open the control character device */
        if ( fstat ( fd, &sb ) < 0 ) {
                perror( "fstat failed -- shmiq not opened." ) ;
                (void) close( fd ) ;
                return 0 ;
        }

        (void) sprintf( cntldev, QCNTLDEVFORMAT, minor( sb.st_rdev ) ) ;

The /dev/qcntl2 device is the control device for minor device 2 as returned
by the clone open of /dev/shmiq.  A clone device returns a different
minor device for each open call; minor device numbers are reused only
after they have been closed.  Similary, /dev/ptc is a clone device for getting
PTYs.



<Prev in Thread] Current Thread [Next in Thread>