kbuild: Fix instrumentation removal breakage on avr32
[wrt350n-kernel.git] / arch / um / os-Linux / tty.c
blob4cfdd18ea1efdd383e44405a4ddcf98642f0c43d
1 /*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #include <stdlib.h>
7 #include <errno.h>
8 #include "os.h"
9 #include "user.h"
10 #include "kern_util.h"
12 struct grantpt_info {
13 int fd;
14 int res;
15 int err;
18 static void grantpt_cb(void *arg)
20 struct grantpt_info *info = arg;
22 info->res = grantpt(info->fd);
23 info->err = errno;
26 int get_pty(void)
28 struct grantpt_info info;
29 int fd;
31 fd = os_open_file("/dev/ptmx", of_rdwr(OPENFLAGS()), 0);
32 if(fd < 0){
33 printk("get_pty : Couldn't open /dev/ptmx - err = %d\n", -fd);
34 return(fd);
37 info.fd = fd;
38 initial_thread_cb(grantpt_cb, &info);
40 if(info.res < 0){
41 printk("get_pty : Couldn't grant pty - errno = %d\n",
42 -info.err);
43 return(-1);
45 if(unlockpt(fd) < 0){
46 printk("get_pty : Couldn't unlock pty - errno = %d\n", errno);
47 return(-1);
49 return(fd);
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: