Use sysconf to obtain the page size in GonkHal.cpp

RESOLVED FIXED in mozilla37

Status

()

Core
Hardware Abstraction Layer (HAL)
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: mwu, Assigned: mwu)

Tracking

unspecified
mozilla37
All
Gonk (Firefox OS)
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

4 years ago
Created attachment 8538577 [details] [diff] [review]
Use sysconf to obtain the page size in GonkHal.cpp

This is a bit more portable.
Attachment #8538577 - Flags: review?(dhylands)
Comment on attachment 8538577 [details] [diff] [review]
Use sysconf to obtain the page size in GonkHal.cpp

Review of attachment 8538577 [details] [diff] [review]:
-----------------------------------------------------------------

::: hal/gonk/GonkHal.cpp
@@ +1355,5 @@
>      // adj is in oom_adj units.
>      adjParams.AppendPrintf("%d,", OomAdjOfOomScoreAdj(oomScoreAdj));
>  
>      // minfree is in pages.
> +    minfreeParams.AppendPrintf("%d,", killUnderKB * 1024 / page_size);

nit: %d is an int. dividing by page_size declared as long makes the result as long.

So technically, this should be %ld and probably the only reason this is working is because we're on a little endian machine. Either that or cast the result of the whole expression to int
Attachment #8538577 - Flags: review?(dhylands) → review+
(Assignee)

Comment 2

4 years ago
Created attachment 8539559 [details] [diff] [review]
Use sysconf to obtain the page size in GonkHal.cpp, v2
Attachment #8538577 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/7566fcba4be9
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.