OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * be found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 | 7 #include <errno.h> |
8 /* | |
9 * Stub routine for `getppid' for porting support. | |
10 */ | |
11 | |
12 #include <sys/types.h> | 8 #include <sys/types.h> |
13 #include <unistd.h> | 9 #include <unistd.h> |
14 #include <errno.h> | 10 |
| 11 #include "native_client/src/untrusted/nacl/nacl_irt.h" |
15 | 12 |
16 pid_t getppid(void) { | 13 pid_t getppid(void) { |
17 errno = ENOSYS; | 14 if (!__libnacl_irt_init_fn(&__libnacl_irt_dev_process.getppid, |
18 return -1; | 15 __libnacl_irt_dev_process_init)) { |
| 16 return -1; |
| 17 } |
| 18 |
| 19 pid_t ppid; |
| 20 int error = __libnacl_irt_dev_process.getppid(&ppid); |
| 21 if (error) { |
| 22 errno = error; |
| 23 return -1; |
| 24 } |
| 25 |
| 26 return ppid; |
19 } | 27 } |
OLD | NEW |