xref: /onnv-gate/usr/src/lib/libc/port/sys/rctlsys.c (revision 6812:febeba71273d)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
53684Srd117015  * Common Development and Distribution License (the "License").
63684Srd117015  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
21*6812Sraf 
220Sstevel@tonic-gate /*
23*6812Sraf  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
29*6812Sraf #pragma weak _getrctl = getrctl
30*6812Sraf #pragma weak _setrctl = setrctl
310Sstevel@tonic-gate 
32*6812Sraf #include "lint.h"
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <sys/syscall.h>
350Sstevel@tonic-gate #include <sys/rctl.h>
360Sstevel@tonic-gate 
370Sstevel@tonic-gate int
getrctl(const char * name,rctlblk_t * old_rblk,rctlblk_t * new_rblk,int flags)380Sstevel@tonic-gate getrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
390Sstevel@tonic-gate     int flags)
400Sstevel@tonic-gate {
410Sstevel@tonic-gate 	return (syscall(SYS_rctlsys,
420Sstevel@tonic-gate 	    0, name, old_rblk, new_rblk, 0, flags));
430Sstevel@tonic-gate }
440Sstevel@tonic-gate 
450Sstevel@tonic-gate int
setrctl(const char * name,rctlblk_t * old_rblk,rctlblk_t * new_rblk,int flags)460Sstevel@tonic-gate setrctl(const char *name, rctlblk_t *old_rblk, rctlblk_t *new_rblk,
470Sstevel@tonic-gate     int flags)
480Sstevel@tonic-gate {
490Sstevel@tonic-gate 	return (syscall(SYS_rctlsys,
500Sstevel@tonic-gate 	    1, name, old_rblk, new_rblk, 0, flags));
510Sstevel@tonic-gate }
520Sstevel@tonic-gate 
530Sstevel@tonic-gate size_t
rctllist(char * list_buf,size_t list_bufsz)540Sstevel@tonic-gate rctllist(char *list_buf, size_t list_bufsz)
550Sstevel@tonic-gate {
560Sstevel@tonic-gate 	sysret_t rval;
570Sstevel@tonic-gate 	int error;
580Sstevel@tonic-gate 
590Sstevel@tonic-gate 	error = __systemcall(&rval, SYS_rctlsys, 2, NULL, list_buf, NULL,
600Sstevel@tonic-gate 	    list_bufsz, 0);
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 	if (error)
630Sstevel@tonic-gate 		(void) __set_errno(error);
640Sstevel@tonic-gate 	return ((size_t)rval.sys_rval1);
650Sstevel@tonic-gate }
660Sstevel@tonic-gate 
670Sstevel@tonic-gate int
rctlctl(const char * name,rctlblk_t * rblk,int flags)680Sstevel@tonic-gate rctlctl(const char *name, rctlblk_t *rblk, int flags)
690Sstevel@tonic-gate {
700Sstevel@tonic-gate 	return (syscall(SYS_rctlsys, 3, name, rblk, NULL, 0, flags));
710Sstevel@tonic-gate }
723684Srd117015 
733684Srd117015 int
setprojrctl(const char * name,rctlblk_t * new_rblk,size_t size,int flags)743684Srd117015 setprojrctl(const char *name, rctlblk_t *new_rblk, size_t size, int flags)
753684Srd117015 {
763684Srd117015 	return (syscall(SYS_rctlsys,
773684Srd117015 	    4, name, NULL, new_rblk, size, flags));
783684Srd117015 }
79