mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Add CTASSERT()'s to check that the sizes of our replicas of the 32 bit
structures come out the right size. Fix the ones that broke. stat32 had some missing fields from the end and statfs32 was broken due to the strange definition of MNAMELEN (which is dependent on sizeof(long)) I'm not sure if this fixes any actual problems or not.
This commit is contained in:
parent
319de71e19
commit
60a8c422cd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=121719
@ -75,6 +75,8 @@ struct rusage32 {
|
||||
int32_t ru_nivcsw;
|
||||
};
|
||||
|
||||
#define FREEBSD32_MNAMELEN (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
|
||||
|
||||
struct statfs32 {
|
||||
int32_t f_spare2;
|
||||
int32_t f_bsize;
|
||||
@ -91,12 +93,12 @@ struct statfs32 {
|
||||
int32_t f_syncwrites;
|
||||
int32_t f_asyncwrites;
|
||||
char f_fstypename[MFSNAMELEN];
|
||||
char f_mntonname[MNAMELEN];
|
||||
char f_mntonname[FREEBSD32_MNAMELEN];
|
||||
int32_t f_syncreads;
|
||||
int32_t f_asyncreads;
|
||||
int16_t f_spares1;
|
||||
char f_mntfromname[MNAMELEN];
|
||||
int16_t f_spares2;
|
||||
char f_mntfromname[FREEBSD32_MNAMELEN];
|
||||
int16_t f_spares2 __packed;
|
||||
int32_t f_spare[2];
|
||||
};
|
||||
|
||||
|
@ -79,6 +79,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <compat/freebsd32/freebsd32.h>
|
||||
#include <compat/freebsd32/freebsd32_proto.h>
|
||||
|
||||
CTASSERT(sizeof(struct timeval32) == 8);
|
||||
CTASSERT(sizeof(struct timespec32) == 8);
|
||||
CTASSERT(sizeof(struct statfs32) == 256);
|
||||
CTASSERT(sizeof(struct rusage32) == 72);
|
||||
|
||||
/*
|
||||
* [ taken from the linux emulator ]
|
||||
* Search an alternate path before passing pathname arguments on
|
||||
@ -356,6 +361,8 @@ struct sigaltstack32 {
|
||||
int ss_flags;
|
||||
};
|
||||
|
||||
CTASSERT(sizeof(struct sigaltstack32) == 12);
|
||||
|
||||
int
|
||||
freebsd32_sigaltstack(struct thread *td,
|
||||
struct freebsd32_sigaltstack_args *uap)
|
||||
@ -589,6 +596,8 @@ struct itimerval32 {
|
||||
struct timeval32 it_value;
|
||||
};
|
||||
|
||||
CTASSERT(sizeof(struct itimerval32) == 16);
|
||||
|
||||
int
|
||||
freebsd32_setitimer(struct thread *td, struct freebsd32_setitimer_args *uap)
|
||||
{
|
||||
@ -668,6 +677,8 @@ struct kevent32 {
|
||||
u_int32_t udata; /* opaque user data identifier */
|
||||
};
|
||||
|
||||
CTASSERT(sizeof(struct kevent32) == 20);
|
||||
|
||||
int
|
||||
freebsd32_kevent(struct thread *td, struct freebsd32_kevent_args *uap)
|
||||
{
|
||||
@ -819,6 +830,8 @@ struct iovec32 {
|
||||
};
|
||||
#define STACKGAPLEN 400
|
||||
|
||||
CTASSERT(sizeof(struct iovec32) == 8);
|
||||
|
||||
int
|
||||
freebsd32_readv(struct thread *td, struct freebsd32_readv_args *uap)
|
||||
{
|
||||
@ -1198,8 +1211,14 @@ struct stat32 {
|
||||
u_int32_t st_blksize;
|
||||
u_int32_t st_flags;
|
||||
u_int32_t st_gen;
|
||||
struct timespec32 st_birthtimespec;
|
||||
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
|
||||
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
|
||||
};
|
||||
|
||||
|
||||
CTASSERT(sizeof(struct stat32) == 96);
|
||||
|
||||
static void
|
||||
copy_stat( struct stat *in, struct stat32 *out)
|
||||
{
|
||||
@ -1342,6 +1361,8 @@ struct sigaction32 {
|
||||
sigset_t sa_mask;
|
||||
};
|
||||
|
||||
CTASSERT(sizeof(struct sigaction32) == 24);
|
||||
|
||||
int
|
||||
freebsd32_sigaction(struct thread *td, struct freebsd32_sigaction_args *uap)
|
||||
{
|
||||
|
@ -35,7 +35,6 @@ struct ia32_sigaltstack {
|
||||
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
|
||||
};
|
||||
|
||||
/* XXX should be 640 bytes long; check and see if __packed is needed */
|
||||
struct ia32_mcontext {
|
||||
int mc_onstack; /* XXX - sigcontext compat. */
|
||||
int mc_gs; /* machine state (struct trapframe) */
|
||||
@ -69,7 +68,6 @@ struct ia32_mcontext {
|
||||
int mc_spare2[8];
|
||||
};
|
||||
|
||||
/* XXX should be 704 bytes long; check and see if __packed is needed */
|
||||
struct ia32_ucontext {
|
||||
sigset_t uc_sigmask;
|
||||
struct ia32_mcontext uc_mcontext;
|
||||
|
Loading…
Reference in New Issue
Block a user