RFC: __kernel_time_t

Aurelien Jarno aurelien at aurel32.net
Tue Jan 3 19:07:54 UTC 2006


Hi all,

I am currently working on changing the ugly hacks into proper fixes. I
wanted to have your comments on __kernel_time_t.

This type is a the type of time_t in the kernel, and is defined as
follow in the kernel:

alpha
  typedef    __int32_t       __time_t;               /* time()... */
amd64
  typedef    __int64_t       __time_t;               /* time()... */
i386:
  typedef    __int32_t       __time_t;               /* time()... */
ia64:
  typedef    __int64_t       __time_t;               /* time()... */
sparc64: 
  typedef    __int64_t       __time_t;               /* time()... */

On the userland part, we have:

GNU/kFreeBSD
  typedef long int __time_t;
  typedef int __kernel_time_t;

GNU/Linux
  typedef long int __time_t;

First, you will se that our definition is wrong in case of amd64, ia64
and sparc64. Then __time_t in the kernel == __time_t in userland on all 
platforms but alpha. That's probably because alpha is the first 64-bit
port and at the time it was done, the wrong choice has been done about
the type of __time_t.

__kernel_time_t is used in the following structures:

struct __kernel_itimerval
  Currently exported to userland, but not used. IMHO, this should not be 
  exported to userland.
struct __kernel_timespec
  Currently exported to userland, but not used. IMHO, this should not be 
  exported to userland.
struct __kernel_itimerval
  Currently exported to userland, but not used. IMHO, this should not be 
  exported to userland.
struct __kernel_timeval
  Currently exported to userland, used by __kernel_rusage. IMHO, this 
  should not be exported to userland.
struct __kernel_rusage
  Currently exported to userland, but not used. IMHO, this should not be 
  exported to userland.
struct stat32
  Not exported to userland.
struct stat16
  Not exported to userland.
struct msqid_ds
  Exported to userland, used by msgctl
struct shmid_ds
  Exported to userland, used by shmctl
struct semid_ds
  Exported to userland, used by semctl


This will probably causes us some problem when we will begin the amd64
ports (and even ports). Moreover, I think the current patch for
__kernel_time_t won't be accepted upstream.

Therefore I will propose the following changes:

* Replace __kernel_time_t into __time_t in all exported headers. No ABI
  break for all platforms, but alpha. But who cares?

* Use conversion functions for alpha. This is already done for some
  functions that already used time_t instead of __kernel_time_t. This is
  all the code in time-64. I propose to move this directory into alpha,
  as future 64-bit ports will probably use a 64-bit __time_t type.
  The conversion functions only concern msgctl(), shmctl() and
  semctl().

If nobody opposes, I will implement that soon.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32 at debian.org         | aurelien at aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



More information about the Glibc-bsd-devel mailing list