mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] - UML - remove some dead code
@ 2004-11-14 23:04 Jeff Dike
  2004-11-14 23:08 ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2004-11-14 23:04 UTC (permalink / raw)
  To: akpm, Blaisorblade; +Cc: linux-kernel, Bodo Stroesser

Bodo pointed out that arch/um/kernel/skas/exec_user.c is dead code, so
this removes it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>

Index: 2.6.9/arch/um/kernel/skas/Makefile
===================================================================
--- 2.6.9.orig/arch/um/kernel/skas/Makefile	2004-11-14 15:31:24.000000000 -0500
+++ 2.6.9/arch/um/kernel/skas/Makefile	2004-11-14 15:31:37.000000000 -0500
@@ -1,11 +1,11 @@
 # 
-# Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com)
 # Licensed under the GPL
 #
 
-obj-y := exec_kern.o exec_user.o mem.o mem_user.o mmu.o process.o \
-	process_kern.o syscall_kern.o syscall_user.o time.o tlb.o trap_user.o \
-	uaccess.o sys-$(SUBARCH)/
+obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \
+	syscall_kern.o syscall_user.o time.o tlb.o trap_user.o uaccess.o \
+	sys-$(SUBARCH)/
 
 subdir-y := util
 
Index: 2.6.9/arch/um/kernel/skas/exec_user.c
===================================================================
--- 2.6.9.orig/arch/um/kernel/skas/exec_user.c	2004-11-14 15:31:24.000000000 -0500
+++ 2.6.9/arch/um/kernel/skas/exec_user.c	2003-09-15 09:40:47.000000000 -0400
@@ -1,63 +0,0 @@
-/* 
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
- * Licensed under the GPL
- */
-
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <sched.h>
-#include <sys/wait.h>
-#include <sys/ptrace.h>
-#include "user.h"
-#include "kern_util.h"
-#include "user_util.h"
-#include "os.h"
-#include "time_user.h"
-
-static int user_thread_tramp(void *arg)
-{
-	if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0)
-		panic("user_thread_tramp - PTRACE_TRACEME failed, "
-		      "errno = %d\n", errno);
-	enable_timer();
-	os_stop_process(os_getpid());
-	return(0);
-}
-
-int user_thread(unsigned long stack, int flags)
-{
-	int pid, status, err;
-
-	pid = clone(user_thread_tramp, (void *) stack_sp(stack), 
-		    flags | CLONE_FILES | SIGCHLD, NULL);
-	if(pid < 0){
-		printk("user_thread - clone failed, errno = %d\n", errno);
-		return(pid);
-	}
-
-	CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
-	if(err < 0){
-		printk("user_thread - waitpid failed, errno = %d\n", errno);
-		return(-errno);
-	}
-
-	if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP)){
-		printk("user_thread - trampoline didn't stop, status = %d\n", 
-		       status);
-		return(-EINVAL);
-	}
-
-	return(pid);
-}
-
-/*
- * 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:
- */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] - UML - remove some dead code
  2004-11-14 23:04 [PATCH] - UML - remove some dead code Jeff Dike
@ 2004-11-14 23:08 ` Arnd Bergmann
  2004-11-15  2:11   ` [PATCH] - UML - cleanup include/asm-um/unistd.h Chris Wedgwood
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2004-11-14 23:08 UTC (permalink / raw)
  To: Jeff Dike; +Cc: akpm, Blaisorblade, linux-kernel, Bodo Stroesser

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

On Maandag 15 November 2004 00:04, Jeff Dike wrote:
> Bodo pointed out that arch/um/kernel/skas/exec_user.c is dead code, so
> this removes it.

Speaking of dead code: I think you should be able to mostly get rid of
the KERNEL_CALL hack in include/asm-um/unistd.h, since all kernel syscalls
except execve are now gone.

It should be enough to have an out of line version of execve and do

