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 2014 Garrett D'Amore <garrett@damore.org>
24 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
25 * Use is subject to license terms.
26 */
27/*
28 * Copyright (c) 2012, Joyent, Inc.  All rights reserved.
29 */
30
31/*
32 * Stubs for the standalone to reduce the dependence on external libraries
33 */
34
35#include <string.h>
36#include "misc.h"
37
38/*ARGSUSED*/
39int
40cond_init(cond_t *cvp, int type, void *arg)
41{
42	return (0);
43}
44
45/*ARGSUSED*/
46int
47cond_destroy(cond_t *cvp)
48{
49	return (0);
50}
51
52/*ARGSUSED*/
53int
54cond_wait(cond_t *cv, mutex_t *mutex)
55{
56	umem_panic("attempt to wait on standumem cv %p", cv);
57
58	/*NOTREACHED*/
59	return (0);
60}
61
62/*ARGSUSED*/
63int
64cond_broadcast(cond_t *cvp)
65{
66	return (0);
67}
68
69/*ARGSUSED*/
70int
71pthread_setcancelstate(int state, int *oldstate)
72{
73	return (0);
74}
75
76thread_t
77thr_self(void)
78{
79	return ((thread_t)1);
80}
81
82static mutex_t _mp = DEFAULTMUTEX;
83
84/*ARGSUSED*/
85int
86mutex_init(mutex_t *mp, int type, void *arg)
87{
88	(void) memcpy(mp, &_mp, sizeof (mutex_t));
89	return (0);
90}
91
92/*ARGSUSED*/
93int
94mutex_destroy(mutex_t *mp)
95{
96	return (0);
97}
98
99/*ARGSUSED*/
100int
101_mutex_held(void *mp)
102{
103	return (1);
104}
105
106/*ARGSUSED*/
107int
108mutex_lock(mutex_t *mp)
109{
110	return (0);
111}
112
113/*ARGSUSED*/
114int
115mutex_trylock(mutex_t *mp)
116{
117	return (0);
118}
119
120/*ARGSUSED*/
121int
122mutex_unlock(mutex_t *mp)
123{
124	return (0);
125}
126
127int
128issetugid(void)
129{
130	return (1);
131}
132
133int
134_tmem_get_nentries(void)
135{
136	return (0);
137}
138
139uintptr_t
140_tmem_get_base(void)
141{
142	return (0);
143}
144
145/*ARGSUSED*/
146void
147_tmem_set_cleanup(void (*f)(int, void *))
148{
149}
150
151int
152isspace(int c)
153{
154	switch (c) {
155	case ' ':
156	case '\t':
157	case '\n':
158	case '\r':
159	case '\f':
160	case '\v':
161		return (1);
162	}
163	return (0);
164}
165