aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/harddog_user.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:08 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:06 -0400
commit8ca842c4b5cbc70b9180617e9f26b6ac9f40dbb9 (patch)
treefe3e4deeae82c7063a72ecb3fdcae47422d6de0e /arch/um/drivers/harddog_user.c
parent28078e8f9790be0854a54f06de822689ab571944 (diff)
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. 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/drivers/harddog_user.c')
-rw-r--r--arch/um/drivers/harddog_user.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index 19ea26f32f14..b56f8e0196a9 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -1,14 +1,13 @@
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 <stdio.h> 6#include <stdio.h>
7#include <unistd.h> 7#include <unistd.h>
8#include <errno.h> 8#include <errno.h>
9#include "user.h"
10#include "mconsole.h"
11#include "os.h" 9#include "os.h"
10#include "user.h"
12 11
13struct dog_data { 12struct dog_data {
14 int stdin; 13 int stdin;
@@ -23,10 +22,10 @@ static void pre_exec(void *d)
23 dup2(data->stdin, 0); 22 dup2(data->stdin, 0);
24 dup2(data->stdout, 1); 23 dup2(data->stdout, 1);
25 dup2(data->stdout, 2); 24 dup2(data->stdout, 2);
26 os_close_file(data->stdin); 25 close(data->stdin);
27 os_close_file(data->stdout); 26 close(data->stdout);
28 os_close_file(data->close_me[0]); 27 close(data->close_me[0]);
29 os_close_file(data->close_me[1]); 28 close(data->close_me[1]);
30} 29}
31 30
32int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock) 31int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
@@ -40,13 +39,13 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
40 char **args = NULL; 39 char **args = NULL;
41 40
42 err = os_pipe(in_fds, 1, 0); 41 err = os_pipe(in_fds, 1, 0);
43 if(err < 0){ 42 if (err < 0) {
44 printk("harddog_open - os_pipe failed, err = %d\n", -err); 43 printk("harddog_open - os_pipe failed, err = %d\n", -err);
45 goto out; 44 goto out;
46 } 45 }
47 46
48 err = os_pipe(out_fds, 1, 0); 47 err = os_pipe(out_fds, 1, 0);
49 if(err < 0){ 48 if (err < 0) {
50 printk("harddog_open - os_pipe failed, err = %d\n", -err); 49 printk("harddog_open - os_pipe failed, err = %d\n", -err);
51 goto out_close_in; 50 goto out_close_in;
52 } 51 }
@@ -56,7 +55,7 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
56 data.close_me[0] = out_fds[1]; 55 data.close_me[0] = out_fds[1];
57 data.close_me[1] = in_fds[0]; 56 data.close_me[1] = in_fds[0];
58 57
59 if(sock != NULL){ 58 if (sock != NULL) {
60 mconsole_args[2] = sock; 59 mconsole_args[2] = sock;
61 args = mconsole_args; 60 args = mconsole_args;
62 } 61 }
@@ -68,25 +67,25 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
68 67
69 pid = run_helper(pre_exec, &data, args); 68 pid = run_helper(pre_exec, &data, args);
70 69
71 os_close_file(out_fds[0]); 70 close(out_fds[0]);
72 os_close_file(in_fds[1]); 71 close(in_fds[1]);
73 72
74 if(pid < 0){ 73 if (pid < 0) {
75 err = -pid; 74 err = -pid;
76 printk("harddog_open - run_helper failed, errno = %d\n", -err); 75 printk("harddog_open - run_helper failed, errno = %d\n", -err);
77 goto out_close_out; 76 goto out_close_out;
78 } 77 }
79 78
80 n = os_read_file(in_fds[0], &c, sizeof(c)); 79 n = read(in_fds[0], &c, sizeof(c));
81 if(n == 0){ 80 if (n == 0) {
82 printk("harddog_open - EOF on watchdog pipe\n"); 81 printk("harddog_open - EOF on watchdog pipe\n");
83 helper_wait(pid); 82 helper_wait(pid);
84 err = -EIO; 83 err = -EIO;
85 goto out_close_out; 84 goto out_close_out;
86 } 85 }
87 else if(n < 0){ 86 else if (n < 0) {
88 printk("harddog_open - read of watchdog pipe failed, " 87 printk("harddog_open - read of watchdog pipe failed, "
89 "err = %d\n", -n); 88 "err = %d\n", errno);
90 helper_wait(pid); 89 helper_wait(pid);
91 err = n; 90 err = n;
92 goto out_close_out; 91 goto out_close_out;
@@ -96,19 +95,19 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
96 return 0; 95 return 0;
97 96
98 out_close_in: 97 out_close_in:
99 os_close_file(in_fds[0]); 98 close(in_fds[0]);
100 os_close_file(in_fds[1]); 99 close(in_fds[1]);
101 out_close_out: 100 out_close_out:
102 os_close_file(out_fds[0]); 101 close(out_fds[0]);
103 os_close_file(out_fds[1]); 102 close(out_fds[1]);
104 out: 103 out:
105 return err; 104 return err;
106} 105}
107 106
108void stop_watchdog(int in_fd, int out_fd) 107void stop_watchdog(int in_fd, int out_fd)
109{ 108{
110 os_close_file(in_fd); 109 close(in_fd);
111 os_close_file(out_fd); 110 close(out_fd);
112} 111}
113 112
114int ping_watchdog(int fd) 113int ping_watchdog(int fd)
@@ -116,10 +115,11 @@ int ping_watchdog(int fd)
116 int n; 115 int n;
117 char c = '\n'; 116 char c = '\n';
118 117
119 n = os_write_file(fd, &c, sizeof(c)); 118 n = write(fd, &c, sizeof(c));
120 if(n != sizeof(c)){ 119 if (n != sizeof(c)) {
121 printk("ping_watchdog - write failed, err = %d\n", -n); 120 printk("ping_watchdog - write failed, ret = %d, err = %d\n",
122 if(n < 0) 121 n, errno);
122 if (n < 0)
123 return n; 123 return n;
124 return -EIO; 124 return -EIO;
125 } 125 }