* cygwin.din: Export rand_r and ttyname_r.

* syscalls.cc (ttyname_r): New function.
	(ttyname): Move functionality to ttyname_r.  Call it from here.
	* include/cygwin/version.h: Bump API minor number.
This commit is contained in:
Corinna Vinschen 2004-04-14 09:12:04 +00:00
parent b923181eca
commit 93d66ddc20
4 changed files with 46 additions and 13 deletions

View File

@ -1,11 +1,18 @@
2004-04-14 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din: Export rand_r and ttyname_r.
* syscalls.cc (ttyname_r): New function.
(ttyname): Move functionality to ttyname_r. Call it from here.
* include/cygwin/version.h: Bump API minor number.
2004-04-14 Pierre Humblet <pierre.humblet@ieee.org>
* path.h (path_conv::set_symlink): Add argument.
(path_conv::get_symlink_length): New method.
(path_conv::symlink_length): New member.
* path.cc (path_conv::check): Pass symlen to set_symlink.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
set st_size from get_symlink_length.
* path.h (path_conv::set_symlink): Add argument.
(path_conv::get_symlink_length): New method.
(path_conv::symlink_length): New member.
* path.cc (path_conv::check): Pass symlen to set_symlink.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): For symlinks
set st_size from get_symlink_length.
2004-04-13 Corinna Vinschen <corinna@vinschen.de>

View File

@ -1067,6 +1067,7 @@ raise SIGFE
_raise = raise SIGFE
rand NOSIGFE
_rand = rand NOSIGFE
rand_r NOSIGFE
random NOSIGFE
read SIGFE
_read = read SIGFE
@ -1438,6 +1439,7 @@ truncf NOSIGFE
tsearch SIGFE
ttyname SIGFE
_ttyname = ttyname SIGFE
ttyname_r SIGFE
ttyslot NOSIGFE
twalk NOSIGFE
tzset SIGFE

View File

@ -240,12 +240,13 @@ details. */
112: Redefine some mtget fields.
113: Again redefine some mtget fields. Use mt_fileno and mt_blkno as
on Linux.
114: Export rand_r, ttyname_r.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 113
#define CYGWIN_VERSION_API_MINOR 114
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -1511,15 +1511,38 @@ pathconf (const char *file, int v)
}
}
extern "C" int
ttyname_r (int fd, char *buf, size_t buflen)
{
int ret = 0;
if (__check_null_invalid_struct (buf, buflen))
ret = EINVAL;
else
{
cygheap_fdget cfd (fd, true);
if (cfd < 0)
ret = EBADF;
else if (!cfd->is_tty ())
ret = ENOTTY;
else if (buflen < strlen (cfd->ttyname ()) + 1)
ret = ERANGE;
else
strcpy (buf, cfd->ttyname ());
}
debug_printf ("returning %d tty: %s", ret, ret ? "NULL" : buf);
return ret;
}
extern "C" char *
ttyname (int fd)
{
char *name;
cygheap_fdget cfd (fd);
if (cfd < 0 || !cfd->is_tty ())
return 0;
name = (char *) (cfd->ttyname ());
debug_printf ("returning %s", name);
static char name[CYG_MAX_PATH];
int ret = ttyname_r (fd, name, CYG_MAX_PATH);
if (ret)
{
set_errno (ret);
return NULL;
}
return name;
}