xref: /illumos-gate/usr/src/lib/smbclnt/libfksmbfs/common/fake_zone.c (revision 6e6545bfaed3bab9ce836ee82d1abd8f2edba89a)
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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24  * Copyright 2015, Joyent Inc. All rights reserved.
25  * Copyright (c) 2016 by Delphix. All rights reserved.
26  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
27  */
28 
29 /*
30  * Simulating just one zone here (the global zone)
31  */
32 
33 #include <sys/types.h>
34 #include <sys/zone.h>
35 #include <sys/debug.h>
36 
37 static void *zone_specific_val;
38 static void *(*zkey_create)(zoneid_t);
39 // static void (*zkey_shutdown)(zoneid_t, void *);
40 // static void (*zkey_destroy)(zoneid_t, void *);
41 
42 /* ARGSUSED */
43 void
44 zone_key_create(zone_key_t *keyp, void *(*create)(zoneid_t),
45     void (*shutdown)(zoneid_t, void *), void (*destroy)(zoneid_t, void *))
46 {
47 
48 	zkey_create = create;
49 	// zkey_shutdown = shutdown;
50 	// zkey_destroy = destroy;
51 	*keyp = 1;
52 }
53 
54 /* ARGSUSED */
55 int
56 zone_key_delete(zone_key_t key)
57 {
58 	return (-1);
59 }
60 
61 /* ARGSUSED */
62 int
63 zone_setspecific(zone_key_t key, zone_t *zone, const void *data)
64 {
65 	return (-1);
66 }
67 
68 /* ARGSUSED */
69 void *
70 zone_getspecific(zone_key_t key, zone_t *zone)
71 {
72 	ASSERT(key == 1);
73 	if (zone_specific_val == NULL)
74 		zone_specific_val = (*zkey_create)(zone->zone_id);
75 	return (zone_specific_val);
76 }
77