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]

Re: Weak linkage of cancellation points.


On Wed, Jul 14, 2004 at 08:12:51AM -0700, Ulrich Drepper wrote:
> These are no supported interfaces of the libc.  If you want to use them
> do this on your own account.   Define the functions yourself.

Heh - how?  By adding it to libc and recompiling it?
I cannot add an alias for say 'lseek64' and then override
the original (or can I?).

For example, libc declares:

000bb1a0 W lseek64

being the only visible variable.  And I want to override it.

Then I need to do something like this?:

// Forward declaration.
off64_t lseek64 (int fd, off64_t offset, int whence);

// Make alias __lseek64
extern __typeof (lseek64) __lseek64 __attribute__ ((alias ("lseek64")));

// Override lseek64
off64_t __attribute__ ((weak)) lseek64 (int fd, off64_t offset, int whence)
{
  int oldtype;
  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
  return_t res = __lseek64 (fd, offset, whence);			// Call libc *original*
  pthread_setcanceltype(oldtype, NULL);
  return res;
}

Will that work?  Or what did you mean?

-- 
Carlo Wood <carlo@alinoe.com>


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