1rpc_svc_input(3NSL) Networking Services Library Functions rpc_svc_input(3NSL)
2
3
4
6 rpc_svc_input, svc_add_input, svc_remove_input - declare or remove a
7 callback on a file descriptor
8
10 #include <rpc/rpc.h>
11
12 typedef void (*svc_callback_t)(svc_input_id_t id, int fd,
13 unsigned int events, void *cookie);
14
15
16 svc_input_id_t svc_add_input(int fd, unsigned int revents,
17 svc_callback_t callback, void *cookie);
18
19
20 int svc_remove_input(svc_input_t id);
21
22
24 The following RPC routines are used to declare or remove a callback on
25 a file descriptor.
26
27 Routines
28 See rpc(3NSL) for the definition of the SVCXPRT data structure.
29
30 svc_add_input() This function is used to register a callback
31 function on a file descriptor, fd. The file
32 descriptor, fd, is the first parameter to be
33 passed to svc_add_input(). This callback function
34 will be automatically called if any of the events
35 specified in the events parameter occur on this
36 descriptor. The events parameter is used to spec‐
37 ify when the callback is invoked. This parameter
38 is a mask of poll events to which the user wants
39 to listen. See poll(2) for further details of the
40 events that can be specified.
41
42 The callback to be invoked is specified using the
43 callback parameter. The cookie parameter can be
44 used to pass any data to the callback function.
45 This parameter is a user-defined value which is
46 passed as an argument to the callback function,
47 and it is not used by the Sun RPC library itself.
48
49 Several callbacks can be registered on the same
50 file descriptor as long as each callback regis‐
51 tration specifies a separate set of event flags.
52
53 The callback function is called with the regis‐
54 tration id, the fd file descriptor, an revents
55 value, which is a bitmask of all events concern‐
56 ing the file descriptor, and the cookie user-
57 defined value.
58
59 Upon successful completion, the function returns
60 a unique identifier for this registration, that
61 can be used later to remove this callback. Upon
62 failure, -1 is returned and errno is set to indi‐
63 cate the error.
64
65 The svc_add_input() function will fail if:
66
67 EINVAL The fd or events parameters are
68 invalid.
69
70
71 EEXIST A callback is already registered to the
72 file descriptor with one of the speci‐
73 fied events.
74
75
76 ENOMEM Memory is exhausted.
77
78
79
80 svc_remove_input() This function is used to unregister a callback
81 function on a file descriptor, fd. The id parame‐
82 ter specifies the registration to be removed.
83
84 Upon successful completion, the function returns
85 zero. Upon failure, -1 is returned and errno is
86 set to indicate the error.
87
88 The svc_remove_input() function will fail if:
89
90 EINVAL The id parameter is invalid.
91
92
93
95 See attributes(5) for descriptions of the following attributes:
96
97
98
99
100 ┌─────────────────────────────┬─────────────────────────────┐
101 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
102 ├─────────────────────────────┼─────────────────────────────┤
103 │Architecture │All │
104 ├─────────────────────────────┼─────────────────────────────┤
105 │Availability │SUNWcsl (32-bit) │
106 ├─────────────────────────────┼─────────────────────────────┤
107 │ │SUNWcslx (64-bit) │
108 ├─────────────────────────────┼─────────────────────────────┤
109 │Interface Stability │Evolving │
110 ├─────────────────────────────┼─────────────────────────────┤
111 │MT-Level │MT-Safe │
112 └─────────────────────────────┴─────────────────────────────┘
113
115 poll(2), rpc(3NSL), attributes(5)
116
117
118
119SunOS 5.11 6 Jan 2003 rpc_svc_input(3NSL)