This is an archive of the discontinued LLVM Phabricator instance.

Use kern.proc.auxv to get the aux data
ClosedPublic

Authored by jhibbits on Oct 31 2014, 5:50 PM.

Details

Summary

Instead of using a homegrown solution to get the auxv from a process, instead
use the OS-provided sysctl to get the needed data. This allows the same code to
be used for both 32-bit and 64-bit processes on a 64-bit host.

Diff Detail

Repository
rL LLVM

Event Timeline

jhibbits updated this revision to Diff 15662.Oct 31 2014, 5:50 PM
jhibbits retitled this revision from to Use kern.proc.auxv to get the aux data.
jhibbits updated this object.
jhibbits edited the test plan for this revision. (Show Details)
jhibbits added a reviewer: emaste.
jhibbits added a subscriber: Unknown Object (MLST).
emaste edited edge metadata.Oct 31 2014, 7:33 PM

LGTM assuming the tests pass. I suspect it was written before the sysctl was readily available, but it should now be available on releases of interest.

jhibbits updated this revision to Diff 15671.Nov 1 2014, 1:42 PM
jhibbits edited edge metadata.

Don't read to the stack, then copy to the heap. Instead, read directly to the heap, to a properly sized buffer.

emaste accepted this revision.Nov 1 2014, 2:32 PM
emaste edited edge metadata.
emaste added inline comments.
source/Host/freebsd/Host.cpp
293 ↗(On Diff #15671)

space after *

This revision is now accepted and ready to land.Nov 1 2014, 2:32 PM
jhibbits closed this revision.Nov 1 2014, 2:38 PM
jhibbits updated this revision to Diff 15672.

Closed by commit rL221063 (authored by @jhibbits).