Tue Oct 8 07:33:15 2019 UTC ()
steal an idea from uwe@ and implement gcc-8 function type cast
friendly methods for sys/conf.h that needs it.

one alias per return type and first function are are needed,
though they can be stubbed to existing code.  the only cost is
the symbol itself, the codegen it the same.


(mrg)
diff -r1.47 -r1.48 src/sys/kern/kern_stub.c
diff -r1.152 -r1.153 src/sys/sys/conf.h

cvs diff -r1.47 -r1.48 src/sys/kern/kern_stub.c (expand / switch to unified diff)

--- src/sys/kern/kern_stub.c 2019/01/27 02:55:26 1.47
+++ src/sys/kern/kern_stub.c 2019/10/08 07:33:15 1.48
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $ */ 1/* $NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE. 55 * SUCH DAMAGE.
56 * 56 *
57 * @(#)subr_xxx.c 8.3 (Berkeley) 3/29/95 57 * @(#)subr_xxx.c 8.3 (Berkeley) 3/29/95
58 */ 58 */
59 59
60/* 60/*
61 * Stubs for system calls and facilities not included in the system. 61 * Stubs for system calls and facilities not included in the system.
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.47 2019/01/27 02:55:26 christos Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.48 2019/10/08 07:33:15 mrg Exp $");
66 66
67#ifdef _KERNEL_OPT 67#ifdef _KERNEL_OPT
68#include "opt_ktrace.h" 68#include "opt_ktrace.h"
69#include "opt_sysv.h" 69#include "opt_sysv.h"
70#include "opt_modular.h" 70#include "opt_modular.h"
71#endif 71#endif
72 72
73#include <sys/param.h> 73#include <sys/param.h>
74#include <sys/kernel.h> 74#include <sys/kernel.h>
75#include <sys/proc.h> 75#include <sys/proc.h>
76#include <sys/fstypes.h> 76#include <sys/fstypes.h>
77#include <sys/signalvar.h> 77#include <sys/signalvar.h>
78#include <sys/syscall.h> 78#include <sys/syscall.h>
@@ -175,26 +175,36 @@ __strong_alias(sys_sa_stacks,sys_nosys); @@ -175,26 +175,36 @@ __strong_alias(sys_sa_stacks,sys_nosys);
175__strong_alias(sys_sa_enable,sys_nosys); 175__strong_alias(sys_sa_enable,sys_nosys);
176__strong_alias(sys_sa_setconcurrency,sys_nosys); 176__strong_alias(sys_sa_setconcurrency,sys_nosys);
177__strong_alias(sys_sa_yield,sys_nosys); 177__strong_alias(sys_sa_yield,sys_nosys);
178__strong_alias(sys_sa_preempt,sys_nosys); 178__strong_alias(sys_sa_preempt,sys_nosys);
179__strong_alias(sys_sa_unblockyield,sys_nosys); 179__strong_alias(sys_sa_unblockyield,sys_nosys);
180 180
181/* 181/*
182 * Stubs for compat_netbsd32. 182 * Stubs for compat_netbsd32.
183 */ 183 */
184__strong_alias(dosa_register,sys_nosys); 184__strong_alias(dosa_register,sys_nosys);
185__strong_alias(sa_stacks1,sys_nosys); 185__strong_alias(sa_stacks1,sys_nosys);
186 186
187/* 187/*
 188 * Stubs for drivers. See sys/conf.h.
 189 */
 190__strong_alias(devenodev,enodev);
 191__strong_alias(deveopnotsupp,eopnotsupp);
 192__strong_alias(devnullop,nullop);
 193__strong_alias(ttyenodev,enodev);
 194__strong_alias(ttyvenodev,voidop);
 195__strong_alias(ttyvnullop,nullop);
 196
 197/*
188 * Stubs for architectures that do not support kernel preemption. 198 * Stubs for architectures that do not support kernel preemption.
189 */ 199 */
190#ifndef __HAVE_PREEMPTION 200#ifndef __HAVE_PREEMPTION
191bool 201bool
192cpu_kpreempt_enter(uintptr_t where, int s) 202cpu_kpreempt_enter(uintptr_t where, int s)
193{ 203{
194 204
195 return false; 205 return false;
196} 206}
197 207
198void 208void
199cpu_kpreempt_exit(uintptr_t where) 209cpu_kpreempt_exit(uintptr_t where)
200{ 210{

cvs diff -r1.152 -r1.153 src/sys/sys/conf.h (expand / switch to unified diff)

--- src/sys/sys/conf.h 2019/10/08 07:16:25 1.152
+++ src/sys/sys/conf.h 2019/10/08 07:33:14 1.153
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: conf.h,v 1.152 2019/10/08 07:16:25 mrg Exp $ */ 1/* $NetBSD: conf.h,v 1.153 2019/10/08 07:33:14 mrg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1990, 1993 4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -116,50 +116,57 @@ devmajor_t cdevsw_lookup_major(const str @@ -116,50 +116,57 @@ devmajor_t cdevsw_lookup_major(const str
116#define dev_type_write(n) int n (dev_t, struct uio *, int) 116#define dev_type_write(n) int n (dev_t, struct uio *, int)
117#define dev_type_ioctl(n) \ 117#define dev_type_ioctl(n) \
118 int n (dev_t, u_long, void *, int, struct lwp *) 118 int n (dev_t, u_long, void *, int, struct lwp *)
119#define dev_type_stop(n) void n (struct tty *, int) 119#define dev_type_stop(n) void n (struct tty *, int)
120#define dev_type_tty(n) struct tty * n (dev_t) 120#define dev_type_tty(n) struct tty * n (dev_t)
121#define dev_type_poll(n) int n (dev_t, int, struct lwp *) 121#define dev_type_poll(n) int n (dev_t, int, struct lwp *)
122#define dev_type_mmap(n) paddr_t n (dev_t, off_t, int) 122#define dev_type_mmap(n) paddr_t n (dev_t, off_t, int)
123#define dev_type_strategy(n) void n (struct buf *) 123#define dev_type_strategy(n) void n (struct buf *)
124#define dev_type_dump(n) int n (dev_t, daddr_t, void *, size_t) 124#define dev_type_dump(n) int n (dev_t, daddr_t, void *, size_t)
125#define dev_type_size(n) int n (dev_t) 125#define dev_type_size(n) int n (dev_t)
126#define dev_type_kqfilter(n) int n (dev_t, struct knote *) 126#define dev_type_kqfilter(n) int n (dev_t, struct knote *)
127#define dev_type_discard(n) int n (dev_t, off_t, off_t) 127#define dev_type_discard(n) int n (dev_t, off_t, off_t)
128 128
129#define noopen ((dev_type_open((*)))enodev) 129int devenodev(dev_t, ...);
130#define noclose ((dev_type_close((*)))enodev) 130int deveopnotsupp(dev_t, ...);
131#define noread ((dev_type_read((*)))enodev) 131int devnullop(dev_t, ...);
132#define nowrite ((dev_type_write((*)))enodev) 132int ttyenodev(struct tty *, ...);
133#define noioctl ((dev_type_ioctl((*)))enodev) 133void ttyvenodev(struct tty *, ...);
134#define nostop ((dev_type_stop((*)))enodev) 134void ttyvnullop(struct tty *, ...);
 135
 136#define noopen ((dev_type_open((*)))devenodev)
 137#define noclose ((dev_type_close((*)))devenodev)
 138#define noread ((dev_type_read((*)))devenodev)
 139#define nowrite ((dev_type_write((*)))devenodev)
 140#define noioctl ((dev_type_ioctl((*)))devenodev)
 141#define nostop ((dev_type_stop((*)))ttyvenodev)
135#define notty NULL 142#define notty NULL
136#define nopoll seltrue 143#define nopoll seltrue
137paddr_t nommap(dev_t, off_t, int); 144paddr_t nommap(dev_t, off_t, int);
138#define nodump ((dev_type_dump((*)))enodev) 145#define nodump ((dev_type_dump((*)))devenodev)
139#define nosize NULL 146#define nosize NULL
140#define nokqfilter seltrue_kqfilter 147#define nokqfilter seltrue_kqfilter
141#define nodiscard ((dev_type_discard((*)))enodev) 148#define nodiscard ((dev_type_discard((*)))devenodev)
142 149
143#define nullopen ((dev_type_open((*)))nullop) 150#define nullopen ((dev_type_open((*)))devnullop)
144#define nullclose ((dev_type_close((*)))nullop) 151#define nullclose ((dev_type_close((*)))devnullop)
145#define nullread ((dev_type_read((*)))nullop) 152#define nullread ((dev_type_read((*)))devnullop)
146#define nullwrite ((dev_type_write((*)))nullop) 153#define nullwrite ((dev_type_write((*)))devnullop)
147#define nullioctl ((dev_type_ioctl((*)))nullop) 154#define nullioctl ((dev_type_ioctl((*)))devnullop)
148#define nullstop ((dev_type_stop((*)))nullop) 155#define nullstop ((dev_type_stop((*)))ttyvnullop)
149#define nullpoll ((dev_type_poll((*)))nullop) 156#define nullpoll ((dev_type_poll((*)))devnullop)
150#define nulldump ((dev_type_dump((*)))nullop) 157#define nulldump ((dev_type_dump((*)))devnullop)
151#define nullkqfilter ((dev_type_kqfilter((*)))eopnotsupp) 158#define nullkqfilter ((dev_type_kqfilter((*)))deveopnotsupp)
152#define nulldiscard ((dev_type_discard((*)))nullop) 159#define nulldiscard ((dev_type_discard((*)))devnullop)
153 160
154/* device access wrappers. */ 161/* device access wrappers. */
155 162
156dev_type_open(bdev_open); 163dev_type_open(bdev_open);
157dev_type_close(bdev_close); 164dev_type_close(bdev_close);
158dev_type_strategy(bdev_strategy); 165dev_type_strategy(bdev_strategy);
159dev_type_ioctl(bdev_ioctl); 166dev_type_ioctl(bdev_ioctl);
160dev_type_dump(bdev_dump); 167dev_type_dump(bdev_dump);
161dev_type_size(bdev_size); 168dev_type_size(bdev_size);
162dev_type_discard(bdev_discard); 169dev_type_discard(bdev_discard);
163 170
164dev_type_open(cdev_open); 171dev_type_open(cdev_open);
165dev_type_close(cdev_close); 172dev_type_close(cdev_close);