| Index: src/untrusted/nacl/stubs/getppid.c
|
| diff --git a/src/untrusted/nacl/stubs/getppid.c b/src/untrusted/nacl/stubs/getppid.c
|
| index a4160b56b4264872546132796056fbad94df8257..ce6a982d603e6e2fe10d5db5e4dba22dc7b6edac 100644
|
| --- a/src/untrusted/nacl/stubs/getppid.c
|
| +++ b/src/untrusted/nacl/stubs/getppid.c
|
| @@ -1,19 +1,27 @@
|
| /*
|
| - * Copyright 2010 The Native Client Authors. All rights reserved.
|
| - * Use of this source code is governed by a BSD-style license that can
|
| - * be found in the LICENSE file.
|
| - */
|
| -
|
| -
|
| -/*
|
| - * Stub routine for `getppid' for porting support.
|
| + * Copyright (c) 2013 The Native Client Authors. All rights reserved.
|
| + * Use of this source code is governed by a BSD-style license that can be
|
| + * found in the LICENSE file.
|
| */
|
|
|
| +#include <errno.h>
|
| #include <sys/types.h>
|
| #include <unistd.h>
|
| -#include <errno.h>
|
| +
|
| +#include "native_client/src/untrusted/nacl/nacl_irt.h"
|
|
|
| pid_t getppid(void) {
|
| - errno = ENOSYS;
|
| - return -1;
|
| + if (!__libnacl_irt_init_fn(&__libnacl_irt_dev_process.getppid,
|
| + __libnacl_irt_dev_process_init)) {
|
| + return -1;
|
| + }
|
| +
|
| + pid_t ppid;
|
| + int error = __libnacl_irt_dev_process.getppid(&ppid);
|
| + if (error) {
|
| + errno = error;
|
| + return -1;
|
| + }
|
| +
|
| + return ppid;
|
| }
|
|
|