| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 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 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 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| 11 #include "native_client/src/untrusted/nacl/nacl_irt.h" | 11 #include "native_client/src/untrusted/nacl/nacl_irt.h" |
| 12 | 12 |
| 13 int chdir(const char *path) { | 13 pid_t getsid(pid_t pid) { |
| 14 if (!__libnacl_irt_init_fn(&__libnacl_irt_dev_filename.chdir, | 14 if (!__libnacl_irt_init_fn(&__libnacl_irt_dev_process.getpgid, |
| 15 __libnacl_irt_dev_filename_init)) { | 15 __libnacl_irt_dev_process_init)) { |
| 16 return -1; | 16 return -1; |
| 17 } | 17 } |
| 18 | 18 |
| 19 int error = __libnacl_irt_dev_filename.chdir(path); | 19 pid_t sid; |
| 20 int error = __libnacl_irt_dev_process.getsid(pid, &sid); |
| 20 if (error) { | 21 if (error) { |
| 21 errno = error; | 22 errno = error; |
| 22 return -1; | 23 return -1; |
| 23 } | 24 } |
| 24 | 25 |
| 25 return 0; | 26 return sid; |
| 26 } | 27 } |
| OLD | NEW |