From 46ebbf82d42460d32705d35912a5bb75ea204719 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 19 Nov 2016 21:04:10 +0100 Subject: [PATCH] Add grantpt(3). --- libc/Makefile | 1 + libc/include/stdlib.h | 5 ++++- libc/stdlib/grantpt.c | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 libc/stdlib/grantpt.c diff --git a/libc/Makefile b/libc/Makefile index 90208253..f31b046a 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -528,6 +528,7 @@ stdlib/clearenv.o \ stdlib/_Exit.o \ stdlib/exit.o \ stdlib/getenv.o \ +stdlib/grantpt.o \ stdlib/mkdtemp.o \ stdlib/mkdtemps.o \ stdlib/mkostemp.o \ diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h index e5b542c5..d288ca20 100644 --- a/libc/include/stdlib.h +++ b/libc/include/stdlib.h @@ -150,7 +150,6 @@ long a64l(const char* s); double drand48(void); double erand48(unsigned short [3]); int getsubopt(char**, char* const *, char**); -int grantpt(int); char* initstate(unsigned, char*, size_t); long jrand48(unsigned short [3]); char* l64a(long); @@ -170,6 +169,10 @@ void srandom(unsigned); int unlockpt(int); #endif +#if __USE_SORTIX || __USE_XOPEN +int grantpt(int); +#endif + #if __USE_SORTIX || 600 <= __USE_XOPEN int posix_openpt(int); #endif diff --git a/libc/stdlib/grantpt.c b/libc/stdlib/grantpt.c new file mode 100644 index 00000000..02d9cd20 --- /dev/null +++ b/libc/stdlib/grantpt.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Jonas 'Sortie' Termansen. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * stdlib/grantpt.c + * Grant permissions to open the pseudoterminal slave. + */ + +#include + +int grantpt(int fd) +{ + (void) fd; + return 0; +}