tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

compat netbsd32 dev_t alignment fixes



Hi,

Attached a small patch that fix some dev_t alignment problems under
compat netbsd32. Now that dev_t is a 64bit value, we cannot use it
directly anymore but rather netbsd32_uint64 (with 32bit alignment)
instead.

This fix some program crashs when using all stat(2) family
functions...

Ok to commit ?

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.
Index: sys/compat/netbsd32/netbsd32.h
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32.h,v
retrieving revision 1.81
diff -u -p -r1.81 netbsd32.h
--- sys/compat/netbsd32/netbsd32.h      28 Jan 2009 00:43:04 -0000      1.81
+++ sys/compat/netbsd32/netbsd32.h      16 Mar 2009 15:43:18 -0000
@@ -158,6 +158,7 @@ typedef netbsd32_pointer_t netbsd32_lwpc
 typedef netbsd32_pointer_t netbsd32_fd_setp_t;
 typedef netbsd32_intptr_t netbsd32_semid_t;
 typedef netbsd32_pointer_t netbsd32_semidp_t;
+typedef netbsd32_uint64 netbsd32_dev_t;
 
 /* from <sys/uio.h> */
 typedef netbsd32_pointer_t netbsd32_iovecp_t;
@@ -594,13 +595,13 @@ struct netbsd32_omsghdr {
 /* from <sys/stat.h> */
 typedef netbsd32_pointer_t netbsd32_stat12p_t;
 struct netbsd32_stat12 {               /* NetBSD-1.2 stat struct */
-       dev_t           st_dev;         /* inode's device */
+       uint32_t        st_dev;         /* inode's device */
        uint32_t        st_ino;         /* inode's number */
        uint16_t        st_mode;        /* inode protection mode */
        uint16_t        st_nlink;       /* number of hard links */
        uid_t           st_uid;         /* user ID of the file's owner */
        gid_t           st_gid;         /* group ID of the file's group */
-       dev_t           st_rdev;        /* device type */
+       uint32_t        st_rdev;        /* device type */
        struct netbsd32_timespec st_atimespec;/* time of last access */
        struct netbsd32_timespec st_mtimespec;/* time of last data modification 
*/
        struct netbsd32_timespec st_ctimespec;/* time of last file status 
change */
@@ -676,13 +677,13 @@ struct netbsd32_stat50 {
 
 typedef netbsd32_pointer_t netbsd32_statp_t;
 struct netbsd32_stat {
-       dev_t           st_dev;         /* inode's device */
+       netbsd32_dev_t  st_dev;         /* inode's device */
        mode_t          st_mode;        /* inode protection mode */
        netbsd32_uint64 st_ino;         /* inode's number */
        nlink_t         st_nlink;       /* number of hard links */
        uid_t           st_uid;         /* user ID of the file's owner */
        gid_t           st_gid;         /* group ID of the file's group */
-       dev_t           st_rdev;        /* device type */
+       netbsd32_dev_t  st_rdev;        /* device type */
        struct netbsd32_timespec st_atimespec;/* time of last access */
        struct netbsd32_timespec st_mtimespec;/* time of last data modification 
*/
        struct netbsd32_timespec st_ctimespec;/* time of last file status 
change */
Index: sys/compat/netbsd32/netbsd32_netbsd.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_netbsd.c,v
retrieving revision 1.155
diff -u -p -r1.155 netbsd32_netbsd.c
--- sys/compat/netbsd32/netbsd32_netbsd.c       4 Mar 2009 18:11:24 -0000       
1.155
+++ sys/compat/netbsd32/netbsd32_netbsd.c       16 Mar 2009 15:43:18 -0000
@@ -323,7 +323,7 @@ netbsd32___mknod50(struct lwp *l, const 
        /* {
                syscallarg(const netbsd32_charp) path;
                syscallarg(mode_t) mode;
-               syscallarg(dev_t) dev;
+               syscallarg(netbsd32_dev_t) dev;
        } */
 
        return do_sys_mknod(l, SCARG_P32(uap, path), SCARG(uap, mode),
Index: sys/compat/netbsd32/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/syscalls.master,v
retrieving revision 1.78
diff -u -p -r1.78 syscalls.master
--- sys/compat/netbsd32/syscalls.master 26 Feb 2009 21:08:48 -0000      1.78
+++ sys/compat/netbsd32/syscalls.master 16 Mar 2009 15:43:18 -0000
@@ -984,6 +984,6 @@
                            netbsd32_intp status, \
                            int options, netbsd32_rusagep_t rusage); }
 450    STD             { int|netbsd32|50|mknod(const netbsd32_charp path, \
-                           mode_t mode, dev_t dev); }
+                           mode_t mode, netbsd32_dev_t dev); }
 451    STD             { int|netbsd32|50|fhstat(const netbsd32_voidp fhp, \
                            netbsd32_size_t fh_size, netbsd32_statp_t sb); }


Home | Main Index | Thread Index | Old Index