home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18238 < prev    next >
Encoding:
Text File  |  1992-12-11  |  1.9 KB  |  53 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!boulder!ucsu!ucsu.Colorado.EDU!baileyc
  3. From: baileyc@ucsu.Colorado.EDU (Christopher R. Bailey)
  4. Subject: SIGIO signal on HP pa-risc??? help needed
  5. Message-ID: <1992Dec12.005923.765@ucsu.Colorado.EDU>
  6. Keywords: SIGIO, fcntl, HP, System V, BSD, signal, socket
  7. Sender: news@ucsu.Colorado.EDU (USENET News System)
  8. Nntp-Posting-Host: ucsu.colorado.edu
  9. Organization: University of Colorado, Boulder
  10. Distribution: usa
  11. Date: Sat, 12 Dec 1992 00:59:23 GMT
  12. Lines: 39
  13.  
  14.  
  15. I have some code I am trying to port to an HP pa-risc architecture machine.
  16. The only thing it's choking on is some signal stuff.  It doesn't know about
  17. the requests F_SETOWN and FASYNC.  This code works on Sun and Dec (and I think 
  18. IBM RS/6000 :-).  I couldn't find anything in the man pages for fcntl() about
  19. these.  They are used to allow the SIGIO and SIGURG signals.  I was wondering
  20. how to implement this on an HP pa-risc machine.  I believe these are BSD
  21. things, because the HP's we have that are running 4.3 BSD (HP 300's and 700)
  22. have it.  This is being used in the app to receive X windows events and call
  23. the signal handler which deals with the events.  If anyone has any example
  24. code that would be great.  I guess this may be true for any Sys V???
  25.  
  26. Here is the two short functions that utilize SIGIO.
  27.  
  28. setup_sigio()
  29. {
  30.     sock = display->fd;
  31.     socket_flags = fcntl(sock, F_GETFL, 0);
  32.     socket_count = 0;
  33.     signal(SIGIO, handle_sigio);
  34.     fcntl(sock, F_SETOWN, getpid() );
  35. }
  36.  
  37. enable_sigio()
  38. {
  39.     if(++socket_count == 1)
  40.         fcntl(sock, F_SETFL, socket_flags | FASYNC);
  41. }
  42.  
  43. disable_sigio()
  44. {
  45.     if(--socket_count == 0)
  46.         fcntl(sock, F_SETFL, socket_flags & ~FASYNC);
  47. }
  48. -- 
  49. Christopher R. Bailey            |Internet: baileyc@dendrite.cs.colorado.edu
  50. University of Colorado at Boulder|CompuServe: 70403,1522
  51. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  52. Ride Fast, Take Chances!
  53.