xref: /titanic_41/usr/src/lib/libumem/common/stub_stand.c (revision 4b0d01e9d944e10498c80bc88d80a2f5cdd9be22)
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  * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
28  */
29 
30 /*
31  * Stubs for the standalone to reduce the dependence on external libraries
32  */
33 
34 #include <string.h>
35 #include "misc.h"
36 
37 /*ARGSUSED*/
38 int
39 cond_init(cond_t *cvp, int type, void *arg)
40 {
41 	return (0);
42 }
43 
44 /*ARGSUSED*/
45 int
46 cond_destroy(cond_t *cvp)
47 {
48 	return (0);
49 }
50 
51 /*ARGSUSED*/
52 int
53 cond_wait(cond_t *cv, mutex_t *mutex)
54 {
55 	umem_panic("attempt to wait on standumem cv %p", cv);
56 
57 	/*NOTREACHED*/
58 	return (0);
59 }
60 
61 /*ARGSUSED*/
62 int
63 cond_broadcast(cond_t *cvp)
64 {
65 	return (0);
66 }
67 
68 /*ARGSUSED*/
69 int
70 pthread_setcancelstate(int state, int *oldstate)
71 {
72 	return (0);
73 }
74 
75 thread_t
76 thr_self(void)
77 {
78 	return ((thread_t)1);
79 }
80 
81 static mutex_t _mp = DEFAULTMUTEX;
82 
83 /*ARGSUSED*/
84 int
85 mutex_init(mutex_t *mp, int type, void *arg)
86 {
87 	(void) memcpy(mp, &_mp, sizeof (mutex_t));
88 	return (0);
89 }
90 
91 /*ARGSUSED*/
92 int
93 mutex_destroy(mutex_t *mp)
94 {
95 	return (0);
96 }
97 
98 /*ARGSUSED*/
99 int
100 _mutex_held(void *mp)
101 {
102 	return (1);
103 }
104 
105 /*ARGSUSED*/
106 int
107 mutex_lock(mutex_t *mp)
108 {
109 	return (0);
110 }
111 
112 /*ARGSUSED*/
113 int
114 mutex_trylock(mutex_t *mp)
115 {
116 	return (0);
117 }
118 
119 /*ARGSUSED*/
120 int
121 mutex_unlock(mutex_t *mp)
122 {
123 	return (0);
124 }
125 
126 int
127 issetugid(void)
128 {
129 	return (1);
130 }
131 
132 int
133 _tmem_get_nentries(void)
134 {
135 	return (0);
136 }
137 
138 uintptr_t
139 _tmem_get_base(void)
140 {
141 	return (0);
142 }
143 
144 /*ARGSUSED*/
145 void
146 _tmem_set_cleanup(void (*f)(int, void *))
147 {
148 }
149