UML - Remove os_* usage from userspace files
PATCH 13/14 UML - Remove os_* usage from userspace files
This patch fixes some userspace files which were calling libc through the os_* wrappers.
It turns out that there was only one user of os_new_tty_pgrp, so it can be deleted.
There are also some style and whitespace fixes in here.
--
arch/um/drivers/chan_user.c | 37 ++++---- arch/um/drivers/harddog_user.c | 54 +++++------ arch/um/include/mconsole.h | 13 -- arch/um/include/os.h | 1 arch/um/include/sysdep-i386/ptrace.h | 3 arch/um/include/sysdep-x86_64/ptrace.h | 152 ++++++++++++++++----------------- arch/um/kernel/skas/uaccess.c | 134 +++++++++++++---------------- arch/um/os-Linux/file.c | 11 -- 8 files changed, 186 insertions(+), 219 deletions(-)
arch/um/drivers/chan_user.c +21 -16
@@ -134,12 +134,12 @@ static int winch_thread(void *arg)struct winch_data *data = arg;sigset_t sigs;int pty_fd, pipe_fd; -int count, err; +int count;char c =1 ; pty_fd = data->pty_fd; pipe_fd = data->pipe_fd; - count =os_write_file (pipe_fd, &c,sizeof (c)); + count =write (pipe_fd, &c,sizeof (c));if (count !=sizeof (c))printk (UM_KERN_ERR "winch_thread : failed to write " "synchronization byte, err = %d\n" , -count);
@@ -167,10 +167,15 @@ static int winch_thread(void *arg)exit (1 ); } - err =os_new_tty_pgrp (pty_fd,os_getpid ()); -if (err <0 ) { -printk (UM_KERN_ERR "winch_thread : new_tty_pgrp failed on " -"fd %d err = %d\n" , pty_fd, -err); +if (ioctl (pty_fd,TIOCSCTTY ,0 ) <0 ){ +printk (UM_KERN_ERR "winch_thread : TIOCSCTTY failed on " +"fd %d err = %d\n" , pty_fd, errno); +exit (1 ); + } + +if (tcsetpgrp (pty_fd,os_getpid ()) <0 ){ +printk (UM_KERN_ERR "winch_thread : tcsetpgrp failed on " +"fd %d err = %d\n" , pty_fd, errno);exit (1 ); }
@@ -180,10 +185,10 @@ static int winch_thread(void *arg)* kernel semaphores. We don't use SysV semaphores because they are * persistent. */ - count =os_read_file (pipe_fd, &c,sizeof (c)); + count =read (pipe_fd, &c,sizeof (c));if (count !=sizeof (c))printk (UM_KERN_ERR "winch_thread : failed to read " -"synchronization byte, err = %d\n" , -count); +"synchronization byte, err = %d\n" , errno);while (1 ) {/*
@@ -192,10 +197,10 @@ static int winch_thread(void *arg)*/ sigsuspend (&sigs); - count =os_write_file (pipe_fd, &c,sizeof (c)); + count =write (pipe_fd, &c,sizeof (c));if (count !=sizeof (c))printk (UM_KERN_ERR "winch_thread : write failed, " -"err = %d\n" , -count); +"err = %d\n" , errno); } }
@@ -229,11 +234,11 @@ static int winch_tramp(int fd, struct tt } *fd_out = fds[0 ]; - n =os_read_file (fds[0 ], &c,sizeof (c)); + n =read (fds[0 ], &c,sizeof (c));if (n !=sizeof (c)) {printk (UM_KERN_ERR "winch_tramp : failed to read " "synchronization byte\n" ); -printk (UM_KERN_ERR "read failed, err = %d\n" , -n); +printk (UM_KERN_ERR "read failed, err = %d\n" , errno);printk (UM_KERN_ERR "fd %d will not support SIGWINCH\n" , fd); err = -EINVAL ; goto out_close;
@@ -248,8 +253,8 @@ static int winch_tramp(int fd, struct ttreturn err; out_close: -os_close_file (fds[1 ]); -os_close_file (fds[0 ]); +close (fds[1 ]); +close (fds[0 ]); out:return err; }
@@ -271,9 +276,9 @@ void register_winch(int fd, struct tty_sregister_winch_irq (thread_fd, fd, thread, tty, stack); - count =os_write_file (thread_fd, &c,sizeof (c)); + count =write (thread_fd, &c,sizeof (c));if (count !=sizeof (c))printk (UM_KERN_ERR "register_winch : failed to write " -"synchronization byte, err = %d\n" , -count); +"synchronization byte, err = %d\n" , errno); } }
arch/um/include/os.h +0 -1
@@ -132,7 +132,6 @@ extern void os_print_error(int error, coextern int os_get_exec_close (int fd,int *close_on_exec);extern int os_set_exec_close (int fd,int close_on_exec);extern int os_ioctl_generic (int fd,unsigned int cmd,unsigned long arg); -extern int os_new_tty_pgrp (int fd,int pid);extern int os_get_ifname (int fd,char *namebuf);extern int os_set_slip (int fd);extern int os_set_owner (int fd,int pid);
arch/um/os-Linux/file.c +0 -11
@@ -101,17 +101,6 @@ int os_ioctl_generic(int fd, unsigned inreturn err; } -int os_new_tty_pgrp (int fd,int pid) -{ -if (ioctl (fd,TIOCSCTTY ,0 ) <0 ) -return -errno; - -if (tcsetpgrp (fd, pid) <0 ) -return -errno; - -return 0 ; -} -/* FIXME: ensure namebuf in os_get_if_name is big enough */ int os_get_ifname (int fd,char * namebuf) {
arch/um/drivers/harddog_user.c +27 -27
125 lines not on this page · raw message
arch/um/include/mconsole.h +1 -12
@@ -1,6 +1,6 @@/* * Copyright (C) 2001 Lennert Buytenhek ([email protected]) -* Copyright (C) 2001, 2002 Jeff Dike ([email protected]) +* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */
@@ -96,14 +96,3 @@ extern void lock_notify(void);extern void unlock_notify (void );#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: -*/
arch/um/include/sysdep-i386/ptrace.h +1 -2
@@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) * Licensed under the GPL */
@@ -130,7 +130,6 @@ struct syscall_args { } \ val; \ }) -#define UPT_SET (regs, reg, val) \ do { \
arch/um/include/sysdep-x86_64/ptrace.h +76 -76
163 lines not on this page · raw message
arch/um/kernel/skas/uaccess.c +60 -74
274 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel