mt_misc.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
* 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]
*
* CDDL HEADER END
*/
/*
* Copyright 1986-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Define and initialize MT data for libnsl.
* The _libnsl_lock_init() function below is the library's .init handler.
*/
#include "mt.h"
#include "rpc_mt.h"
#include <unistd.h>
#include <stdlib.h>
#include <syslog.h>
extern mutex_t _ti_userlock;
static rwlock_t *rwlock_table[] = {
&svc_lock,
};
/* and default_domain (rpcdname.c) */
/* (key_call.c) */
static mutex_t *mutex_table[] = {
&ops_lock,
&tsd_lock,
};
static void
{
}
static void
{
}
static void
{
}
#pragma init(_libnsl_lock_init)
void
{
int i;
(void) _sigfillset(&fillset);
for (i = 0; i < (sizeof (mutex_table) / sizeof (mutex_table[0])); i++)
mutex_init(mutex_table[i], 0, (void *) 0);
for (i = 0; i < (sizeof (rwlock_table) / sizeof (rwlock_table[0])); i++)
rwlock_init(rwlock_table[i], 0, (void *) 0);
/*
* There is no way to unregister these atfork functions,
* but we don't need to. The dynamic linker and libc take
*/
(void) pthread_atfork(_libnsl_prefork,
}
#pragma fini(_libnsl_fini)
void _key_call_fini(void);
void
{
}
struct rpc_createerr rpc_createerr;
struct rpc_createerr *
{
static pthread_key_t rce_key = 0;
struct rpc_createerr *rce_addr;
if (thr_main())
return (&rpc_createerr);
return (&rpc_createerr);
}
return (rce_addr);
}
struct rpc_err rpc_callerr;
struct rpc_err *
__rpc_callerr(void)
{
static pthread_key_t rpc_callerr_key = 0;
if (thr_main())
return (&rpc_callerr);
return (&rpc_callerr);
}
return (tsd);
}