| OLD | NEW |
| (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 /* | |
| 8 * NaCl service runtime. Transferrable shared memory objects. | |
| 9 */ | |
| 10 #ifndef NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_LINUX_SYSV_SHM_H_ | |
| 11 #define NATIVE_CLIENT_SRC_TRUSTED_DESC_NACL_DESC_LINUX_SYSV_SHM_H_ | |
| 12 | |
| 13 #include "native_client/src/include/portability.h" | |
| 14 #include "native_client/src/include/nacl_base.h" | |
| 15 | |
| 16 #include "native_client/src/trusted/desc/nacl_desc_base.h" | |
| 17 | |
| 18 EXTERN_C_BEGIN | |
| 19 | |
| 20 struct NaClDescEffector; | |
| 21 struct NaClDescXferState; | |
| 22 struct NaClMessageHeader; | |
| 23 struct nacl_abi_stat; | |
| 24 | |
| 25 /* | |
| 26 * Since the SysV shared memory abstraction does not permit mapping in | |
| 27 * only a portion of the shared memory object (offset==0), the SysV | |
| 28 * shm objects have their own fstat object type. The user code should | |
| 29 * not encounter SysV shm objects normally and is unable to create any | |
| 30 * SysV shm objects; the only source of SysV shm objects is in the | |
| 31 * context of Pepper2d, and the Pepper2d library code should hide | |
| 32 * this implementation detail. | |
| 33 */ | |
| 34 extern struct NaClDescVtbl const kNaClDescSysvShmVtbl; | |
| 35 | |
| 36 /* | |
| 37 * SysV shared memory objects have weird semantics. There is no way | |
| 38 * for untrusted code to create one. These are normally imported -- | |
| 39 * from the GPU process when we are embedded in Chrome -- and the shm | |
| 40 * object is externally owned, and we do not have to worry about its | |
| 41 * lifetime. The normal Ctor is here primarily for completeness. | |
| 42 * Note, however, the following semantics: the process that Ctor'd the | |
| 43 * SysV shm object is the owner; the SysV shm object may be | |
| 44 * externalized (its ID sent) and internalized in another process; | |
| 45 * however, there is no sharing of ownership nor reference counting -- | |
| 46 * the receiving process can access the SysV shm object as long as it | |
| 47 * is live, but when the owner Dtors its object, the ID will get | |
| 48 * invalidated, and the receiving process's accesses will fail. The | |
| 49 * RMID only occurs in the Dtor of the owner, not in the processes | |
| 50 * that internalized the SysV shm object in a nrd xfer. | |
| 51 */ | |
| 52 struct NaClDescSysvShm { | |
| 53 struct NaClDesc base NACL_IS_REFCOUNT_SUBCLASS; | |
| 54 int id; | |
| 55 size_t size; | |
| 56 int rmid_in_dtor; | |
| 57 }; | |
| 58 | |
| 59 int NaClDescSysvShmInternalize(struct NaClDesc **baseptr, | |
| 60 struct NaClDescXferState *xfer, | |
| 61 struct NaClDescQuotaInterface *quota_interface) | |
| 62 NACL_WUR; | |
| 63 | |
| 64 | |
| 65 int NaClDescSysvShmImportCtor(struct NaClDescSysvShm *self, | |
| 66 int id, | |
| 67 nacl_off64_t size) NACL_WUR; | |
| 68 | |
| 69 int NaClDescSysvShmCtor(struct NaClDescSysvShm *self, | |
| 70 nacl_off64_t size) NACL_WUR; | |
| 71 | |
| 72 EXTERN_C_END | |
| 73 | |
| 74 #endif /* NATIVE_CLIENT_SRC_TRUSTED_DESC_LINUX_NACL_DESC_SYSV_SHM_H_ */ | |
| OLD | NEW |