Linux header file

Source: Internet
Author: User
Tags function prototype prototype definition semaphore

In different versions of the kernel source code, the location of the header file is different, for example, in

#include <asm/arch/regs-gpio.h>

#include <mach/regs-gpio.h>

Also Regs-gpio.h,<asm/arch/regs-gpio.h> is located in Arch/arm/include/asm in a relatively low version (e.g. 2.6.25), and mach/ Regs-gpio.h is located in Arch/arm/mach-s3c2410/include/mach, 2.6.30 version of the kernel is this structure, so, according to the different version of the kernel to modify the location of the header file ! I copy someone else's code, the compilation does not pass, there is no end to find the file phenomenon.

#include <linux/***.h> is looking for source files under Linux-2.6.29/include/linux.

#include <asm/***.h> is looking for source files under Linux-2.6.29/arch/arm/include/asm.

#include <mach/***.h> is looking for source files under Linux-2.6.29/arch/arm/mach-s3c2410/include/mach.

#include <plat/regs-adc.h> in Linux-2.6.31_tx2440a20100510\linux-2.6.31_tx2440a\arch\arm\plat-s3c\include\ Plat

#include <linux/module.h>//the most basic files, support dynamic add and unload modules. Hello World Driver wants this one file on it

#include <linux/fs.h>//contains definitions of file operations related structs, such as the famous struct file_operations

Contains the definition of struct inode, MINOR, major header file.

#include <linux/errno.h>//contains a macro definition of the return value so that the user program can output the error message with Perror.

#include <linux/types.h>//for some special types of definitions, such as dev_t, off_t, pid_t. Most of these types are unsigned int, which is changed through a series of TypeDef, Just for the convenience of reading.

#include <linux/cdev.h>//the definition of the character device structure Cdev and a series of operation functions. Contains the definitions of the CDEV structure and related functions.

#include <linux/wait.h>//Queue Related header file//kernel wait queue, it contains the spin lock header file

#include <linux/init.h>//initialization header file

#include <linux/kernel.h>//driver to write to the kernel, the kernel-related header file

#include <linux/slab.h>//contains definitions of Kcalloc, kzalloc memory allocation functions.

#include <linux/uaccess.h>//contains the function definitions for kernel access to user process memory addresses, such as Copy_to_user, Copy_from_user, and so on.

#include <linux/device.h>//contains definitions of device, class, and other structures

#include <linux/io.h>//contains definitions of functions such as Ioremap, Iowrite, and so on, such as kernel access IO memory.

#include <linux/miscdevice.h>//contains the definition of the MISCDEVICE structure and its associated operation functions.

#include <linux/interrupt.h>//use interrupt required header file

#include <mach/irqs.h>//use interrupt required header file

The #include <asm/bitops.h>//contains the Set_bit bitwise operation function, which is available when the input subsystem is implemented.

#include <linux/semaphore.h>//The header file required for semaphore usage

#include <linux/spinlock.h>//spin Lock

#include <linux/sched.h>//kernel waits for the task_normal to be used in the queue, task_interruptible contained in this header file

#include <linux/kfifo.h>//fifo ring queue

#include <linux/timer.h>//Core timers

#include <linux/input.h>//Interrupt Handling

#include <linux/delay.h>//delay header file
#include <asm/irq.h>//processor-related interrupts

#include <linux/interrupt.h>//operating system interrupt

#include <asm/uaccess.h>//processor-related portals

#include <asm/arch/regs-gpio.h>//processor-related IO port operation

#include <mach/regs-gpio.h>//Ibid.

#include <asm/hardware.h>//processor-related hardware

#include <mach/hardware.h>//Ibid.

#include <linux/poll.h>//Polling files

#include <linux/gpio.h>//OS-related IO port files

#include <stdio.h>//standard input and output

#include <stdlib.h>//Standard Library

#include <unistd.h>

#include <sys/ioctl.h>//io control

