L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
vfs.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 * License: see LICENSE.spdx (in this directory or the directories above)
7 */
8#pragma once
9
10#include <l4/sys/compiler.h>
11
12#include <unistd.h>
13#include <stdarg.h>
14#include <fcntl.h>
15#include <sys/stat.h>
16#include <sys/time.h>
17#include <sys/mman.h>
18#include <sys/socket.h>
19#include <utime.h>
20#include <errno.h>
21
22#ifndef AT_FDCWD
23# define AT_FDCWD -100
24#endif
25
26#ifdef __cplusplus
27
28#include <l4/sys/capability>
29#include <l4/re/cap_alloc>
30#include <l4/re/dataspace>
31#include <l4/cxx/pair>
32#include <l4/cxx/ref_ptr>
33
34namespace L4Re {
38namespace Vfs {
39
40class Mount_tree;
41class File;
42
53{
54public:
60 enum Ready_type : unsigned
61 {
62 Read = 0,
63 Write,
64 Exception
65 };
66
67 virtual ~Generic_file() noexcept = 0;
68
80 virtual int unlock_all_locks() noexcept = 0;
81
90 virtual int fstat(struct stat64 *buf) const noexcept = 0;
91
97 virtual int fchmod(mode_t) noexcept = 0;
98
108 virtual int get_status_flags() const noexcept = 0;
109
125 virtual int set_status_flags(long flags) noexcept = 0;
126
127 virtual int utime(const struct utimbuf *) noexcept = 0;
128 virtual int utimes(const struct timeval [2]) noexcept = 0;
129 virtual ssize_t readlink(char *, size_t) = 0;
130
146 virtual bool check_ready(Ready_type rt) noexcept = 0;
147};
148
149inline
150Generic_file::~Generic_file() noexcept
151{}
152
161{
162public:
163 virtual ~Directory() noexcept = 0;
164
178 virtual int faccessat(const char *path, int mode, int flags) noexcept = 0;
179
192 virtual int mkdir(const char *path, mode_t mode) noexcept = 0;
193
204 virtual int unlink(const char *path) noexcept = 0;
205
219 virtual int rename(const char *src_path, const char *dst_path) noexcept = 0;
220
234 virtual int link(const char *src_path, const char *dst_path) noexcept = 0;
235
248 virtual int symlink(const char *src_path, const char *dst_path) noexcept = 0;
249
260 virtual int rmdir(const char *path) noexcept = 0;
261 virtual int openat(const char *path, int flags, mode_t mode,
262 cxx::Ref_ptr<File> *f) noexcept = 0;
263
264 virtual ssize_t getdents(char *buf, size_t sizebytes) noexcept = 0;
265
266 virtual int fchmodat(const char *pathname,
267 mode_t mode, int flags) noexcept = 0;
268
269 virtual int utimensat(const char *pathname,
270 const struct timespec times[2], int flags) noexcept = 0;
271
275 virtual int get_entry(const char *, int, mode_t, cxx::Ref_ptr<File> *) noexcept = 0;
276};
277
278inline
279Directory::~Directory() noexcept
280{}
281
288{
289public:
290 virtual ~Regular_file() noexcept = 0;
291
302 virtual L4::Cap<L4Re::Dataspace> data_space() noexcept = 0;
303
313 virtual ssize_t readv(const struct iovec*, int iovcnt) noexcept = 0;
314
325 virtual ssize_t writev(const struct iovec*, int iovcnt) noexcept = 0;
326
327 virtual ssize_t preadv(const struct iovec *iov, int iovcnt, off64_t offset) noexcept = 0;
328 virtual ssize_t pwritev(const struct iovec *iov, int iovcnt, off64_t offset) noexcept = 0;
329
337 virtual off64_t lseek(off64_t, int) noexcept = 0;
338
339
347 virtual int ftruncate(off64_t pos) noexcept = 0;
348
354 virtual int fsync() const noexcept = 0;
355
361 virtual int fdatasync() const noexcept = 0;
362
372 virtual int get_lock(struct flock64 *lock) noexcept = 0;
373
382 virtual int set_lock(struct flock64 *lock, bool wait) noexcept = 0;
383};
384
385inline
386Regular_file::~Regular_file() noexcept
387{}
388
389class Socket
390{
391public:
392 virtual ~Socket() noexcept = 0;
393 virtual int bind(sockaddr const *, socklen_t) noexcept = 0;
394 virtual int connect(sockaddr const *, socklen_t) noexcept = 0;
395 virtual ssize_t send(void const *, size_t, int) noexcept = 0;
396 virtual ssize_t recv(void *, size_t, int) noexcept = 0;
397 virtual ssize_t sendto(void const *, size_t, int, sockaddr const *, socklen_t) noexcept = 0;
398 virtual ssize_t recvfrom(void *, size_t, int, sockaddr *, socklen_t *) noexcept = 0;
399 virtual ssize_t sendmsg(msghdr const *, int) noexcept = 0;
400 virtual ssize_t recvmsg(msghdr *, int) noexcept = 0;
401 virtual int getsockopt(int level, int opt, void *, socklen_t *) noexcept = 0;
402 virtual int setsockopt(int level, int opt, void const *, socklen_t) noexcept = 0;
403 virtual int listen(int) noexcept = 0;
404 virtual int accept(sockaddr *addr, socklen_t *) noexcept = 0;
405 virtual int shutdown(int) noexcept = 0;
406
407 virtual int getsockname(sockaddr *, socklen_t *) noexcept = 0;
408 virtual int getpeername(sockaddr *, socklen_t *) noexcept = 0;
409};
410
411inline
412Socket::~Socket() noexcept
413{}
414
421{
422public:
423 virtual ~Special_file() noexcept = 0;
424
435 virtual int ioctl(unsigned long cmd, va_list args) noexcept = 0;
436};
437
438inline
439Special_file::~Special_file() noexcept
440{}
441
455class File :
456 public Generic_file,
457 public Regular_file,
458 public Directory,
459 public Special_file,
460 public Socket
461{
462 friend class Mount_tree;
463
464private:
465 void operator = (File const &);
466
467protected:
468 File() noexcept : _ref_cnt(0) {}
469 File(File const &)
470 : Generic_file(),Regular_file(), Directory(), Special_file(), _ref_cnt(0)
471 {}
472
473public:
474
475 const char *get_mount(const char *path, cxx::Ref_ptr<File> *dir,
476 cxx::Ref_ptr<Mount_tree> *mt = 0) noexcept;
477
478 int openat(const char *path, int flags, mode_t mode,
479 cxx::Ref_ptr<File> *f) noexcept override;
480
481 void add_ref() noexcept { ++_ref_cnt; }
482 int remove_ref() noexcept { return --_ref_cnt; }
483
484 virtual ~File() noexcept = 0;
485
486 cxx::Ref_ptr<Mount_tree> mount_tree() const noexcept
487 { return _mount_tree; }
488
489 char const *path() const noexcept { return _path; }
490
491private:
492 int _ref_cnt;
493 cxx::Ref_ptr<Mount_tree> _mount_tree;
494 char _path[80] = "";
495};
496
497inline
498File::~File() noexcept
499{}
500
501class Path
502{
503private:
504 char const *_p;
505 unsigned _l;
506
507public:
508 Path() noexcept : _p(0), _l(0) {}
509
510 explicit Path(char const *p) noexcept : _p(p)
511 { for (_l = 0; *p; ++p, ++_l) ; }
512
513 Path(char const *p, unsigned l) noexcept : _p(p), _l(l)
514 {}
515
516 static bool __is_sep(char s) noexcept;
517
518 Path cmp_path(char const *prefix) const noexcept;
519
520 struct Invalid_ptr;
521 operator Invalid_ptr const * () const
522 { return reinterpret_cast<Invalid_ptr const *>(_p); }
523
524 unsigned length() const { return _l; }
525 char const *path() const { return _p; }
526
527 bool empty() const { return _l == 0; }
528
529 bool is_sep(unsigned offset) const { return __is_sep(_p[offset]); }
530
531 bool strip_sep()
532 {
533 bool s = false;
534 for (; __is_sep(*_p) && _l; ++_p, --_l)
535 s = true;
536 return s;
537 }
538
539 Path first() const
540 {
541 unsigned i;
542 for (i = 0; i < _l && !is_sep(i); ++i)
543 ;
544
545 return Path(_p, i);
546 }
547
548 Path strip_first()
549 {
550 Path r = first();
551 _p += r.length();
552 _l -= r.length();
553 strip_sep();
554 return r;
555 }
556
557};
558
559
566class Mount_tree
567{
568public:
569
570 explicit Mount_tree(char *n) noexcept;
571
572 Path lookup(Path const &path, cxx::Ref_ptr<Mount_tree> *mt,
573 cxx::Ref_ptr<Mount_tree> *mp = 0) noexcept;
574
575 Path find(Path const &p, cxx::Ref_ptr<Mount_tree> *t) noexcept;
576
577 cxx::Ref_ptr<File> mount() const
578 { return _mount; }
579
580 void mount(cxx::Ref_ptr<File> const &m)
581 {
582 m->_mount_tree = cxx::ref_ptr(this);
583 _mount = m;
584 }
585
586 static int create_tree(cxx::Ref_ptr<Mount_tree> const &root,
587 char const *path,
588 cxx::Ref_ptr<File> const &dir) noexcept;
589
590 void add_child_node(cxx::Ref_ptr<Mount_tree> const &cld);
591
592 virtual ~Mount_tree() noexcept = 0;
593 void operator delete (void *) {}
594
595 void add_ref() noexcept { ++_ref_cnt; }
596 int remove_ref() noexcept { return --_ref_cnt; }
597
598private:
599 friend class Real_mount_tree;
600
601 int _ref_cnt;
602 char *_name;
603 cxx::Ref_ptr<Mount_tree> _cld;
604 cxx::Ref_ptr<Mount_tree> _sib;
605 cxx::Ref_ptr<File> _mount;
606};
607
608inline
609Mount_tree::~Mount_tree() noexcept
610{}
611
612inline bool
613Path::__is_sep(char s) noexcept
614{ return s == '/'; }
615
616inline Path
617Path::cmp_path(char const *n) const noexcept
618{
619 char const *p = _p;
620 for (; *p && !__is_sep(*p) && *n; ++p, ++n)
621 if (*p != *n)
622 return Path();
623
624 if (*n || (*p && !__is_sep(*p)))
625 return Path();
626
627 return Path(p, _l - (p - _p));
628}
629
630inline
631Mount_tree::Mount_tree(char *n) noexcept
632: _ref_cnt(0), _name(n)
633{}
634
635inline Path
636Mount_tree::find(Path const &p, cxx::Ref_ptr<Mount_tree> *t) noexcept
637{
638 if (!_cld)
639 return Path();
640
641 for (cxx::Ref_ptr<Mount_tree> x = _cld; x; x = x->_sib)
642 {
643 Path const r = p.cmp_path(x->_name);
644 if (r)
645 {
646 *t = x;
647 return r;
648 }
649 }
650
651 return Path();
652}
653
654inline Path
655Mount_tree::lookup(Path const &path, cxx::Ref_ptr<Mount_tree> *mt,
656 cxx::Ref_ptr<Mount_tree> *mp) noexcept
657{
658 cxx::Ref_ptr<Mount_tree> x(this);
659 Path p = path;
660
661 if (p.first().cmp_path("."))
662 p.strip_first();
663
664 Path last_mp = p;
665
666 if (mp)
667 *mp = x;;
668
669 while (1)
670 {
671 Path r = x->find(p, &x);
672
673 if (!r)
674 {
675 if (mp)
676 return last_mp;
677
678 if (mt)
679 *mt = x;
680
681 return p;
682 }
683
684 r.strip_sep();
685
686 if (mp && x->_mount)
687 {
688 last_mp = r;
689 *mp = x;
690 }
691
692 if (r.empty())
693 {
694 if (mt)
695 *mt = x;
696
697 if (mp)
698 return last_mp;
699 else
700 return r;
701 }
702
703 p = r;
704 }
705}
706
707inline
708void
709Mount_tree::add_child_node(cxx::Ref_ptr<Mount_tree> const &cld)
710{
711 cld->_sib = _cld;
712 _cld = cld;
713}
714
715inline
716const char *
717File::get_mount(const char *path, cxx::Ref_ptr<File> *dir,
718 cxx::Ref_ptr<Mount_tree> *mt) noexcept
719{
720 if (!_mount_tree)
721 {
722 *dir = cxx::ref_ptr(this);
723 return path;
724 }
725
726 cxx::Ref_ptr<Mount_tree> mp;
727 Path p = _mount_tree->lookup(Path(path), mt, &mp);
728 if (mp->mount())
729 {
730 *dir = mp->mount();
731 return p.path();
732 }
733 else
734 {
735 *dir = cxx::ref_ptr(this);
736 return path;
737 }
738}
739
740inline int
741File::openat(const char *path, int flags, mode_t mode,
742 cxx::Ref_ptr<File> *f) noexcept
743{
744 cxx::Ref_ptr<File> dir;
745 cxx::Ref_ptr<Mount_tree> mt;
746 char const *m_path = get_mount(path, &dir, &mt);
747
748 int res = dir->get_entry(m_path, flags, mode, f);
749
750 if (res < 0)
751 return res;
752
753 if (!(*f)->_mount_tree && mt)
754 (*f)->_mount_tree = mt;
755
756 // Debugging {
757 size_t i = 0;
758 for (; i < sizeof((*f)->_path) - 1 && path[i]; ++i)
759 (*f)->_path[i] = path[i];
760 (*f)->_path[i] = '\0';
761 // } Debugging
762
763 return res;
764}
765
774class Mman
775{
776public:
778 virtual int mmap2(void *start, size_t len, int prot, int flags, int fd,
779 off_t offset, void **ptr) noexcept = 0;
780
782 virtual int munmap(void *start, size_t len) noexcept = 0;
783
785 virtual int mprotect(const void *a, size_t sz, int prot) noexcept = 0;
786
788 virtual int msync(void *addr, size_t len, int flags) noexcept = 0;
789
791 virtual int madvise(void *addr, size_t len, int advice) noexcept = 0;
792
793 virtual ~Mman() noexcept = 0;
794};
795
796inline
797Mman::~Mman() noexcept {}
798
799class File_factory
800{
801private:
802 int _ref_cnt = 0;
803 int _proto = 0;
804 char const *_proto_name = 0;
805
806 template<typename T> friend struct cxx::Default_ref_counter;
807 void add_ref() noexcept { ++_ref_cnt; }
808 int remove_ref() noexcept { return --_ref_cnt; }
809
810public:
811 explicit File_factory(int proto) : _proto(proto) {}
812 explicit File_factory(char const *proto_name) : _proto_name(proto_name) {}
813 File_factory(int proto, char const *proto_name)
814 : _proto(proto), _proto_name(proto_name)
815 {}
816
817 File_factory(File_factory const &) = delete;
818 File_factory &operator = (File_factory const &) = delete;
819
820 char const *proto_name() const { return _proto_name; }
821 int proto() const { return _proto; }
822
823 virtual ~File_factory() noexcept = 0;
824 virtual cxx::Ref_ptr<File> create(L4::Cap<void> file) = 0;
825};
826
827inline File_factory::~File_factory() noexcept {}
828
829template<typename IFACE, typename IMPL>
830class File_factory_t : public File_factory
831{
832public:
833 File_factory_t()
834 : File_factory(IFACE::Protocol, L4::kobject_typeid<IFACE>()->name())
835 {}
836
837 cxx::Ref_ptr<File> create(L4::Cap<void> file) override
838 { return cxx::make_ref_obj<IMPL>(L4::cap_cast<IFACE>(file)); }
839};
840
854class File_system
855{
856protected:
857 File_system *_next;
858
859public:
860 File_system() noexcept : _next(0) {}
866 virtual char const *type() const noexcept = 0;
867
884 virtual int mount(char const *source, unsigned long mountflags,
885 void const *data, cxx::Ref_ptr<File> *dir) noexcept = 0;
886
887 virtual ~File_system() noexcept = 0;
888
893 File_system *next() const noexcept { return _next; }
894 File_system *&next() noexcept { return _next; }
895 void next(File_system *n) noexcept { _next = n; }
896};
897
898inline
899File_system::~File_system() noexcept
900{}
901
902class File_system_list
903{
904public:
905 class Iterator
906 {
907 public:
908 explicit constexpr Iterator(File_system *c = nullptr) : _c(c) {}
909
910 Iterator &operator++()
911 {
912 if (_c)
913 _c = _c->next();
914 return *this;
915 }
916
917 bool operator==(Iterator const &other) const { return _c == other._c; }
918 bool operator!=(Iterator const &other) const { return _c != other._c; }
919 File_system *operator*() const { return _c; }
920 File_system *operator->() const { return _c; }
921
922 private:
923 File_system *_c;
924 };
925
926 File_system_list(File_system *head) : _head(head) {}
927
928 constexpr Iterator begin() const
929 { return Iterator(_head); }
930
931 constexpr Iterator end() const
932 { return Iterator(); }
933
934private:
935 File_system *_head;
936};
937
943class Fs
944{
945public:
951 virtual cxx::Ref_ptr<File> get_file(int fd) noexcept = 0;
952
954 virtual cxx::Ref_ptr<File> get_root() noexcept = 0;
955
957 virtual cxx::Ref_ptr<File> get_cwd() noexcept { return get_root(); }
958
960 virtual void set_cwd(cxx::Ref_ptr<File> const &) noexcept {}
961
967 virtual int alloc_fd(cxx::Ref_ptr<File> const &f = cxx::Ref_ptr<>::Nil) noexcept = 0;
968
979 virtual cxx::Pair<cxx::Ref_ptr<File>, int>
980 set_fd(int fd, cxx::Ref_ptr<File> const &f = cxx::Ref_ptr<>::Nil) noexcept = 0;
981
987 virtual cxx::Ref_ptr<File> free_fd(int fd) noexcept = 0;
988
996 virtual int mount(char const *path, cxx::Ref_ptr<File> const &dir) noexcept = 0;
997
1005 virtual int register_file_system(File_system *f) noexcept = 0;
1006
1014 virtual int unregister_file_system(File_system *f) noexcept = 0;
1015
1023 virtual File_system *get_file_system(char const *fstype) noexcept = 0;
1024
1033 virtual File_system_list file_system_list() noexcept = 0;
1034
1038 int mount(char const *source, char const *target,
1039 char const *fstype, unsigned long mountflags,
1040 void const *data) noexcept;
1041
1042 virtual int register_file_factory(cxx::Ref_ptr<File_factory> f) noexcept = 0;
1043 virtual int unregister_file_factory(cxx::Ref_ptr<File_factory> f) noexcept = 0;
1044 virtual cxx::Ref_ptr<File_factory> get_file_factory(int proto) noexcept = 0;
1045 virtual cxx::Ref_ptr<File_factory> get_file_factory(char const *proto_name) noexcept = 0;
1046
1047 virtual ~Fs() = 0;
1048
1049private:
1050 int mount_one(char const *source, char const *target,
1051 File_system *fs, unsigned long mountflags,
1052 void const *data) noexcept;
1053};
1054
1055inline int
1056Fs::mount_one(char const *source, char const *target,
1057 File_system *fs, unsigned long mountflags,
1058 void const *data) noexcept
1059{
1061 int res = fs->mount(source, mountflags, data, &dir);
1062
1063 if (res < 0)
1064 return res;
1065
1066 return mount(target, dir);
1067}
1068
1069inline int
1070Fs::mount(char const *source, char const *target,
1071 char const *fstype, unsigned long mountflags,
1072 void const *data) noexcept
1073{
1074 if ( fstype[0] == 'a'
1075 && fstype[1] == 'u'
1076 && fstype[2] == 't'
1077 && fstype[3] == 'o'
1078 && fstype[4] == 0)
1079 {
1080 File_system_list fsl = file_system_list();
1081 for (File_system_list::Iterator c = fsl.begin(); c != fsl.end(); ++c)
1082 if (mount_one(source, target, *c, mountflags, data) == 0)
1083 return 0;
1084
1085 return -ENODEV;
1086 }
1087
1088 File_system *fs = get_file_system(fstype);
1089
1090 if (!fs)
1091 return -ENODEV;
1092
1093 return mount_one(source, target, fs, mountflags, data);
1094}
1095
1096inline
1097Fs::~Fs()
1098{}
1099
1106class Ops : public Mman, public Fs
1107{
1108public:
1109 virtual void *malloc(size_t bytes) noexcept = 0;
1110 virtual void free(void *mem) noexcept = 0;
1111 virtual ~Ops() noexcept = 0;
1112
1113 char *strndup(char const *str, unsigned l) noexcept
1114 {
1115 unsigned len;
1116 for (len = 0; str[len] && len < l; ++len)
1117 ;
1118
1119 if (len == 0)
1120 return nullptr;
1121
1122 ++len;
1123
1124 char *b = static_cast<char *>(this->malloc(len));
1125 if (b == nullptr)
1126 return nullptr;
1127
1128 char *r = b;
1129 for (; len - 1 > 0 && *str; --len, ++b, ++str)
1130 *b = *str;
1131
1132 *b = 0;
1133 return r;
1134 }
1135
1136};
1137
1138inline
1139Ops::~Ops() noexcept
1140{}
1141
1142}}
1143
1144#endif
1145
Abstract capability-allocator interface.
L4::Cap related definitions.
Interface for a POSIX file that is a directory.
Definition vfs.h:161
virtual int mkdir(const char *path, mode_t mode) noexcept=0
Create a new subdirectory.
virtual int link(const char *src_path, const char *dst_path) noexcept=0
Create a hard link (second name) for the given file.
virtual int unlink(const char *path) noexcept=0
Unlink the given file from that directory.
virtual int symlink(const char *src_path, const char *dst_path) noexcept=0
Create a symbolic link for the given file.
virtual int rmdir(const char *path) noexcept=0
Delete an empty directory.
virtual int rename(const char *src_path, const char *dst_path) noexcept=0
Rename the given file.
virtual int faccessat(const char *path, int mode, int flags) noexcept=0
Check access permissions on the given file.
Basic interface for an L4Re::Vfs file system.
Definition vfs.h:855
virtual char const * type() const noexcept=0
Returns the type of the file system used in mount as fstype argument.
virtual int mount(char const *source, unsigned long mountflags, void const *data, cxx::Ref_ptr< File > *dir) noexcept=0
Create a directory object dir representing source mounted with this file system.
The basic interface for an open POSIX file.
Definition vfs.h:461
POSIX File-system related functionality.
Definition vfs.h:944
virtual void set_cwd(cxx::Ref_ptr< File > const &) noexcept
Set the current working directory for the application.
Definition vfs.h:960
virtual int mount(char const *path, cxx::Ref_ptr< File > const &dir) noexcept=0
Mount a given file object at the given global path in the VFS.
virtual cxx::Ref_ptr< File > get_file(int fd) noexcept=0
Get the L4Re::Vfs::File for the file descriptor fd.
virtual cxx::Ref_ptr< File > free_fd(int fd) noexcept=0
Free the file descriptor fd.
virtual cxx::Pair< cxx::Ref_ptr< File >, int > set_fd(int fd, cxx::Ref_ptr< File > const &f=cxx::Ref_ptr<>::Nil) noexcept=0
Set the file object referenced by the file descriptor fd.
virtual int alloc_fd(cxx::Ref_ptr< File > const &f=cxx::Ref_ptr<>::Nil) noexcept=0
Allocate the next free file descriptor.
virtual cxx::Ref_ptr< File > get_root() noexcept=0
Get the directory object for the application's root directory.
virtual cxx::Ref_ptr< File > get_cwd() noexcept
Get the directory object for the application's current working directory.
Definition vfs.h:957
The common interface for an open POSIX file.
Definition vfs.h:53
virtual int unlock_all_locks() noexcept=0
Unlock all locks on the file.
virtual int fchmod(mode_t) noexcept=0
Change POSIX access rights on the file.
virtual int fstat(struct stat64 *buf) const noexcept=0
Get status information for the file.
virtual int set_status_flags(long flags) noexcept=0
Set file status flags (fcntl F_SETFL).
Ready_type
Type of I/O operation/condition a file can indicate readiness.
Definition vfs.h:61
virtual bool check_ready(Ready_type rt) noexcept=0
Check whether the file is ready for an I/O operation/condition.
virtual int get_status_flags() const noexcept=0
Get file status flags (fcntl F_GETFL).
Interface for POSIX memory management.
Definition vfs.h:775
virtual int mmap2(void *start, size_t len, int prot, int flags, int fd, off_t offset, void **ptr) noexcept=0
Backend for the mmap2 system call.
virtual int msync(void *addr, size_t len, int flags) noexcept=0
Backend for the msync system call.
virtual int munmap(void *start, size_t len) noexcept=0
Backend for the munmap system call.
virtual int madvise(void *addr, size_t len, int advice) noexcept=0
Backend for the madvice system call.
virtual int mprotect(const void *a, size_t sz, int prot) noexcept=0
Backend for the mprotect system call.
Interface for the POSIX backends of an application.
Definition vfs.h:1107
Interface for a POSIX file that provides regular file semantics.
Definition vfs.h:288
virtual ssize_t writev(const struct iovec *, int iovcnt) noexcept=0
Write one or more blocks of data to the file.
virtual L4::Cap< L4Re::Dataspace > data_space() noexcept=0
Get an L4Re::Dataspace object for the file.
virtual ssize_t readv(const struct iovec *, int iovcnt) noexcept=0
Read one or more blocks of data from the file.
virtual int fdatasync() const noexcept=0
Sync the data to persistent storage.
virtual int fsync() const noexcept=0
Sync the data and meta data to persistent storage.
virtual off64_t lseek(off64_t, int) noexcept=0
Change the file pointer.
virtual int get_lock(struct flock64 *lock) noexcept=0
Test if the given lock can be placed in the file.
virtual int ftruncate(off64_t pos) noexcept=0
Truncate the file at the given position.
virtual int set_lock(struct flock64 *lock, bool wait) noexcept=0
Acquire or release the given lock on the file.
Interface for a POSIX file that provides special file semantics.
Definition vfs.h:421
virtual int ioctl(unsigned long cmd, va_list args) noexcept=0
The famous IO control.
C++ interface for capabilities.
Definition capability.h:249
A reference-counting pointer with automatic cleanup.
Definition ref_ptr:71
L4 compiler related defines.
Dataspace interface.
Type_info const * kobject_typeid() noexcept
Get the L4::Type_info for the L4Re interface given in T.
Definition __typeinfo.h:682
Virtual file system for interfaces in POSIX libc.
Definition backend:16
L4Re C++ Interfaces.
Definition cmd_control:14
Cap< T > cap_cast(Cap< F > const &c) noexcept
static_cast for capabilities.
Definition capability.h:437
Our C++ library.
Definition arith:11
Pair implementation.
Pair of two values.
Definition pair:28