Include sys types h in linux

Include sys types h in linux

NAME

SYNOPSIS

DESCRIPTION

The  header shall include definitions for at least the following types: blkcnt_t Used for file block counts. blksize_t Used for block sizes. clock_t Used for system times in clock ticks or CLOCKS_PER_SEC; see . clockid_t Used for clock ID type in the clock and timer functions. dev_t Used for device IDs. fsblkcnt_t Used for file system block counts. fsfilcnt_t Used for file system file counts. gid_t Used for group IDs. id_t Used as a general identifier; can be used to contain at least a pid_t, uid_t, or gid_t. ino_t Used for file serial numbers. key_t Used for XSI interprocess communication. mode_t Used for some file attributes. nlink_t Used for link counts. off_t Used for file sizes. pid_t Used for process IDs and process group IDs. pthread_attr_t Used to identify a thread attribute object. pthread_barrier_t Used to identify a barrier. pthread_barrierattr_t Used to define a barrier attributes object. pthread_cond_t Used for condition variables. pthread_condattr_t Used to identify a condition attribute object. pthread_key_t Used for thread-specific data keys. pthread_mutex_t Used for mutexes. pthread_mutexattr_t Used to identify a mutex attribute object. pthread_once_t Used for dynamic package initialization. pthread_rwlock_t Used for read-write locks. pthread_rwlockattr_t Used for read-write lock attributes. pthread_spinlock_t Used to identify a spin lock. pthread_t Used to identify a thread. size_t Used for sizes of objects. ssize_t Used for a count of bytes or an error indication. suseconds_t Used for time in microseconds. time_t Used for time in seconds. timer_t Used for timer ID returned by timer_create(). trace_attr_t Used to identify a trace stream attributes object. trace_event_id_t Used to identify a trace event type. trace_event_set_t Used to identify a trace event type set. trace_id_t Used to identify a trace stream. uid_t Used for user IDs. useconds_t Used for time in microseconds. All of the types shall be defined as arithmetic types of an appropriate length, with the following exceptions: key_t pthread_attr_t pthread_barrier_t pthread_barrierattr_t pthread_cond_t pthread_condattr_t pthread_key_t pthread_mutex_t pthread_mutexattr_t pthread_once_t pthread_rwlock_t pthread_rwlockattr_t pthread_spinlock_t trace_attr_t trace_event_id_t trace_event_set_t trace_id_t Additionally: * mode_t shall be an integer type. * nlink_t, uid_t, gid_t, and id_t shall be integer types. * blkcnt_t and off_t shall be signed integer types. * fsblkcnt_t, fsfilcnt_t, and ino_t shall be defined as unsigned integer types. * size_t shall be an unsigned integer type. * blksize_t, pid_t, and ssize_t shall be signed integer types. * time_t and clock_t shall be integer or real-floating types. The type ssize_t shall be capable of storing values at least in the range [-1, ]. The type useconds_t shall be an unsigned integer type capable of storing values at least in the range [0, 1000000]. The type suseconds_t shall be a signed integer type capable of storing values at least in the range [-1, 1000000]. The implementation shall support one or more programming environments in which the widths of blksize_t, pid_t, size_t, ssize_t, suseconds_t, and useconds_t are no greater than the width of type long. The names of these programming environments can be obtained using the confstr() function or the getconf utility. There are no defined comparison or assignment operators for the following types: pthread_attr_t pthread_barrier_t pthread_barrierattr_t pthread_cond_t pthread_condattr_t pthread_mutex_t pthread_mutexattr_t pthread_rwlock_t pthread_rwlockattr_t pthread_spinlock_t trace_attr_t The following sections are informative. 

APPLICATION USAGE

RATIONALE

FUTURE DIRECTIONS

SEE ALSO

 , the System Interfaces volume of IEEE Std 1003.1-2001, confstr(), the Shell and Utilities volume of IEEE Std 1003.1-2001, getconf 

Источник

Include sys types h in linux

The data types defined in < sys/types.h >are as follows:

32-bit Solaris

The data types listed below are defined in < sys/types.h >for 32-bit Solaris.

typedef struct < int r[1]; >*physadr; typedef long clock_t; typedef long daddr_t; typedef char * caddr_t; typedef unsigned char unchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong_t; typedef unsigned long ino_t; typedef long uid_t; typedef long gid_t; typedef ulong_t nlink_t; typedef ulong_t mode_t; typedef short cnt_t; typedef long time_t; typedef int label_t[10]; typedef ulong_t dev_t; typedef long off_t; typedef long pid_t; typedef long paddr_t; typedef int key_t; typedef unsigned char use_t; typedef short sysid_t; typedef short index_t; typedef short lock_t; typedef unsigned int size_t; typedef long clock_t; typedef long pid_t;

64-bit Solaris

The data types listed below are defined in < sys/types.h >for 64-bit Solaris.

