遇到了嵌入式linux下面系统级内存泄露问题。跟踪问题日志。 平台:ARM9 内核:2.6.22 问题:execl造成系统内存减少,通过cat /proc/memoinfo 发现少的内存并且都移往slab中去了 测试代码: #include #include #include #include #include #include #include #include #include #include int main() { int i = 0; int pid = 0; for (i=0; i<1000; i++) { pid = fork(); if (pid < 0) ...
by vikingyi - Linux文档专区 - 2009-10-10 10:25:07 阅读(1089) 回复(0)
请问一下:下面的程序为什么不会输出 :hello! int main() { execl("/bin/ls","ls","-l",NULL); prinf("hello!"); exit(0); } 假如本进程叫作进程1,那么它在执行完execl之后是不是进程1的代码区已被ls的代码区所覆盖了,而不能执行进程1中下面的部分,还是别的原因,小弟想知道它的机制和原理,请各位高手不吝赐教!谢谢。
请问一下:下面的程序为什么不会输出 :hello! int main() { execl("/bin/ls","ls","-l",NULL); prinf("hello!"); exit(0); } 假如本进程叫作进程1,那么它在执行完execl之后是不是进程1的代码区已被ls的代码区所覆盖了,而不能执行进程1中下面的部分,还是别的原因,小弟想知道它的机制和原理,请各位高手不吝赐教!谢谢。
RedHat linux下编写的多进程使用execl,源码如下: pid=fork(); if(pid<0) { ........ } if(pid == 0) { /*执行子程序*/ if (execl("gather","gather",ini_array->;msc_name,shmid_buf,(char*)0)<0) { sprintf(buf,"error:调用%s子进程出错!\n",ini_array->;msc_name); write_main_log_file(buf); } }............ 可是运行后ps -ef|grep gather 却是三个gather进程 那位大侠知道怎...
本帖最后由 netocool 于 2012-02-17 09:53 编辑
shell.sh:[code]#!/bin/sh
echo "hello shell!"[/code]execl.c[code]#include
#include
本帖最后由 garyv 于 2013-05-31 11:06 编辑 函数声明是: int execl(const char *path, const char *arg, ...); 我使用这个函数测试发现: execl("/work/app", NULL); // 编译报错 execl("/work/app", "app", NULL); // 编译运行都正常 execl("/work/app", "a", NULL); // 编译运行都正常 问题是,第二个参数到底是干什么用的?如果是应用程序名称的话,第一个参数里面已经有了啊,而且从第三行代码看随便填个字符串都行 我...