Skip to contentSkip to conversation

time_t, size_t, off_t, ...

parisc-linux Paul Bame 3 participants 4 messages Nov 30, 2000 – Dec 1, 2000

lore
Share & tools
lore

Paul Bame

author
#0 lore raw

Thanks for all the helpful suggestions for data types. Here's my current plan so far as I know it, plus some questions/gripes. I have no current plans to break user space, though a new glibc should be produced eventually because of changes to struct sigcontext. I hope to make and test most(3) of these changes today. Let me know if anything is flatly stupid -- I already know some choices are not ideal because ideal is impossible (off_t for example).

						# bits
					parisc		parisc64
					------------------------
__kernel_off_t (long)			32		64(1)
__kernel_size_t	(unsigned long)		32		64(1)
__kernel_daddr_t (int)			32		32(2)
__kernel_time_t (long)			32		64(1,3)
__kernel_suseconds_t (long)		32		64(1,3)
sigset_t.sig[] (long)			32		64(4)
__kernel_ino_t (unsigned int)		32		32(5)
elf.h:gregs_t				DEBUGGER ISSUE(6)

(1) A difference from the current posix_types.h

(2) Appears to be used for an on-media data structure. mips64
has it 64 bits which is probably wrong.

(3) I'm currently using 32-bit time_t and suseconds_t for my 64-bit
kernel and it appears to work just fine, and saves lots of syscall wrapper work. However the other ports use 'long' so there's probably a good reason (or hidden assumptions in kernel code) for it. Those are
probably not the best reasons (I mean, why should a type used to describe milliseconds (timeval.tv_usec) be 64 bits? Oh well, here come lots more 32/64 syscall wrappers to handle timevals.

** NOTE ** I may not make the changes to these two types immediately due to the number of (uninteresting) syscall wrappers required (I'd rather write the networking ones first). Sorry this means posix_types.h may change more than once.

(4) I thought I could get away with making this 'int' and therefore

	32 bits everywhere.  It would save several 32/64 syscall
	wrappers (and increase speed).  However this little piece
	in kernel/signal.c is a hard-coded assumption that .sig[] is
	an array of long, and was a bitch to find:

		unsigned long i, *s, *m, x;
		s = tsk->pending.signal.sig;

(5) This looks to be 32 bits everywhere, even on 64-bit archs,

	with the single exception of sparc.  Although this little
	snippet in <linux/nfs_fs.h>:

	static inline ino_t
	nfs_fileid_to_ino_t(u64 fileid)
	{
		ino_t ino = (ino_t) fileid;
		if (sizeof(ino_t) < sizeof(u64))
			ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8;
		return ino;
	}
	
	clearly shows a 32-bit ino_t is currently a (potential) problem,
	it seems to me this is a Linux problem not a parisc problem, so
	it seemed better to follow the lead of the other ports.

(6) Debugger is going to care about structs in elf.h, which are not
identical narrow and wide at the present time.

-Paul Bame

#1 lore raw
Quoted 5 lines

(3) I'm currently using 32-bit time_t and suseconds_t for my 64-bit
kernel and it appears to work just fine, and saves lots of syscall wrapper work. However the other ports use 'long' so there's probably a good reason (or hidden assumptions in kernel code) for it. Those are

time_t itself is normally a long because historically (pre ANSI/POSIX) back when men where men and adb was the coolest debugger on the planet it was the case that time() foo was a function using longs

[Random historical aside - very early C didnt support passing long as an argument hence time(&foo) not foo=time()]

I know of no kernel reason. If you are using a 1KHz system clock then it may be handy to up the loop time for the counter to above 50 days by using long.

Quoted 8 lines

(4) I thought I could get away with making this 'int' and therefore

	32 bits everywhere.  It would save several 32/64 syscall
	wrappers (and increase speed).  However this little piece
	in kernel/signal.c is a hard-coded assumption that .sig[] is
	an array of long, and was a bitch to find:

		unsigned long i, *s, *m, x;
		s = tsk->pending.signal.sig;

Eep. Its not unreasonable to suggest to Linus that gets fixed 8)

Quoted 16 lines

(5) This looks to be 32 bits everywhere, even on 64-bit archs,

	with the single exception of sparc.  Although this little
	snippet in <linux/nfs_fs.h>:

	static inline ino_t
	nfs_fileid_to_ino_t(u64 fileid)
	{
		ino_t ino = (ino_t) fileid;
		if (sizeof(ino_t) < sizeof(u64))
			ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8;
		return ino;
	}
	
	clearly shows a 32-bit ino_t is currently a (potential) problem,
	it seems to me this is a Linux problem not a parisc problem, so
	it seemed better to follow the lead of the other ports.

On the 64bit port _please_ use a 64bit ino_t. It'll possibly tickle the odd other problem but post 2.4 the main kernel has to move to 64bit ino_t to make NFSv3 and XFS sanely work. That may well let you relax and look smug as the rest of the world suffers 8)

Alan

author
#2 lore raw

= time_t itself is normally a long because historically (pre ANSI/POSIX) back = when men where men and adb was the coolest debugger on the planet it was = the case that time() foo was a function using longs
=
= [Random historical aside - very early C didnt support passing long as an = argument hence time(&foo) not foo=time()]

I cut my Unix teeth on pdp11/v6-7 -- counts as very early I think :-)

= I know of no kernel reason. If you are using a 1KHz system clock then it = may be handy to up the loop time for the counter to above 50 days by using = long.

I'm setting clock_t to 64 bits on wide kernel FYI, but will keep time_t and suseconds_t at 32 bits until there's a problem. Won't effect 32-bit userspace if it has to change.

= > (4) I thought I could get away with making sigset_t.sig int[] therefore
= > 32 bits everywhere. It would save several 32/64 syscall
= > wrappers (and increase speed). However this little piece
= > in kernel/signal.c is a hard-coded assumption that .sig[] is
= > an array of long, and was a bitch to find:
= >
= > unsigned long i, *s, *m, x;
= > s = tsk->pending.signal.sig;
=
= Eep. Its not unreasonable to suggest to Linus that gets fixed 8)

Yeah, too bad I'm too much of a wimp to sign up for l-k -- already get more e-mail than I read :-(

= On the 64bit port _please_ use a 64bit ino_t. It'll possibly tickle the odd = other problem but post 2.4 the main kernel has to move to 64bit ino_t to make = NFSv3 and XFS sanely work. That may well let you relax and look smug as the = rest of the world suffers 8)

Ok, I'll use 64-bit ino_t on parisc64.

	-P
#3 lore raw
In reply to Paul Bame
Quoted 2 lines · Paul Bame

(6) Debugger is going to care about structs in elf.h, which are not
identical narrow and wide at the present time.

I'm more concerned about the fact that quite a few registers of interest are missing from elf_gregset_t

Signature · 1 line
Linuxcare.  Support for the Revolution.