1 /* 2 * CDDL HEADER START 3 * 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 7 * with the License. 8 * 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. 13 * 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] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25 * Use is subject to license terms. 26 */ 27 28 #ifndef _LIBNSL_INCLUDE_MT_H 29 #define _LIBNSL_INCLUDE_MT_H 30 31 #pragma ident "%Z%%M% %I% %E% SMI" 32 33 /* 34 * Threading and mutual exclusion declarations of primitives used for 35 * MT operation of libnsl code. 36 * 37 * Note: These primitives are designed to achieve the effect of avoiding a 38 * deadlock possibility by an interface operation being called from 39 * a signal handler while holding a lock. 40 * Note: the sig_*() functions use the _sigoff() and _sigon() consolidation 41 * private interfaces provided by libc to defer all asynchronously 42 * generated signals for the duration of holding the lock. Unlike 43 * blocking all signals with sigprocmask() or thr_sigsetmask(), 44 * _sigoff() allows signals with default dispositions to exercise 45 * their default actions (killing the process, stopping the process). 46 */ 47 48 #include "c_synonyms.h" 49 #if !defined(__lint) /* libnsl synonyms */ 50 #define inet_aton _inet_aton 51 #define t_strerror _t_strerror 52 #endif 53 #include <thread.h> 54 #include <pthread.h> 55 #include <signal.h> 56 #include <synch.h> 57 58 #ifdef __cplusplus 59 extern "C" { 60 #endif 61 62 extern sigset_t fillset; /* for actually blocking all signals */ 63 64 extern void sig_mutex_lock(mutex_t *); 65 extern void sig_mutex_unlock(mutex_t *); 66 extern void sig_rw_rdlock(rwlock_t *); 67 extern void sig_rw_wrlock(rwlock_t *); 68 extern void sig_rw_unlock(rwlock_t *); 69 70 extern void _sigoff(void); 71 extern void _sigon(void); 72 73 extern void *thr_get_storage(pthread_key_t *, size_t, void(*)(void *)); 74 75 #ifdef __cplusplus 76 } 77 #endif 78 79 #endif /* _LIBNSL_INCLUDE_MT_H */ 80