CVS commit: src/sys/compat/sys
Module Name:src Committed By: kre Date: Sat Jan 20 08:40:37 UTC 2024 Modified Files: src/sys/compat/sys: resource.h Log Message: Now that rusage_to_rusage50() has switched from being an external function, to a static inline, we need for it to work. Not all callers provide that (and nor should they need to), so include it here. Should unbreak the builds. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/resource.h diff -u src/sys/compat/sys/resource.h:1.6 src/sys/compat/sys/resource.h:1.7 --- src/sys/compat/sys/resource.h:1.6 Fri Jan 19 18:39:15 2024 +++ src/sys/compat/sys/resource.h Sat Jan 20 08:40:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: resource.h,v 1.6 2024/01/19 18:39:15 christos Exp $ */ +/* $NetBSD: resource.h,v 1.7 2024/01/20 08:40:37 kre Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -35,6 +35,7 @@ #define _COMPAT_SYS_RESOURCE_H_ #include +#include #include #include
CVS commit: src/sys/compat/sys
Module Name:src Committed By: kre Date: Sat Jan 20 08:40:37 UTC 2024 Modified Files: src/sys/compat/sys: resource.h Log Message: Now that rusage_to_rusage50() has switched from being an external function, to a static inline, we need for it to work. Not all callers provide that (and nor should they need to), so include it here. Should unbreak the builds. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/resource.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: rin Date: Sat Jul 29 11:58:53 UTC 2023 Modified Files: src/sys/compat/sys: event.h Log Message: Sprinkle __inline to compat_100___kevent50_{fetch_changes,put_events} To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/compat/sys/event.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/event.h diff -u src/sys/compat/sys/event.h:1.3 src/sys/compat/sys/event.h:1.4 --- src/sys/compat/sys/event.h:1.3 Fri Jul 28 18:19:01 2023 +++ src/sys/compat/sys/event.h Sat Jul 29 11:58:53 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: event.h,v 1.3 2023/07/28 18:19:01 christos Exp $ */ +/* $NetBSD: event.h,v 1.4 2023/07/29 11:58:53 rin Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -63,7 +63,7 @@ kevent_to_kevent100(const struct kevent } #ifdef _KERNEL -static int +static __inline int compat_100___kevent50_fetch_changes(void *ctx, const struct kevent *changelist, struct kevent *changes, size_t index, int n) { @@ -88,7 +88,7 @@ leave: return error; } -static int +static __inline int compat_100___kevent50_put_events(void *ctx, struct kevent *events, struct kevent *eventlist, size_t index, int n) {
CVS commit: src/sys/compat/sys
Module Name:src Committed By: rin Date: Sat Jul 29 11:58:53 UTC 2023 Modified Files: src/sys/compat/sys: event.h Log Message: Sprinkle __inline to compat_100___kevent50_{fetch_changes,put_events} To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/compat/sys/event.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: riastradh Date: Mon Aug 30 08:40:00 UTC 2021 Modified Files: src/sys/compat/sys: mount.h Log Message: sys/compat: Don't clobber f_oflags with zero. Mistake was introduced in previous refactoring. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/compat/sys/mount.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: riastradh Date: Mon Aug 30 08:40:00 UTC 2021 Modified Files: src/sys/compat/sys: mount.h Log Message: sys/compat: Don't clobber f_oflags with zero. Mistake was introduced in previous refactoring. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/compat/sys/mount.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/mount.h diff -u src/sys/compat/sys/mount.h:1.14 src/sys/compat/sys/mount.h:1.15 --- src/sys/compat/sys/mount.h:1.14 Fri Jul 3 18:49:37 2020 +++ src/sys/compat/sys/mount.h Mon Aug 30 08:40:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mount.h,v 1.14 2020/07/03 18:49:37 jdolecek Exp $ */ +/* $NetBSD: mount.h,v 1.15 2021/08/30 08:40:00 riastradh Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -101,10 +101,12 @@ static __inline void statvfs_to_statfs12(const struct statvfs *fs, struct statfs12 *s12) { size_t i = 0; + + memset(s12, 0, sizeof(*s12)); + s12->f_type = 0; s12->f_oflags = (short)fs->f_flag; - memset(s12, 0, sizeof(*s12)); for (i = 0; i < sizeof(__nv) / sizeof(__nv[0]); i++) { if (strcmp(__nv[i].name, fs->f_fstypename) == 0) { s12->f_type = __nv[i].value;
Re: CVS commit: src/sys/compat/sys
> On Jun 28, 2020, at 10:24 AM, Robert Elz wrote: > >Date:Sat, 27 Jun 2020 11:49:30 -0400 >From:"Christos Zoulas" >Message-ID: <20200627154930.84e22f...@cvs.netbsd.org> > > | Modified Files: > |src/sys/compat/sys: mount.h > | > | Log Message: > | Ignore the supplied size, and always use the argument size that we know. > > Is this fix correct?Certainly looks more reasonable than > what was there before, as the supplied size (for no seemingly > good reason) is often 0, but in compat_20_sys_getfsstat() (in > sys/compat/common/vfs_syscalls_20.c) statvfs_to_statfs12_copy() > is called, via do_sys_getvfsstat() with a size of > sizeof(struct statvfs90) and a statvfs90 (compat/sys/statvfs.h) > is certainly not the same size as a statfs12 (compat/sys/mount.h) > > Or perhaps (probably more likely) compat_20_sys_getfsstat() should > be passing sizeof(struct statfs12) instead ? (And now may as well > just pass 0). No, it has to be sizeof(struct statfs12) because the function fills an array of struct statfs12 and needs to know how much to increment. Thanks, christos signature.asc Description: Message signed with OpenPGP
Re: CVS commit: src/sys/compat/sys
Date:Sat, 27 Jun 2020 11:49:30 -0400 From:"Christos Zoulas" Message-ID: <20200627154930.84e22f...@cvs.netbsd.org> | Modified Files: | src/sys/compat/sys: mount.h | | Log Message: | Ignore the supplied size, and always use the argument size that we know. Is this fix correct?Certainly looks more reasonable than what was there before, as the supplied size (for no seemingly good reason) is often 0, but in compat_20_sys_getfsstat() (in sys/compat/common/vfs_syscalls_20.c) statvfs_to_statfs12_copy() is called, via do_sys_getvfsstat() with a size of sizeof(struct statvfs90) and a statvfs90 (compat/sys/statvfs.h) is certainly not the same size as a statfs12 (compat/sys/mount.h) Or perhaps (probably more likely) compat_20_sys_getfsstat() should be passing sizeof(struct statfs12) instead ? (And now may as well just pass 0). kre
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Sep 26 01:29:00 UTC 2019 Modified Files: src/sys/compat/sys: socket.h Log Message: accrightslen is always used in an unsigned context so make it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/compat/sys/socket.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Sep 26 01:29:00 UTC 2019 Modified Files: src/sys/compat/sys: socket.h Log Message: accrightslen is always used in an unsigned context so make it. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/compat/sys/socket.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/socket.h diff -u src/sys/compat/sys/socket.h:1.18 src/sys/compat/sys/socket.h:1.19 --- src/sys/compat/sys/socket.h:1.18 Thu Apr 11 00:42:08 2019 +++ src/sys/compat/sys/socket.h Wed Sep 25 21:29:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: socket.h,v 1.18 2019/04/11 04:42:08 msaitoh Exp $ */ +/* $NetBSD: socket.h,v 1.19 2019/09/26 01:29:00 christos Exp $ */ /* * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 @@ -67,7 +67,7 @@ struct omsghdr { struct iovec *msg_iov; /* scatter/gather array */ int msg_iovlen; /* # elements in msg_iov */ void * msg_accrights; /* access rights sent/received */ - int msg_accrightslen; + u_int msg_accrightslen; }; /*
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Sun Sep 22 23:18:53 UTC 2019 Added Files: src/sys/compat/sys: statvfs.h Log Message: new files for statvfs90 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/compat/sys/statvfs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Sun Sep 22 23:18:53 UTC 2019 Added Files: src/sys/compat/sys: statvfs.h Log Message: new files for statvfs90 To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/compat/sys/statvfs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/compat/sys/statvfs.h diff -u /dev/null src/sys/compat/sys/statvfs.h:1.1 --- /dev/null Sun Sep 22 19:18:53 2019 +++ src/sys/compat/sys/statvfs.h Sun Sep 22 19:18:53 2019 @@ -0,0 +1,161 @@ +/* $NetBSD: statvfs.h,v 1.1 2019/09/22 23:18:53 christos Exp $ */ + +/*- + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _COMPAT_SYS_STATVFS_H_ +#define _COMPAT_SYS_STATVFS_H_ + +#include + +struct statvfs90 { + unsigned long f_flag; /* copy of mount exported flags */ + unsigned long f_bsize; /* file system block size */ + unsigned long f_frsize; /* fundamental file system block size */ + unsigned long f_iosize; /* optimal file system block size */ + + /* The following are in units of f_frsize */ + fsblkcnt_t f_blocks; /* number of blocks in file system, */ + fsblkcnt_t f_bfree; /* free blocks avail in file system */ + fsblkcnt_t f_bavail; /* free blocks avail to non-root */ + fsblkcnt_t f_bresvd; /* blocks reserved for root */ + + fsfilcnt_t f_files; /* total file nodes in file system */ + fsfilcnt_t f_ffree; /* free file nodes in file system */ + fsfilcnt_t f_favail; /* free file nodes avail to non-root */ + fsfilcnt_t f_fresvd; /* file nodes reserved for root */ + + uint64_t f_syncreads; /* count of sync reads since mount */ + uint64_t f_syncwrites; /* count of sync writes since mount */ + + uint64_t f_asyncreads; /* count of async reads since mount */ + uint64_t f_asyncwrites; /* count of async writes since mount */ + + fsid_t f_fsidx; /* NetBSD compatible fsid */ + unsigned long f_fsid; /* Posix compatible fsid */ + unsigned long f_namemax; /* maximum filename length */ + uid_t f_owner; /* user that mounted the file system */ + + uint32_t f_spare[4]; /* spare space */ + + char f_fstypename[_VFS_NAMELEN]; /* fs type name */ + char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */ + char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */ +}; + +__BEGIN_DECLS +#ifndef _KERNEL +#include +#endif + +static __inline void +statvfs_to_statvfs90(const struct statvfs *s, struct statvfs90 *s90) +{ + s90->f_flag = s->f_flag; + s90->f_bsize = s->f_bsize; + s90->f_frsize = s->f_frsize; + s90->f_iosize = s->f_iosize; + + s90->f_blocks = s->f_blocks; + s90->f_bfree = s->f_bfree; + s90->f_bavail = s->f_bavail; + s90->f_bresvd = s->f_bresvd; + + s90->f_files = s->f_files; + s90->f_ffree = s->f_ffree; + s90->f_favail = s->f_favail; + s90->f_fresvd = s->f_fresvd; + + s90->f_syncreads = s->f_syncreads; + s90->f_syncwrites = s->f_syncwrites; + + s90->f_asyncreads = s->f_asyncreads; + s90->f_asyncwrites = s->f_asyncwrites; + + s90->f_fsidx = s->f_fsidx; + s90->f_fsid = s->f_fsid; + s90->f_namemax = s->f_namemax; + s90->f_owner = s->f_owner; + + memcpy(s90->f_fstypename, s->f_fstypename, sizeof(s90->f_fstypename)); + memcpy(s90->f_mntonname, s->f_mntonname, sizeof(s90->f_mntonname)); + memcpy(s90->f_mntfromname, s->f_mntfromname, sizeof(s90->f_mntfromname)); +} + +#ifdef _KERNEL +static __inline int +statvfs_to_statvfs90_copy(const void *vs, void *vs90, size_t l) +{ + struct statvfs90 *s90 = STATVFSBUF_GET(); + int error; + + statvfs_to_statvfs90(vs, s90); +
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Sun Jun 30 14:37:33 UTC 2019 Modified Files: src/sys/compat/sys: sigtypes.h ucontext.h Log Message: This code is used in 32 bit arm emulations so always expose the stack32_t and the 32 bit machine context structure definition and types. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/compat/sys/sigtypes.h cvs rdiff -u -r1.7 -r1.8 src/sys/compat/sys/ucontext.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/sigtypes.h diff -u src/sys/compat/sys/sigtypes.h:1.3 src/sys/compat/sys/sigtypes.h:1.4 --- src/sys/compat/sys/sigtypes.h:1.3 Wed Jun 26 21:58:49 2019 +++ src/sys/compat/sys/sigtypes.h Sun Jun 30 10:37:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sigtypes.h,v 1.3 2019/06/27 01:58:49 christos Exp $ */ +/* $NetBSD: sigtypes.h,v 1.4 2019/06/30 14:37:33 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -63,7 +63,7 @@ struct sigaltstack13 { #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */ -#if defined(_LP64) && defined(_KERNEL) +#ifdef _KERNEL struct __sigaltstack32 { uint32_t ss_sp; @@ -73,7 +73,7 @@ struct __sigaltstack32 { typedef struct __sigaltstack32 stack32_t; -#endif /* _LP64 && _KERNEL */ +#endif /* _KERNEL */ #endif /* !_COMPAT_SYS_SIGTYPES_H_ */ Index: src/sys/compat/sys/ucontext.h diff -u src/sys/compat/sys/ucontext.h:1.7 src/sys/compat/sys/ucontext.h:1.8 --- src/sys/compat/sys/ucontext.h:1.7 Wed Jun 26 21:58:49 2019 +++ src/sys/compat/sys/ucontext.h Sun Jun 30 10:37:33 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ucontext.h,v 1.7 2019/06/27 01:58:49 christos Exp $ */ +/* $NetBSD: ucontext.h,v 1.8 2019/06/30 14:37:33 christos Exp $ */ /*- * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include -#if defined(_LP64) && defined(_KERNEL) +#ifdef _KERNEL typedef struct __ucontext32 ucontext32_t; @@ -61,6 +61,6 @@ int cpu_mcontext32_validate(struct lwp * void cpu_getmcontext32(struct lwp *, mcontext32_t *, unsigned int *); int cpu_setmcontext32(struct lwp *, const mcontext32_t *, unsigned int); -#endif /* _LP64 && _KERNEL */ +#endif /* _KERNEL */ #endif /* !_COMPAT_SYS_UCONTEXT_H_ */
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Sun Jun 30 14:37:33 UTC 2019 Modified Files: src/sys/compat/sys: sigtypes.h ucontext.h Log Message: This code is used in 32 bit arm emulations so always expose the stack32_t and the 32 bit machine context structure definition and types. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/compat/sys/sigtypes.h cvs rdiff -u -r1.7 -r1.8 src/sys/compat/sys/ucontext.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: martin Date: Sun Jun 30 08:49:21 UTC 2019 Modified Files: src/sys/compat/sys: siginfo.h Log Message: Provide the compat structures even if not building 64bit kernels, as we have same-bitness netbsd32 emulations for different ABIs on some architectures. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: martin Date: Sun Jun 30 08:49:21 UTC 2019 Modified Files: src/sys/compat/sys: siginfo.h Log Message: Provide the compat structures even if not building 64bit kernels, as we have same-bitness netbsd32 emulations for different ABIs on some architectures. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/siginfo.h diff -u src/sys/compat/sys/siginfo.h:1.6 src/sys/compat/sys/siginfo.h:1.7 --- src/sys/compat/sys/siginfo.h:1.6 Thu Jun 27 01:58:49 2019 +++ src/sys/compat/sys/siginfo.h Sun Jun 30 08:49:21 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.6 2019/06/27 01:58:49 christos Exp $ */ +/* $NetBSD: siginfo.h,v 1.7 2019/06/30 08:49:21 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #ifndef _COMPAT_SYS_SIGINFO_H_ #define _COMPAT_SYS_SIGINFO_H_ -#if defined(_LP64) && defined(_KERNEL) +#ifdef _KERNEL typedef union sigval32 { int sival_int; @@ -83,6 +83,6 @@ typedef union siginfo32 { struct __ksiginfo32 _info; } siginfo32_t; -#endif /* _LP64 && _KERNEL */ +#endif /* _KERNEL */ #endif /* !_COMPAT_SYS_SIGINFO_H_ */
Re: CVS commit: src/sys/compat/sys
On Fri, Jun 28, 2019 at 05:03:37AM -0700, Jason Thorpe wrote: > > > On Jun 26, 2019, at 7:10 PM, matthew green wrote: > > > >> Always include the 32 bit structure and definitions on _LP64 regardless > >> of compat32 being on or off, because we want the headers to work when > >> compiling modular kernels. Of course the 32 bit structs do not make sense > >> on platforms that don't have 32 bit modes (alpha), but we don't have > >> a define for that and it does not hurt. > > > > i've been using _LP64 && !__alpha__ for this when it strikes. > > > > sub-optimal, but also easy to grep and find :-) > > Perhaps we should define "_LP64_ONLY" in for this type of > situation? > I'm a really huge fan of keeping structs the same across archs when it doesn't cost us very much. It's been a real blessing that netbsd is mostly consistent when porting programming languages, which often end up embedding a list of structs and their sizes, generated by very fragile code (or by hand!)
Re: CVS commit: src/sys/compat/sys
> On Jun 26, 2019, at 7:10 PM, matthew green wrote: > >> Always include the 32 bit structure and definitions on _LP64 regardless >> of compat32 being on or off, because we want the headers to work when >> compiling modular kernels. Of course the 32 bit structs do not make sense >> on platforms that don't have 32 bit modes (alpha), but we don't have >> a define for that and it does not hurt. > > i've been using _LP64 && !__alpha__ for this when it strikes. > > sub-optimal, but also easy to grep and find :-) Perhaps we should define "_LP64_ONLY" in for this type of situation? -- thorpej
re: CVS commit: src/sys/compat/sys
> Always include the 32 bit structure and definitions on _LP64 regardless > of compat32 being on or off, because we want the headers to work when > compiling modular kernels. Of course the 32 bit structs do not make sense > on platforms that don't have 32 bit modes (alpha), but we don't have > a define for that and it does not hurt. i've been using _LP64 && !__alpha__ for this when it strikes. sub-optimal, but also easy to grep and find :-) .mrg.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Jun 27 02:44:54 UTC 2019 Modified Files: src/sys/compat/sys: rnd.h Log Message: This actually needs the netbsd32 stuff present since the struct for the 32 bit syscall has a netbsd32_voidp... This header is used also for compat/common, so just revert (helped us to fix a bug though :-) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/rnd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Jun 27 02:44:54 UTC 2019 Modified Files: src/sys/compat/sys: rnd.h Log Message: This actually needs the netbsd32 stuff present since the struct for the 32 bit syscall has a netbsd32_voidp... This header is used also for compat/common, so just revert (helped us to fix a bug though :-) To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/rnd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/rnd.h diff -u src/sys/compat/sys/rnd.h:1.6 src/sys/compat/sys/rnd.h:1.7 --- src/sys/compat/sys/rnd.h:1.6 Wed Jun 26 21:58:49 2019 +++ src/sys/compat/sys/rnd.h Wed Jun 26 22:44:54 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.h,v 1.6 2019/06/27 01:58:49 christos Exp $ */ +/* $NetBSD: rnd.h,v 1.7 2019/06/27 02:44:54 christos Exp $ */ /*- * Copyright (c) 1997,2011 The NetBSD Foundation, Inc. @@ -33,9 +33,18 @@ #ifndef _COMPAT_SYS_RND_H_ #define _COMPAT_SYS_RND_H_ +#if defined(_KERNEL_OPT) +#include "opt_compat_netbsd.h" +#include "opt_compat_netbsd32.h" +#endif + #include #include +#ifdef COMPAT_NETBSD32 +#include +#endif /* COMPAT_NETBSD32 */ + #include /* @@ -57,7 +66,7 @@ typedef struct { void *unused_state; /* was: internal state */ } rndsource50_t; -#ifdef _LP64 +#ifdef COMPAT_NETBSD32 typedef struct { char name[16]; /* device name */ uint32_t unused_time; /* was: last time recorded */ @@ -68,7 +77,7 @@ typedef struct { uint32_t flags; /* flags */ netbsd32_voidp unused_state; /* was: internal state */ } rndsource50_32_t; -#endif /* _LP64 */ +#endif /* COMPAT_NETBSD32 */ /* * NetBSD-5 defined RND_MAXSTATCOUNT as 10. We define RND_MAXSTATCOUNT50 @@ -88,13 +97,13 @@ typedef struct { rndsource50_t source[RND_MAXSTATCOUNT50]; } rndstat50_t; -#ifdef _LP64 +#ifdef COMPAT_NETBSD32 typedef struct { uint32_t start; uint32_t count; rndsource50_32_t source[RND_MAXSTATCOUNT50]; } rndstat50_32_t; -#endif /* _LP64 */ +#endif /* COMPAT_NETBSD32 */ /* * return information on a specific source by name @@ -104,12 +113,12 @@ typedef struct { rndsource50_t source; } rndstat_name50_t; -#ifdef _LP64 +#ifdef COMPAT_NETBSD32 typedef struct { char name[16]; rndsource50_32_t source; } rndstat_name50_32_t; -#endif /* _LP64 */ +#endif /* COMPAT_NETBSD32 */ /* * NetBSD-5 defined RND_POOLWORDS as 128. In NetBSD-6, the value @@ -134,9 +143,9 @@ int compat32_50_rnd_ioctl(struct file *, #define RNDGETSRCNUM50 _IOWR('R', 102, rndstat50_t) #define RNDGETSRCNAME50 _IOWR('R', 103, rndstat_name50_t) -#ifdef _LP64 +#ifdef COMPAT_NETBSD32 #define RNDGETSRCNUM50_32 _IOWR('R', 102, rndstat50_32_t) #define RNDGETSRCNAME50_32 _IOWR('R', 103, rndstat_name50_32_t) -#endif +#endif /* COMPAT_NETBSD32 */ #endif /* !_COMPAT_SYS_RND_H_ */
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Jun 27 01:58:49 UTC 2019 Modified Files: src/sys/compat/sys: rnd.h siginfo.h sigtypes.h ttycom.h ucontext.h Log Message: Always include the 32 bit structure and definitions on _LP64 regardless of compat32 being on or off, because we want the headers to work when compiling modular kernels. Of course the 32 bit structs do not make sense on platforms that don't have 32 bit modes (alpha), but we don't have a define for that and it does not hurt. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/rnd.h \ src/sys/compat/sys/siginfo.h cvs rdiff -u -r1.2 -r1.3 src/sys/compat/sys/sigtypes.h cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/ttycom.h cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/ucontext.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/rnd.h diff -u src/sys/compat/sys/rnd.h:1.5 src/sys/compat/sys/rnd.h:1.6 --- src/sys/compat/sys/rnd.h:1.5 Sat Jan 26 21:08:41 2019 +++ src/sys/compat/sys/rnd.h Wed Jun 26 21:58:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.h,v 1.5 2019/01/27 02:08:41 pgoyette Exp $ */ +/* $NetBSD: rnd.h,v 1.6 2019/06/27 01:58:49 christos Exp $ */ /*- * Copyright (c) 1997,2011 The NetBSD Foundation, Inc. @@ -33,18 +33,9 @@ #ifndef _COMPAT_SYS_RND_H_ #define _COMPAT_SYS_RND_H_ -#if defined(_KERNEL_OPT) -#include "opt_compat_netbsd.h" -#include "opt_compat_netbsd32.h" -#endif - #include #include -#ifdef COMPAT_NETBSD32 -#include -#endif /* COMPAT_NETBSD32 */ - #include /* @@ -66,7 +57,7 @@ typedef struct { void *unused_state; /* was: internal state */ } rndsource50_t; -#ifdef COMPAT_NETBSD32 +#ifdef _LP64 typedef struct { char name[16]; /* device name */ uint32_t unused_time; /* was: last time recorded */ @@ -77,7 +68,7 @@ typedef struct { uint32_t flags; /* flags */ netbsd32_voidp unused_state; /* was: internal state */ } rndsource50_32_t; -#endif /* COMPAT_NETBSD32 */ +#endif /* _LP64 */ /* * NetBSD-5 defined RND_MAXSTATCOUNT as 10. We define RND_MAXSTATCOUNT50 @@ -97,13 +88,13 @@ typedef struct { rndsource50_t source[RND_MAXSTATCOUNT50]; } rndstat50_t; -#ifdef COMPAT_NETBSD32 +#ifdef _LP64 typedef struct { uint32_t start; uint32_t count; rndsource50_32_t source[RND_MAXSTATCOUNT50]; } rndstat50_32_t; -#endif /* COMPAT_NETBSD32 */ +#endif /* _LP64 */ /* * return information on a specific source by name @@ -113,12 +104,12 @@ typedef struct { rndsource50_t source; } rndstat_name50_t; -#ifdef COMPAT_NETBSD32 +#ifdef _LP64 typedef struct { char name[16]; rndsource50_32_t source; } rndstat_name50_32_t; -#endif /* COMPAT_NETBSD32 */ +#endif /* _LP64 */ /* * NetBSD-5 defined RND_POOLWORDS as 128. In NetBSD-6, the value @@ -143,9 +134,9 @@ int compat32_50_rnd_ioctl(struct file *, #define RNDGETSRCNUM50 _IOWR('R', 102, rndstat50_t) #define RNDGETSRCNAME50 _IOWR('R', 103, rndstat_name50_t) -#ifdef COMPAT_NETBSD32 +#ifdef _LP64 #define RNDGETSRCNUM50_32 _IOWR('R', 102, rndstat50_32_t) #define RNDGETSRCNAME50_32 _IOWR('R', 103, rndstat_name50_32_t) -#endif /* COMPAT_NETBSD32 */ +#endif #endif /* !_COMPAT_SYS_RND_H_ */ Index: src/sys/compat/sys/siginfo.h diff -u src/sys/compat/sys/siginfo.h:1.5 src/sys/compat/sys/siginfo.h:1.6 --- src/sys/compat/sys/siginfo.h:1.5 Wed Jun 19 12:14:07 2019 +++ src/sys/compat/sys/siginfo.h Wed Jun 26 21:58:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.5 2019/06/19 16:14:07 maya Exp $ */ +/* $NetBSD: siginfo.h,v 1.6 2019/06/27 01:58:49 christos Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -32,11 +32,7 @@ #ifndef _COMPAT_SYS_SIGINFO_H_ #define _COMPAT_SYS_SIGINFO_H_ -#if defined(_KERNEL_OPT) -#include "opt_compat_netbsd32.h" -#endif - -#if defined(COMPAT_NETBSD32) && defined(_KERNEL) +#if defined(_LP64) && defined(_KERNEL) typedef union sigval32 { int sival_int; @@ -87,6 +83,6 @@ typedef union siginfo32 { struct __ksiginfo32 _info; } siginfo32_t; -#endif /* COMPAT_NETBSD32 && _KERNEL */ +#endif /* _LP64 && _KERNEL */ #endif /* !_COMPAT_SYS_SIGINFO_H_ */ Index: src/sys/compat/sys/sigtypes.h diff -u src/sys/compat/sys/sigtypes.h:1.2 src/sys/compat/sys/sigtypes.h:1.3 --- src/sys/compat/sys/sigtypes.h:1.2 Sun Dec 11 07:20:29 2005 +++ src/sys/compat/sys/sigtypes.h Wed Jun 26 21:58:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sigtypes.h,v 1.2 2005/12/11 12:20:29 christos Exp $ */ +/* $NetBSD: sigtypes.h,v 1.3 2019/06/27 01:58:49 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -39,10 +39,6 @@ #ifndef _COMPAT_SYS_SIGTYPES_H_ #define _COMPAT_SYS_SIGTYPES_H_ -#if defined(_KERNEL_OPT) -#include "opt_compat_netbsd32.h" -#endif - #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ defined(_NETBSD_SOURCE) @@ -67,7 +63,7 @@ struct sigaltstack13 { #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */ -#if d
CVS commit: src/sys/compat/sys
Module Name:src Committed By: christos Date: Thu Jun 27 01:58:49 UTC 2019 Modified Files: src/sys/compat/sys: rnd.h siginfo.h sigtypes.h ttycom.h ucontext.h Log Message: Always include the 32 bit structure and definitions on _LP64 regardless of compat32 being on or off, because we want the headers to work when compiling modular kernels. Of course the 32 bit structs do not make sense on platforms that don't have 32 bit modes (alpha), but we don't have a define for that and it does not hurt. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/rnd.h \ src/sys/compat/sys/siginfo.h cvs rdiff -u -r1.2 -r1.3 src/sys/compat/sys/sigtypes.h cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/ttycom.h cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/ucontext.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: maya Date: Wed Jun 19 16:14:07 UTC 2019 Modified Files: src/sys/compat/sys: siginfo.h Log Message: Match the regular _ksiginfo size since sys/sys/siginfo.h:1.33 "Expand siginfo_t (struct size not changed) to new values for SIGTRAP TRAP_SCE/TRAP_SCX events." Fixes port-mips/54309: gdb doesn't work on mips64 (32bit userland, 64bit kernel) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/compat/sys
Module Name:src Committed By: maya Date: Wed Jun 19 16:14:07 UTC 2019 Modified Files: src/sys/compat/sys: siginfo.h Log Message: Match the regular _ksiginfo size since sys/sys/siginfo.h:1.33 "Expand siginfo_t (struct size not changed) to new values for SIGTRAP TRAP_SCE/TRAP_SCX events." Fixes port-mips/54309: gdb doesn't work on mips64 (32bit userland, 64bit kernel) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/siginfo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/sys/siginfo.h diff -u src/sys/compat/sys/siginfo.h:1.4 src/sys/compat/sys/siginfo.h:1.5 --- src/sys/compat/sys/siginfo.h:1.4 Mon Apr 28 20:23:46 2008 +++ src/sys/compat/sys/siginfo.h Wed Jun 19 16:14:07 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.4 2008/04/28 20:23:46 martin Exp $ */ +/* $NetBSD: siginfo.h,v 1.5 2019/06/19 16:14:07 maya Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -72,6 +72,13 @@ struct __ksiginfo32 { int32_t _band; int _fd; } _poll; + + struct { + int _sysnum; + int _retval[2]; + int _error; + uint64_t _args[8]; /* SYS_MAXSYSARGS */ + } _syscall; } _reason; };
Re: CVS commit: src/sys/compat/sys
> Date: Fri, 15 Jun 2018 19:55:28 +0700 > From: Robert Elz > > Another way would be > > static const struct timespec50 zts = { 0 }; > and > *ts50 = zts; I have nothing substantive to add about the question at hand, but one tiny nit: there is no need for the initializer in this case, and indeed if you have -Werror=missing-field-initializers as I think we do by default, writing out the full initializer is a pain. It suffices to say static const struct timespec50 zts; and the implementation will guarantee it is initialized to all zero/null as appropriate.
Re: CVS commit: src/sys/compat/sys
On Fri, Jun 15, 2018 at 17:11:49 +0300, Valery Ushakov wrote: > It seems that with restrict we can just memset the whole struct and > the compiler will elide the memset completely when there's no pad to > scrub. Alas, with the real code the compiler cannot elide the memset. :( -uwe
Re: CVS commit: src/sys/compat/sys
On Fri, Jun 15, 2018 at 19:55:28 +0700, Robert Elz wrote: > Date:Fri, 15 Jun 2018 12:41:56 +0300 > From:Valery Ushakov > Message-ID: <20180615094156.gd3...@pony.stderr.spb.ru> > > | Re memset - I now wonder if > | compiler is even allowed to be smart here b/c strict aliasing > > Another way would be > > static const struct timespec50 zts = { 0 }; > and > *ts50 = zts; > > which is unlikely to have that problem, and which the compiler might > be smart enough to optimise into a single assignment where there is > padding, and perhaps even nothing where there is none. The compiler does field-by-field assignment in that case and uses "narrow" movl that doesn't scrub the pad. With memset you seem to also need to add "restrict" so that the compiler can elide the dead moves. The example I'm playing with is: #include struct s { int i; long l; }; struct s64 { long i; long l; }; //#define restrict void foo(struct s * restrict l, const struct s64 * restrict r) { #if 0 static const struct s s0 = { 0, 0 }; *l = s0; #else memset(l, 0, sizeof(*l)); #endif l->i = r->i; l->l = r->l; } > I'm also not really a fan of the #if that tests the number of bits in > int and long (by testing their max values) - that is assuming that > when long is wider than int, it also has wider alignment, which is > not necessarily so - a system with 4 byte ints and 8 byte long, > could have long with 4 byte alignment (and that struct be 12 bytes > long, alogned 4). The code as it is isn't wrong, ijust the attempt > to avoid the memset() when it isn't needed might fail, and do the > memset() when there is nothing to clear - and if the compiler doesn't > or even can't, optimise it away then it is wasteful. Yes, the #if test feels icky... It seems that with restrict we can just memset the whole struct and the compiler will elide the memset completely when there's no pad to scrub. -uwe
Re: CVS commit: src/sys/compat/sys
Date:Fri, 15 Jun 2018 12:41:56 +0300 From:Valery Ushakov Message-ID: <20180615094156.gd3...@pony.stderr.spb.ru> | Re memset - I now wonder if | compiler is even allowed to be smart here b/c strict aliasing Another way would be static const struct timespec50 zts = { 0 }; and *ts50 = zts; which is unlikely to have that problem, and which the compiler might be smart enough to optimise into a single assignment where there is padding, and perhaps even nothing where there is none. I'm also not really a fan of the #if that tests the number of bits in int and long (by testing their max values) - that is assuming that when long is wider than int, it also has wider alignment, which is not necessarily so - a system with 4 byte ints and 8 byte long, could have long with 4 byte alignment (and that struct be 12 bytes long, alogned 4). The code as it is isn't wrong, ijust the attempt to avoid the memset() when it isn't needed might fail, and do the memset() when there is nothing to clear - and if the compiler doesn't or even can't, optimise it away then it is wasteful. kre
Re: CVS commit: src/sys/compat/sys
On Fri, Jun 15, 2018 at 18:05:29 +1000, matthew green wrote: > "Robert Elz" writes: > > Module Name:src > > Committed By: kre > > Date: Fri Jun 15 07:46:59 UTC 2018 > > > > Modified Files: > > src/sys/compat/sys: time_types.h > > > > Log Message: > > If we are going to use offsetof() we'd need to include to > > get it defined. Rather than deal with potential namespace issues > > with that, just clear the entire struct, rather than attempting to > > stop after the potential padding field. If the compiler is good enough > > it should make no difference (there are just 3 fields, 2 named ones > > are assigned to, immediately after the memset() - the compiler can > > detect that, and not bother assigning (via memset()) to the unmamed > > 3rd padding field). If the compiler is not smart enough to deal > > with this, then I doubt writing 8 more zero bytes will make enough > > difference to matter. > > the compiler isn't smart apparently, and the previous change > should have fixed the problem. did we really need this too? Oh, thanks for fixing it, my bad. Re memset - I now wonder if compiler is even allowed to be smart here b/c strict aliasing (but I'm not re^n-reading that part of the standard just to satisfy my idle curiosity :) -uwe
re: CVS commit: src/sys/compat/sys
"Robert Elz" writes: > Module Name: src > Committed By: kre > Date: Fri Jun 15 07:46:59 UTC 2018 > > Modified Files: > src/sys/compat/sys: time_types.h > > Log Message: > If we are going to use offsetof() we'd need to include to > get it defined. Rather than deal with potential namespace issues > with that, just clear the entire struct, rather than attempting to > stop after the potential padding field. If the compiler is good enough > it should make no difference (there are just 3 fields, 2 named ones > are assigned to, immediately after the memset() - the compiler can > detect that, and not bother assigning (via memset()) to the unmamed > 3rd padding field). If the compiler is not smart enough to deal > with this, then I doubt writing 8 more zero bytes will make enough > difference to matter. the compiler isn't smart apparently, and the previous change should have fixed the problem. did we really need this too? .mrg.
Re: CVS commit: src/sys/compat/sys
On Tue, 20 Dec 2011, Alan Barrett wrote: On Tue, 20 Dec 2011, Matthias Drochner wrote: Modified Files: src/sys/compat/sys: rnd.h Log Message: allow kernels w/o COMPAT_50 to build What was the actual problem? Nothing defined by this file is supposed to be used in a kernel without COMPAT_50; if something is being used accidentally then I'd like to fix that. OK, I found it. rndpseudo_50.o is unconditionally compiled and added to libcompat in the kernel build directory. Everything else in sys/compat/common is handled in the same way. I am inclined to wrap most of the contents of compat/common/rndpseudo_50.c and compat/sys/rnd.h in "#ifdef COMPAT_50" guards, although other files in compat/common and compat/sys do not seem to do this. --apb (Alan Barrett)
Re: CVS commit: src/sys/compat/sys
On Tue, 20 Dec 2011, Matthias Drochner wrote: Module Name:src Committed By: drochner Date: Tue Dec 20 16:38:06 UTC 2011 Modified Files: src/sys/compat/sys: rnd.h Log Message: allow kernels w/o COMPAT_50 to build What was the actual problem? Nothing defined by this file is supposed to be used in a kernel without COMPAT_50; if something is being used accidentally then I'd like to fix that. --apb (Alan Barrett)