荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: jjksam (UNIX+C+XML+??), 信区: Linux
标  题: [合集]编译出现
发信站: 荔园晨风BBS站 (Wed Apr 17 16:23:53 2002), 站内信件

wengison (听风) 于Fri Apr  5 13:55:10 2002提到:

/tmp/ccLBswmm.o: In function `do_proxy':
/tmp/ccLBswmm.o(.text+0x63d): undefined reference to `sys_myerrlist'
collect2: ld returned 1 exit status
编译程序时出现的
为何?


jjksam (Global Variable) 于Fri Apr  5 13:59:25 2002提到:

源代码呢?


zlc (.......................................) 于Fri Apr  5 14:31:56 2002提到:

加入连接库


wengison (听风) 于Fri Apr  5 15:41:40 2002提到:

怎么加?


wengison (听风) 于Fri Apr  5 15:45:08 2002提到:

.............
extern char *sys_myerrlist[];
............
strcpy(buf,sys_myerrlist[errno]);
.........
相关的就这些



bstone (郁闷) 于Fri Apr  5 15:57:46 2002提到:

好像是gcc -l连接库


jjksam (Global Variable) 于Fri Apr  5 16:00:48 2002提到:

给源代码我帮你调试一下看看吧。呵呵。。



jjksam (Global Variable) 于Fri Apr  5 16:01:57 2002提到:

Linker Options
              -llibrary -nostartfiles -nostdlib -static -shared
              -symbolic -Xlinker option -Wl,option -u symbol



wengison (听风) 于Fri Apr  5 16:10:16 2002提到:

哈哈
在网上找到的东东
凑合着看看罢了


jjksam (Global Variable) 于Fri Apr  5 16:13:17 2002提到:

ft .这么少信息怎么调试啊?


wengison (听风) 于Fri Apr  5 16:16:23 2002提到:

麻烦了
还是我自己来吧
我喜欢粗重活的
不过我想问问你关于僵尸进程如何清理
你说说清理过程就行了


jjksam (Global Variable) 于Fri Apr  5 16:25:06 2002提到:

先查出那个zombie进程的id..然后
kill -9 pid
或者直接
killall -9 进程名字



wengison (听风) 于Fri Apr  5 16:28:06 2002提到:

我想问的是编程实现


jjksam (UNIX+C+XML+??) 于Wed Apr 17 15:52:12 2002提到:

参考ps, top 的源代码...
这些程序都会从内核获取有关进程和系统资源的信息.
调试器和其它类似的工具也需要有控制和监察运行进程的能力.
不同版本的UNIX通过许多接口提供了这些特征, 几乎所有这些特征都是和计算机有
关的, 或者紧密地和特定的内核设计联系在一起的.

kvm过程
许多系统使用kvm_open, kvm_nlist and kvm_read等过程来直接访问内核数据结构,
这些访问是通过/dev/kmem设备来进行的. 一般来说, 这些程序将打开/dev/kmem, 读入
内核的符号表, 使用该表查找运行的内核中的数据, 并使用过程读取内核地址空间中
适当的地址. 因为这将需要用户程序和内核同意以这种方式读入的数据结构的大小和
格式, 所以这样的程序在移植时,对每次内核变动以及cpu类型的变化, 它都需要重新
建立.

ptrace和/proc文件系统
in 4.3BSD and SVID, you can control the process by using the ptrace system
call, and you can read datas from the process. this system call usually
used by the debuger.
 /proc filesystem looks like a directory, every running process has its
corresponding file item, the name of the file item is the ID# of the process
user level application can open the file in /proc, and use several ioctl
system call to control the execution of that program, or you can get the
information from the kernel.
use the same thoery, program can read data from the process address by using
the file descriptor, or write the data of process address into /proc filesystem

process control under Linux
 Under Linux ptrace system call can use to control the process, its principle
is similar as that in 4.3BSD.
but the meaning of /proc in Linux has changed a lot. /proc in Linux has include
a lot of files, these files can provide system infomation, such as the usage of
the memory, loaded modules, and network stat. These file is visited by read and
write, their content can be filtered by scanf.


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店