L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
ro_file.h
1/*
2 * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
5 *
6 * This file is part of TUD:OS and distributed under the terms of the
7 * GNU General Public License 2.
8 * Please see the COPYING-GPL-2 file for details.
9 *
10 * As a special exception, you may use this file as part of a free software
11 * library without restriction. Specifically, if other files instantiate
12 * templates or use macros or inline functions from this file, or you compile
13 * this file and link it with other files to produce an executable, this
14 * file does not by itself cause the resulting executable to be covered by
15 * the GNU General Public License. This exception does not however
16 * invalidate any other reasons why the executable file might be covered by
17 * the GNU General Public License.
18 */
19#pragma once
20
21#include <l4/l4re_vfs/backend>
22
23namespace L4Re { namespace Core {
24
25class Ro_file : public L4Re::Vfs::Be_file_pos
26{
27private:
29 off64_t _size;
30 char const *_addr;
31
32public:
33 explicit Ro_file(L4::Cap<L4Re::Dataspace> ds) noexcept
34 : Be_file_pos(), _ds(ds), _addr(0)
35 {
36 _size = _ds->size();
37 }
38
39 L4::Cap<L4Re::Dataspace> data_space() const noexcept override { return _ds; }
40
41 int fstat64(struct stat64 *buf) const noexcept override;
42
43 int ioctl(unsigned long, va_list) noexcept override;
44
45 off64_t size() const noexcept override { return _size; }
46
47 int get_status_flags() const noexcept override
48 { return O_RDONLY; }
49
50 int set_status_flags(long) noexcept override
51 { return 0; }
52
53 ~Ro_file() noexcept;
54
55private:
56 ssize_t read_single(const struct iovec*, off64_t) noexcept;
57 ssize_t preadv(const struct iovec *, int, off64_t) noexcept override;
58 ssize_t pwritev(const struct iovec *, int , off64_t) noexcept override;
59};
60
61
62}}
C++ interface for capabilities.
Definition capability.h:222
L4Re C++ Interfaces.
Definition cmd_control:15