/* acserver2.c - generic server dispatch */
static char *rcsid
= "$Header: /f/osi/acsap/RCS/acserver2.c,v 7.4 91/02/22 09:14:24 mrose Interim $";
* $Header: /f/osi/acsap/RCS/acserver2.c,v 7.4 91/02/22 09:14:24 mrose Interim $
* Revision 7.4 91/02/22 09:14:24 mrose
* Revision 7.3 90/10/29 18:37:51 mrose
* Revision 7.2 90/07/09 14:30:46 mrose
* Revision 7.1 90/02/19 13:07:07 mrose
* Revision 7.0 89/11/23 21:22:03 mrose
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
int iserver_init (argc
, argv
, aei
, initfnx
, td
)
struct TSAPdisconnect
*td
;
if ((fd
= (*initfnx
) (argc
, argv
)) == NOTOK
)
return tsaplose (td
, DR_NETWORK
, NULLCP
, "initialization failed");
if ((pa
= aei2addr (aei
)) == NULLPA
)
return tsaplose (td
, DR_ADDRESS
, NULLCP
,
"address translation failed");
if (TNetListen (&pa
-> pa_addr
.sa_addr
, td
) == NOTOK
)
for (i
= 0; i
< 5; i
++) {
if ((fd
= open ("/dev/null", O_RDWR
)) != NOTOK
) {
(void) dup2 (fd
, 0), (void) close (fd
);
if ((fd
= open ("/dev/tty", O_RDWR
)) != NOTOK
) {
(void) ioctl (fd
, TIOCNOTTY
, NULLCP
);
(void) signal (SIGINT
, SIG_IGN
);
(void) signal (SIGQUIT
, SIG_IGN
);
isodexport (NULLCP
); /* re-initialize logfiles */
int iserver_wait (initfnx
, workfnx
, losefnx
, nfds
, rfds
, wfds
, efds
, secs
,
struct TSAPdisconnect
*td
;
ifds
= is_mask
; /* struct copy */
for (fd
= 0; fd
< nfds
; fd
++)
if (TNetAccept (&vecp
, vec
, nfds
, &ifds
, &ofds
, &xfds
, secs
, td
)
if (vecp
> 0 && (fd
= (*initfnx
) (vecp
, vec
)) != NOTOK
) {
for (fd
= 0; fd
< nfds
; fd
++)
if (FD_ISSET (fd
, &is_mask
) && FD_ISSET (fd
, &ifds
)) {
if (workfnx
== NULLIFP
) {
(void) TNetClose (NULLTA
, td
);
return tsaplose (td
, DR_OPERATION
, NULLCP
,
"no worker routine for connected fd");
if ((*workfnx
) (fd
) == NOTOK
) {
for (xd
= 0; xd
< nfds
; xd
++)
if (FD_ISSET (xd
, &is_mask
))