mctl.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/*
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * CDDL HEADER START
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen *
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * The contents of this file are subject to the terms of the
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * Common Development and Distribution License, Version 1.0 only
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * (the "License"). You may not use this file except in compliance
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * with the License.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen *
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * or http://www.opensolaris.org/os/licensing.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * See the License for the specific language governing permissions
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * and limitations under the License.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen *
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * When distributing Covered Code, include this CDDL HEADER in each
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * If applicable, add the following below this CDDL HEADER, with the
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * fields enclosed by brackets "[]" replaced with your own identifying
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * information: Portions Copyright [yyyy] [name of copyright owner]
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen *
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * CDDL HEADER END
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/*
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * Use is subject to license terms.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/* All Rights Reserved */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/*
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * University Copyright- Copyright (c) 1982, 1986, 1988
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * The Regents of the University of California
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * All Rights Reserved
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen *
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * University Acknowledgment- Portions of this document are derived from
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * software developed by the University of California, Berkeley, and its
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * contributors.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen#pragma ident "%Z%%M% %I% %E% SMI"
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/*LINTLIBRARY*/
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen#include <sys/types.h>
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen#include <errno.h>
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen#include <sys/mman.h>
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen/*
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen * Memory control function.
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen */
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chenint
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chenmctl(caddr_t addr, size_t len, int function, int arg)
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen{
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen if ((long)len < 0L) {
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen errno = EINVAL;
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen return (-1);
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen }
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen return (memcntl(addr, len, function, (caddr_t)(uintptr_t)arg, 0, 0));
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen}
0035018c6da861f1b758fb9bf6b50245c52b48e2Raymond Chen