10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*6812Sraf * Common Development and Distribution License (the "License"). 6*6812Sraf * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211219Sraf 220Sstevel@tonic-gate /* 23*6812Sraf * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _LIBNSL_INCLUDE_MT_H 280Sstevel@tonic-gate #define _LIBNSL_INCLUDE_MT_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate /* 330Sstevel@tonic-gate * Threading and mutual exclusion declarations of primitives used for 340Sstevel@tonic-gate * MT operation of libnsl code. 350Sstevel@tonic-gate * 360Sstevel@tonic-gate * Note: These primitives are designed to achieve the effect of avoiding a 370Sstevel@tonic-gate * deadlock possibility by an interface operation being called from 380Sstevel@tonic-gate * a signal handler while holding a lock. 390Sstevel@tonic-gate * Note: the sig_*() functions use the _sigoff() and _sigon() consolidation 400Sstevel@tonic-gate * private interfaces provided by libc to defer all asynchronously 410Sstevel@tonic-gate * generated signals for the duration of holding the lock. Unlike 420Sstevel@tonic-gate * blocking all signals with sigprocmask() or thr_sigsetmask(), 430Sstevel@tonic-gate * _sigoff() allows signals with default dispositions to exercise 440Sstevel@tonic-gate * their default actions (killing the process, stopping the process). 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate 470Sstevel@tonic-gate #include <thread.h> 480Sstevel@tonic-gate #include <pthread.h> 490Sstevel@tonic-gate #include <signal.h> 500Sstevel@tonic-gate #include <synch.h> 510Sstevel@tonic-gate 520Sstevel@tonic-gate #ifdef __cplusplus 530Sstevel@tonic-gate extern "C" { 540Sstevel@tonic-gate #endif 550Sstevel@tonic-gate 560Sstevel@tonic-gate extern sigset_t fillset; /* for actually blocking all signals */ 570Sstevel@tonic-gate 580Sstevel@tonic-gate extern void sig_mutex_lock(mutex_t *); 590Sstevel@tonic-gate extern void sig_mutex_unlock(mutex_t *); 600Sstevel@tonic-gate extern void sig_rw_rdlock(rwlock_t *); 610Sstevel@tonic-gate extern void sig_rw_wrlock(rwlock_t *); 620Sstevel@tonic-gate extern void sig_rw_unlock(rwlock_t *); 630Sstevel@tonic-gate 640Sstevel@tonic-gate extern void _sigoff(void); 650Sstevel@tonic-gate extern void _sigon(void); 660Sstevel@tonic-gate 670Sstevel@tonic-gate extern void *thr_get_storage(pthread_key_t *, size_t, void(*)(void *)); 680Sstevel@tonic-gate 690Sstevel@tonic-gate #ifdef __cplusplus 700Sstevel@tonic-gate } 710Sstevel@tonic-gate #endif 720Sstevel@tonic-gate 730Sstevel@tonic-gate #endif /* _LIBNSL_INCLUDE_MT_H */ 74