#undef __KERNEL_SYSCALLS
#include "asm/arch/unistd.h"
extern int execve(const char *filename, char *const argv[],
			char *const envp[]);

	Arnd <><

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] - UML - cleanup include/asm-um/unistd.h
  2004-11-14 23:08 ` Arnd Bergmann
@ 2004-11-15  2:11   ` Chris Wedgwood
  2004-11-15  5:20     ` Jeff Dike
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Wedgwood @ 2004-11-15  2:11 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Jeff Dike, akpm, Blaisorblade, linux-kernel, Bodo Stroesser

On Mon, Nov 15, 2004 at 12:08:49AM +0100, Arnd Bergmann wrote:

> Speaking of dead code: I think you should be able to mostly get rid
> of the KERNEL_CALL hack in include/asm-um/unistd.h, since all kernel
> syscalls except execve are now gone.

This from my quilt patches directory (just refreshed and tested (TT
only) again just now).  This might be a line or two large than it
otherwise should be due to whitespace changes...



Index: cw-current/include/asm-um/unistd.h
===================================================================
--- cw-current.orig/include/asm-um/unistd.h	2004-11-14 17:54:19.360054284 -0800
+++ cw-current/include/asm-um/unistd.h	2004-11-14 17:58:04.457939393 -0800
@@ -42,106 +42,29 @@
 #include <linux/compiler.h>
 #include <linux/types.h>
 
-#define KERNEL_CALL(ret_t, sys, args...)	\
-	mm_segment_t fs = get_fs();		\
-	ret_t ret;				\
-	set_fs(KERNEL_DS);			\
-	ret = sys(args);			\
-	set_fs(fs);				\
-	if (ret >= 0)				\
-		return ret;			\
-	errno = -(long)ret;			\
-	return -1;
-
-static inline long open(const char *pathname, int flags, int mode) 
-{
-	KERNEL_CALL(int, sys_open, pathname, flags, mode)
-}
-
-static inline long dup(unsigned int fd)
-{
-	KERNEL_CALL(int, sys_dup, fd);
-}
-
-static inline long close(unsigned int fd)
-{
-	KERNEL_CALL(int, sys_close, fd);
-}
-
-static inline int execve(const char *filename, char *const argv[], 
+static inline int execve(const char *filename, char *const argv[],
 			 char *const envp[])
 {
-	KERNEL_CALL(int, um_execve, filename, argv, envp);
-}
+	mm_segment_t fs;
+	int ret;
 
-static inline long waitpid(pid_t pid, unsigned int *status, int options)
-{
-	KERNEL_CALL(pid_t, sys_wait4, pid, status, options, NULL)
-}
-
-static inline pid_t setsid(void)
-{
-	KERNEL_CALL(pid_t, sys_setsid)
-}
-
-static inline long lseek(unsigned int fd, off_t offset, unsigned int whence)
-{
-	KERNEL_CALL(long, sys_lseek, fd, offset, whence)
-}
+	fs = get_fs();
+	set_fs(KERNEL_DS);
+	ret = um_execve(filename, argv, envp);
+	set_fs(fs);
 
-static inline int read(unsigned int fd, char * buf, int len)
-{
-	KERNEL_CALL(int, sys_read, fd, buf, len)
-}
+	if (ret >= 0)
+		return ret;
 
-static inline int write(unsigned int fd, char * buf, int len)
-{
-	KERNEL_CALL(int, sys_write, fd, buf, len)
+	errno = -(long)ret;
+	return -1;
 }
 
-long sys_mmap2(unsigned long addr, unsigned long len,
-		unsigned long prot, unsigned long flags,
-		unsigned long fd, unsigned long pgoff);
 int sys_execve(char *file, char **argv, char **env);
-long sys_clone(unsigned long clone_flags, unsigned long newsp,
-		int *parent_tid, int *child_tid);
-long sys_fork(void);
-long sys_vfork(void);
-int sys_pipe(unsigned long *fildes);
-int sys_ptrace(long request, long pid, long addr, long data);
-struct sigaction;
-asmlinkage long sys_rt_sigaction(int sig,
-				const struct sigaction __user *act,
-				struct sigaction __user *oact,
-				size_t sigsetsize);
-
-#endif
-
-/* Save the value of __KERNEL_SYSCALLS__, undefine it, include the underlying
- * arch's unistd.h for the system call numbers, and restore the old 
- * __KERNEL_SYSCALLS__.
- */
-
-#ifdef __KERNEL_SYSCALLS__
-#define __SAVE_KERNEL_SYSCALLS__ __KERNEL_SYSCALLS__
-#endif
+
+#endif /* __KERNEL_SYSCALLS__ */
 
 #undef __KERNEL_SYSCALLS__
 #include "asm/arch/unistd.h"
 
-#ifdef __KERNEL_SYSCALLS__
-#define __KERNEL_SYSCALLS__ __SAVE_KERNEL_SYSCALLS__
-#endif
-
-#endif
-
-/*
- * 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:
- */
+#endif /* _UM_UNISTD_H_*/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] - UML - cleanup include/asm-um/unistd.h
  2004-11-15  2:11   ` [PATCH] - UML - cleanup include/asm-um/unistd.h Chris Wedgwood
@ 2004-11-15  5:20     ` Jeff Dike
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2004-11-15  5:20 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: Arnd Bergmann, Blaisorblade, linux-kernel, Bodo Stroesser

cw@f00f.org said:
> This from my quilt patches directory (just refreshed and tested (TT
> only) again just now).  This might be a line or two large than it
> otherwise should be due to whitespace changes... 

Applied, thanks.

		Jeff


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-11-15  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-14 23:04 [PATCH] - UML - remove some dead code Jeff Dike
2004-11-14 23:08 ` Arnd Bergmann
2004-11-15  2:11   ` [PATCH] - UML - cleanup include/asm-um/unistd.h Chris Wedgwood
2004-11-15  5:20     ` Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome