summaryrefslogtreecommitdiff
path: root/usr/src/man/man3nsl/rpc_svc_input.3nsl
blob: 7d1be024ff00e599363211def67c584fee740e2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
'\" te
.\" Copyright (C) 2003, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH RPC_SVC_INPUT 3NSL "Jan 6, 2003"
.SH NAME
rpc_svc_input, svc_add_input, svc_remove_input \- declare or remove a callback
on a file descriptor
.SH SYNOPSIS
.LP
.nf
#include <rpc/rpc.h>

\fBtypedef void (*\fR\fBsvc_callback_t\fR)(\fBsvc_input_id_t\fR \fIid\fR, \fBint\fR \fIfd\fR,
     \fBunsigned int\fR \fIevents\fR, \fBvoid *\fR\fIcookie\fR);
.fi

.LP
.nf
\fBsvc_input_id_t\fR \fBsvc_add_input\fR(\fBint\fR \fIfd\fR, \fBunsigned int\fR \fIrevents\fR,
     \fBsvc_callback_t\fR \fIcallback\fR, \fBvoid *\fR\fIcookie\fR);
.fi

.LP
.nf
\fBint\fR \fBsvc_remove_input\fR(\fBsvc_input_t\fR \fIid\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The following RPC routines are used to declare or remove a callback on a file
descriptor.
.SS "Routines"
.sp
.LP
See \fBrpc\fR(3NSL) for the definition of the \fBSVCXPRT\fR data structure.
.sp
.ne 2
.na
\fBsvc_add_input\fB()\fR\fR
.ad
.RS 22n
This function is used to register a \fIcallback\fR function on a file
descriptor, \fIfd\fR. The file descriptor, \fIfd\fR, is the first parameter to
be passed to \fBsvc_add_input()\fR. This \fIcallback\fR function will be
automatically called if any of the events specified in the \fIevents\fR
parameter occur on this descriptor. The \fIevents\fR parameter is used to
specify when the callback is invoked. This parameter is a mask of poll events
to which the user wants to listen. See \fBpoll\fR(2) for further details of the
events that can be specified.
.sp
The callback to be invoked is specified using the \fIcallback\fR parameter. The
\fIcookie\fR parameter can be used to pass any data to the \fIcallback\fR
function. This parameter is a user-defined value which is passed as an argument
to the \fIcallback\fR function, and it is not used by the Sun RPC library
itself.
.sp
Several callbacks can be registered on the same file descriptor as long as each
callback registration specifies a separate set of event flags.
.sp
The \fIcallback\fR function is called with the registration \fIid\fR, the
\fIfd\fR file descriptor, an \fIrevents\fR value, which is a bitmask of all
events concerning the file descriptor, and the \fIcookie\fR user-defined value.
.sp
Upon successful completion, the function returns a unique identifier for this
registration, that can be used later to remove this callback. Upon failure,
\fB-1\fR is returned and \fBerrno\fR is set to indicate the error.
.sp
The \fBsvc_add_input()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The \fIfd\fR or \fIevents\fR parameters are invalid.
.RE

.sp
.ne 2
.na
\fB\fBEEXIST\fR\fR
.ad
.RS 10n
A callback is already registered to the file descriptor with one of the
specified events.
.RE

.sp
.ne 2
.na
\fB\fBENOMEM\fR\fR
.ad
.RS 10n
Memory is exhausted.
.RE

.RE

.sp
.ne 2
.na
\fB\fBsvc_remove_input()\fR\fR
.ad
.RS 22n
This function is used to unregister a callback function on a file descriptor,
\fIfd\fR. The \fIid\fR parameter specifies the registration to be removed.
.sp
Upon successful completion, the function returns zero. Upon failure, \fB-1\fR
is returned and \fBerrno\fR is set to indicate the error.
.sp
The \fBsvc_remove_input()\fR function will fail if:
.sp
.ne 2
.na
\fBEINVAL\fR
.ad
.RS 10n
The \fIid\fR parameter is invalid.
.RE

.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Architecture	All
_
Interface Stability	Evolving
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
\fBpoll\fR(2), \fBrpc\fR(3NSL), \fBattributes\fR(5)