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

Side by Side Diff: src/trusted/service_runtime/nacl_resource.h

Issue 8825007: Native Client side changes for debugging support: stdout/err -> postmessage. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_RESOURCE_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_SERVICE_RUNTIME_NACL_RESOURCE_H_
9
10 #include "native_client/src/include/nacl_base.h"
11
12 EXTERN_C_BEGIN
13
14 /*
15 * Pseudo device name for NACL_EXE_STD{OUT,ERR}.
16 */
17 #define NACL_RESOURCE_DEBUG_WARNING "DEBUG_ONLY:"
18 #define NACL_RESOURCE_FILE_PREFIX "file:"
19 #define NACL_RESOURCE_DEV_PREFIX "dev:"
20 #define NACL_RESOURCE_DEV_POSTMESSAGE_LOCATOR "//postmessage"
21 #define NACL_RESOURCE_DEV_POSTMESSAGE \
22 NACL_RESOURCE_DEV_PREFIX NACL_RESOURCE_DEV_POSTMESSAGE_LOCATOR
23
24 struct NaClResource;
25
26 struct NaClResourceSchemes {
27 char const *scheme_prefix;
28 int default_scheme;
29 /*
30 * |default_scheme| is a bool. If no scheme prefixes match, try
31 * Open with this. There should be only one default scheme per
32 * scheme_table.
33 */
34
35 /*
36 * The reason to separate out these functions is to make resource
37 * namespace separation clearer. Files, which requires --no-sandbox
38 * to disable the outer sandbox, allow arbitrary paths for logging
39 * untrusted code output; pseudo-devices (for postmessage) is
40 * (currently) a namespace of one entry.
41 *
42 * |nacl_flags| should be NACL_ABI_ versions of |flags| and should
43 * be consistent. This is typically determined at compile time, but
44 * the utility NaClHostDescMapOpenFlags can be used to convert
45 * nacl_flags values to flags values.
46 *
47 * |mode| should be file access mode (if file, if O_CREAT, if appropriate).
48 */
49 struct NaClDesc *(*Open)(struct NaClResource *resource,
50 char const *resource_specifier_rest,
51 int nacl_flags,
52 int mode /* 0777 etc */,
53 int allow_debug /* bool */
54 );
55 };
56
57
58 struct NaClResource {
59 /*
60 * no vtbl with virtual dtor, since (for now) only object creator
61 * should dtor/delete, and there are no other virtual functions
62 * needed.
63 */
64 struct NaClResourceSchemes const *schemes;
65 size_t num_schemes;
66 };
67
68 /*
69 * NaCLResourceOpen handles NACL_RESOURCE_DEBUG_WARNING_PREFIX checks
70 * (and stripping), NACL_RESOURCE_{FILE,DEV}_PREFIX dispatch.
71 *
72 * This function does not take a descriptor number to directly modify
73 * the descriptor array and require the caller to invoke NaClSetDesc,
74 * since the API allows other uses of the returned NaClDesc object
75 * than just for redirection.
76 */
77 struct NaClDesc *NaClResourceOpen(struct NaClResource *self,
78 char const *resource_locator,
79 int nacl_flags,
80 int mode);
81
82 /*
83 * Subclasses can expand on the NaClResource base class, e.g., add
84 * startup phase information so that the Open functions can get the
85 * NaClApp pointer, etc. The sole base class member function,
86 * NaClResourceOpen, is unaware of startup phases and relies on the
87 * scheme table's Open function to do the right thing.
88 */
89 struct NaClResourceNaClApp {
90 struct NaClResource base;
91 struct NaClApp *nap;
92 };
93
94 int NaClResourceNaClAppCtor(struct NaClResourceNaClApp *self,
95 struct NaClResourceSchemes const *scheme_tbl,
96 size_t num_schemes,
97 struct NaClApp *nap);
98
99 /*
100 * Invoke Ctor with standard resource schemes.
101 */
102 int NaClResourceNaClAppInit(struct NaClResourceNaClApp *self,
103 struct NaClApp *nap);
104
105 EXTERN_C_END
106
107 #endif
OLDNEW
« no previous file with comments | « src/trusted/service_runtime/nacl_desc_postmessage.c ('k') | src/trusted/service_runtime/nacl_resource.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698