2 * Copyright 2008, Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * NaCl service runtime. NaClDescIoDesc subclass of NaClDesc.
35 #ifndef NATIVE_CLIENT_SERVICE_RUNTIME_NACL_DESC_IO_H_
36 #define NATIVE_CLIENT_SERVICE_RUNTIME_NACL_DESC_IO_H_
38 #include "native_client/include/portability.h"
40 #include "native_client/include/nacl_base.h"
45 struct NaClDescEffector
;
46 struct NaClDescIoDesc
;
47 struct NaClDescXferState
;
49 struct NaClMessageHeader
;
51 struct nacl_abi_timespec
;
53 int NaClDescIoDescCtor(struct NaClDescIoDesc
*self
,
54 struct NaClHostDesc
*hd
);
56 void NaClDescIoDescDtor(struct NaClDesc
*vself
);
58 struct NaClDescIoDesc
*NaClDescIoDescMake(struct NaClHostDesc
*nhdp
);
60 /* a simple factory */
61 struct NaClDescIoDesc
*NaClDescIoDescOpen(char *path
,
65 int NaClDescIoDescMap(struct NaClDesc
*vself
,
66 struct NaClDescEffector
*effp
,
73 int NaClDescIoDescUnmapUnsafe(struct NaClDesc
*vself
,
74 struct NaClDescEffector
*effp
,
78 int NaClDescIoDescUnmap(struct NaClDesc
*vself
,
79 struct NaClDescEffector
*effp
,
83 ssize_t
NaClDescIoDescRead(struct NaClDesc
*vself
,
84 struct NaClDescEffector
*effp
,
88 ssize_t
NaClDescIoDescWrite(struct NaClDesc
*vself
,
89 struct NaClDescEffector
*effp
,
93 int NaClDescIoDescSeek(struct NaClDesc
*vself
,
94 struct NaClDescEffector
*effp
,
98 int NaClDescIoDescIoctl(struct NaClDesc
*vself
,
99 struct NaClDescEffector
*effp
,
103 int NaClDescIoDescFstat(struct NaClDesc
*vself
,
104 struct NaClDescEffector
*effp
,
105 struct nacl_abi_stat
*statbuf
);
107 int NaClDescIoDescClose(struct NaClDesc
*vself
,
108 struct NaClDescEffector
*effp
);
110 int NaClDescIoDescExternalizeSize(struct NaClDesc
*vself
,
114 int NaClDescIoDescExternalize(struct NaClDesc
*vself
,
115 struct NaClDescXferState
*xfer
);