aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_types.h
Commit message (Collapse)AuthorAgeFilesLines
* Reduce namespace pollution from r349233Alan Somers2019-06-211-0/+1
| | | | | | | | | | | | | | Define __daddr_t in _types.h and use it in filio.h Reported by: ian, bde Reviewed by: ian, imp, cem MFC after: 2 weeks MFC-With: 349233 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D20715 Notes: svn path=/head/; revision=349280
* Do not include float interfaces when using libsa.Warner Losh2018-02-231-0/+2
| | | | | | | | | | We don't support float in the boot loaders, so don't include interfaces for float or double in systems headers. In addition, take the unusual step of spiking double and float to prevent any more accidental seepage. Notes: svn path=/head/; revision=329859
* Move __va_list and related defines to sys/sys/_types.hWarner Losh2018-02-121-0/+15
| | | | | | | | | | __va_list and related defines are identical in all the ARCH/include/_types.h files. Move them to sys/sys/_types.h Sponsored by: Netflix Notes: svn path=/head/; revision=329165
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326256
* Define a new __INO64 macro in <sys/_types.h>, to indicate the systemDimitry Andric2017-05-261-0/+7
| | | | | | | | | | uses 64-bit inode numbers. Programs can use this to avoid including <sys/param.h>, with its associated namespace pollution. Reviewed by: kib Notes: svn path=/head/; revision=318959
* Commit the 64-bit inode project.Konstantin Belousov2017-05-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the ino_t, dev_t, nlink_t types to 64-bit ints. Modify struct dirent layout to add d_off, increase the size of d_fileno to 64-bits, increase the size of d_namlen to 16-bits, and change the required alignment. Increase struct statfs f_mntfromname[] and f_mntonname[] array length MNAMELEN to 1024. ABI breakage is mitigated by providing compatibility using versioned symbols, ingenious use of the existing padding in structures, and by employing other tricks. Unfortunately, not everything can be fixed, especially outside the base system. For instance, third-party APIs which pass struct stat around are broken in backward and forward incompatible ways. Kinfo sysctl MIBs ABI is changed in backward-compatible way, but there is no general mechanism to handle other sysctl MIBS which return structures where the layout has changed. It was considered that the breakage is either in the management interfaces, where we usually allow ABI slip, or is not important. Struct xvnode changed layout, no compat shims are provided. For struct xtty, dev_t tty device member was reduced to uint32_t. It was decided that keeping ABI compat in this case is more useful than reporting 64-bit dev_t, for the sake of pstat. Update note: strictly follow the instructions in UPDATING. Build and install the new kernel with COMPAT_FREEBSD11 option enabled, then reboot, and only then install new world. Credits: The 64-bit inode project, also known as ino64, started life many years ago as a project by Gleb Kurtsou (gleb). Kirk McKusick (mckusick) then picked up and updated the patch, and acted as a flag-waver. Feedback, suggestions, and discussions were carried by Ed Maste (emaste), John Baldwin (jhb), Jilles Tjoelker (jilles), and Rick Macklem (rmacklem). Kris Moore (kris) performed an initial ports investigation followed by an exp-run by Antoine Brodin (antoine). Essential and all-embracing testing was done by Peter Holm (pho). The heavy lifting of coordinating all these efforts and bringing the project to completion were done by Konstantin Belousov (kib). Sponsored by: The FreeBSD Foundation (emaste, kib) Differential revision: https://reviews.freebsd.org/D10439 Notes: svn path=/head/; revision=318736
* Define max_align_t for C11.John Baldwin2016-10-211-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 Reviewed by: dim MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8194 Notes: svn path=/head/; revision=307756
* Pollute more places with off64_t and add __off64_tConrad Meyer2016-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 Notes: svn path=/head/; revision=299571
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.Justin Hibbits2016-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 Notes: svn path=/head/; revision=297000
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-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 Notes: svn path=/head/; revision=294883
* Change the type of blksize_t from uint32_t to a POSIX compliant int32_tKevin Lo2015-01-041-1/+1
| | | | | | | http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html Notes: svn path=/head/; revision=276660
* Change the cap_rights_t type from uint64_t to a structure that we can extendPawel Jakub Dawidek2013-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 Notes: svn path=/head/; revision=255219
* Fix <uchar.h> in for C++11.Ed Schouten2013-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). Notes: svn path=/head/; revision=250985
* Add <uchar.h>.Ed Schouten2013-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 Notes: svn path=/head/; revision=250883
* Make the wchar_t type machine dependent.Andrew Turner2012-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 Notes: svn path=/head/; revision=237517
* Define cap_rights_t and DTYPE_CAPABILITY, which are required toJonathan Anderson2011-07-011-0/+1
| | | | | | | | | implement Capsicum capabilities. Approved by: mentor (rwatson), re (bz) Notes: svn path=/head/; revision=223710
* Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessaryEdward Tomasz Napierala2008-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) Notes: svn path=/head/; revision=184413
* Add cpuset, an api for thread to cpu binding and cpu resource groupingJeff Roberson2008-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 Notes: svn path=/head/; revision=176730
* Let kernel POSIX timer code and mqueue code to use integer as a resourceDavid Xu2006-03-011-2/+2
| | | | | | | | handle, the timer_t and mqd_t types will be a pointer which userland will define it. Notes: svn path=/head/; revision=156134
* Bring in experimental kernel support for POSIX message queue.David Xu2005-11-261-0/+1
| | | | Notes: svn path=/head/; revision=152825
* - Declare mknod in stat.h (in addition to unistd.h), as per XSI.David Schultz2005-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. Notes: svn path=/head/; revision=143952
* Document why rlim_t needs to be a signed type.Dag-Erling Smørgrav2004-11-081-1/+3
| | | | | | | | | Define RLIM_INFINITY as INT64_MAX instead of hand-rolling it. MFC after: 1 week Notes: svn path=/head/; revision=137390
* Define __lwpid_t as an int32_t in <sys/_types.h> and define lwpid_tMarcel Moolenaar2004-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. Notes: svn path=/head/; revision=130735
* Second half of the dev_t cleanup.Poul-Henning Kamp2004-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. Notes: svn path=/head/; revision=130640
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-6/+1
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Fixed some style bugs:Bruce Evans2004-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. Notes: svn path=/head/; revision=130473
* Add __fixpt_t to _types.h, and typedef __fixpt_t fixpt_t in types.h.David Schultz2004-06-131-0/+2
| | | | Notes: svn path=/head/; revision=130434
* Move details of dev_t (and udev_t) to <sys/_types.h>.Mike Barcroft2003-03-281-0/+11
| | | | Notes: svn path=/head/; revision=112745
* Share ino_t and nlink_t.Mike Barcroft2003-03-011-0/+2
| | | | Notes: svn path=/head/; revision=111705
* Add suseconds_t and useconds_t for storing microseconds.Mike Barcroft2002-12-221-0/+2
| | | | Notes: svn path=/head/; revision=108190
* Note that id_t can also hold a gid_t. Realign comments.Mike Barcroft2002-10-221-8/+8
| | | | Notes: svn path=/head/; revision=105690
* Add id_t, a new type capable of representing a pid_t or a uid_t. MoveMike Barcroft2002-10-211-0/+2
| | | | | | | the definition of rlim_t to <sys/_types.h> so that it can be shared. Notes: svn path=/head/; revision=105650
* Move details of key_t to <sys/_types.h>, so that it can be typedef'dMike Barcroft2002-10-151-0/+1
| | | | | | | in more than just <sys/types.h>. Notes: svn path=/head/; revision=105142
* Move definition of nl_item type to <sys/_types.h>, so that it can beMike Barcroft2002-09-181-0/+1
| | | | | | | shared. Notes: svn path=/head/; revision=103521
* Move intrmask_t to the kernel-only section of <sys/types.h>. Add someMike Barcroft2002-08-251-1/+0
| | | | | | | comments submitted by bde. Notes: svn path=/head/; revision=102421
* o Fix namespace issues in <sys/mman.h>.Mike Barcroft2002-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 Notes: svn path=/head/; revision=102325
* Move several MI types from <machine/_types.h> to <sys/_types.h>.Mike Barcroft2002-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) Notes: svn path=/head/; revision=102315
* o Merge <machine/ansi.h> and <machine/types.h> into a new headerMike Barcroft2002-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 Notes: svn path=/head/; revision=102227
* Implement the <sys/statvfs.h> header. Related changes to <sys/types.h>Garrett Wollman2002-06-141-0/+2
| | | | | | | | are still awaiting a worldstone. Functions and their declarations to come later. Notes: svn path=/head/; revision=98232
* Add sa_family_t type to <sys/_types.h> and typedefs to <netinet/in.h>Mike Barcroft2002-04-201-0/+1
| | | | | | | | and <sys/socket.h>. Previously, sa_family_t was only typedef'd in <sys/socket.h>. Notes: svn path=/head/; revision=95099
* o Implement <sys/_types.h>, a new header for storing types that areMike Barcroft2002-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 Notes: svn path=/head/; revision=93514