summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorkurt <kurt@openbsd.org>2007-05-23 18:30:07 +0000
committerkurt <kurt@openbsd.org>2007-05-23 18:30:07 +0000
commit99965f212083ea2e2175eb90a25b5f8eb91191d5 (patch)
tree0b90210f9d97339e6dbdc745c6447972c5ff8f99 /lib/libc
parentAdd hack to prevent switching to serial console on four-digit B/C/J class (diff)
downloadwireguard-openbsd-99965f212083ea2e2175eb90a25b5f8eb91191d5.tar.xz
wireguard-openbsd-99965f212083ea2e2175eb90a25b5f8eb91191d5.zip
Remove unnecessary locking. There is no need for serializing calls to
these functions and each use of the fd is already protected. No externally visible changes. okay marc@ millert@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/isatty.c13
-rw-r--r--lib/libc/gen/ttyname.c19
2 files changed, 5 insertions, 27 deletions
diff --git a/lib/libc/gen/isatty.c b/lib/libc/gen/isatty.c
index a4c34d8b5c3..1915c6c3392 100644
--- a/lib/libc/gen/isatty.c
+++ b/lib/libc/gen/isatty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isatty.c,v 1.6 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: isatty.c,v 1.7 2007/05/23 18:30:07 kurt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -29,20 +29,11 @@
*/
#include <termios.h>
-#include <unistd.h>
-#include "thread_private.h"
int
isatty(int fd)
{
- int retval;
struct termios t;
- if (_FD_LOCK(fd, FD_READ, NULL) == 0) {
- retval = (tcgetattr(fd, &t) != -1);
- _FD_UNLOCK(fd, FD_READ);
- } else {
- retval = 0;
- }
- return(retval);
+ return (tcgetattr(fd, &t) != -1);
}
diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c
index 7a70cca95fa..fa75c4bc59f 100644
--- a/lib/libc/gen/ttyname.c
+++ b/lib/libc/gen/ttyname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttyname.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: ttyname.c,v 1.13 2007/05/23 18:30:07 kurt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -43,19 +43,6 @@
static char buf[TTY_NAME_MAX];
static int oldttyname(int, struct stat *, char *, size_t);
-static int __ttyname_r_basic(int, char *, size_t);
-
-int
-ttyname_r(int fd, char *buf, size_t buflen)
-{
- int ret;
-
- if ((ret = _FD_LOCK(fd, FD_READ, NULL)) == 0) {
- ret = __ttyname_r_basic(fd, buf, buflen);
- _FD_UNLOCK(fd, FD_READ);
- }
- return ret;
-}
char *
ttyname(int fd)
@@ -75,8 +62,8 @@ ttyname(int fd)
return bufp;
}
-static int
-__ttyname_r_basic(int fd, char *buf, size_t len)
+int
+ttyname_r(int fd, char *buf, size_t len)
{
struct stat sb;
struct termios ttyb;