Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isystem: ship and use stdarg.h

Ship minimal stdarg.h (1 type, 4 macros) as <linux/stdarg.h>.
stdarg.h is the only userspace header commonly used in the kernel.

GPL 2 version of <stdarg.h> can be extracted from
http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Alexey Dobriyan and committed by
Masahiro Yamada
c0891ac1 39f75da7

+41 -31
+1 -1
arch/parisc/kernel/firmware.c
··· 51 51 * prumpf 991016 52 52 */ 53 53 54 - #include <stdarg.h> 54 + #include <linux/stdarg.h> 55 55 56 56 #include <linux/delay.h> 57 57 #include <linux/init.h>
+1 -1
arch/powerpc/kernel/prom_init.c
··· 14 14 /* we cannot use FORTIFY as it brings in new symbols */ 15 15 #define __NO_FORTIFY 16 16 17 - #include <stdarg.h> 17 + #include <linux/stdarg.h> 18 18 #include <linux/kernel.h> 19 19 #include <linux/string.h> 20 20 #include <linux/init.h>
+1 -1
arch/powerpc/kernel/rtas.c
··· 7 7 * Copyright (C) 2001 IBM. 8 8 */ 9 9 10 - #include <stdarg.h> 10 + #include <linux/stdarg.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/types.h> 13 13 #include <linux/spinlock.h>
+1 -1
arch/powerpc/kernel/udbg.c
··· 5 5 * c 2001 PPC 64 Team, IBM Corp 6 6 */ 7 7 8 - #include <stdarg.h> 8 + #include <linux/stdarg.h> 9 9 #include <linux/types.h> 10 10 #include <linux/sched.h> 11 11 #include <linux/console.h>
+1 -1
arch/s390/boot/pgm_check_info.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/kernel.h> 3 + #include <linux/stdarg.h> 3 4 #include <linux/string.h> 4 5 #include <linux/ctype.h> 5 6 #include <asm/stacktrace.h> ··· 9 8 #include <asm/setup.h> 10 9 #include <asm/sclp.h> 11 10 #include <asm/uv.h> 12 - #include <stdarg.h> 13 11 #include "boot.h" 14 12 15 13 const char hex_asc[] = "0123456789abcdef";
+1 -1
arch/x86/boot/boot.h
··· 18 18 19 19 #ifndef __ASSEMBLY__ 20 20 21 - #include <stdarg.h> 21 + #include <linux/stdarg.h> 22 22 #include <linux/types.h> 23 23 #include <linux/edd.h> 24 24 #include <asm/setup.h>
+1 -1
drivers/firmware/efi/libstub/efi-stub-helper.c
··· 7 7 * Copyright 2011 Intel Corporation; author Matt Fleming 8 8 */ 9 9 10 - #include <stdarg.h> 10 + #include <linux/stdarg.h> 11 11 12 12 #include <linux/ctype.h> 13 13 #include <linux/efi.h>
+1 -1
drivers/firmware/efi/libstub/vsprintf.c
··· 10 10 * Oh, it's a waste of space, but oh-so-yummy for debugging. 11 11 */ 12 12 13 - #include <stdarg.h> 13 + #include <linux/stdarg.h> 14 14 15 15 #include <linux/compiler.h> 16 16 #include <linux/ctype.h>
+1 -1
drivers/gpu/drm/amd/display/dc/dc_helper.c
··· 28 28 */ 29 29 30 30 #include <linux/delay.h> 31 + #include <linux/stdarg.h> 31 32 32 33 #include "dm_services.h" 33 - #include <stdarg.h> 34 34 35 35 #include "dc.h" 36 36 #include "dc_dmub_srv.h"
+1 -1
drivers/gpu/drm/drm_print.c
··· 25 25 26 26 #define DEBUG /* for pr_debug() */ 27 27 28 - #include <stdarg.h> 28 + #include <linux/stdarg.h> 29 29 30 30 #include <linux/io.h> 31 31 #include <linux/moduleparam.h>
+1 -1
drivers/isdn/capi/capiutil.c
··· 379 379 /*2f */ "Useruserdata" 380 380 }; 381 381 382 - #include <stdarg.h> 382 + #include <linux/stdarg.h> 383 383 384 384 /*-------------------------------------------------------*/ 385 385 static _cdebbuf *bufprint(_cdebbuf *cdb, char *fmt, ...)
+1 -1
drivers/macintosh/via-cuda.c
··· 9 9 * 10 10 * Copyright (C) 1996 Paul Mackerras. 11 11 */ 12 - #include <stdarg.h> 12 + #include <linux/stdarg.h> 13 13 #include <linux/types.h> 14 14 #include <linux/errno.h> 15 15 #include <linux/kernel.h>
+1 -1
drivers/macintosh/via-pmu.c
··· 18 18 * a sleep or a freq. switch 19 19 * 20 20 */ 21 - #include <stdarg.h> 21 + #include <linux/stdarg.h> 22 22 #include <linux/mutex.h> 23 23 #include <linux/types.h> 24 24 #include <linux/errno.h>
+1 -1
drivers/staging/media/atomisp/pci/hive_isp_css_include/print_support.h
··· 16 16 #ifndef __PRINT_SUPPORT_H_INCLUDED__ 17 17 #define __PRINT_SUPPORT_H_INCLUDED__ 18 18 19 - #include <stdarg.h> 19 + #include <linux/stdarg.h> 20 20 21 21 extern int (*sh_css_printf)(const char *fmt, va_list args); 22 22 /* depends on host supplied print function in ia_css_init() */
+1 -1
drivers/staging/media/atomisp/pci/ia_css_env.h
··· 17 17 #define __IA_CSS_ENV_H 18 18 19 19 #include <type_support.h> 20 - #include <stdarg.h> /* va_list */ 20 + #include <linux/stdarg.h> /* va_list */ 21 21 #include "ia_css_types.h" 22 22 #include "ia_css_acc_types.h" 23 23
+1 -1
drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h
··· 19 19 /*! \file */ 20 20 21 21 #include <type_support.h> 22 - #include <stdarg.h> 22 + #include <linux/stdarg.h> 23 23 #include "ia_css_types.h" 24 24 #include "ia_css_binary.h" 25 25 #include "ia_css_frame_public.h"
+1 -1
drivers/staging/media/atomisp/pci/sh_css_internal.h
··· 20 20 #include <math_support.h> 21 21 #include <type_support.h> 22 22 #include <platform_support.h> 23 - #include <stdarg.h> 23 + #include <linux/stdarg.h> 24 24 25 25 #if !defined(ISP2401) 26 26 #include "input_formatter.h"
+1 -1
fs/befs/debug.c
··· 14 14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15 15 #ifdef __KERNEL__ 16 16 17 - #include <stdarg.h> 17 + #include <linux/stdarg.h> 18 18 #include <linux/string.h> 19 19 #include <linux/spinlock.h> 20 20 #include <linux/kernel.h>
+1 -1
fs/reiserfs/prints.c
··· 8 8 #include <linux/string.h> 9 9 #include <linux/buffer_head.h> 10 10 11 - #include <stdarg.h> 11 + #include <linux/stdarg.h> 12 12 13 13 static char error_buf[1024]; 14 14 static char fmt_buf[1024];
+1 -1
fs/ufs/super.c
··· 70 70 #include <linux/module.h> 71 71 #include <linux/bitops.h> 72 72 73 - #include <stdarg.h> 73 + #include <linux/stdarg.h> 74 74 75 75 #include <linux/uaccess.h> 76 76
+1 -1
include/acpi/platform/acgcc.h
··· 22 22 #define va_arg(v, l) __builtin_va_arg(v, l) 23 23 #define va_copy(d, s) __builtin_va_copy(d, s) 24 24 #else 25 - #include <stdarg.h> 25 + #include <linux/stdarg.h> 26 26 #endif 27 27 #endif 28 28
+1 -1
include/linux/kernel.h
··· 2 2 #ifndef _LINUX_KERNEL_H 3 3 #define _LINUX_KERNEL_H 4 4 5 - #include <stdarg.h> 5 + #include <linux/stdarg.h> 6 6 #include <linux/align.h> 7 7 #include <linux/limits.h> 8 8 #include <linux/linkage.h>
+1 -1
include/linux/printk.h
··· 2 2 #ifndef __KERNEL_PRINTK__ 3 3 #define __KERNEL_PRINTK__ 4 4 5 - #include <stdarg.h> 5 + #include <linux/stdarg.h> 6 6 #include <linux/init.h> 7 7 #include <linux/kern_levels.h> 8 8 #include <linux/linkage.h>
+11
include/linux/stdarg.h
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + #ifndef _LINUX_STDARG_H 3 + #define _LINUX_STDARG_H 4 + 5 + typedef __builtin_va_list va_list; 6 + #define va_start(v, l) __builtin_va_start(v, l) 7 + #define va_end(v) __builtin_va_end(v) 8 + #define va_arg(v, T) __builtin_va_arg(v, T) 9 + #define va_copy(d, s) __builtin_va_copy(d, s) 10 + 11 + #endif
+1 -1
include/linux/string.h
··· 6 6 #include <linux/types.h> /* for size_t */ 7 7 #include <linux/stddef.h> /* for NULL */ 8 8 #include <linux/errno.h> /* for E2BIG */ 9 - #include <stdarg.h> 9 + #include <linux/stdarg.h> 10 10 #include <uapi/linux/string.h> 11 11 12 12 extern char *strndup_user(const char __user *, long);
+1 -2
lib/debug_info.c
··· 5 5 * CONFIG_DEBUG_INFO_REDUCED. Please do not add actual code. However, 6 6 * adding appropriate #includes is fine. 7 7 */ 8 - #include <stdarg.h> 9 - 10 8 #include <linux/cred.h> 11 9 #include <linux/crypto.h> 12 10 #include <linux/dcache.h> ··· 20 22 #include <linux/net.h> 21 23 #include <linux/sched.h> 22 24 #include <linux/slab.h> 25 + #include <linux/stdarg.h> 23 26 #include <linux/types.h> 24 27 #include <net/addrconf.h> 25 28 #include <net/sock.h>
+1 -1
lib/kasprintf.c
··· 5 5 * Copyright (C) 1991, 1992 Linus Torvalds 6 6 */ 7 7 8 - #include <stdarg.h> 8 + #include <linux/stdarg.h> 9 9 #include <linux/export.h> 10 10 #include <linux/slab.h> 11 11 #include <linux/types.h>
+1 -1
lib/kunit/string-stream.h
··· 11 11 12 12 #include <linux/spinlock.h> 13 13 #include <linux/types.h> 14 - #include <stdarg.h> 14 + #include <linux/stdarg.h> 15 15 16 16 struct string_stream_fragment { 17 17 struct kunit *test;
+1 -1
lib/vsprintf.c
··· 17 17 * - scnprintf and vscnprintf 18 18 */ 19 19 20 - #include <stdarg.h> 20 + #include <linux/stdarg.h> 21 21 #include <linux/build_bug.h> 22 22 #include <linux/clk.h> 23 23 #include <linux/clk-provider.h>
+1 -1
mm/kfence/report.c
··· 5 5 * Copyright (C) 2020, Google LLC. 6 6 */ 7 7 8 - #include <stdarg.h> 8 + #include <linux/stdarg.h> 9 9 10 10 #include <linux/kernel.h> 11 11 #include <linux/lockdep.h>
+1 -1
net/batman-adv/log.c
··· 7 7 #include "log.h" 8 8 #include "main.h" 9 9 10 - #include <stdarg.h> 10 + #include <linux/stdarg.h> 11 11 12 12 #include "trace.h" 13 13