diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2007-05-23 18:30:08 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2007-05-23 18:30:08 +0000 |
commit | acdf7b21bbbec259e8fc905971ab6ac759b205de (patch) | |
tree | caaf3fc149152b8345fbcef1eeb01c9e90651933 /lib/libc/gen | |
parent | f1506023f2b67e85e1a66dabd49d690d4633fb03 (diff) |
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/gen')
-rw-r--r-- | lib/libc/gen/isatty.c | 13 | ||||
-rw-r--r-- | lib/libc/gen/ttyname.c | 19 |
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; |