Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
6b2cac62
Commit
6b2cac62
authored
Apr 28, 2020
by
Uwe Schulzweida
Browse files
file::pagesize(): added patch from Harald Anlauf.
parent
19f6389a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/file.c
View file @
6b2cac62
...
...
@@ -338,6 +338,35 @@ const char *fileLibraryVersion(void)
static
int
pagesize
(
void
)
{
static
int
my_pagesize
=
-
1
;
static
bool
_pagesize_init
=
false
;
if
(
!
_pagesize_init
)
{
_pagesize_init
=
true
;
char
*
envSize
=
getenv
(
"PBIO_PAGESIZE"
);
if
(
envSize
!=
NULL
)
{
int
loop
;
for
(
loop
=
0
;
loop
<
(
int
)
strlen
(
envSize
)
;
loop
++
)
{
if
(
!
isdigit
((
int
)
envSize
[
loop
])
)
{
printf
(
"Invalid character in PBIO_PAGESIZE: %s
\n
"
,
envSize
);
printf
(
"PBIO_PAGESIZE must comprise only digits [0-9].
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
my_pagesize
=
atol
(
envSize
);
if
(
my_pagesize
<=
0
||
(
my_pagesize
&
(
my_pagesize
-
1
))
!=
0
)
{
printf
(
"Invalid value in PBIO_PAGESIZE: %s
\n
"
,
envSize
);
printf
(
"Pagesize defined by PBIO_PAGESIZE must be power of 2.
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
}
if
(
my_pagesize
>
0
)
return
my_pagesize
;
#ifdef _SC_PAGESIZE
return
(
int
)
sysconf
(
_SC_PAGESIZE
);
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment