This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: need help understanding header file organization
- From: Geoff Keating <geoffk at geoffk dot org>
- To: george at mvista dot com
- Cc: libc-alpha at sources dot redhat dot com
- Date: Wed, 6 Mar 2002 17:55:29 -0800
- Subject: Re: need help understanding header file organization
- References: <3C86BE32.A539DA48@mvista.com>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> Date: Wed, 06 Mar 2002 17:11:14 -0800
> From: george anzinger <george@mvista.com>
> I am attempting to add the system call stubs for posix timers to the
> library. I have set it up so the stubs replace the library routines
> conditioned on the __NR_<call name> being defined. I think I have this
> under control, BUT...
>
> The system calls have need of slightly different defines for some of the
> CLOCK_ and other constants in the header files. One way of doing this
> is to condition the values again on __NR_<call name> being defined. Is
> this a "ok" way to do this or is there some other preferred method.
This is really not a good idea. glibc needs to have the same API no
matter what kernel happens to be installed (consider a system that
switches between an older and a newer kernel version). If the API
should be modified, the best way to do this is to:
- Provide old versions of the routines that just translate the
constants and call the new routines
- The new routines then call either the system call (if it is present)
or emulate the syscall (for the case of running a new glibc on an
older kernel).
The detection of whether the syscalls are present should be done at
runtime; for an example, look at libc/sysdeps/unix/sysv/linux/i386/chown.c.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>