summaryrefslogtreecommitdiffstats
path: root/sys/sys/_types.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC 307756: Define max_align_t for C11.jhb2016-11-281-0/+5
| | | | | | | | | | | libc++'s stddef.h includes an existing definition of max_align_t for C++11, but it is only defined for C++, not for C. In addition, GCC and clang both define an alternate version of max_align_t that uses a union of multiple types rather than a plain long double as in libc++. This adds a __max_align_t to <sys/_types.h> that matches the GCC and clang definition that is mapped to max_align_t in <stddef.h>. PR: 210890
* Pollute more places with off64_t and add __off64_tcem2016-05-121-0/+1
| | | | | | | | | | | Despite the private namespace, several broken ports depend on the __off64_t name for the type. Export it exactly the same way off_t and __off_t are exported. A follow-up to r299456. Suggested by: php56 Sponsored by: EMC / Isilon Storage Division
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.jhibbits2016-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544
* Convert rman to use rman_res_t instead of u_longjhibbits2016-01-271-0/+2
| | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075
* Change the type of blksize_t from uint32_t to a POSIX compliant int32_tkevlo2015-01-041-1/+1
| | | | http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
* Change the cap_rights_t type from uint64_t to a structure that we can extendpjd2013-09-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the future in a backward compatible (API and ABI) way. The cap_rights_t represents capability rights. We used to use one bit to represent one right, but we are running out of spare bits. Currently the new structure provides place for 114 rights (so 50 more than the previous cap_rights_t), but it is possible to grow the structure to hold at least 285 rights, although we can make it even larger if 285 rights won't be enough. The structure definition looks like this: struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; }; The initial CAP_RIGHTS_VERSION is 0. The top two bits in the first element of the cr_rights[] array contain total number of elements in the array - 2. This means if those two bits are equal to 0, we have 2 array elements. The top two bits in all remaining array elements should be 0. The next five bits in all array elements contain array index. Only one bit is used and bit position in this five-bits range defines array index. This means there can be at most five array elements in the future. To define new right the CAPRIGHT() macro must be used. The macro takes two arguments - an array index and a bit to set, eg. #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL) We still support aliases that combine few rights, but the rights have to belong to the same array element, eg: #define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL) #define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP) There is new API to manage the new cap_rights_t structure: cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); Capability rights to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions are provided by separating them with commas, eg: cap_rights_t rights; cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT); There is no need to terminate the list of rights, as those functions are actually macros that take care of the termination, eg: #define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...); Thanks to using one bit as an array index we can assert in those functions that there are no two rights belonging to different array elements provided together. For example this is illegal and will be detected, because CAP_LOOKUP belongs to element 0 and CAP_PDKILL to element 1: cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL); Providing several rights that belongs to the same array's element this way is correct, but is not advised. It should only be used for aliases definition. This commit also breaks compatibility with some existing Capsicum system calls, but I see no other way to do that. This should be fine as Capsicum is still experimental and this change is not going to 9.x. Sponsored by: The FreeBSD Foundation
* Fix <uchar.h> in for C++11.ed2013-05-251-0/+5
| | | | | | | | | | | It turns out that in C++11, char16_t and char32_t are built-in types; language keywords. Just fix this by putting traditional _*_T_DECLARED blocks around the definitions. We'll just predefine these in <sys/_types.h>. This also opens up the possibility to define char16_t in other header files, if ever needed (e.g. if we would gain a <ctype.h> for char16_t/char32_t).
* Add <uchar.h>.ed2013-05-211-0/+6
| | | | | | | | | | | | The <uchar.h> header, part of C11, adds a small number of utility functions for 16/32-bit "universal" characters, which may or may not be UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight wrappers around wcrtomb() and mbrtowc(). While there, also add (non-yet-standard) _l functions, similar to the ones we already have for the other locale-dependent functions. Reviewed by: theraven
* Make the wchar_t type machine dependent.andrew2012-06-241-5/+4
| | | | | | | | | | | | | | This is required for ARM EABI. Section 7.1.1 of the Procedure Call for the ARM Architecture (AAPCS) defines wchar_t as either an unsigned int or an unsigned short with the former preferred. Because of this requirement we need to move the definition of __wchar_t to a machine dependent header. It also cleans up the macros defining the limits of wchar_t by defining __WCHAR_MIN and __WCHAR_MAX in the same machine dependent header then using them to define WCHAR_MIN and WCHAR_MAX respectively. Discussed with: bde
* Define cap_rights_t and DTYPE_CAPABILITY, which are required tojonathan2011-07-011-0/+1
| | | | | | implement Capsicum capabilities. Approved by: mentor (rwatson), re (bz)
* Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessarytrasz2008-10-281-0/+1
| | | | | | | to add more V* constants, and the variables changed by this patch were often being assigned to mode_t variables, which is 16 bit. Approved by: rwatson (mentor)
* Add cpuset, an api for thread to cpu binding and cpu resource groupingjeff2008-03-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | and assignment. - Add a reference to a struct cpuset in each thread that is inherited from the thread that created it. - Release the reference when the thread is destroyed. - Add prototypes for syscalls and macros for manipulating cpusets in sys/cpuset.h - Add syscalls to create, get, and set new numbered cpusets: cpuset(), cpuset_{get,set}id() - Add syscalls for getting and setting affinity masks for cpusets or individual threads: cpuid_{get,set}affinity() - Add types for the 'level' and 'which' parameters for the cpuset. This will permit expansion of the api to cover cpu masks for other objects identifiable with an id_t integer. For example, IRQs and Jails may be coming soon. - The root set 0 contains all valid cpus. All thread initially belong to cpuset 1. This permits migrating all threads off of certain cpus to reserve them for special applications. Sponsored by: Nokia Discussed with: arch, rwatson, brooks, davidxu, deischen Reviewed by: antoine
* Let kernel POSIX timer code and mqueue code to use integer as a resourcedavidxu2006-03-011-2/+2
| | | | | handle, the timer_t and mqd_t types will be a pointer which userland will define it.
* Bring in experimental kernel support for POSIX message queue.davidxu2005-11-261-0/+1
|
* - Declare mknod in stat.h (in addition to unistd.h), as per XSI.das2005-03-221-0/+2
| | | | | | - Use blksize_t and blkcnt_t in struct stat. - Hide non-standard fields in stat.h when !__BSD_VISIBLE. - Add restrict qualifiers in stat.h.
* Document why rlim_t needs to be a signed type.des2004-11-081-1/+3
| | | | | | Define RLIM_INFINITY as INT64_MAX instead of hand-rolling it. MFC after: 1 week
* Define __lwpid_t as an int32_t in <sys/_types.h> and define lwpid_tmarcel2004-06-191-0/+1
| | | | | as an __lwpid_t in <sys/types.h>. Retype td_tid from an int to a lwpid_t and change related definitions accordingly.
* Second half of the dev_t cleanup.phk2004-06-171-4/+1
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+1
| | | | Bump __FreeBSD_version accordingly.
* Fixed some style bugs:bde2004-06-141-8/+7
| | | | | | - the comments on the rune/wide char types were lost - struct cdev was bogusly forward declared - some comments were excessively indented.
* Add __fixpt_t to _types.h, and typedef __fixpt_t fixpt_t in types.h.das2004-06-131-0/+2
|
* Move details of dev_t (and udev_t) to <sys/_types.h>.mike2003-03-281-0/+11
|
* Share ino_t and nlink_t.mike2003-03-011-0/+2
|
* Add suseconds_t and useconds_t for storing microseconds.mike2002-12-221-0/+2
|
* Note that id_t can also hold a gid_t. Realign comments.mike2002-10-221-8/+8
|
* Add id_t, a new type capable of representing a pid_t or a uid_t. Movemike2002-10-211-0/+2
| | | | the definition of rlim_t to <sys/_types.h> so that it can be shared.
* Move details of key_t to <sys/_types.h>, so that it can be typedef'dmike2002-10-151-0/+1
| | | | in more than just <sys/types.h>.
* Move definition of nl_item type to <sys/_types.h>, so that it can bemike2002-09-181-0/+1
| | | | shared.
* Move intrmask_t to the kernel-only section of <sys/types.h>. Add somemike2002-08-251-1/+0
| | | | comments submitted by bde.
* o Fix namespace issues in <sys/mman.h>.mike2002-08-231-0/+1
| | | | | | | | o Move mode_t details from <sys/types.h> into <sys/_types.h>. o Add primitives for sharing the mode_t and off_t typedefs. o Add typedefs mode_t, off_t, and size_t to <sys/mman.h>. PR: 21644
* Move several MI types from <machine/_types.h> to <sys/_types.h>.mike2002-08-231-0/+42
| | | | | | | | | | | | | | | | These types are unlikely to ever become very MD. They include: clockid_t, ct_rune_t, fflags_t, intrmask_t, mbstate_t, off_t, pid_t, rune_t, socklen_t, timer_t, wchar_t, and wint_t. While moving them, make a few adjustments (submitted by bde): o __ct_rune_t needs to be precisely `int', not necessarily __int32_t, since the arg type of the ctype functions is int. o __rune_t, __wchar_t and __wint_t inherit this via a typedef of __ct_rune_t. o Some minor wording changes in the comment blocks for ct_rune_t and mbstate_t. Submitted by: bde (partially)
* o Merge <machine/ansi.h> and <machine/types.h> into a new headermike2002-08-211-6/+6
| | | | | | | | | | | | | | | | | | | | | called <machine/_types.h>. o <machine/ansi.h> will continue to live so it can define MD clock macros, which are only MD because of gratuitous differences between architectures. o Change all headers to make use of this. This mainly involves changing: #ifdef _BSD_FOO_T_ typedef _BSD_FOO_T_ foo_t; #undef _BSD_FOO_T_ #endif to: #ifndef _FOO_T_DECLARED typedef __foo_t foo_t; #define _FOO_T_DECLARED #endif Concept by: bde Reviewed by: jake, obrien
* Implement the <sys/statvfs.h> header. Related changes to <sys/types.h>wollman2002-06-141-0/+2
| | | | | are still awaiting a worldstone. Functions and their declarations to come later.
* Add sa_family_t type to <sys/_types.h> and typedefs to <netinet/in.h>mike2002-04-201-0/+1
| | | | | and <sys/socket.h>. Previously, sa_family_t was only typedef'd in <sys/socket.h>.
* o Implement <sys/_types.h>, a new header for storing types that aremike2002-04-011-0/+38
MI, not required to be a fixed size, and used in multiple headers. This will grow in time, as more things move here from <sys/types.h> and <machine/ansi.h>. o Add missing type definitions (uint16_t and uint32_t) to <arpa/inet.h> and <netinet/in.h>. o Reduce pollution in <sys/types.h> by using `#if _FOO_T_DECLARED' widgets to avoid including <sys/stdint.h>. o Add some missing type definitions to <unistd.h> and note the ones that still need to be added. o Make use of <sys/_types.h> primitives in <grp.h> and <sys/types.h>. Reviewed by: bde
OpenPOWER on IntegriCloud