mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-21 10:00:30 +00:00
Perform some code cleanup
This commit is contained in:
parent
992a4638ae
commit
72f8bd10b7
8 changed files with 55 additions and 265 deletions
|
@ -16,9 +16,10 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/log/libfatal.internal.h"
|
||||
#include "libc/runtime/memtrack.internal.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
|
||||
privileged void PrintSystemMappings(int outfd) {
|
||||
|
@ -26,12 +27,12 @@ privileged void PrintSystemMappings(int outfd) {
|
|||
ssize_t rc;
|
||||
char buf[64];
|
||||
if (!IsWindows()) {
|
||||
if ((infd = __sysv_open("/proc/self/maps", O_RDONLY, 0)) >= 0) {
|
||||
__sysv_write(outfd, "\n", 1);
|
||||
while ((rc = __sysv_read(infd, buf, sizeof(buf))) > 0) {
|
||||
__sysv_write(outfd, buf, rc);
|
||||
if ((infd = __sys_openat(AT_FDCWD, "/proc/self/maps", O_RDONLY, 0)) >= 0) {
|
||||
sys_write(outfd, "\n", 1);
|
||||
while ((rc = sys_read(infd, buf, sizeof(buf))) > 0) {
|
||||
sys_write(outfd, buf, rc);
|
||||
}
|
||||
}
|
||||
__sysv_close(infd);
|
||||
sys_close(infd);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue