home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / sys5 / r3 / 77 < prev    next >
Encoding:
Text File  |  1992-11-07  |  2.3 KB  |  80 lines

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!cs!tasos
  2. From: tasos@cs.bu.edu (Anastasios Kotsikonas)
  3. Newsgroups: comp.unix.sys5.r3
  4. Subject: Re: how to get SIGIO
  5. Message-ID: <100856@bu.edu>
  6. Date: 6 Nov 92 17:34:53 GMT
  7. References: <100320@bu.edu> <Bx5yE7.DDn@flatlin.ka.sub.org>
  8. Sender: news@bu.edu
  9. Organization: Computer Science Department, Boston University, Boston, MA, USA
  10. Lines: 68
  11.  
  12. In article <Bx5yE7.DDn@flatlin.ka.sub.org> bad@flatlin.ka.sub.org (Christoph Badura) writes:
  13. >In <100320@bu.edu> tasos@cs.bu.edu (Anastasios Kotsikonas) writes:
  14. >
  15. >>I am trying to write a client that does async socket I/O but I cannot grab the
  16. >>SIGIO signal:
  17. >>but I never get it; I only have this problem on certain SVR3 systems (SGI's
  18. >>system works as expected).
  19. >
  20. >You have to tell us more. Especially what version of UNIX you're
  21. >trying this on and what your code looks like.
  22. >
  23. >All that can be said now is that certain (in fact most) SVR3 systems
  24. >don't support SIGIO. 
  25.  
  26. Here are excerpts of the code:
  27.  
  28. First catch the signals:
  29.  
  30.   signal (SIGIO, (void (*)()) urg_data);
  31.   signal (SIGURG, (void (*)()) urg_data);
  32.  
  33. then once I have the socket:
  34.  
  35. #ifdef sco
  36.   if (ioctl (sock_fd, I_SETSIG, S_INPUT) < 0) {
  37.     perror ("Cannot set SIGIO");
  38.     return -1;
  39.   }
  40. #else
  41. # ifdef F_SETOWN
  42.   if (fcntl (sock_fd, F_SETOWN, getpid()) < 0) {
  43.     perror ("Cannot assign socket to process group");
  44.     return -1;
  45.   }
  46. # elif defined (SIOCSPGRP)
  47.   value = -getpid();
  48.   if (ioctl (sock_fd, SIOCSPGRP, (char *) &value) < 0) {
  49.     perror ("Cannot assign socket to process group");
  50.     return -1;
  51.   }
  52. # else
  53.   perror ("Cannot assign socket to process group");
  54.   return -1;
  55. # endif
  56. # ifdef FASYNC
  57.   if (fcntl (sock_fd, F_SETFL, (fcntl (sock_fd, F_GETFL, 0) | FASYNC)) < 0) {
  58.     perror ("Cannot set asynchronous I/O for socket");
  59.     return -1;
  60.   }
  61. # elif defined (FIOASYNC)
  62.   value = 1;
  63.   if (ioctl (sock_fd, FIOASYNC, (char *) &value) < 0) {
  64.     perror ("Cannot set asynchronous I/O for socket");
  65.     return -1;
  66.   }
  67. # else
  68.   perror ("Cannot set asynchronous I/O for socket");
  69.   return -1;
  70. # endif
  71. #endif
  72.   return sock_fd;
  73.  
  74.  
  75. Any help will be greatly appreciated.
  76.  
  77. Tasos
  78.  
  79. PS: and BTW, I disagree with your .signature: AIX is the worst UNIX I have
  80.