Article View: comp.unix.programmer
Article #54Re: SIGIO in HP-UX
From: Anastasios Kotsikonas
Date: Wed, 04 Nov 1992 18:41
Date: Wed, 04 Nov 1992 18:41
49 lines
1723 bytes
1723 bytes
In article <1992Oct31.060115.29466@cs.wisc.edu> tan@feta.cs.wisc.edu (C.K. Tan) writes:
>Could someone tell me how to do BSD4.3 style SIGIO handling in HP/UX?
>I have got a few TCP connections set up, and would like to catch SIGIO
>when data arrived. In BSD, I would use fcntl() to F_SETOWN and then
>F_SETFL to O_ASYNC. I could not find anything in the man pages that
>describe asynchronous I/O, although SIGIO is defined in sys/signal.h
Here is the most portable code I am using for all systems (??)
# ifdef sco
if (ioctl (sock_fd, I_SETSIG, S_INPUT) < 0) {
some error
return -1;
}
# else
# ifdef F_SETOWN
if (fcntl (sock_fd, F_SETOWN, getpid()) < 0) {
some error
return -1;
}
# elif defined (SIOCSPGRP)
value = -getpid();
if (ioctl (sock_fd, SIOCSPGRP, (char *) &value) < 0) {
some error
return -1;
}
# else
some error
return -1;
# endif
# ifdef FASYNC
if (fcntl (sock_fd, F_SETFL, (fcntl (sock_fd, F_GETFL, 0) | FASYNC)) < 0) {
some error
return -1;
}
# elif defined (FIOASYNC)
value = 1;
if (ioctl (sock_fd, FIOASYNC, (char *) &value) < 0) {
some error
return -1;
}
# else
some error
return -1;
# endif
# endif
Tasos
Technical Details
Message-ID:
<100604@bu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!cs!tasosReferences:
<1992Oct31.060115.29466@cs.wisc.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!cs!tasos From: tasos@cs.bu.edu (Anastasios Kotsikonas) Newsgroups: comp.unix.programmer Subject: Re: SIGIO in HP-UX Message-ID: <100604@bu.edu> Date: 4 Nov 92 18:41:41 GMT References: <1992Oct31.060115.29466@cs.wisc.edu> Sender: news@bu.edu Organization: Computer Science Department, Boston University, Boston, MA, USA Lines: 49