From: Keir Fraser Date: Thu, 18 Jun 2009 09:19:25 +0000 (+0100) Subject: minios: Use posix_openpt() rather than non-standard openpty(). X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f8ee95718be704769f2c271438df1a35e4bd1ab3;p=people%2Fliuw%2Flibxenctrl-split%2Fmini-os.git minios: Use posix_openpt() rather than non-standard openpty(). Signed-off-by: Stefano Stabellini --- diff --git a/include/lib.h b/include/lib.h index 4aa34d4..0834a18 100644 --- a/include/lib.h +++ b/include/lib.h @@ -101,7 +101,6 @@ char * strcat(char * dest, const char * src); char *strdup(const char *s); #endif #include -int openpty(void); #define RAND_MIX 2654435769U diff --git a/lib/sys.c b/lib/sys.c index 045481e..166ecc9 100644 --- a/lib/sys.c +++ b/lib/sys.c @@ -167,15 +167,17 @@ int mkdir(const char *pathname, mode_t mode) return 0; } -int openpty(void) +int posix_openpt(int flags) { struct consfront_dev *dev; + /* Ignore flags */ + dev = init_consfront(NULL); dev->fd = alloc_fd(FTYPE_CONSOLE); files[dev->fd].cons.dev = dev; - printk("fd(%d) = openpty\n", dev->fd); + printk("fd(%d) = posix_openpt\n", dev->fd); return(dev->fd); } @@ -188,6 +190,8 @@ int open(const char *pathname, int flags, ...) printk("open(%s) -> %d\n", pathname, fd); return fd; } + if (!strncmp(pathname, "/dev/ptmx", strlen("/dev/ptmx"))) + return posix_openpt(flags); printk("open(%s, %x)", pathname, flags); switch (flags & ~O_ACCMODE) { case 0: @@ -1341,6 +1345,9 @@ unsupported_function_crash(lockf); unsupported_function_crash(sysconf); unsupported_function(int, tcsetattr, -1); unsupported_function(int, tcgetattr, 0); +unsupported_function(int, grantpt, -1); +unsupported_function(int, unlockpt, -1); +unsupported_function(char *, ptsname, NULL); unsupported_function(int, poll, -1); /* net/if.h */