typedef long blkcnt_t typedef long clock_t typedef long daddr_t typedef ulong_t dev_t typedef ulong_t fsblkcnt_t typedef ulong_t fsfilcnt_t typedef int gid_t typedef int id_t typedef long ino_t typedef int key_t typedef uint_t major_t typedef uint_t minor_t typedef uint_t mode_t typedef uint_t nlink_t typedef int pid_t typedef ptrdiff_t intptr_t typedef ulong_t rlim_t typedef ulong_t size_t typedef uint_t speed_t typedef long ssize_t typedef long suseconds_t typedef uint_t tcflag_t typedef long time_t typedef int uid_t typedef int wchar_t

Preprocessor Symbols

For 32-bit programs, pointers and the C data types int and long are all 32-bit quantities. For 64-bit programs, pointers and the C data type long are defined as 64-bit quantities.

The preprocessor symbol _ILP32 , made visible by the inclusion of < sys/types.h >, can be used with the preprocessor #ifdef construct to define sections of code that will be compiled only as part of a 32-bit version of a given C program.

The preprocessor symbol _LP64 can be used in the same way to define sections of code that will be compiled only as part of a 64-bit version of a given C program. See EXAMPLES.

This header incorporates definitions of other preprocessor symbols that can be useful when keeping code portable between different instruction set architectures.

_LITTLE_ENDIAN
_BIG_ENDIAN The natural byte order of the processor. A pointer to an int points to the least/most significant byte of that int .

_STACK_GROWS_UPWARD
_STACK_GROWS_DOWNWARD The processor specific direction of stack growth. A push onto the stack increases/decreases the stack pointer, so it stores data at successively higher/lower addresses.

_CHAR_IS_UNSIGNED
_CHAR_IS_SIGNED The C Compiler implements objects of type char as unsigned or signed respectively. This is really an implementation choice of the compiler, but it is specified in the ABI and tends to be uniform across compilers for an instruction set architecture.

_CHAR_ALIGNMENT
_SHORT_ALIGNMENT
_INT_ALIGNMENT
_LONG_ALIGNMENT
_LONG_LONG_ALIGNMENT
_DOUBLE_ALIGNMENT
_LONG_DOUBLE_ALIGNMENT
_POINTER_ALIGNMENT
_FLOAT_ALIGNMENT The ABI defines alignment requirements of each of the primitive object types. Some, if not all, might be hardware requirements as well. The values are expressed in bytes.

_MAX_ALIGNMENT The most stringent alignment requirement as specified by the ABI. Equal to the maximum of all the above _ XXX _ ALIGNMENT values.

_LONG_LONG_ALIGNMENT_32 The 32-bit ABI supported by a 64-bit kernel may have different alignment requirements for primitive object types. The value of this identifier is expressed in bytes.

USAGE

The daddr_t type is used for disk addresses except in an inode on disk. Times are encoded in seconds since 00:00:00 UTC, January 1, 1970. The major and minor parts of a device code specify kind and unit number of a device and are installation-dependent. Offsets are measured in bytes from the beginning of a file.

The label_t[] types are used to save the processor state while another process is running.

EXAMPLES

Example 1 Use of preprocessor symbol _LP64 .

In the following example, the preprocessor symbol _LP64 defines sections of code that will be compiled only as part of a 64-bit version of the given C program.

#include sys/types.h> . #ifdef _LP64 printf("The data model is LP64 in this environment\n"); #else #ifdef _ILP32 printf("The data model is ILP32 in this environment\n"); #else #error "Unknown data model!" #endif #endif

ATTRIBUTES

See attributes (5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
Interface StabilityStable

Источник

Where is sys/types.h located?

I just found out that the and headers are located in the /usr/include folder in Ubuntu server, but I don’t find sys/types.h . And I start to suspect the compiler won’t actually use the header file in the /usr/include folder. Is this true, and where is the file located?

5 Answers 5

My Debian box (and hopefully Ubuntu haven’t butchered it too much in their zeal) has it in /usr/include/sys/types.h .

Your best bet is to execute:

find /usr/include -name types.h find / -name types.h # if not found by one above 

However, keep in mind that the development stuff may not even be installed on a server. Unless it’s a server for a compiler farm, it wouldn’t surprise me if the compiler and a bunch of other stuff was not part of the default install.

If the compiler is locating it somewhere and you just don’t know where, you can use something like:

echo "#include " | gcc -E -x c - | grep /types.h 

to find out where it’s getting it from.

  • stops after the pre-processing phase ( -E );
  • forces the file to be treated as C source code ( -x c ); and
  • retrieves the program from standard input ( — ), in this case from the echo statement.

The final grep just strips out the unimportant lines leaving the ones that are likely to contain the location of the included file.

Источник

Читайте также:  Linux compile cpp files
Оцените статью
Adblock
detector