xref: /illumos-gate/usr/src/lib/libumem/common/stub_stand.c (revision a07094369b21309434206d9b3601d162693466fc)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 /*
31  * Stubs for the standalone to reduce the dependence on external libraries
32  */
33 
34 #include <string.h>
35 #include <thread.h>
36 
37 #include "misc.h"
38 
39 /*ARGSUSED*/
40 int
41 _cond_init(cond_t *cvp, int type, void *arg)
42 {
43 	return (0);
44 }
45 
46 /*ARGSUSED*/
47 int
48 _cond_destroy(cond_t *cvp)
49 {
50 	return (0);
51 }
52 
53 /*ARGSUSED*/
54 int
55 _cond_wait(cond_t *cv, mutex_t *mutex)
56 {
57 	umem_panic("attempt to wait on standumem cv %p", cv);
58 
59 	/*NOTREACHED*/
60 	return (0);
61 }
62 
63 /*ARGSUSED*/
64 int
65 _cond_broadcast(cond_t *cvp)
66 {
67 	return (0);
68 }
69 
70 thread_t
71 _thr_self(void)
72 {
73 	return ((thread_t)1);
74 }
75 
76 static mutex_t _mp = DEFAULTMUTEX;
77 
78 /*ARGSUSED*/
79 int
80 __mutex_init(mutex_t *mp, int type, void *arg)
81 {
82 	(void) memcpy(mp, &_mp, sizeof (mutex_t));
83 	return (0);
84 }
85 
86 /*ARGSUSED*/
87 int
88 __mutex_destroy(mutex_t *mp)
89 {
90 	return (0);
91 }
92 
93 /*ARGSUSED*/
94 int
95 __mutex_held(mutex_t *mp)
96 {
97 	return (1);
98 }
99 
100 /*ARGSUSED*/
101 int
102 __mutex_lock(mutex_t *mp)
103 {
104 	return (0);
105 }
106 
107 /*ARGSUSED*/
108 int
109 __mutex_trylock(mutex_t *mp)
110 {
111 	return (0);
112 }
113 
114 /*ARGSUSED*/
115 int
116 __mutex_unlock(mutex_t *mp)
117 {
118 	return (0);
119 }
120 
121 int
122 _issetugid(void)
123 {
124 	return (1);
125 }
126