VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
97870c34b4532 arch/um/os-Linux/util.c    (Alex Dewar                     2019-08-25 10:49:18 +0100   1) // SPDX-License-Identifier: GPL-2.0
4fef0c10fa174 arch/um/os-Linux/util.c    (Gennady Sharapov               2006-01-18 17:42:41 -0800   2) /*
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800   3)  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700   4)  */
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700   5) 
39f75da7bcc82 arch/um/os-Linux/util.c    (Alexey Dobriyan                2021-08-02 23:40:31 +0300   6) #include <stdarg.h>
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700   7) #include <stdio.h>
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700   8) #include <stdlib.h>
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700   9) #include <unistd.h>
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  10) #include <errno.h>
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  11) #include <signal.h>
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  12) #include <string.h>
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  13) #include <termios.h>
5e1121cd43d4d arch/um/os-Linux/util.c    (Ignat Korchagin                2020-07-19 22:02:21 +0100  14) #include <sys/wait.h>
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  15) #include <sys/mman.h>
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  16) #include <sys/utsname.h>
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900  17) #include <init.h>
37185b3324087 arch/um/os-Linux/util.c    (Al Viro                        2012-10-08 03:27:32 +0100  18) #include <os.h>
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  19) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  20) void stack_protections(unsigned long address)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  21) {
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  22) 	if (mprotect((void *) address, UM_THREAD_SIZE,
57598fd7b31f6 arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-10 22:22:30 -0700  23) 		    PROT_READ | PROT_WRITE | PROT_EXEC) < 0)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  24) 		panic("protecting stack failed, errno = %d", errno);
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  25) }
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  26) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  27) int raw(int fd)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  28) {
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  29) 	struct termios tt;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  30) 	int err;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  31) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  32) 	CATCH_EINTR(err = tcgetattr(fd, &tt));
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  33) 	if (err < 0)
b4fd310e16347 arch/um/kernel/user_util.c (Jeff Dike                      2005-09-16 19:27:49 -0700  34) 		return -errno;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  35) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  36) 	cfmakeraw(&tt);
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  37) 
4fef0c10fa174 arch/um/os-Linux/util.c    (Gennady Sharapov               2006-01-18 17:42:41 -0800  38) 	CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt));
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  39) 	if (err < 0)
b4fd310e16347 arch/um/kernel/user_util.c (Jeff Dike                      2005-09-16 19:27:49 -0700  40) 		return -errno;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  41) 
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  42) 	/*
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  43) 	 * XXX tcsetattr could have applied only some changes
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  44) 	 * (and cfmakeraw() is a set of changes)
5134d8fea06ab arch/um/os-Linux/util.c    (Jeff Dike                      2008-02-08 04:22:08 -0800  45) 	 */
57598fd7b31f6 arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-10 22:22:30 -0700  46) 	return 0;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  47) }
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  48) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  49) void setup_machinename(char *machine_out)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  50) {
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  51) 	struct utsname host;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  52) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  53) 	uname(&host);
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  54) #ifdef UML_CONFIG_UML_X86
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  55) # ifndef UML_CONFIG_64BIT
8e5cb35a60c87 arch/um/kernel/user_util.c (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:14 +0200  56) 	if (!strcmp(host.machine, "x86_64")) {
8e5cb35a60c87 arch/um/kernel/user_util.c (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:14 +0200  57) 		strcpy(machine_out, "i686");
8e5cb35a60c87 arch/um/kernel/user_util.c (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:14 +0200  58) 		return;
8e5cb35a60c87 arch/um/kernel/user_util.c (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:14 +0200  59) 	}
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  60) # else
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  61) 	if (!strcmp(host.machine, "i686")) {
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  62) 		strcpy(machine_out, "x86_64");
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  63) 		return;
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  64) 	}
69fada32d868d arch/um/os-Linux/util.c    (Paolo 'Blaisorblade' Giarrusso 2006-10-11 01:21:36 -0700  65) # endif
8e5cb35a60c87 arch/um/kernel/user_util.c (Paolo 'Blaisorblade' Giarrusso 2005-09-21 18:39:14 +0200  66) #endif
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  67) 	strcpy(machine_out, host.machine);
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  68) }
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  69) 
b4ffb6ad8d847 arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:50:59 -0700  70) void setup_hostinfo(char *buf, int len)
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  71) {
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  72) 	struct utsname host;
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  73) 
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  74) 	uname(&host);
b4ffb6ad8d847 arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:50:59 -0700  75) 	snprintf(buf, len, "%s %s %s %s %s", host.sysname, host.nodename,
b4ffb6ad8d847 arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:50:59 -0700  76) 		 host.release, host.version, host.machine);
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  77) }
^1da177e4c3f4 arch/um/kernel/user_util.c (Linus Torvalds                 2005-04-16 15:20:36 -0700  78) 
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  79) /*
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  80)  * We cannot use glibc's abort(). It makes use of tgkill() which
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  81)  * has no effect within UML's kernel threads.
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  82)  * After that glibc would execute an invalid instruction to kill
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  83)  * the calling process and UML crashes with SIGSEGV.
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  84)  */
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  85) static inline void __attribute__ ((noreturn)) uml_abort(void)
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  86) {
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  87) 	sigset_t sig;
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  88) 
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  89) 	fflush(NULL);
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  90) 
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  91) 	if (!sigemptyset(&sig) && !sigaddset(&sig, SIGABRT))
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  92) 		sigprocmask(SIG_UNBLOCK, &sig, 0);
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  93) 
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  94) 	for (;;)
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  95) 		if (kill(getpid(), SIGABRT) < 0)
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  96) 			exit(127);
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  97) }
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700  98) 
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200  99) /*
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 100)  * UML helper threads must not handle SIGWINCH/INT/TERM
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 101)  */
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 102) void os_fix_helper_signals(void)
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 103) {
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 104) 	signal(SIGWINCH, SIG_IGN);
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 105) 	signal(SIGINT, SIG_DFL);
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 106) 	signal(SIGTERM, SIG_DFL);
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 107) }
91d44ff860a9e arch/um/os-Linux/util.c    (Richard Weinberger             2013-08-18 13:30:08 +0200 108) 
63843c265fd0e arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:51:39 -0700 109) void os_dump_core(void)
63843c265fd0e arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:51:39 -0700 110) {
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 111) 	int pid;
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 112) 
63843c265fd0e arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:51:39 -0700 113) 	signal(SIGSEGV, SIG_DFL);
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 114) 
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 115) 	/*
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 116) 	 * We are about to SIGTERM this entire process group to ensure that
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 117) 	 * nothing is around to run after the kernel exits.  The
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 118) 	 * kernel wants to abort, not die through SIGTERM, so we
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 119) 	 * ignore it here.
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 120) 	 */
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 121) 
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 122) 	signal(SIGTERM, SIG_IGN);
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 123) 	kill(0, SIGTERM);
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 124) 	/*
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 125) 	 * Most of the other processes associated with this UML are
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 126) 	 * likely sTopped, so give them a SIGCONT so they see the
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 127) 	 * SIGTERM.
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 128) 	 */
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 129) 	kill(0, SIGCONT);
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 130) 
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 131) 	/*
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 132) 	 * Now, having sent signals to everyone but us, make sure they
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 133) 	 * die by ptrace.  Processes can survive what's been done to
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 134) 	 * them so far - the mechanism I understand is receiving a
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 135) 	 * SIGSEGV and segfaulting immediately upon return.  There is
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 136) 	 * always a SIGSEGV pending, and (I'm guessing) signals are
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 137) 	 * processed in numeric order so the SIGTERM (signal 15 vs
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 138) 	 * SIGSEGV being signal 11) is never handled.
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 139) 	 *
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 140) 	 * Run a waitpid loop until we get some kind of error.
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 141) 	 * Hopefully, it's ECHILD, but there's not a lot we can do if
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 142) 	 * it's something else.  Tell os_kill_ptraced_process not to
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 143) 	 * wait for the child to report its death because there's
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 144) 	 * nothing reasonable to do if that fails.
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 145) 	 */
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 146) 
4dbed85a35ed3 arch/um/os-Linux/util.c    (Stanislaw Gruszka              2007-12-17 16:19:46 -0800 147) 	while ((pid = waitpid(-1, NULL, WNOHANG | __WALL)) > 0)
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 148) 		os_kill_ptraced_process(pid, 0);
a24864a1d52a9 arch/um/os-Linux/util.c    (Lepton Wu                      2007-10-16 01:27:35 -0700 149) 
b2db21997f439 arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-17 15:44:11 -0700 150) 	uml_abort();
63843c265fd0e arch/um/os-Linux/util.c    (Jeff Dike                      2007-05-06 14:51:39 -0700 151) }
d634f194d4e2e arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-24 17:13:01 -0700 152) 
d634f194d4e2e arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-24 17:13:01 -0700 153) void um_early_printk(const char *s, unsigned int n)
d634f194d4e2e arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-24 17:13:01 -0700 154) {
d634f194d4e2e arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-24 17:13:01 -0700 155) 	printf("%.*s", n, s);
d634f194d4e2e arch/um/os-Linux/util.c    (Richard Weinberger             2011-05-24 17:13:01 -0700 156) }
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 157) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 158) static int quiet_info;
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 159) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 160) static int __init quiet_cmd_param(char *str, int *add)
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 161) {
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 162) 	quiet_info = 1;
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 163) 	return 0;
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 164) }
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 165) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 166) __uml_setup("quiet", quiet_cmd_param,
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 167) "quiet\n"
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 168) "    Turns off information messages during boot.\n\n");
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 169) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 170) void os_info(const char *fmt, ...)
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 171) {
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 172) 	va_list list;
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 173) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 174) 	if (quiet_info)
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 175) 		return;
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 176) 
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 177) 	va_start(list, fmt);
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 178) 	vfprintf(stderr, fmt, list);
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 179) 	va_end(list);
f7887ee11082b arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:16:05 +0900 180) }
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 181) 
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 182) void os_warn(const char *fmt, ...)
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 183) {
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 184) 	va_list list;
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 185) 
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 186) 	va_start(list, fmt);
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 187) 	vfprintf(stderr, fmt, list);
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 188) 	va_end(list);
721ccae88d04f arch/um/os-Linux/util.c    (Masami Hiramatsu               2017-05-18 02:18:22 +0900 189) }