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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2015, Joyent, Inc.
25 */
26
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 /*
41 * VM - segment management.
42 */
43
44 #include <sys/types.h>
1844 {
1845 struct segvn_data *svd;
1846 size_t swap = 0;
1847
1848 if (seg->s_ops == &segvn_ops) {
1849 svd = (struct segvn_data *)seg->s_data;
1850 if (svd->type == MAP_PRIVATE && svd->swresv > 0)
1851 swap = svd->swresv;
1852 }
1853 return (swap);
1854 }
1855
1856 /*
1857 * General not supported function for SEGOP_INHERIT
1858 */
1859 /* ARGSUSED */
1860 int
1861 seg_inherit_notsup(struct seg *seg, caddr_t addr, size_t len, uint_t op)
1862 {
1863 return (ENOTSUP);
1864 }
|
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright (c) 2015, Joyent, Inc.
25 * Copyright 2015, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /*
32 * University Copyright- Copyright (c) 1982, 1986, 1988
33 * The Regents of the University of California
34 * All Rights Reserved
35 *
36 * University Acknowledgment- Portions of this document are derived from
37 * software developed by the University of California, Berkeley, and its
38 * contributors.
39 */
40
41 /*
42 * VM - segment management.
43 */
44
45 #include <sys/types.h>
1845 {
1846 struct segvn_data *svd;
1847 size_t swap = 0;
1848
1849 if (seg->s_ops == &segvn_ops) {
1850 svd = (struct segvn_data *)seg->s_data;
1851 if (svd->type == MAP_PRIVATE && svd->swresv > 0)
1852 swap = svd->swresv;
1853 }
1854 return (swap);
1855 }
1856
1857 /*
1858 * General not supported function for SEGOP_INHERIT
1859 */
1860 /* ARGSUSED */
1861 int
1862 seg_inherit_notsup(struct seg *seg, caddr_t addr, size_t len, uint_t op)
1863 {
1864 return (ENOTSUP);
1865 }
1866
1867 /*
1868 * segop wrappers
1869 */
1870 int
1871 segop_dup(struct seg *seg, struct seg *new)
1872 {
1873 return (seg->s_ops->dup(seg, new));
1874 }
1875
1876 int
1877 segop_unmap(struct seg *seg, caddr_t addr, size_t len)
1878 {
1879 return (seg->s_ops->unmap(seg, addr, len));
1880 }
1881
1882 void
1883 segop_free(struct seg *seg)
1884 {
1885 seg->s_ops->free(seg);
1886 }
1887
1888 faultcode_t
1889 segop_fault(struct hat *hat, struct seg *seg, caddr_t addr, size_t len,
1890 enum fault_type type, enum seg_rw rw)
1891 {
1892 return (seg->s_ops->fault(hat, seg, addr, len, type, rw));
1893 }
1894
1895 faultcode_t
1896 segop_faulta(struct seg *seg, caddr_t addr)
1897 {
1898 return (seg->s_ops->faulta(seg, addr));
1899 }
1900
1901 int
1902 segop_setprot(struct seg *seg, caddr_t addr, size_t len, uint_t prot)
1903 {
1904 return (seg->s_ops->setprot(seg, addr, len, prot));
1905 }
1906
1907 int
1908 segop_checkprot(struct seg *seg, caddr_t addr, size_t len, uint_t prot)
1909 {
1910 return (seg->s_ops->checkprot(seg, addr, len, prot));
1911 }
1912
1913 int
1914 segop_kluster(struct seg *seg, caddr_t addr, ssize_t d)
1915 {
1916 return (seg->s_ops->kluster(seg, addr, d));
1917 }
1918
1919 size_t
1920 segop_swapout(struct seg *seg)
1921 {
1922 return (seg->s_ops->swapout(seg));
1923 }
1924
1925 int
1926 segop_sync(struct seg *seg, caddr_t addr, size_t len, int atr, uint_t f)
1927 {
1928 return (seg->s_ops->sync(seg, addr, len, atr, f));
1929 }
1930
1931 size_t
1932 segop_incore(struct seg *seg, caddr_t addr, size_t len, char *v)
1933 {
1934 return (seg->s_ops->incore(seg, addr, len, v));
1935 }
1936
1937 int
1938 segop_lockop(struct seg *seg, caddr_t addr, size_t len, int atr, int op,
1939 ulong_t *b, size_t p)
1940 {
1941 return (seg->s_ops->lockop(seg, addr, len, atr, op, b, p));
1942 }
1943
1944 int
1945 segop_getprot(struct seg *seg, caddr_t addr, size_t len, uint_t *p)
1946 {
1947 return (seg->s_ops->getprot(seg, addr, len, p));
1948 }
1949
1950 u_offset_t
1951 segop_getoffset(struct seg *seg, caddr_t addr)
1952 {
1953 return (seg->s_ops->getoffset(seg, addr));
1954 }
1955
1956 int
1957 segop_gettype(struct seg *seg, caddr_t addr)
1958 {
1959 return (seg->s_ops->gettype(seg, addr));
1960 }
1961
1962 int
1963 segop_getvp(struct seg *seg, caddr_t addr, struct vnode **vpp)
1964 {
1965 return (seg->s_ops->getvp(seg, addr, vpp));
1966 }
1967
1968 int
1969 segop_advise(struct seg *seg, caddr_t addr, size_t len, uint_t b)
1970 {
1971 return (seg->s_ops->advise(seg, addr, len, b));
1972 }
1973
1974 void
1975 segop_dump(struct seg *seg)
1976 {
1977 seg->s_ops->dump(seg);
1978 }
1979
1980 int
1981 segop_pagelock(struct seg *seg, caddr_t addr, size_t len, struct page ***page,
1982 enum lock_type type, enum seg_rw rw)
1983 {
1984 return (seg->s_ops->pagelock(seg, addr, len, page, type, rw));
1985 }
1986
1987 int
1988 segop_setpagesize(struct seg *seg, caddr_t addr, size_t len, uint_t szc)
1989 {
1990 return (seg->s_ops->setpagesize(seg, addr, len, szc));
1991 }
1992
1993 int
1994 segop_getmemid(struct seg *seg, caddr_t addr, memid_t *mp)
1995 {
1996 return (seg->s_ops->getmemid(seg, addr, mp));
1997 }
1998
1999 struct lgrp_mem_policy_info *
2000 segop_getpolicy(struct seg *seg, caddr_t addr)
2001 {
2002 if (seg->s_ops->getpolicy == NULL)
2003 return (NULL);
2004
2005 return (seg->s_ops->getpolicy(seg, addr));
2006 }
2007
2008 int
2009 segop_capable(struct seg *seg, segcapability_t cap)
2010 {
2011 return (seg->s_ops->capable(seg, cap));
2012 }
2013
2014 int
2015 segop_inherit(struct seg *seg, caddr_t addr, size_t len, uint_t op)
2016 {
2017 if (seg->s_ops->inherit == NULL)
2018 return (ENOTSUP);
2019
2020 return (seg->s_ops->inherit(seg, addr, len, op));
2021 }
|