1*9acbbeafSnn /*
2*9acbbeafSnn  * CDDL HEADER START
3*9acbbeafSnn  *
4*9acbbeafSnn  * The contents of this file are subject to the terms of the
5*9acbbeafSnn  * Common Development and Distribution License (the "License").
6*9acbbeafSnn  * You may not use this file except in compliance with the License.
7*9acbbeafSnn  *
8*9acbbeafSnn  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9acbbeafSnn  * or http://www.opensolaris.org/os/licensing.
10*9acbbeafSnn  * See the License for the specific language governing permissions
11*9acbbeafSnn  * and limitations under the License.
12*9acbbeafSnn  *
13*9acbbeafSnn  * When distributing Covered Code, include this CDDL HEADER in each
14*9acbbeafSnn  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9acbbeafSnn  * If applicable, add the following below this CDDL HEADER, with the
16*9acbbeafSnn  * fields enclosed by brackets "[]" replaced with your own identifying
17*9acbbeafSnn  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9acbbeafSnn  *
19*9acbbeafSnn  * CDDL HEADER END
20*9acbbeafSnn  */
21*9acbbeafSnn /*
22*9acbbeafSnn  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*9acbbeafSnn  * Use is subject to license terms.
24*9acbbeafSnn  */
25*9acbbeafSnn 
26*9acbbeafSnn #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*9acbbeafSnn 
28*9acbbeafSnn #include <sys/brand.h>
29*9acbbeafSnn #include <sys/systm.h>
30*9acbbeafSnn #include <sys/types.h>
31*9acbbeafSnn #include <sys/zone.h>
32*9acbbeafSnn 
33*9acbbeafSnn /*
34*9acbbeafSnn  * brand(2) system call.
35*9acbbeafSnn  */
36*9acbbeafSnn int64_t
brandsys(int cmd,uintptr_t arg1,uintptr_t arg2,uintptr_t arg3,uintptr_t arg4,uintptr_t arg5,uintptr_t arg6)37*9acbbeafSnn brandsys(int cmd, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3,
38*9acbbeafSnn     uintptr_t arg4, uintptr_t arg5, uintptr_t arg6)
39*9acbbeafSnn {
40*9acbbeafSnn 	struct proc *p = curthread->t_procp;
41*9acbbeafSnn 	int64_t rval = 0;
42*9acbbeafSnn 	int err;
43*9acbbeafSnn 
44*9acbbeafSnn 	/*
45*9acbbeafSnn 	 * The brandsys system call can only be executed from inside a
46*9acbbeafSnn 	 * branded zone.
47*9acbbeafSnn 	 */
48*9acbbeafSnn 	if (INGLOBALZONE(p) || !ZONE_IS_BRANDED(p->p_zone))
49*9acbbeafSnn 		return (set_errno(ENOSYS));
50*9acbbeafSnn 
51*9acbbeafSnn 	if ((err = ZBROP(p->p_zone)->b_brandsys(cmd, &rval, arg1, arg2, arg3,
52*9acbbeafSnn 	    arg4, arg5, arg6)) != 0)
53*9acbbeafSnn 		return (set_errno(err));
54*9acbbeafSnn 
55*9acbbeafSnn 	return (rval);
56*9acbbeafSnn }
57