This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Issues in adding a new API function in pthread
- From: "Dongyoon Lee" <dongyoon at gmail dot com>
- To: "Carlos O'Donell" <carlos at systemhalted dot org>
- Cc: libc-help at sourceware dot org
- Date: Fri, 13 Jun 2008 12:52:13 -0400
- Subject: Re: Issues in adding a new API function in pthread
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Xmedjumbph/hzbPmrZnGj177Hkarv8VH+cy9STDiBVg=; b=MahN/5Bm+nEhCXwKtIbuI+QL350l2wJ9YuXcFCF1WzY4gmdNjcJZcHfqCwQWGh3lo9 Ru6fBISgvh71IfMt2w+KPDRKzgrOPXpBHNFFpyuLSie5tHGJv61qIgsW9+kxbgRgXzvj oInXd38r178Q5Vn05m8DziPz9/0yWZKiritKU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=TNDsqwTX1cRoltfLbU4tXhi0KVE3DYq8KC+XRfkJw9pSeVCSkQzG90zGPXejYogLms nGGCK41vjXKJeylNgbDyOUOkRWOKgxffJp+78grMD/s8UMWeWMFcdF2Q9Sk2PBXkDbMC Otog54eJ0tkh7ApJr6m7PAt3ClhOXqPCkZYGs=
- References: <cbefbaa0806121249g7474d4afyde4fdc82a29f619b@mail.gmail.com> <cbefbaa0806121251kf76b2fci5d1869a189e4c671@mail.gmail.com> <119aab440806130714h56f9fc41n6fce0115705dd6a@mail.gmail.com>
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