Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
6b2cac62
Commit
6b2cac62
authored
4 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
file::pagesize(): added patch from Harald Anlauf.
parent
19f6389a
No related branches found
Branches containing commit
No related tags found
1 merge request
!7
Replaced gridDefDatatype()/gridInqDatatype() by cdiDefKeyInt()/cdiInqKeyInt()...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/file.c
+29
-0
29 additions, 0 deletions
src/file.c
with
29 additions
and
0 deletions
src/file.c
+
29
−
0
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment