[so] tema 2 linux
Octavian Purdila
so@cursuri.cs.pub.ro
Fri, 19 Nov 2004 16:03:23 +0200 (EET)
> 1. Daca folosesc LD_PRELOAD=libtid.so imi da erori la executarea
> ls/cat/orice program facut de mine
> [root@localhost tema2]# export LD_PRELOAD=libtid.so
> [root@localhost tema2]# ls
> ls: relocation error: ./libtid.so: undefined symbol: dlopen
> (pt compilare libtid.so execut gcc -shared -o libtid.so libtid.c)
>
Ai nevoie de gcc -shared -o libtid.so libtid.c -ldl
> 2. Daca folosesc LD_LIBRARY_PATH=. imi da eroare la compilare
> gcc -shared -o libtid.so libtid.c
> gcc -o tester tester.c -L. -I. -ltid
> ./libtid.so: undefined reference to `dlopen'
> ./libtid.so: undefined reference to `dlsym'
> collect2: ld returned 1 exit status
> make: *** [tester] Error 1
> (in libtid.c/libtid.h am inclus <dlfnc.h>)
>
gcc -shared -o libtid.so libtid.c -ldl
> 3. Daca am doar kernel 2.4 cum aflu` numele procesului si CPUtime ?
> (care pe kernel 2.6 se puteau afla din /proc/pid/stat)
>
>
Le poti afla tot din /proc/pid/stat, numele procesului fiind al doilea
camp, iar CPUTime (user) fiind al 14 camp (la fel ca si la 2.6 deci :).
tavi