aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/chan_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/chan_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/chan_user.c')
-rw-r--r--arch/um/drivers/chan_user.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c
index 74f22d27327..8443d372f67 100644
--- a/arch/um/drivers/chan_user.c
+++ b/arch/um/drivers/chan_user.c
@@ -134,12 +134,12 @@ static int winch_thread(void *arg)
134 struct winch_data *data = arg; 134 struct winch_data *data = arg;
135 sigset_t sigs; 135 sigset_t sigs;
136 int pty_fd, pipe_fd; 136 int pty_fd, pipe_fd;
137 int count, err; 137 int count;
138 char c = 1; 138 char c = 1;
139 139
140 pty_fd = data->pty_fd; 140 pty_fd = data->pty_fd;
141 pipe_fd = data->pipe_fd; 141 pipe_fd = data->pipe_fd;
142 count = os_write_file(pipe_fd, &c, sizeof(c)); 142 count = write(pipe_fd, &c, sizeof(c));
143 if (count != sizeof(c)) 143 if (count != sizeof(c))
144 printk(UM_KERN_ERR "winch_thread : failed to write " 144 printk(UM_KERN_ERR "winch_thread : failed to write "
145 "synchronization byte, err = %d\n", -count); 145 "synchronization byte, err = %d\n", -count);
@@ -167,10 +167,15 @@ static int winch_thread(void *arg)
167 exit(1); 167 exit(1);
168 } 168 }
169 169
170 err = os_new_tty_pgrp(pty_fd, os_getpid()); 170 if(ioctl(pty_fd, TIOCSCTTY, 0) < 0){
171 if (err < 0) { 171 printk(UM_KERN_ERR "winch_thread : TIOCSCTTY failed on "
172 printk(UM_KERN_ERR "winch_thread : new_tty_pgrp failed on " 172 "fd %d err = %d\n", pty_fd, errno);
173 "fd %d err = %d\n", pty_fd, -err); 173 exit(1);
174 }
175
176 if(tcsetpgrp(pty_fd, os_getpid()) < 0){
177 printk(UM_KERN_ERR "winch_thread : tcsetpgrp failed on "
178 "fd %d err = %d\n", pty_fd, errno);
174 exit(1); 179 exit(1);
175 } 180 }
176 181
@@ -180,10 +185,10 @@ static int winch_thread(void *arg)
180 * kernel semaphores. We don't use SysV semaphores because they are 185 * kernel semaphores. We don't use SysV semaphores because they are
181 * persistent. 186 * persistent.
182 */ 187 */
183 count = os_read_file(pipe_fd, &c, sizeof(c)); 188 count = read(pipe_fd, &c, sizeof(c));
184 if (count != sizeof(c)) 189 if (count != sizeof(c))
185 printk(UM_KERN_ERR "winch_thread : failed to read " 190 printk(UM_KERN_ERR "winch_thread : failed to read "
186 "synchronization byte, err = %d\n", -count); 191 "synchronization byte, err = %d\n", errno);
187 192
188 while(1) { 193 while(1) {
189 /* 194 /*
@@ -192,10 +197,10 @@ static int winch_thread(void *arg)
192 */ 197 */
193 sigsuspend(&sigs); 198 sigsuspend(&sigs);
194 199
195 count = os_write_file(pipe_fd, &c, sizeof(c)); 200 count = write(pipe_fd, &c, sizeof(c));
196 if (count != sizeof(c)) 201 if (count != sizeof(c))
197 printk(UM_KERN_ERR "winch_thread : write failed, " 202 printk(UM_KERN_ERR "winch_thread : write failed, "
198 "err = %d\n", -count); 203 "err = %d\n", errno);
199 } 204 }
200} 205}
201 206
@@ -229,11 +234,11 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
229 } 234 }
230 235
231 *fd_out = fds[0]; 236 *fd_out = fds[0];
232 n = os_read_file(fds[0], &c, sizeof(c)); 237 n = read(fds[0], &c, sizeof(c));
233 if (n != sizeof(c)) { 238 if (n != sizeof(c)) {
234 printk(UM_KERN_ERR "winch_tramp : failed to read " 239 printk(UM_KERN_ERR "winch_tramp : failed to read "
235 "synchronization byte\n"); 240 "synchronization byte\n");
236 printk(UM_KERN_ERR "read failed, err = %d\n", -n); 241 printk(UM_KERN_ERR "read failed, err = %d\n", errno);
237 printk(UM_KERN_ERR "fd %d will not support SIGWINCH\n", fd); 242 printk(UM_KERN_ERR "fd %d will not support SIGWINCH\n", fd);
238 err = -EINVAL; 243 err = -EINVAL;
239 goto out_close; 244 goto out_close;
@@ -248,8 +253,8 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out,
248 return err; 253 return err;
249 254
250 out_close: 255 out_close:
251 os_close_file(fds[1]); 256 close(fds[1]);
252 os_close_file(fds[0]); 257 close(fds[0]);
253 out: 258 out:
254 return err; 259 return err;
255} 260}
@@ -271,9 +276,9 @@ void register_winch(int fd, struct tty_struct *tty)
271 276
272 register_winch_irq(thread_fd, fd, thread, tty, stack); 277 register_winch_irq(thread_fd, fd, thread, tty, stack);
273 278
274 count = os_write_file(thread_fd, &c, sizeof(c)); 279 count = write(thread_fd, &c, sizeof(c));
275 if (count != sizeof(c)) 280 if (count != sizeof(c))
276 printk(UM_KERN_ERR "register_winch : failed to write " 281 printk(UM_KERN_ERR "register_winch : failed to write "
277 "synchronization byte, err = %d\n", -count); 282 "synchronization byte, err = %d\n", errno);
278 } 283 }
279} 284}