int32_t NaClSysGetdents(struct NaClAppThread *natp,
int d,
- void *dirp,
+ uint32_t dirp,
size_t count) {
struct NaClApp *nap = natp->nap;
int32_t retval = -NACL_ABI_EINVAL;
NaClLog(3,
("Entered NaClSysGetdents(0x%08"NACL_PRIxPTR", "
- "%d, 0x%08"NACL_PRIxPTR", "
+ "%d, 0x%08"NACL_PRIx32", "
"%"NACL_PRIuS"[0x%"NACL_PRIxS"])\n"),
- (uintptr_t) natp, d, (uintptr_t) dirp, count, count);
+ (uintptr_t) natp, d, dirp, count, count);
ndp = NaClAppGetDesc(nap, d);
if (NULL == ndp) {
* |count| is arbitrary and we wouldn't want to have to allocate
* memory in trusted address space to match.
*/
- sysaddr = NaClUserToSysAddrRange(nap, (uintptr_t) dirp, count);
+ sysaddr = NaClUserToSysAddrRange(nap, dirp, count);
if (kNaClBadAddress == sysaddr) {
NaClLog(4, " illegal address for directory data\n");
retval = -NACL_ABI_EFAULT;
int32_t NaClSysRead(struct NaClAppThread *natp,
int d,
- void *buf,
- size_t count) {
+ uint32_t buf,
+ uint32_t count) {
struct NaClApp *nap = natp->nap;
int32_t retval = -NACL_ABI_EINVAL;
ssize_t read_result = -NACL_ABI_EINVAL;
NaClLog(3,
("Entered NaClSysRead(0x%08"NACL_PRIxPTR", "
- "%d, 0x%08"NACL_PRIxPTR", "
- "%"NACL_PRIuS"[0x%"NACL_PRIxS"])\n"),
- (uintptr_t) natp, d, (uintptr_t) buf, count, count);
+ "%d, 0x%08"NACL_PRIx32", "
+ "%"NACL_PRIu32"[0x%"NACL_PRIx32"])\n"),
+ (uintptr_t) natp, d, buf, count, count);
ndp = NaClAppGetDesc(nap, d);
if (NULL == ndp) {
goto cleanup;
}
- sysaddr = NaClUserToSysAddrRange(nap, (uintptr_t) buf, count);
+ sysaddr = NaClUserToSysAddrRange(nap, buf, count);
if (kNaClBadAddress == sysaddr) {
NaClDescUnref(ndp);
retval = -NACL_ABI_EFAULT;
count = INT32_MAX;
}
- NaClVmIoWillStart(nap,
- (uint32_t) (uintptr_t) buf,
- (uint32_t) (((uintptr_t) buf) + count - 1));
+ NaClVmIoWillStart(nap, buf, buf + count - 1);
read_result = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
Read)(ndp, (void *) sysaddr, count);
- NaClVmIoHasEnded(nap,
- (uint32_t) (uintptr_t) buf,
- (uint32_t) (((uintptr_t) buf) + count - 1));
+ NaClVmIoHasEnded(nap, buf, buf + count - 1);
if (read_result > 0) {
NaClLog(4, "read returned %"NACL_PRIdS" bytes\n", read_result);
log_bytes = (size_t) read_result;
int32_t NaClSysWrite(struct NaClAppThread *natp,
int d,
- void *buf,
- size_t count) {
+ uint32_t buf,
+ uint32_t count) {
struct NaClApp *nap = natp->nap;
int32_t retval = -NACL_ABI_EINVAL;
ssize_t write_result = -NACL_ABI_EINVAL;
NaClLog(3,
"Entered NaClSysWrite(0x%08"NACL_PRIxPTR", "
- "%d, 0x%08"NACL_PRIxPTR", "
- "%"NACL_PRIuS"[0x%"NACL_PRIxS"])\n",
- (uintptr_t) natp, d, (uintptr_t) buf, count, count);
+ "%d, 0x%08"NACL_PRIx32", "
+ "%"NACL_PRIu32"[0x%"NACL_PRIx32"])\n",
+ (uintptr_t) natp, d, buf, count, count);
ndp = NaClAppGetDesc(nap, d);
NaClLog(4, " ndp = %"NACL_PRIxPTR"\n", (uintptr_t) ndp);
goto cleanup;
}
- sysaddr = NaClUserToSysAddrRange(nap, (uintptr_t) buf, count);
+ sysaddr = NaClUserToSysAddrRange(nap, buf, count);
if (kNaClBadAddress == sysaddr) {
NaClDescUnref(ndp);
retval = -NACL_ABI_EFAULT;
ellipsis = "...";
}
}
- NaClLog(8, "In NaClSysWrite(%d, %.*s%s, %"NACL_PRIuS")\n",
+ NaClLog(8, "In NaClSysWrite(%d, %.*s%s, %"NACL_PRIu32")\n",
d, (int) log_bytes, (char *) sysaddr, ellipsis, count);
/*
count = INT32_MAX;
}
- NaClVmIoWillStart(nap,
- (uint32_t) (uintptr_t) buf,
- (uint32_t) (((uintptr_t) buf) + count - 1));
+ NaClVmIoWillStart(nap, buf, buf + count - 1);
write_result = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
Write)(ndp, (void *) sysaddr, count);
- NaClVmIoHasEnded(nap,
- (uint32_t) (uintptr_t) buf,
- (uint32_t) (((uintptr_t) buf) + count - 1));
+ NaClVmIoHasEnded(nap, buf, buf + count - 1);
NaClDescUnref(ndp);
*/
int32_t NaClSysLseek(struct NaClAppThread *natp,
int d,
- nacl_abi_off_t *offp,
+ uint32_t offp,
int whence) {
struct NaClApp *nap = natp->nap;
nacl_abi_off_t offset;
NaClLog(3,
("Entered NaClSysLseek(0x%08"NACL_PRIxPTR", %d,"
- " 0x%08"NACL_PRIxPTR", %d)\n"),
- (uintptr_t) natp, d, (uintptr_t) offp, whence);
+ " 0x%08"NACL_PRIx32", %d)\n"),
+ (uintptr_t) natp, d, offp, whence);
ndp = NaClAppGetDesc(nap, d);
if (NULL == ndp) {
goto cleanup;
}
- if (!NaClCopyInFromUser(nap, &offset, (uintptr_t) offp, sizeof offset)) {
+ if (!NaClCopyInFromUser(nap, &offset, offp, sizeof offset)) {
retval = -NACL_ABI_EFAULT;
goto cleanup_unref;
}
- NaClLog(4, "offset 0x%08"NACL_PRIxNACL_OFF"\n", offset);
+ NaClLog(4, "offset 0x%08"NACL_PRIx64"\n", (uint64_t) offset);
retval64 = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
Seek)(ndp, (nacl_off64_t) offset, whence);
if (NaClOff64IsNegErrno(&retval64)) {
retval = (int32_t) retval64;
} else {
- if (NaClCopyOutToUser(nap, (uintptr_t) offp, &retval64, sizeof retval64)) {
+ if (NaClCopyOutToUser(nap, offp, &retval64, sizeof retval64)) {
retval = 0;
} else {
NaClLog(LOG_FATAL,
int32_t NaClSysFstat(struct NaClAppThread *natp,
int d,
- struct nacl_abi_stat *nasp) {
+ uint32_t nasp) {
struct NaClApp *nap = natp->nap;
int32_t retval = -NACL_ABI_EINVAL;
struct NaClDesc *ndp;
NaClLog(3,
("Entered NaClSysFstat(0x%08"NACL_PRIxPTR
- ", %d, 0x%08"NACL_PRIxPTR")\n"),
- (uintptr_t) natp,
- d, (uintptr_t) nasp);
-
- NaClLog(4,
- " sizeof(struct nacl_abi_stat) = %"NACL_PRIuS" (0x%"NACL_PRIxS")\n",
- sizeof *nasp, sizeof *nasp);
+ ", %d, 0x%08"NACL_PRIx32")\n"),
+ (uintptr_t) natp, d, nasp);
ndp = NaClAppGetDesc(nap, d);
if (NULL == ndp) {
retval = (*((struct NaClDescVtbl const *) ndp->base.vtbl)->
Fstat)(ndp, &result);
if (0 == retval) {
- if (!NaClCopyOutToUser(nap, (uintptr_t) nasp,
- &result, sizeof result)) {
+ if (!NaClCopyOutToUser(nap, nasp, &result, sizeof result)) {
retval = -NACL_ABI_EFAULT;
}
}