xref: /titanic_44/usr/src/man/man3c/port_alert.3c (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
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]
PORT_ALERT 3C "Oct 1, 2003"
NAME
port_alert - set a port in alert mode
SYNOPSIS

#include <port.h>

int port_alert(int port, int flags, int events, void *user);
DESCRIPTION

The port_alert() function transitions a port into or out of alert mode. A port in alert mode immediately awakens all threads blocked in port_get(3C) or port_getn(3C). These threads return with an alert notification that consists of a single port_event_t structure with the source PORT_SOURCE_ALERT. Subsequent threads trying to retrieve events from a port that is in alert mode will return immediately with the alert notification.

A port is transitioned into alert mode by calling the port_alert() function with a non-zero events parameter. The specified events and user parameters will be made available in the portev_events and the portev_user members of the alert notification, respectively. The flags argument determines the mode of operation of the alert mode:

If flags is set to PORT_ALERT_SET, port_alert() sets the port in alert mode independent of the current state of the port. The portev_events and portev_user members are set or updated accordingly.

If flags is set to PORT_ALERT_UPDATE and the port is not in alert mode, port_alert() transitions the port into alert mode. The portev_events and portev_user members are set accordingly.

If flags is set to PORT_ALERT_UPDATE and the port is already in alert mode, port_alert() returns with an error value of EBUSY.

PORT_ALERT_SET and PORT_ALERT_UPDATE are mutually exclusive.

A port is transitioned out of alert mode by calling the port_alert() function with a zero events parameter.

Events can be queued to a port that is in alert mode, but they will not be retrievable until the port is transitioned out of alert mode.

RETURN VALUES

Upon succesful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

The port_alert() function will fail if: EBADF

The port identifier is not valid.

EBADFD

The port argument is not an event port file descriptor.

EBUSY

The port is already in alert mode.

EINVAL

Mutually exclusive flags are set.

ATTRIBUTES

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

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

port_associate(3C), port_create(3C), port_get(3C), port_send(3C), attributes(5)