4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
24 /* All Rights Reserved */
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
31 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
34 * t_sndrel.c and t_sndreldata.c are very similar and contain common code.
35 * Any changes to either of them should be reviewed to see whether they
36 * are applicable to the other file.
41 #include <sys/stream.h>
42 #define _SUN_TPI_VERSION 2
43 #include <sys/tihdr.h>
44 #include <sys/timod.h>
49 _tx_sndrel(int fd
, int api_semantics
)
51 struct T_ordrel_req orreq
;
53 struct _ti_user
*tiptr
;
55 if ((tiptr
= _t_checkfd(fd
, 0, api_semantics
)) == NULL
)
57 sig_mutex_lock(&tiptr
->ti_lock
);
59 if (tiptr
->ti_servtype
!= T_COTS_ORD
) {
60 t_errno
= TNOTSUPPORT
;
61 sig_mutex_unlock(&tiptr
->ti_lock
);
65 if (_T_IS_XTI(api_semantics
)) {
67 * User level state verification only done for XTI
68 * because doing for TLI may break existing applications
70 if (!(tiptr
->ti_state
== T_DATAXFER
||
71 tiptr
->ti_state
== T_INREL
)) {
73 sig_mutex_unlock(&tiptr
->ti_lock
);
77 if (_t_look_locked(fd
, tiptr
, 0,
78 api_semantics
) == T_DISCONNECT
) {
80 sig_mutex_unlock(&tiptr
->ti_lock
);
86 orreq
.PRIM_type
= T_ORDREL_REQ
;
87 ctlbuf
.maxlen
= (int)sizeof (struct T_ordrel_req
);
88 ctlbuf
.len
= (int)sizeof (struct T_ordrel_req
);
89 ctlbuf
.buf
= (caddr_t
)&orreq
;
92 * Calls to send data (write or putmsg) can potentially
93 * block, for MT case, we drop the lock and enable signals here
96 sig_mutex_unlock(&tiptr
->ti_lock
);
97 if (putmsg(fd
, &ctlbuf
, NULL
, 0) < 0) {
104 sig_mutex_lock(&tiptr
->ti_lock
);
105 _T_TX_NEXTSTATE(T_SNDREL
, tiptr
,
106 "t_sndrel: invalid state on event T_SNDREL");
107 sig_mutex_unlock(&tiptr
->ti_lock
);