Issues in adding a new API function in pthread
Dongyoon Lee
dongyoon@gmail.com
Fri Jun 13 16:52:00 GMT 2008
First of all, I appreciate your advice. Can I ask one more?
I checked the symbols in the DSO, but they seem to be fine. However, I
still have trouble adding new API.
Plus, I tested setschedprio function in the GLIB_2.3.4 but I got the same errors
[root@localhost TMP]# gcc d.c -o d -lpthread
/tmp/ccEeiBLd.o(.text+0x179): In function `main':
: undefined reference to `pthread_setschedprio'
collect2: ld returned 1 exit status
Other general APIs such as pthread_create, pthread_mutex_lock, etc.
work well, and in order to add pthread_log2() API, I modified as
follows.
-------------------------------------------------------------------------------------------------------------------------
1. abilist\libpthread.abilist
[ADD] __pthread_log2 F
[ADD] pthread_log2 F
2. conform\data\pthread.h-data
[ADD] function int pthread_log2(int)
3. nptl\Makefile
[ADD in libpthread-routines] pthread_log2
4. nptl\pthreadP.h
[ADD] extern int __pthread_log2(int on);
5. nptl\pthread_log2.c
#include <errno.h>
#include "pthreadP.h"
#include <lowlevellock.h>
int
__pthread_log2 (on)
int on;
{
return 0;
}
strong_alias (__pthread_log2, pthread_log2)
6. nptl\Versions
[ADD] pthread_log2;
7. nptl\sysdeps\pthread\pthread.h
[ADD] extern int pthread_log2 (int on) __THROW;
-------------------------------------------------------------------------------------------------------------------------
FYI, here is my system information and output of readelf...
-------------------------------------------------------------------------------------------------------------------------
Operating System CentOS 4.6 (x86_64), Linux version 2.6.9-67.Elsmp
gcc version 3.4.6 20060404 (Red Hat 3.4.6-9)
glibc (pthread) src glibc-2.3.4-2.39.src.rpm
-------------------------------------------------------------------------------------------------------------------------
#readelf -a /lib64/tls/libpthread.so.0
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x3b34405750
....(omitted)....
249: 0000003b344081c0 3 FUNC GLOBAL DEFAULT 12
pthread_log2@@GLIBC_2.2.5
....(omitted)....
148: 0000000000000000 0 FILE LOCAL DEFAULT ABS pthread_log2.c
....(omitted)....
1086: 0000003b344081c0 3 FUNC LOCAL DEFAULT 12 __pthread_log2
....(omitted)....
1397: 0000003b344081c0 3 FUNC GLOBAL DEFAULT 12 pthread_log2
....(omitted)....
- Dongyoon
More information about the Libc-help
mailing list