aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2016-01-26 15:58:49 -0800
committerH. Peter Anvin <hpa@zytor.com>2016-01-26 15:58:49 -0800
commitb4babe7a3618705a283fc9458de19aba1d12401d (patch)
treed338b88f5ec3eb7ce11785b0654ce2d563902263
parentb7536497ab08689ebe12c03558379982dc61ac0c (diff)
downloadklibc-b4babe7a3618705a283fc9458de19aba1d12401d.tar.gz
[klibc] Make posix_openpt() an inline
This function is so trivial that there is no reason to not make it an inline. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--usr/include/stdlib.h9
-rw-r--r--usr/klibc/Kbuild2
-rw-r--r--usr/klibc/posix_openpt.c14
3 files changed, 9 insertions, 16 deletions
diff --git a/usr/include/stdlib.h b/usr/include/stdlib.h
index c2d62640f6b95..250755f3ba9f6 100644
--- a/usr/include/stdlib.h
+++ b/usr/include/stdlib.h
@@ -83,7 +83,14 @@ static __inline__ void srandom(unsigned int __s)
__extern int unlockpt(int);
__extern char *ptsname(int);
-__extern int posix_openpt(int);
+
+static __inline__ int posix_openpt(int __mode)
+{
+ __extern int open(const char *, int, ...);
+
+ __mode &= ~(O_CREAT | O_TMPFILE);
+ return open("/dev/ptmx", __mode);
+}
static __inline__ int grantpt(int __fd)
{
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index a0e440d29822c..eba6addf90b3a 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -52,7 +52,7 @@ klib-y += vsnprintf.o snprintf.o vsprintf.o sprintf.o \
getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
clearenv.o nullenv.o \
getopt.o getopt_long.o readdir.o scandir.o alphasort.o remove.o \
- syslog.o closelog.o pty.o posix_openpt.o isatty.o reboot.o \
+ syslog.o closelog.o pty.o isatty.o reboot.o \
time.o utime.o lseek.o nice.o getpriority.o \
qsort.o bsearch.o \
lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \
diff --git a/usr/klibc/posix_openpt.c b/usr/klibc/posix_openpt.c
deleted file mode 100644
index 794ca466f62fd..0000000000000
--- a/usr/klibc/posix_openpt.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * posix_openpt.c
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <termios.h>
-#include <fcntl.h>
-
-int posix_openpt(int oflag)
-{
- return open("/dev/ptmx", oflag);
-}