| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* | 7 /* |
| 8 * NaCl service run-time, non-platform specific system call helper routines. | 8 * NaCl service run-time, non-platform specific system call helper routines. |
| 9 */ | 9 */ |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 "npages 0x%"NACL_PRIxS"\n", | 283 "npages 0x%"NACL_PRIxS"\n", |
| 284 ent->page_num, ent->npages); | 284 ent->page_num, ent->npages); |
| 285 nap->break_addr = new_break; | 285 nap->break_addr = new_break; |
| 286 break_addr = new_break; | 286 break_addr = new_break; |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 | 290 |
| 291 | 291 |
| 292 cleanup: | 292 cleanup: |
| 293 (void) NaClMutexUnlock(&nap->mu); | 293 NaClXMutexUnlock(&nap->mu); |
| 294 cleanup_no_lock: | 294 cleanup_no_lock: |
| 295 NaClSysCommonThreadSyscallLeave(natp); | 295 NaClSysCommonThreadSyscallLeave(natp); |
| 296 | 296 |
| 297 /* | 297 /* |
| 298 * This cast is safe because the incoming value (new_break) cannot | 298 * This cast is safe because the incoming value (new_break) cannot |
| 299 * exceed the user address space--even though its type (uintptr_t) | 299 * exceed the user address space--even though its type (uintptr_t) |
| 300 * theoretically allows larger values. | 300 * theoretically allows larger values. |
| 301 */ | 301 */ |
| 302 rv = (int32_t) break_addr; | 302 rv = (int32_t) break_addr; |
| 303 | 303 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 391 |
| 392 NaClLog(1, "Exit syscall handler: %d\n", status); | 392 NaClLog(1, "Exit syscall handler: %d\n", status); |
| 393 NaClSysCommonThreadSyscallEnter(natp); | 393 NaClSysCommonThreadSyscallEnter(natp); |
| 394 | 394 |
| 395 nap = natp->nap; | 395 nap = natp->nap; |
| 396 NaClSyncQueueQuit(&nap->work_queue); | 396 NaClSyncQueueQuit(&nap->work_queue); |
| 397 | 397 |
| 398 NaClXMutexLock(&nap->mu); | 398 NaClXMutexLock(&nap->mu); |
| 399 nap->exit_status = status; | 399 nap->exit_status = status; |
| 400 nap->running = 0; | 400 nap->running = 0; |
| 401 NaClCondVarSignal(&nap->cv); | 401 NaClXCondVarSignal(&nap->cv); |
| 402 NaClXMutexUnlock(&nap->mu); | 402 NaClXMutexUnlock(&nap->mu); |
| 403 | 403 |
| 404 NaClSysCommonThreadSuicide(natp); | 404 NaClSysCommonThreadSuicide(natp); |
| 405 /* NOTREACHED */ | 405 /* NOTREACHED */ |
| 406 return -NACL_ABI_EINVAL; | 406 return -NACL_ABI_EINVAL; |
| 407 } | 407 } |
| 408 | 408 |
| 409 int32_t NaClCommonSysThreadExit(struct NaClAppThread *natp, | 409 int32_t NaClCommonSysThreadExit(struct NaClAppThread *natp, |
| 410 int32_t *stack_flag) { | 410 int32_t *stack_flag) { |
| 411 uintptr_t sys_stack_flag; | 411 uintptr_t sys_stack_flag; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (NULL == desc_obj_ptr) { | 484 if (NULL == desc_obj_ptr) { |
| 485 retval = -NACL_ABI_EBADF; | 485 retval = -NACL_ABI_EBADF; |
| 486 goto done; | 486 goto done; |
| 487 } | 487 } |
| 488 if (NACL_DESC_CONN_CAP != NACL_VTBL(NaClDesc, desc_obj_ptr)->typeTag && | 488 if (NACL_DESC_CONN_CAP != NACL_VTBL(NaClDesc, desc_obj_ptr)->typeTag && |
| 489 NACL_DESC_CONN_CAP_FD != NACL_VTBL(NaClDesc, desc_obj_ptr)->typeTag) { | 489 NACL_DESC_CONN_CAP_FD != NACL_VTBL(NaClDesc, desc_obj_ptr)->typeTag) { |
| 490 retval = -NACL_ABI_EINVAL; | 490 retval = -NACL_ABI_EINVAL; |
| 491 goto done; | 491 goto done; |
| 492 } | 492 } |
| 493 /* write */ | 493 /* write */ |
| 494 NaClMutexLock(&natp->nap->mu); | 494 NaClXMutexLock(&natp->nap->mu); |
| 495 NaClDescUnref(natp->nap->name_service_conn_cap); | 495 NaClDescUnref(natp->nap->name_service_conn_cap); |
| 496 natp->nap->name_service_conn_cap = desc_obj_ptr; | 496 natp->nap->name_service_conn_cap = desc_obj_ptr; |
| 497 NaClMutexUnlock(&natp->nap->mu); | 497 NaClXMutexUnlock(&natp->nap->mu); |
| 498 retval = 0; | 498 retval = 0; |
| 499 } | 499 } |
| 500 | 500 |
| 501 done: | 501 done: |
| 502 NaClSysCommonThreadSyscallLeave(natp); | 502 NaClSysCommonThreadSyscallLeave(natp); |
| 503 return retval; | 503 return retval; |
| 504 } | 504 } |
| 505 | 505 |
| 506 int32_t NaClCommonSysDup(struct NaClAppThread *natp, | 506 int32_t NaClCommonSysDup(struct NaClAppThread *natp, |
| 507 int oldfd) { | 507 int oldfd) { |
| (...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2726 retval = -NACL_ABI_EBADF; | 2726 retval = -NACL_ABI_EBADF; |
| 2727 goto cleanup; | 2727 goto cleanup; |
| 2728 } | 2728 } |
| 2729 | 2729 |
| 2730 retval = (*((struct NaClDescVtbl const *) desc->base.vtbl)->GetValue)(desc); | 2730 retval = (*((struct NaClDescVtbl const *) desc->base.vtbl)->GetValue)(desc); |
| 2731 NaClDescUnref(desc); | 2731 NaClDescUnref(desc); |
| 2732 cleanup: | 2732 cleanup: |
| 2733 NaClSysCommonThreadSyscallLeave(natp); | 2733 NaClSysCommonThreadSyscallLeave(natp); |
| 2734 return retval; | 2734 return retval; |
| 2735 } | 2735 } |
| OLD | NEW |