Linux的initcalls调用机制
只要看看 include/linux/init.h中的定义就清楚了:
#define core_initcall(fn) __define_initcall("1",fn)
#define postcore_initcall(fn) __define_initcall("2",fn)
#define arch_initcall(fn) __define_initcall("3",fn)
#define subsys_initcall(fn) __define_initcall("4",fn)
#define fs_initcall(fn) __define_initcall("5",fn)
#define device_initcall(fn) __define_initcall("6",fn)
#define late_initcall(fn) __define_initcall("7",fn)
#define __initcall(fn) device_initcall(fn)
#define console_initcall(fn) \
static initcall_t __initcall_##fn \
__attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn
#define security_initcall(fn) \
static initcall_t __initcall_##fn \
__attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn
#define module_init(x) __initcall(x); //modlue的级别是6
链接的时候按下面的顺序链接:
__initcall_start = .;
*(.initcall1.init)
*(.initcall2.init)
*(.initcall3.init)
*(.initcall4.init)
*(.initcall5.init)
*(.initcall6.init)
*(.initcall7.init)
__initcall_end = .;
因此,在do_initcalls的时候就按照前面的顺序来了。
其中 console_initcall等这些则是定义在专门的section中的。比如console_initcall就是定义在:__con_initcall_start与__con_initcall_end这个section中。
相关文档:
摘自:http://blog.chinaunix.net/u3/105005/showart.php?id=2076571
Linux下查看文件和文件夹大小的df和du命令
df du
当磁盘大小超过标准时会有报警提示,这时如果掌握df和du命令是非常明智的选择。
df可以查看一级文件夹大小、使用比例、档� ......
线程处于分离状态后,当线程退出后,则有操作系统来负责系统的回收。
创建分离状态线程的方法有:
1、在线程函数中调用, pthread_detach(pthread_self());
2、线程属性的设置函数
摘自:Unix 环境高级编程
int makethread(void *(*fn),void *arg)
{
int err;
&n ......
原文地址:http://blog.csdn.net/wyzxg/archive/2007/10/23/1840110.aspx
linux修改主机名的方法
linux修改主机名的方法
用hostname命令可以临时修改机器名,但机器重新启动之后就会恢复原来的值。
#hostname //查看机器名
#hostname -i //查看本机器名对应的ip地址
另外一种方法就是 ......
1. Technically speaking, and in this book, the operating
system
is considered the parts of the system responsible for basic use
and administration. This includes the kernel and device drivers, boot loader,
command shell or other user interface, and basic file and system utilities ......
随着Linux应用的日益广泛,有大量的网络服务器使用Linux操作系统。为了全面衡量网络运行状况,就需要对网络状态做更细致、更精确的测量。 SNMP协议的制订为互联网测量提供了有力支持。MRTG(MultiRouter Traffic Grapher, MRTG)就是基于SNMP的典型网络流量统计分析工具。它耗用的系统资源很小,因此有很多外挂的程序也依附在 ......