If the discharging time is unknown, the W3C Battery Status API
requires its value to be 'Infinity'. The current code returns a
discharging time of 0 when discharging the battery. This patch
fixes the problem.
Previously, suppose we were changing a process's priority from 18 to 1.
If a task had priority 19, that should have changed to 2. But instead
we changed it to 18! That's totally wrong.
It turns out that setpriority() on Linux sets the priority of just one
thread. If you call setpriority() on a pid, you're setting the priority
of only the main thread in that process.
On the PandaBoard, and probably other platforms, no battery exists and
the related kernel interfaces are missing. The HAL returns 'charging' at
a battery level of 100%. The charging time is set to 'unknown'. This is
inconsistent according to the battery manager.
With this patch, the returned charging time is set to zero, which fulfills
the battery manager's requirements. The patch also cleans up and simplifies
the source code.
Occurences of PR_MAX in layout/style/nsCSSProps.cpp and xpcom/glue/nsTArray.h
can not be converted without C++11 support (constexpr).
--HG--
extra : rebase_source : 3b4f7e26690fad487dd11594449948411d4e79bc
The call to fscanf for reading the battery status used an incorrect pointer in its
arguments. The code only worked because the first byte of a character array is the
first element within the array. To fix this problem, fscanf has been replaced by
fgets, which is less error prone and checks the length of the supplied array.
Additionaly, we don't want to operate on an undefined result if fgets fails. In
this case we assume that the battery is not being charged.
The interface /proc/<pid>/oom_score_adj has been added as a replacement for /proc/<pid>/oom_adj. It
is now supported and used by default within Gonk. If oom_scrore_adj is not available, the code falls
back to the old interface.
The preference settings
hal.processPriorityManager.gonk.backgroundOomAdjust,
hal.processPriorityManager.gonk.foregroundOomAdjust, and
hal.processPriorityManager.gonk.masterOomAdjust
have been replaced by
hal.processPriorityManager.gonk.backgroundOomScoreAdjust,
hal.processPriorityManager.gonk.foregroundOomScoreAdjust, and
hal.processPriorityManager.gonk.masterOomScoreAdjust.
The new settings adopt the semantics of /proc/<pid>/oom_score_adj and the default
values have been changed accordingly. The interface to the OOM killer interface is
still /proc/<pid>/oom_adj, and its input values are computed from the settings.
For supporting multiple files in the OOM adjustment, we need to know if a file
has been successfully written to. in this case WriteToFile now returns 'true',
otherwise it returns 'false'.
SIGUSR2 was originally chosen to avoid interferering with dalvik. We don't need
to avoid that on B2G.
--HG--
extra : rebase_source : 99098a28daee28933f379cfa520a433c44d5465d