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

Unified Diff: src/trusted/desc/nacl_desc_io.c

Issue 12929033: Add NaClDescIoDescMakeFromHandle (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: add error checks Created 7 years, 9 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/trusted/desc/nacl_desc_io.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/desc/nacl_desc_io.c
diff --git a/src/trusted/desc/nacl_desc_io.c b/src/trusted/desc/nacl_desc_io.c
index 610232e4889a4258c3499671298d67e5c38c63fb..25b016ee9f7ac12c10896ef60f022a4834153258 100644
--- a/src/trusted/desc/nacl_desc_io.c
+++ b/src/trusted/desc/nacl_desc_io.c
@@ -90,6 +90,25 @@ struct NaClDescIoDesc *NaClDescIoDescMake(struct NaClHostDesc *nhdp) {
return ndp;
}
+struct NaClDesc *NaClDescIoDescMakeFromHandle(NaClHandle handle) {
+ int posix_d;
+ struct NaClHostDesc *nhdp;
+ struct NaClDescIoDesc *desc;
+
+#if NACL_WINDOWS
+ posix_d = _open_osfhandle((intptr_t) handle, _O_RDWR | _O_BINARY);
+ if (-1 == posix_d)
+ return NULL;
+#else
+ posix_d = handle;
+#endif
+ nhdp = NaClHostDescPosixMake(posix_d, NACL_ABI_O_RDWR);
+ if (NULL == nhdp)
+ return NULL;
+ desc = NaClDescIoDescMake(nhdp);
+ return &desc->base;
+}
+
struct NaClDescIoDesc *NaClDescIoDescOpen(char *path,
int mode,
int perms) {
« no previous file with comments | « src/trusted/desc/nacl_desc_io.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698