xref: /titanic_44/usr/src/man/man3nsl/rpc_svc_input.3nsl (revision d4f95bf4d6ec7ef0f01e5ddf22813ac641edf019)
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]
RPC_SVC_INPUT 3NSL "Jan 6, 2003"
NAME
rpc_svc_input, svc_add_input, svc_remove_input - declare or remove a callback on a file descriptor
SYNOPSIS

#include <rpc/rpc.h>

typedef void (*svc_callback_t)(svc_input_id_t id, int fd,
 unsigned int events, void *cookie);

svc_input_id_t svc_add_input(int fd, unsigned int revents,
 svc_callback_t callback, void *cookie);

int svc_remove_input(svc_input_t id);
DESCRIPTION

The following RPC routines are used to declare or remove a callback on a file descriptor.

"Routines"

See rpc(3NSL) for the definition of the SVCXPRT data structure. svc_add_input()

This function is used to register a callback function on a file descriptor, fd. The file descriptor, fd, is the first parameter to be passed to svc_add_input(). This callback function will be automatically called if any of the events specified in the events parameter occur on this descriptor. The events 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 poll(2) for further details of the events that can be specified. The callback to be invoked is specified using the callback parameter. The cookie parameter can be used to pass any data to the callback function. This parameter is a user-defined value which is passed as an argument to the callback function, and it is not used by the Sun RPC library itself. Several callbacks can be registered on the same file descriptor as long as each callback registration specifies a separate set of event flags. The callback function is called with the registration id, the fd file descriptor, an revents value, which is a bitmask of all events concerning the file descriptor, and the cookie user-defined value. Upon successful completion, the function returns a unique identifier for this registration, that can be used later to remove this callback. Upon failure, -1 is returned and errno is set to indicate the error. The svc_add_input() function will fail if: EINVAL

The fd or events parameters are invalid.

EEXIST

A callback is already registered to the file descriptor with one of the specified events.

ENOMEM

Memory is exhausted.

svc_remove_input()

This function is used to unregister a callback function on a file descriptor, fd. The id parameter specifies the registration to be removed. Upon successful completion, the function returns zero. Upon failure, -1 is returned and errno is set to indicate the error. The svc_remove_input() function will fail if: EINVAL

The id parameter is invalid.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Architecture All
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO

poll(2), rpc(3NSL), attributes(5)