刚用到system函数,要根据其返回值来做进一步操作,可是system的返回值并不等于其调用的程序的返回值,man了没看懂,后来在网上搜索了一下,终于看到了一个DX的理解,记录之。 引自: 原文 [color="#0000ff"]要分成两部分来说: 1,在程序中,用exit来设置进程的退出值时,虽然该函数的参数类型为int型,但再父进程中只能取到其值的低8位.所以用exit返回值时,高于255的值是没有意义的. 2,对于system函数,返回值是由两部分组...
转载几篇文章,留待以后参考
How to: Compile linux kernel modules
http://www.cyberciti.biz/tips/compiling-linux-kernel-module.html
"hello world" 简单内核模块
http://blank-dic.blog.163.com/blog/static/31018622201122111262729/
insmod: no symbol version for module_layout
http://blank-dic.blog.163.com/blog/st...
共享内存的基本用法: shmget shmat 调用都没有问题 对shmat做了封装,示意代码如下 char* LinkShm(int shm_id, int flag) { char *shmptr; shmptr = shmat(shm_id,NULL,flag); return shm_ptr; } 然后调用返回的值,一直是错误的,调用代码如下: char* shmptr; shmptr = LinkShm(shm_id,0); 使用gdb调试发现,函数LinkShm()中的shmptr的值是对的,返回给调用者指针shmptr时shmat返回的64位地址,高位4字节给截断了,...
在写一本shell中有这样一段,想进行数据库expdp 导出,但当导出出错时 $?仍然返回0, 应该如何修改呢 谢谢 su - oracle -c "expdp system/$DB_SYSTEM_PASSWD schemas=$schemas include=table directory=TEMP_DIR1 dumpfile="$schemas"_USER.dmp logfile=exp"$schemas"_USER.log" >> $logfile SQLPLUS_RET=$? if [ ${SQLPLUS_RET} -eq 0 ]; then echo "NOTE: Data exporting succeeded without error !" ...
linux创建进程函数fork()正确调用一次的时候有两个返回值:
子进程返回:0
父进程返回:>0的整数(返回子进程ID号)
而错误的时候返回-1
而在介绍fork()函数时的应用例子一般都为以下结构:如下例:
#include
网上高人说学习内核 通过写module开始 那是一个捷径 今天就初步的学习了下 module 就写篇以防以后查询吧 主要是参考下面得网页 来写的 还是挺好的 http://dirac.org/linux/writing/lkmpg/2.6/chinese/lkmpg_chs/#AEN30 但是按照他第二章步骤来出现了很多问题 不得不依从从网上查找资料 慢慢解决 如下 首先得把 hello module编译成功吧 首先得明白一个问题 这个hello module是用运行的内核来编译的 具...
Finding hidden kernel modules (the extrem way) --------by madsys 1 Introduction 2 The technique of module hiding 3 Countermeasure -- brute force 4 Problem of unmapped 5 Greetings 6 References 7 Code 1 Introduction This paper presents a method for how to find out the hidden modules in linux system. Generaly speaking, most of the attackers intend to hide their modules after taking down the ...
memcpy使用户空间函数,可以用在内核模块的设计上吗?是否可以这样理解,内核模块的所有变量都是工作在内核空间,因此不能使用用户空间的函数?
linux Device Drivers, 2nd Edition By Alessandro Rubini & Jonathan Corbet 2nd Edition June 2001 0-59600-008-1, Order Number: 0081 586 pages, $39.95 Chapter 2 Building and Running modules Contents: Kernel modules Versus Applications Compiling and Loading The Kernel Symbol Table Initialization and Shutdown Using Resources Automatic and Manual Configuration Doing It in User Space Backward Compatibi...
如果你想要升级你的Debian/Ubuntu linux内核,或者你希望为内核开发新的模块,或者您要为某个硬件写新的驱动程序……这一切都涉及到Debian/Ubuntu linux内核编程。 作为一个内核编程者,有那么几个软件是你必须要有的,看作是你进行内核编程的几件法宝吧,下面我一一列举出来: 1、gcc 大名鼎鼎的gcc我想没有人不知道的吧?它是任何编程者必然要先安装的一个武器了。不过一般如果你是安装的Debian系统,应该已经默认安装了的。要是...