Linux内核开发常用函数及其头文件

一、protocol

//protocol

//-----include/linux/in.h
IPPROTO_UDP
INADDR_ANY
struct sockaddr_in

//-----include/linux/ip.h 
struct iphdr
ip_hdr()

//-----include/linux/udp.h              
struct udphdr
udp_hdr()

//-----include/linux/tcp.h                      
struct tcphdr
tcp_hdr()

二、sk_buff

//sk_buff

//-----include/linux/skbuff.h
struct sk_buff    

三、memory

//memory

//-----include/linux/slab_def.h
kmalloc()

//-----include/linux/slab.h
kfree()
ksize()

//-----include/linux/gfp.h
GFP_KERNEL
 
  四、string 
  

//string

//-----include/linux/string.h
strcmp()
strim()
strrchr()
strsep()
strpbrk()
memset()
memcpy()
memmove()
五、byteorder

//byteorder

//-----include/linux/byteorder/generic.h
ntohs()
__be16_to_cpu()
六、output

//output

//-----include/linux/kernel.h
printk()

//-----lib/vsprintf.c                                  
sprintf()
snprintf()

七、process

//process

//-----include/linux/sched.h
struct task_struct
TASK_RUNNING
set_task_state()
set_current_state()

//-----include/asm-generic/current.h
current

//-----include/linux/thread_info.h                          
set_need_resched()
clear_need_resched()

//-----arch/x86/include/asm/thread_info.h                       
struct thread_info
八、thread

//thread

//-----include/linux/kthread.h
kthread_create()
kthread_stop() 

//-----include/linux/sched.h
wake_up_process
九、wait queue

//wait queue

//-----include/linux/wait.h
wait_queue_head_t
init_waitqueue_head()
wake_up()
wait_event()

十、lock

//lock

//-----include/asm-generic/atomic.h
atomic_inc()

//-----include/linux/spinlock.h                                 
spin_lock()
spin_lock_bh()

//-----include/linux/rcupdate.h                      
rcu_read_lock()
synchronize_rcu()

十一、time

//time

//-----include/linux/raid/pq.h
HZ/jiffies

//-----include/linux/time.h                                       
struct timespec
get_seconds()
current_kernel_time()
mktime()

//-----include/linux/timer.h
struct timer_list
init_timer()
mod_timer()
add_timer()
del_timer()

//-----include/linux/jiffies.h
time_before()
time_after_eq()
jiffies_to_msecs()

十二、cpu

//cpu

//-----include/linux/cpumask.h
num_online_cpus()
for_each_possible_cpu()

//-----include/linux/smp.h
smp_processor_id()
get_cpu()

//-----include/linux/percpu.h
get_cpu_var()
//-----include/asm-generic/percpu.h   
per_cpu()
__get_cpu_var()

//  
DEFINE_PER_CPU

十三、proc file

//proc file

//-----include/linux/sysctl.h
struct ctl_table
struct ctl_table_header
register_sysctl_table()
register_sysctl_table()
proc_dointvec()
proc_doulongvec_minmax()
proc_dostring()
十四、uio

//uio

//-----include/linux/platform_device.h
struct platform_device
platform_device_register_simple()
platform_device_unregister()

//-----include/linux/device.h
struct device_driver
driver_register()
driver_unregister()

//-----include/linux/uio_driver.h
struct uio_info
UIO_IRQ_NONE
uio_register_device()
uio_unregister_device()
十五、random
//random

//-----include/linux/random.h
random32()
十六、device

//device

//-----include/linux/netdevice.h
struct net_device

//-----include/linux/pci.h
struct pci_driver

//-----include/linux/mod_devicetable.h
struct pci_device_id

你可能感兴趣的:(Linux内核编程)