Linux/SGI: Xsgi Shmiq/Qcntl

3 messages, 3 authors, 1997-09-12 · open the first message on its own page

Linux/SGI: Xsgi Shmiq/Qcntl

From: Miguel de Icaza <hidden>
Date: 1997-09-11 03:12:29

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. 

Cheers,
Miguel.

Re: Linux/SGI: Xsgi Shmiq/Qcntl

From: Mike Shaver <hidden>
Date: 1997-09-11 06:55:29

Thus spake Miguel de Icaza:
    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. 
If it's like the rest of the shmiq stuff, it's probably the minor
number.   Remind me to test that stuff better now that I have an
Indy. =)

Mike

-- 
#> Mike Shaver (shaver@ingenia.com)      Information Warfare Division  
#> Chief Tactical and Strategic Officer         "Saepe fidelis"        
#>                                                                     
#> "I like your game, but we have to change the rules." -- Anon        
#>                                                                     

Re: Linux/SGI: Xsgi Shmiq/Qcntl

From: William J. Earl <hidden>
Date: 1997-09-12 00:55:55

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help