paul@181 | 1 | /* |
paul@181 | 2 | * Base types used by various other types. |
paul@181 | 3 | * |
paul@181 | 4 | * Copyright (C) 2019, 2021 Paul Boddie <paul@boddie.org.uk> |
paul@181 | 5 | * |
paul@181 | 6 | * This program is free software; you can redistribute it and/or |
paul@181 | 7 | * modify it under the terms of the GNU General Public License as |
paul@181 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@181 | 9 | * the License, or (at your option) any later version. |
paul@181 | 10 | * |
paul@181 | 11 | * This program is distributed in the hope that it will be useful, |
paul@181 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@181 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@181 | 14 | * GNU General Public License for more details. |
paul@181 | 15 | * |
paul@181 | 16 | * You should have received a copy of the GNU General Public License |
paul@181 | 17 | * along with this program; if not, write to the Free Software |
paul@181 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@181 | 19 | * Boston, MA 02110-1301, USA |
paul@181 | 20 | */ |
paul@181 | 21 | |
paul@181 | 22 | #pragma once |
paul@181 | 23 | |
paul@181 | 24 | #include <l4/sys/compiler.h> |
paul@181 | 25 | |
paul@181 | 26 | #include <systypes/factory.h> |
paul@181 | 27 | |
paul@181 | 28 | EXTERN_C_BEGIN |
paul@181 | 29 | |
paul@181 | 30 | /* unsigned long is a 64-bit type. |
paul@181 | 31 | See: pkg/l4re-core/l4sys/include/l4int.h */ |
paul@181 | 32 | |
paul@181 | 33 | /* Types for file access (access flags, offsets) and IPC operations. */ |
paul@181 | 34 | |
paul@181 | 35 | typedef unsigned long flags_t; |
paul@181 | 36 | typedef unsigned long offset_t; |
paul@181 | 37 | typedef l4_addr_t address_t; /* unsigned long */ |
paul@181 | 38 | |
paul@181 | 39 | /* Dataspace mapping flags. |
paul@181 | 40 | See: pkg/l4re-core/l4re_c/include/dataspace.h */ |
paul@181 | 41 | |
paul@181 | 42 | typedef unsigned long map_flags_t; /* 64-bit */ |
paul@181 | 43 | |
paul@181 | 44 | /* Types and values for notification. */ |
paul@181 | 45 | |
paul@181 | 46 | typedef unsigned long notify_flags_t; |
paul@181 | 47 | |
paul@181 | 48 | enum notify_flags |
paul@181 | 49 | { |
paul@181 | 50 | NOTIFY_CONTENT_AVAILABLE = 1, |
paul@181 | 51 | NOTIFY_SPACE_AVAILABLE = 2, |
paul@181 | 52 | NOTIFY_PEER_CLOSED = 4 |
paul@181 | 53 | }; |
paul@181 | 54 | |
paul@181 | 55 | /* Filesystem object properties. */ |
paul@181 | 56 | |
paul@181 | 57 | typedef unsigned long object_flags_t; |
paul@181 | 58 | |
paul@181 | 59 | enum object_flags |
paul@181 | 60 | { |
paul@181 | 61 | OBJECT_SUPPORTS_MMAP = 1, |
paul@181 | 62 | OBJECT_HAS_SIZE = 2 |
paul@181 | 63 | }; |
paul@181 | 64 | |
paul@181 | 65 | /* Equivalent types are defined in sys/types.h typically. In newlib, they are |
paul@181 | 66 | defined in sys/_types.h if not defined elsewhere (such as in |
paul@181 | 67 | machine/_types.h). */ |
paul@181 | 68 | |
paul@181 | 69 | typedef unsigned long long sys_dev_t; /* device number */ |
paul@181 | 70 | typedef unsigned long sys_ino_t; /* inode number */ |
paul@181 | 71 | typedef unsigned int sys_mode_t; /* file permissions */ |
paul@181 | 72 | typedef unsigned int sys_nlink_t; /* link count */ |
paul@181 | 73 | typedef unsigned int sys_uid_t; /* user identifier */ |
paul@181 | 74 | typedef unsigned int sys_gid_t; /* group identifier */ |
paul@181 | 75 | typedef long sys_off_t; /* file offset/position */ |
paul@181 | 76 | typedef long sys_blksize_t; /* input/output block size */ |
paul@181 | 77 | typedef long sys_blkcnt_t; /* number of 512-byte blocks */ |
paul@181 | 78 | |
paul@181 | 79 | /* Factory types for L4 factory interface invocations. */ |
paul@181 | 80 | |
paul@181 | 81 | ipc_varg_typedef(sys_mode_t, ipc_varg_sys_mode_t) |
paul@181 | 82 | ipc_varg_typedef(sys_uid_t, ipc_varg_sys_uid_t) |
paul@181 | 83 | ipc_varg_typedef(sys_gid_t, ipc_varg_sys_gid_t) |
paul@181 | 84 | |
paul@181 | 85 | #define ipc_varg_sys_mode(value) \ |
paul@181 | 86 | ipc_varg_umword(ipc_varg_sys_mode_t, value) |
paul@181 | 87 | |
paul@181 | 88 | #define ipc_varg_sys_uid(value) \ |
paul@181 | 89 | ipc_varg_umword(ipc_varg_sys_uid_t, value) |
paul@181 | 90 | |
paul@181 | 91 | #define ipc_varg_sys_gid(value) \ |
paul@181 | 92 | ipc_varg_umword(ipc_varg_sys_gid_t, value) |
paul@181 | 93 | |
paul@181 | 94 | EXTERN_C_END |
paul@181 | 95 | |
paul@181 | 96 | // vim: tabstop=2 expandtab shiftwidth=2 |