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