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