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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值