|
|
1.1 root 1: /* rystub.c - ROSY: stubs */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/rosy/RCS/rystub.c,v 6.0 89/03/18 23:42:58 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/rosy/RCS/rystub.c,v 6.0 89/03/18 23:42:58 mrose Rel $
9: *
10: *
11: * $Log: rystub.c,v $
12: * Revision 6.0 89/03/18 23:42:58 mrose
13: * Release 5.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: /* LINTLIBRARY */
29:
30: #include <signal.h>
31: #include <stdio.h>
32: #include "rosy.h"
33:
34:
35: #define missingP(p) \
36: { \
37: if (p == NULL) \
38: return rosaplose (roi, ROS_PARAMETER, NULLCP, \
39: "mandatory parameter \"%s\" missing", "p"); \
40: }
41:
42: /* */
43:
44: static int interrupted;
45: SFD intrser ();
46:
47: /* stub */
48:
49: int RyStub (sd, ryo, op, id, linked, in, rfx, efx, class, roi)
50: int sd;
51: register struct RyOperation *ryo;
52: int op,
53: id,
54: *linked,
55: class;
56: caddr_t in;
57: IFP rfx,
58: efx;
59: struct RoSAPindication *roi;
60: {
61: int firstime,
62: opclass,
63: result;
64: SFP istat;
65:
66: #ifdef notdef /* let RyOpInvoke check these as necessary */
67: missingP (ryo);
68: missingP (in);
69: missingP (rfx);
70: missingP (efx);
71: #endif
72: missingP (roi);
73:
74: if ((opclass = class) == ROS_INTR) {
75: interrupted = 0;
76: istat = signal (SIGINT, intrser);
77:
78: opclass = ROS_ASYNC;
79: }
80:
81: result = RyOpInvoke (sd, ryo, op, in, (caddr_t *) NULL, rfx, efx,
82: opclass, id, linked, ROS_NOPRIO, roi);
83: firstime = 1;
84:
85: again: ;
86: switch (result) {
87: case NOTOK:
88: break;
89:
90: case OK:
91: switch (class) {
92: case ROS_ASYNC:
93: break;
94:
95: case ROS_INTR:
96: if (firstime) {
97: for (;;) {
98: if (!interrupted) {
99: int nfds;
100: fd_set rfds;
101:
102: nfds = 0;
103: FD_ZERO (&rfds);
104:
105: /* interrupt causes EINTR */
106: if (RoSelectMask (sd, &rfds, &nfds, roi) == OK)
107: (void) xselect (nfds, &rfds, NULLFD,
108: NULLFD, NOTOK);
109: }
110: if (interrupted) {
111: result = rosaplose (roi, ROS_INTERRUPTED,
112: NULLCP, NULLCP);
113: break;
114: }
115: if ((result = RyWait (sd, &id, (caddr_t *) NULL,
116: OK, roi)) != NOTOK
117: || roi -> roi_preject.rop_reason
118: != ROS_TIMER) {
119: firstime = 0;
120: goto again;
121: }
122: }
123: break;
124: }
125: /* else fall */
126:
127: default:
128: switch (roi -> roi_type) {
129: case ROI_RESULT:
130: case ROI_ERROR:
131: case ROI_UREJECT:
132: result = OK;
133: break;
134:
135: default:
136: result = rosaplose (roi, ROS_PROTOCOL, NULLCP,
137: "unknown indication type=%d",
138: roi -> roi_type);
139: break;
140: }
141: break;
142: }
143:
144: case DONE:
145: break;
146:
147: default:
148: result = rosaplose (roi, ROS_PROTOCOL, NULLCP,
149: "unknown return from RyInvoke=%d", result);
150: break;
151: }
152:
153: if (class == ROS_INTR)
154: (void) signal (SIGINT, istat);
155:
156: return result;
157: }
158:
159: /* */
160:
161: /* ARGSUSED */
162:
163: static SFD intrser (sig)
164: int sig;
165: {
166: #ifndef BSDSIGS
167: (void) signal (SIGINT, intrser);
168: #endif
169:
170: interrupted++;
171: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.