xref: /titanic_44/usr/src/lib/libumem/common/stub_stand.c (revision 02032da2d8b8c39f8555e913f6239bba49238e55)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * Stubs for the standalone to reduce the dependence on external libraries
29  */
30 
31 #include <string.h>
32 #include "misc.h"
33 
34 /*ARGSUSED*/
35 int
36 cond_init(cond_t *cvp, int type, void *arg)
37 {
38 	return (0);
39 }
40 
41 /*ARGSUSED*/
42 int
43 cond_destroy(cond_t *cvp)
44 {
45 	return (0);
46 }
47 
48 /*ARGSUSED*/
49 int
50 cond_wait(cond_t *cv, mutex_t *mutex)
51 {
52 	umem_panic("attempt to wait on standumem cv %p", cv);
53 
54 	/*NOTREACHED*/
55 	return (0);
56 }
57 
58 /*ARGSUSED*/
59 int
60 cond_broadcast(cond_t *cvp)
61 {
62 	return (0);
63 }
64 
65 /*ARGSUSED*/
66 int
67 pthread_setcancelstate(int state, int *oldstate)
68 {
69 	return (0);
70 }
71 
72 thread_t
73 thr_self(void)
74 {
75 	return ((thread_t)1);
76 }
77 
78 static mutex_t _mp = DEFAULTMUTEX;
79 
80 /*ARGSUSED*/
81 int
82 mutex_init(mutex_t *mp, int type, void *arg)
83 {
84 	(void) memcpy(mp, &_mp, sizeof (mutex_t));
85 	return (0);
86 }
87 
88 /*ARGSUSED*/
89 int
90 mutex_destroy(mutex_t *mp)
91 {
92 	return (0);
93 }
94 
95 /*ARGSUSED*/
96 int
97 _mutex_held(void *mp)
98 {
99 	return (1);
100 }
101 
102 /*ARGSUSED*/
103 int
104 mutex_lock(mutex_t *mp)
105 {
106 	return (0);
107 }
108 
109 /*ARGSUSED*/
110 int
111 mutex_trylock(mutex_t *mp)
112 {
113 	return (0);
114 }
115 
116 /*ARGSUSED*/
117 int
118 mutex_unlock(mutex_t *mp)
119 {
120 	return (0);
121 }
122 
123 int
124 issetugid(void)
125 {
126 	return (1);
127 }
128