Type sizes
What was the reasoning behind:
/* Note these change from narrow to wide kernels */ #ifdef __LP64__
typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_ptrdiff_t; typedef long __kernel_time_t; #else typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef int __kernel_time_t;
#endif
in <asm/posix_types.h> ?
on a 32-bit kernel, sizeof(long) == sizeof(int), so why can't we just use the first set of typedefs?
Signature · 1 line
Revolutions do not require corporate support.
Quoted 2 lines · Matthew Wilcox
on a 32-bit kernel, sizeof(long) == sizeof(int), so why can't we just use the first set of typedefs?
It avoids lots and lots of gcc warning messages compiling the kernel. gcc makes the fine distinction that long != int, even if they are the same physical size. size_t on pa32 is unsigned int but on pa64 is unsigned long, and gcc knows about this for its builtin string functions.
Alan
Signature · 1 line
Linuxcare