From 05ae46ee7a70b158d58b2c8581451fed9c18da2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira?= Date: Mon, 3 May 2021 22:51:52 -0300 Subject: linux: implement ttyname as a wrapper around ttyname_r. Big win in binary size and avoids duplicating the logic in multiple places. On x86_64, dropped from 1883206 to 1881790, a 1416 byte decrease. Also changed logic to track if ttyname_buf has been allocated by checking if it's NULL instead of tracking buflen as an additional variable. Reviewed-by: Adhemerval Zanella --- include/unistd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/unistd.h b/include/unistd.h index 1363976..96c066c 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -134,8 +134,8 @@ libc_hidden_proto (__setresuid) libc_hidden_proto (__setresgid) extern __pid_t __vfork (void); libc_hidden_proto (__vfork) -extern int __ttyname_r (int __fd, char *__buf, size_t __buflen) - attribute_hidden; +extern int __ttyname_r (int __fd, char *__buf, size_t __buflen); +libc_hidden_proto (__ttyname_r) extern int __isatty (int __fd) attribute_hidden; extern int __link (const char *__from, const char *__to); extern int __symlink (const char *__from, const char *__to); -- cgit v1.1