1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2022 Oxide Computer Company
14#
15
16#
17# Historical note: This header has never been part of ISO C. The
18# visibility rules were always specific to versions of POSIX/XPG.
19# Applications have assumed that these are visible even in a strict ISO
20# C environment, which we honor because this header isn't part of the
21# standard. See <sys/mman.h> for more details, but this is why you see
22# the STDC group here for things that aren't standardized, as we want
23# to make sure we don't regress that support.
24#
25
26#
27# Types
28#
29
30#
31# Values.
32#
33value	| PROT_READ	| int	| sys/mman.h	| +ALL
34value	| PROT_WRITE	| int	| sys/mman.h	| +ALL
35value	| PROT_EXEC	| int	| sys/mman.h	| +ALL
36value	| PROT_NONE	| int	| sys/mman.h	| +ALL
37value	| MAP_SHARED	| int	| sys/mman.h	| +ALL
38value	| MAP_PRIVATE	| int	| sys/mman.h	| +ALL
39value	| MAP_FILE	| int	| sys/mman.h	| +ALL
40value	| MAP_FIXED	| int	| sys/mman.h	| +ALL
41value	| MAP_NORESERVE	| int	| sys/mman.h	| +ALL
42value	| MAP_ANON	| int	| sys/mman.h	| +ALL
43value	| MAP_ALIGN	| int	| sys/mman.h	| +ALL
44value	| MAP_TEXT	| int	| sys/mman.h	| +ALL
45value	| MAP_INITDATA	| int	| sys/mman.h	| +ALL
46
47value	| MCL_CURRENT	| int	| sys/mman.h	| STDC POSIX-1993+ SUSv2+
48value	| MCL_FUTURE	| int	| sys/mman.h	| STDC POSIX-1993+ SUSv2+
49
50
51value	| POSIX_MADV_NORMAL	| int	| sys/mman.h	| STDC SUSv3+
52value	| POSIX_MADV_RANDOM	| int	| sys/mman.h	| STDC SUSv3+
53value	| POSIX_MADV_SEQUENTIAL	| int	| sys/mman.h	| STDC SUSv3+
54value	| POSIX_MADV_WILLNEED	| int	| sys/mman.h	| STDC SUSv3+
55value	| POSIX_MADV_DONTNEED	| int	| sys/mman.h	| STDC SUSv3+
56
57value	| MAP_FAILED	| void *	| sys/mman.h	| +ALL
58
59#
60# Defines
61#
62
63#
64# Functions
65#
66
67#
68# This first group of functions basically should always be visible.
69#
70func | mmap						|\
71	void *						|\
72	void *; size_t; int; int; int; off_t		|\
73	sys/mman.h | +ALL
74
75func | munmap						|\
76	int						|\
77	void *; size_t					|\
78	sys/mman.h | +ALL
79
80func | mprotect						|\
81	int						|\
82	void *; size_t; int				|\
83	sys/mman.h | +ALL
84
85func | msync						|\
86	int						|\
87	void *; size_t; int				|\
88	sys/mman.h | +ALL
89
90
91#
92# This next group of functions were added in the realtime POSIX extensions, e.g.
93# they should be in POSIX at POSIX-1993. However, they weren't part of XPG until
94# XPG5, aka what we call SUSv2 in these tests.
95#
96func | mlock						|\
97	int						|\
98	void *; size_t					|\
99	sys/mman.h | STDC POSIX-1993+ SUSv2+
100
101func | munlock						|\
102	int						|\
103	void *; size_t					|\
104	sys/mman.h | STDC POSIX-1993+ SUSv2+
105
106func | mlockall						|\
107	int						|\
108	int						|\
109	sys/mman.h | STDC POSIX-1993+ SUSv2+
110
111func | munlockall					|\
112	int						|\
113	void						|\
114	sys/mman.h | STDC POSIX-1993+ SUSv2+
115
116func | shm_open						|\
117	int						|\
118	const char *; int; mode_t			|\
119	sys/mman.h | STDC POSIX-1993+ SUSv2+
120
121func | shm_unlink					|\
122	int						|\
123	const char *					|\
124	sys/mman.h | STDC POSIX-1993+ SUSv2+
125
126#
127# Added in XPG6
128#
129func | posix_madvise					|\
130	int						|\
131	void *; size_t; int				|\
132	sys/mman.h | STDC SUSv3+
133
134#
135# Our various extensions. No visibility expected in a standards environment. We
136# do a handful of these with the assumption that as long as a few in the block
137# are OK, the rest should be.
138#
139func | mincore						|\
140	int						|\
141	caddr_t; size_t; char *				|\
142	sys/mman.h | -ALL STDC
143
144func | memcntl						|\
145	int						|\
146	void *; size_t; int; void *; int; int		|\
147	sys/mman.h | -ALL STDC
148
149func | madvise						|\
150	int						|\
151	void *; size_t; int				|\
152	sys/mman.h | -ALL STDC
153
154func | getpagesizes					|\
155	int						|\
156	size_t *; int					|\
157	sys/mman.h | -ALL STDC
158
159func | getpagesizes2					|\
160	int						|\
161	size_t *; int					|\
162	sys/mman.h | -ALL STDC
163