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