Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: src/untrusted/nacl/stubs/getppid.c

Issue 24908002: Provide IRT process interface Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/untrusted/nacl/sigprocmask.c ('k') | src/untrusted/nacl/stubs/kill.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/untrusted/nacl/sigprocmask.c ('k') | src/untrusted/nacl/stubs/kill.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698