aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/tty.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2008-02-05 01:30:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:26 -0500
commitedea138584d7586a3b93b6d5ab5ec021d18e11e9 (patch)
tree0c5a5dd14256d675c8c64c8abdda86053f72abc8 /arch/um/os-Linux/tty.c
parent0ba7fe03b638a084a4e15e21d2e585ba321ad9c8 (diff)
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>
Diffstat (limited to 'arch/um/os-Linux/tty.c')
-rw-r--r--arch/um/os-Linux/tty.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/arch/um/os-Linux/tty.c b/arch/um/os-Linux/tty.c
index 4cfdd18ea1ef..b09ff66a77ee 100644
--- a/arch/um/os-Linux/tty.c
+++ b/arch/um/os-Linux/tty.c
@@ -1,13 +1,16 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <unistd.h>
7#include <errno.h> 8#include <errno.h>
9#include <fcntl.h>
10#include "kern_constants.h"
11#include "kern_util.h"
8#include "os.h" 12#include "os.h"
9#include "user.h" 13#include "user.h"
10#include "kern_util.h"
11 14
12struct grantpt_info { 15struct grantpt_info {
13 int fd; 16 int fd;
@@ -26,36 +29,34 @@ static void grantpt_cb(void *arg)
26int get_pty(void) 29int get_pty(void)
27{ 30{
28 struct grantpt_info info; 31 struct grantpt_info info;
29 int fd; 32 int fd, err;
30 33
31 fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0); 34 fd = open("/dev/ptmx", O_RDWR);
32 if(fd < 0){ 35 if (fd < 0) {
33 printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd); 36 err = -errno;
34 return(fd); 37 printk(UM_KERN_ERR "get_pty : Couldn't open /dev/ptmx - "
38 "err = %d\n", errno);
39 return err;
35 } 40 }
36 41
37 info.fd = fd; 42 info.fd = fd;
38 initial_thread_cb(grantpt_cb, &info); 43 initial_thread_cb(grantpt_cb, &info);
39 44
40 if(info.res < 0){ 45 if (info.res < 0) {
41 printk("get_pty : Couldn't grant pty - errno = %d\n", 46 err = -info.err;
42 -info.err); 47 printk(UM_KERN_ERR "get_pty : Couldn't grant pty - "
43 return(-1); 48 "errno = %d\n", -info.err);
49 goto out;
44 } 50 }
45 if(unlockpt(fd) < 0){ 51
46 printk("get_pty : Couldn't unlock pty - errno = %d\n", errno); 52 if (unlockpt(fd) < 0) {
47 return(-1); 53 err = -errno;
54 printk(UM_KERN_ERR "get_pty : Couldn't unlock pty - "
55 "errno = %d\n", errno);
56 goto out;
48 } 57 }
49 return(fd); 58 return fd;
59out:
60 close(fd);
61 return err;
50} 62}
51
52/*
53 * Overrides for Emacs so that we follow Linus's tabbing style.
54 * Emacs will notice this stuff at the end of the file and automatically
55 * adjust the settings for this buffer only. This must remain at the end
56 * of the file.
57 * ---------------------------------------------------------------------------
58 * Local variables:
59 * c-file-style: "linux"
60 * End:
61 */