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.5 */
40 #include <sys/stream.h>
41 #define _SUN_TPI_VERSION 2
42 #include <sys/tihdr.h>
43 #include <sys/timod.h>
54 _tx_getinfo(int fd
, struct t_info
*info
, int api_semantics
)
56 struct T_info_req
*inforeqp
;
57 struct T_info_ack
*infoackp
;
59 struct _ti_user
*tiptr
;
60 int retval
, sv_errno
, didalloc
;
63 if ((tiptr
= _t_checkfd(fd
, 0, api_semantics
)) == 0)
65 sig_mutex_lock(&tiptr
->ti_lock
);
68 * Acquire buffer for use in sending/receiving the message.
69 * Note: assumes (correctly) that ti_ctlsize is large enough
70 * to hold sizeof (struct T_info_req/ack)
72 if (_t_acquire_ctlbuf(tiptr
, &ctlbuf
, &didalloc
) < 0) {
74 sig_mutex_unlock(&tiptr
->ti_lock
);
79 /* LINTED pointer cast */
80 inforeqp
= (struct T_info_req
*)ctlbuf
.buf
;
81 inforeqp
->PRIM_type
= T_INFO_REQ
;
84 retval
= _t_do_ioctl(fd
, ctlbuf
.buf
,
85 (int)sizeof (struct T_info_req
), TI_GETINFO
, &retlen
);
86 } while (retval
< 0 && errno
== EINTR
);
91 if (retlen
!= (int)sizeof (struct T_info_ack
)) {
97 /* LINTED pointer cast */
98 infoackp
= (struct T_info_ack
*)ctlbuf
.buf
;
100 info
->addr
= infoackp
->ADDR_size
;
101 info
->options
= infoackp
->OPT_size
;
102 info
->tsdu
= infoackp
->TSDU_size
;
103 info
->etsdu
= infoackp
->ETSDU_size
;
104 info
->connect
= infoackp
->CDATA_size
;
105 info
->discon
= infoackp
->DDATA_size
;
106 info
->servtype
= infoackp
->SERV_type
;
108 if (_T_IS_XTI(api_semantics
)) {
109 /* XTI ONLY - TLI t_info struct does not have "flags" */
111 if (infoackp
->PROVIDER_flag
& (SENDZERO
|OLD_SENDZERO
))
112 info
->flags
|= T_SENDZERO
;
117 tiptr
->ti_ctlbuf
= ctlbuf
.buf
;
118 sig_mutex_unlock(&tiptr
->ti_lock
);
126 tiptr
->ti_ctlbuf
= ctlbuf
.buf
;
127 sig_mutex_unlock(&tiptr
->ti_lock
);