Re: RFD: x32 ABI system call numbers

From: H.J. Lu
Date: Sat Sep 03 2011 - 00:44:37 EST


On Fri, Sep 2, 2011 at 9:29 PM, H. Peter Anvin <hpa@xxxxxxxxx> wrote:
> On 09/02/2011 09:02 PM, H.J. Lu wrote:
>>
>> I defined __SNATIVE_LONG_TYPE and  __UNATIVE_LONG_TYPE
>> in x32 header, which are native signed and unsigned long types. I
>> used them in
>>
>
> What is the definition of these macros?
>

I have

#if defined __x86_64__ && __WORDSIZE == 32
#define __INO_T_TYPE __UQUAD_TYPE
#define __NLINK_T_TYPE __UQUAD_TYPE
#define __OFF_T_TYPE __SQUAD_TYPE
#define __RLIM_T_TYPE __UQUAD_TYPE
#define __BLKCNT_T_TYPE __SQUAD_TYPE
#define __FSFILCNT_T_TYPE __UQUAD_TYPE
#define __FSBLKCNT_T_TYPE __UQUAD_TYPE
#define __TIME_T_TYPE __SQUAD_TYPE
#define __BLKSIZE_T_TYPE __SQUAD_TYPE
#define __SUSECONDS_T_TYPE __SQUAD_TYPE
#define __SNATIVE_LONG_TYPE __SQUAD_TYPE
#define __UNATIVE_LONG_TYPE __UQUAD_TYPE
#else
#define __INO_T_TYPE __ULONGWORD_TYPE
#define __NLINK_T_TYPE __UWORD_TYPE
#define __OFF_T_TYPE __SLONGWORD_TYPE
#define __RLIM_T_TYPE __ULONGWORD_TYPE
#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
#define __SNATIVE_LONG_TYPE __SLONGWORD_TYPE
#define __UNATIVE_LONG_TYPE __ULONGWORD_TYPE
#endif

There is one problem with:

int sysinfo(struct sysinfo *info);

struct sysinfo comes from <linux/kernel.h>:

struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */
unsigned short pad; /* explicit padding for m68k */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
};

I couldn't find a clean way to use long long for x32. I wind up calling
compat_sys_sysinfo. Also linux/aio_abi.h has

typedef unsigned long aio_context_t;

I had to use compat_sys_io_setup for

int io_setup(unsigned nr_events, aio_context_t *ctxp);

Is there a way to support something similar to __SNATIVE_LONG_TYPE
and __UNATIVE_LONG_TYPE for kernel header files.


--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/