Commit graph

5 commits

Author SHA1 Message Date
Colin Cross
26532523c6 Cast sysinfo.uptime for musl
Upstream musl libc defines sysinfo.uptime as unsigned long, while the
kernel and glibc define it as long.  Cast it to long for the
comparision.

Bug: 190084016
Test: bionic-unit-tests-glibc
Change-Id: Ib322472d512a9a7474a936e33f35523e1dc995d9
2022-09-29 11:15:06 -07:00
Elliott Hughes
40c8a8b1ba Extend <sys/sysinfo.h> tests slightly.
We know game developers (and the Games SDK) look at this stuff, so make
a bit more of an effort to ensure it's not completely broken.

Test: treehugger
Change-Id: I20b1c167faa1d9f4f39a94a723dabb848ce34269
2021-06-21 16:50:13 -07:00
Dimitry Ivanov
f008a11ef2 Relax flaky _SC_AVPHYS_PAGES check in sys_sysinfo_test
The number of available physical pages is not constant and can
potentially change between calls to get_avphys_pages and
sysconf(_SC_AVPHYS_PAGES) calls.

Relax the assert to check that sconf(_SC_AVPHYS_PAGES) <= phys_pages.

Bug: http://b/31502852
Test: build and run bionic-unit-tests
Change-Id: Ibf8873d2151d93239391d2638dfbf055b70cde3a
2017-05-25 14:27:37 -07:00
Elliott Hughes
c508de0e41 Use sysinfo(2) to implement more of <sys/sysinfo.h>.
We already had implementations of some of the functions, and I didn't
bother rewriting them when we added sysinfo(2). Ross Anderson said in
https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
that we should "simply disable access to all procfs files", which made
me curious how many places we use /proc in bionic. This is the one that's
obviously unnecessary. The others I'm not aware of alternative APIs for.

Change-Id: Ia64f36b76f29a7a1dd67845270a5472e121aae10
2016-08-11 14:51:31 -07:00
Yabin Cui
9d93986481 Add functions in sysinfo.h.
Bug: 17703902

Change-Id: I699d12d76a8fc483c919be730c2ac63641b71a1d
2014-11-14 16:22:48 -08:00