uml: tidy kern_util.h
Tidy kern_util.h. It turns out that most of the function declarations aren't used, so they can go away. os.h no longer includes kern_util.h, so files which got it through os.h now need to include it directly. A number of other files never needed it, so these includes are deleted. The structure which was used to pass signal handlers from the kernel side to the userspace side is gone. Instead, the handlers are declared here, and used directly from libc code. This allows arch/um/os-Linux/trap.c to be deleted, with its remnants being moved to arch/um/os-Linux/skas/trap.c. arch/um/os-Linux/tty.c had its inclusions changed, and it needed some style attention, so it got tidied. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
0ba7fe03b6
commit
edea138584
@@ -4,7 +4,7 @@
|
||||
#
|
||||
|
||||
obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
|
||||
registers.o sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o \
|
||||
registers.o sigio.o signal.o start_up.o time.o tty.o uaccess.o \
|
||||
umid.o tls.o user_syms.o util.o drivers/ sys-$(SUBARCH)/ skas/
|
||||
|
||||
obj-$(CONFIG_TTY_LOG) += tty_log.o
|
||||
@@ -12,7 +12,7 @@ user-objs-$(CONFIG_TTY_LOG) += tty_log.o
|
||||
|
||||
USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
|
||||
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
|
||||
trap.o tty.o tls.o uaccess.o umid.o util.o
|
||||
tty.o tls.o uaccess.o umid.o util.o
|
||||
|
||||
CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "aio.h"
|
||||
#include "init.h"
|
||||
#include "kern_constants.h"
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
#include "user.h"
|
||||
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/uio.h>
|
||||
#include "kern_constants.h"
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
#include "tuntap.h"
|
||||
#include "user.h"
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <sys/uio.h>
|
||||
#include "os.h"
|
||||
#include "user.h"
|
||||
#include "kern_util.h"
|
||||
|
||||
static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
|
||||
{
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <sys/poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "kern_util.h"
|
||||
#include "user.h"
|
||||
#include "process.h"
|
||||
#include "sigio.h"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/statfs.h>
|
||||
#include "kern_util.h"
|
||||
#include "user.h"
|
||||
#include "mem_user.h"
|
||||
#include "init.h"
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <strings.h>
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
#include "sysdep/barrier.h"
|
||||
#include "sysdep/sigcontext.h"
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "as-layout.h"
|
||||
#include "chan_user.h"
|
||||
#include "kern_constants.h"
|
||||
#include "kern_util.h"
|
||||
#include "mem.h"
|
||||
#include "os.h"
|
||||
#include "process.h"
|
||||
|
@@ -3,22 +3,26 @@
|
||||
* Licensed under the GPL
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#include "kern_util.h"
|
||||
#include "skas.h"
|
||||
#include "ptrace_user.h"
|
||||
#include "sysdep/ptrace_user.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include "sysdep/ptrace.h"
|
||||
#include "kern_constants.h"
|
||||
#include "as-layout.h"
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
#include "sigcontext.h"
|
||||
#include "task.h"
|
||||
|
||||
void (*sig_info[NSIG])(int, struct uml_pt_regs *) = {
|
||||
[SIGTRAP] = relay_signal,
|
||||
[SIGFPE] = relay_signal,
|
||||
[SIGILL] = relay_signal,
|
||||
[SIGWINCH] = winch,
|
||||
[SIGBUS] = bus_handler,
|
||||
[SIGSEGV] = segv_handler,
|
||||
[SIGIO] = sigio_handler,
|
||||
[SIGVTALRM] = timer_handler };
|
||||
|
||||
static struct uml_pt_regs ksig_regs[UM_NR_CPUS];
|
||||
|
||||
void sig_handler_common_skas(int sig, void *sc_ptr)
|
||||
|
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
||||
* Licensed under the GPL
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
#include "os.h"
|
||||
#include "sysdep/ptrace.h"
|
||||
|
||||
/* Initialized from linux_main() */
|
||||
void (*sig_info[NSIG])(int, struct uml_pt_regs *);
|
||||
|
||||
void os_fill_handlinfo(struct kern_handlers h)
|
||||
{
|
||||
sig_info[SIGTRAP] = h.relay_signal;
|
||||
sig_info[SIGFPE] = h.relay_signal;
|
||||
sig_info[SIGILL] = h.relay_signal;
|
||||
sig_info[SIGWINCH] = h.winch;
|
||||
sig_info[SIGBUS] = h.bus_handler;
|
||||
sig_info[SIGSEGV] = h.page_fault;
|
||||
sig_info[SIGIO] = h.sigio_handler;
|
||||
sig_info[SIGVTALRM] = h.timer_handler;
|
||||
}
|
@@ -1,13 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
|
||||
/*
|
||||
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
||||
* Licensed under the GPL
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include "kern_constants.h"
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
#include "user.h"
|
||||
#include "kern_util.h"
|
||||
|
||||
struct grantpt_info {
|
||||
int fd;
|
||||
@@ -26,36 +29,34 @@ static void grantpt_cb(void *arg)
|
||||
int get_pty(void)
|
||||
{
|
||||
struct grantpt_info info;
|
||||
int fd;
|
||||
int fd, err;
|
||||
|
||||
fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0);
|
||||
if(fd < 0){
|
||||
printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd);
|
||||
return(fd);
|
||||
fd = open("/dev/ptmx", O_RDWR);
|
||||
if (fd < 0) {
|
||||
err = -errno;
|
||||
printk(UM_KERN_ERR "get_pty : Couldn't open /dev/ptmx - "
|
||||
"err = %d\n", errno);
|
||||
return err;
|
||||
}
|
||||
|
||||
info.fd = fd;
|
||||
initial_thread_cb(grantpt_cb, &info);
|
||||
|
||||
if(info.res < 0){
|
||||
printk("get_pty : Couldn't grant pty - errno = %d\n",
|
||||
-info.err);
|
||||
return(-1);
|
||||
if (info.res < 0) {
|
||||
err = -info.err;
|
||||
printk(UM_KERN_ERR "get_pty : Couldn't grant pty - "
|
||||
"errno = %d\n", -info.err);
|
||||
goto out;
|
||||
}
|
||||
if(unlockpt(fd) < 0){
|
||||
printk("get_pty : Couldn't unlock pty - errno = %d\n", errno);
|
||||
return(-1);
|
||||
}
|
||||
return(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Overrides for Emacs so that we follow Linus's tabbing style.
|
||||
* Emacs will notice this stuff at the end of the file and automatically
|
||||
* adjust the settings for this buffer only. This must remain at the end
|
||||
* of the file.
|
||||
* ---------------------------------------------------------------------------
|
||||
* Local variables:
|
||||
* c-file-style: "linux"
|
||||
* End:
|
||||
*/
|
||||
if (unlockpt(fd) < 0) {
|
||||
err = -errno;
|
||||
printk(UM_KERN_ERR "get_pty : Couldn't unlock pty - "
|
||||
"errno = %d\n", errno);
|
||||
goto out;
|
||||
}
|
||||
return fd;
|
||||
out:
|
||||
close(fd);
|
||||
return err;
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include <sys/time.h>
|
||||
#include "init.h"
|
||||
#include "user.h"
|
||||
#include "kern_util.h"
|
||||
#include "os.h"
|
||||
|
||||
#define TTY_LOG_DIR "./"
|
||||
|
Reference in New Issue
Block a user