This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

__libc symbols


Hello Everybody, 

I have a question concerning glibc internals. I am currently porting the
dcethreads package (DCE threads emulation on the top of Pthreads) found in
sourceforge to the most recent glibc. 

One module of this package consists to provide jacket for some classical
syscall like /read()/, /write()/, /close()/ etc. in order to define the
cancellation/non cancellation accordingly to the DCE semantic. 

For instance, there is the following macro: 

#define CANCELABLE_SYSCALL(res_type, name, param_list, params)          \
res_type __libc_##name param_list;                                      \
res_type                                                                \
name param_list                                                         \
{                                                                       \
        res_type result;                                                \
        int oldtype;                                                    \
        pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);  \
        result = __libc_##name params;                                  \
        pthread_setcanceltype (oldtype, NULL);                          \
        return result;                                                  \
}
...
CANCELABLE_SYSCALL (ssize_t, read, (int fd, void *buf, size_t count),
                    (fd, buf, count))
strong_alias (read, __read)


That macro was needed at the good old time were LinuxThreads was used and
/read()/ wasn't a CP in glibc. 

That kind of code compiled fine up to FC1. But with recent glibc (for
instance glibc-2.3.3-200405070341 on FC2), ld complains when linking to the
libdcethreads that the __libc symbols are not found: 

/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_tcdrain'
/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_fsync'
/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_fcntl'
/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_accept'
/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_read'
/opt/dce/lib/libdcethreads.so: undefined reference to `__libc_send'
...

Some functions are now true CP. That's easy, I just have for instance to use
/read()/ instead of the jacket. But DCE define also syscall to be
non-cancelable, like for instance /system()/


#define NON_CANCELABLE_SYSCALL(res_type, name, param_list, params)      \
res_type __libc_##name param_list;                              \
res_type                                                        \
name param_list                                                 \
{                                                               \
        res_type result;                                        \
        result = __libc_##name params;                          \
        return result;                                          \
}

* XXX system(3).  */
NON_CANCELABLE_SYSCALL (int, system, (const char *line), (line))
again, this was at the time were the glibc functions weren't CP. 


I wonder what is the best way to port this jacket to recent glibc? 

And second, what's the name of the internal glibc function? Is it now 
close@@GLIBC_2.0 instead of __libc_close ? 


Thanks in advance,
Loic Domaigne. 

-- 
--
// Sender address goes to /dev/null (!!) 
// Use my 32/64 bits, ANSI C89, compliant email-address instead:   

unsigned y[]=
{0,34432,26811,16721,41866,63119,61007,48155,26147,10986};
void x(z){putchar(z);}; unsigned t; 
main(i){if(i<10){t=(y[i]*47560)%65521;x(t>>8);x(t&255);main(++i);}}

GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]