Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F4588426
mapper.c
dougm (Doug Moore)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
dougm
May 18 2019, 7:43 AM
2019-05-18 07:43:37 (UTC+0)
Size
588 B
Referenced Files
None
Subscribers
None
mapper.c
View Options
#include
<sys/mman.h>
#include
<stdlib.h>
#include
<stdio.h>
enum
{
MAX_MAPS
=
16384
,
MAP_SIZE
=
4096
};
void
*
mappings
[
MAX_MAPS
];
int
main
()
{
int
i
;
int
nmappings
=
0
;
for
(
i
=
0
;
i
<
128
*
MAX_MAPS
;
++
i
)
{
long
r
=
random
()
%
MAX_MAPS
;
if
(
mappings
[
r
]
==
NULL
)
{
mappings
[
r
]
=
mmap
(
0
,
MAP_SIZE
,
PROT_WRITE
,
MAP_ALIGNED
(
13
)
|
MAP_ANON
,
-1
,
0
);
if
(
mappings
[
r
]
!=
NULL
)
++
nmappings
;
}
else
{
munmap
(
mappings
[
r
],
MAP_SIZE
);
mappings
[
r
]
=
0
;
--
nmappings
;
}
}
printf
(
"nmappings = %d; ok?
\n
"
,
nmappings
);
getchar
();
return
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1898428
Default Alt Text
mapper.c (588 B)
Attached To
Mode
D19826: reduce accesses to vm_map entries off the search path in updating max_free
Attached
Detach File
Event Timeline
Log In to Comment