userland: make build perfect

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 8618025682
commit 1d766fe3d7
16 changed files with 49 additions and 47 deletions

View File

@@ -9,7 +9,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <userland/common.h> /* virt_to_phys_user */
#include <lkmc/pagemap.h> /* lkmc_pagemap_virt_to_phys_user */
int main(int argc, char **argv) {
char buffer[BUFSIZ];
@@ -89,10 +89,10 @@ int main(int argc, char **argv) {
}
/* Get info about all pages in this page range with pagemap. */
{
PagemapEntry entry;
LkmcPagemapEntry entry;
for (uintptr_t vaddr = low; vaddr < high; vaddr += sysconf(_SC_PAGE_SIZE)) {
/* TODO always fails for the last page (vsyscall), why? pread returns 0. */
if (!pagemap_get_entry(&entry, pagemap_fd, vaddr)) {
if (!lkmc_pagemap_get_entry(&entry, pagemap_fd, vaddr)) {
printf(
"%jx %jx %u %u %u %u %s\n",
(uintmax_t)vaddr,

View File

@@ -4,7 +4,7 @@
#include <stdio.h> /* printf */
#include <stdlib.h> /* EXIT_SUCCESS, EXIT_FAILURE, strtoull */
#include <userland/common.h> /* virt_to_phys_user */
#include <lkmc/pagemap.h> /* lkmc_pagemap_virt_to_phys_user */
int main(int argc, char **argv) {
pid_t pid;
@@ -16,8 +16,8 @@ int main(int argc, char **argv) {
}
pid = strtoull(argv[1], NULL, 0);
vaddr = strtoull(argv[2], NULL, 0);
if (virt_to_phys_user(&paddr, pid, vaddr)) {
fprintf(stderr, "error: virt_to_phys_user\n");
if (lkmc_pagemap_virt_to_phys_user(&paddr, pid, vaddr)) {
fprintf(stderr, "error: lkmc_pagemap_virt_to_phys_user\n");
return EXIT_FAILURE;
};
printf("0x%jx\n", (uintmax_t)paddr);