随笔分类 - linux_program
linux program
摘要:#ifdef RC_DEBUG_ENABLE#define xprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) #else#define xprintf(fmt, ...) #endif
阅读全文
摘要:int my_getline(char* line, int max_size) { int c; int len = 0; //fflush(stdin); while( (c=getchar()) != '\n' && c != EOF); while( (c=getchar()) != EOF && len < max_size){ ...
阅读全文
摘要:uint32 mparam_print(uint32 param_num, ...){ va_list arg_ptr; uint32 i; uint32 param[10]; va_start(arg_ptr, param_num); for(i = 0; i < param_num && i <
阅读全文
摘要:pdl_handle = dlopen(lib_file_path, RTLD_LAZY); pfFunval = dlsym(pdl_handle, call_info->func_name); gcc -fPIC -shared libdemo.c -o libdemo.so gcc -rdyn
阅读全文
摘要:https://blog.csdn.net/wzhwho/article/details/4996510 1. 原理说明 Linux内核中采用了一种同时适用于32位和64位系统的内存分页模型,对于32位系统来说,两级页表足够用了,而在x86_64系统中,用到了四级页表,如图2-1所示。四级页表分别为
阅读全文
摘要:https://www.cnblogs.com/cxjchen/archive/2013/03/30/2990548.html 查看RAM使用情况最简单的方法是通过/proc/meminfo。这个动态更新的虚拟文件实际上是许多其他内存相关工具(如:free / ps / top)等的组合显示。/pr
阅读全文
摘要:http://man7.org/linux/man-pages/man2/timer_create.2.html http://man7.org/linux/man-pages/man7/sigevent.7.html http://man7.org/linux/man-pages/man2/tim
阅读全文
摘要:1、void openlog(const char *ident, int option, int facility); 第一个参数ident将是一个标记,ident所表示的字符串将固定地加在每行日志的前面以标识这个日志,通常就写成当前程序的名称以作标记。第二个参数option是下列值取与运算的结果
阅读全文
摘要:https://segmentfault.com/a/1190000006917884
阅读全文
摘要:http://blog.csdn.net/gatieme/article/details/50779184 系统调用概述 计算机系统的各种硬件资源是有限的,在现代多任务操作系统上同时运行的多个进程都需要访问这些资源,为了更好的管理这些资源进程是不允许直接操作的,所有对这些资源的访问都必须有操作系统控
阅读全文
摘要:http://blog.jobbole.com/107110/ 1. Tasklet机制分析 上面我们介绍了软中断机制,linux内核为什么还要引入tasklet机制呢?主要原因是软中断的pending标志位也就32位,一般情况是不随意增加软中断处理的。而且内核也没有提供通用的增加软中断的接口。其次
阅读全文
摘要:http://blog.jobbole.com/107057/ 1. 为什么要软中断 编写驱动的时候,一个中断产生之后,内核在中断处理函数中可能需要完成很多工作。但是中断处理函数的处理是关闭了中断的。也就是说在响应中断时,系统不能再次响应外部的其它中断。这样的后果会造成有可能丢失外部中断。于是,li
阅读全文
摘要:http://edsionte.com/techblog/archives/3223 1.线程 通过操作系统原理课,我们知道进程是系统资源分配的基本单位,线程是程序独立运行的基本单位。线程有时候也被称作小型进程,首先,这是因为多个线程之间是可以共享资源的;其次,多个线程之间的切换所花费的代价远远比进
阅读全文
摘要:/* linux-2.6.38.8/include/linux/compiler-gcc4.h */ #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) /* linux-2.6.38.8/include/linux/stddef.h */ #undef offsetof #ifdef __compiler_offsetof #...
阅读全文
摘要:https://www.cnblogs.com/ilinuxer/p/6364064.html https://www.cnblogs.com/ggjucheng/archive/2012/08/19/2646466.html
阅读全文
摘要:1. ARM Device Tree起源 Linus Torvalds在2011年3月17日的ARM Linux邮件列表宣称“this whole ARM thing is a f*cking pain in the ass”,引发ARM Linux社区的地震,随后ARM社区进行了一系列的重大修正。
阅读全文
摘要:https://www.cnblogs.com/cobbliu/p/3627061.html Linux 的计时函数,用于获得当前时间: time(2) / time_t (秒) ftime(3) / struct timeb (毫秒) gettimeofday(2) / struct timeva
阅读全文
摘要:1、sleep() 以秒为单位unsigned int sleep(unsigned int seconds); //#include<unistd.h>sleep()非系统调用,sleep()是在库函数中实现的,它是通过alarm()来设定报警时间,使用sigsuspend()将进程挂起在信号SI
阅读全文
摘要:调度器的配置参数 /proc/sys/kernel/sched_min_granularity_ns(4000000ns): sysctl_sched_min_granularity,表示进程最少运行时间,防止频繁的切换,对于交互系统(如桌面),该值可以设置得较小,这样可以保证交互得到更快的响应(见
阅读全文