Header file home directory include

There are a total of 32. h header files in the header file directory. There are 13 in the main directory, 4 in the ASM subdirectory, 10 in the Linux subdirectory, and 5 in the SYS subdirectory. The respective functions of these header files are as follows, the specific functions and the information contained in the 14th chapter.

<a.out.h>:a.out header file that defines the a.out execution file format and some macros.

<CONST.H>: constant symbol header file, currently only defines the flag bits of the I_mode field in the I node.

<ctype.h>: A character type header file that defines some macros about character type judgments and conversions.

<ERRNO.H>: Error xwould file containing various error numbers in the system. (Linus introduced from the Minix).

<fcntl.h>: The file control header file, which is used for the operation of the file and its descriptor to control the definition of the constant symbol.

<signal.h>: Signal header file, define signal symbol constants, signal structure and signal operation function prototype.

<STDARG.H>: A standard parameter header file that defines a variable parameter list as a macro. The main description is a type (va_list) and 3 macros (Va_start, Va_arg, and Va_end) for vsprintf, vprintf, vfprintf functions.

<STDDEF.H>: standard definition header file, defines null, Offsetof (TYPE, MEMBER).

<string.h>: string header file that defines some embedded functions for string manipulation.

<TERMIOS.H>: terminal input and Output function header file, mainly defines the terminal interface to control the asynchronous communication port.

<time.h>: The time type header file, mainly defines the TM structure and some time-related function prototype.

<unistd.h>:linux a standard header file that defines various symbol constants and types, and declares various functions. For example, __library__ is defined, and the system call number and inline assembler _syscall0 () are included.

<utime.h>: User Time header file, defines the access and modification time structure, and the Utime () prototype.

(1) Architecture related header file subdirectory include/asm

These header files primarily define data structures, macro functions, and variables that are closely related to the CPU architecture. A total of 4 files.

A <ASM/IO.H>:I/O header file that defines functions for I/O port operations in the form of an embedded assembler of macros.

<asm/memory.h>: Memory copy header file containing memcpy () embedded assembly macro function.

<asm/segment.h>: Segment operation header file, defines the embedded assembler function for the segment register operation.

<asm/system.h>: System header file, which defines the embedded assembly macros for setting or modifying descriptors/break gates, etc.

(2) Linux kernel dedicated header file subdirectory Include/linux

<linux/config.h>: Kernel configuration header file, define keyboard language and hard disk type (Hd_type) options.

<linux/fdreg.h>: Floppy drive header file containing some definitions of the floppy disk controller parameters.

<linux/fs.h>: File system header file, definition file table structure (File,buffer_head,m_inode, etc.).

<LINUX/HDREG.H>: Hard disk parameter header file, which defines information such as access to the hard disk register port, status code, and partition table.

The <linux/head.h>:head header file defines the simple structure of the segment descriptor, and several selection constants.

<linux/kernel.h>: Kernel header file, contains some of the kernel common functions of the prototype definition.

<LINUX/MM.H>: Memory management header file containing page size definitions and some page release function prototypes.

<linux/sched.h>: Scheduler header file that defines the data for the task structure task_struct, initial task 0,

As well as some embedded assembler function macro statements about descriptor parameter setting and getting.

<LINUX/SYS.H>: The system calls the header file, which contains 72 system calls to the C function handler, beginning with "Sys_".

The <linux/tty.h>:tty header file defines the parameters and constants for Tty_io, serial communication.

(3) System-specific data structure subdirectory Include/sys

<sys/stat.h>: File status header file, containing file or file system state structure stat{} and constants.

<SYS/TIMES.H>: Defines a process run time structure TMS and The Times () function prototype.

<sys/types.h>: A type header file that defines the basic system data type.

<sys/utsname.h>: System name Structure header file.

<sys/wait.h>: Wait for the header file to be called, define system calls wait () and waitpid () and related constant symbols

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.