mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-03 05:25:24 +08:00
* cygwin.din: Add `dirfd'.
* dir.cc (dirfd): New function. (opendir): Open a directory file descriptor and save it in __d_dirent->d_fd. (closedir): Close directory file descriptor. * include/cygwin/version.h: Bump API minor version to 44.
This commit is contained in:
parent
6d47f33adb
commit
a71aee46c4
@ -1,3 +1,12 @@
|
|||||||
|
Mon Sep 3 18:34:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* cygwin.din: Add `dirfd'.
|
||||||
|
* dir.cc (dirfd): New function.
|
||||||
|
(opendir): Open a directory file descriptor and save it in
|
||||||
|
__d_dirent->d_fd.
|
||||||
|
(closedir): Close directory file descriptor.
|
||||||
|
* include/cygwin/version.h: Bump API minor version to 44.
|
||||||
|
|
||||||
Sun Sep 2 22:09:31 2001 Christopher Faylor <cgf@cygnus.com>
|
Sun Sep 2 22:09:31 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* child_info.h: Modify magic number.
|
* child_info.h: Modify magic number.
|
||||||
|
@ -130,6 +130,8 @@ difftime
|
|||||||
_difftime = difftime
|
_difftime = difftime
|
||||||
div
|
div
|
||||||
_div = div
|
_div = div
|
||||||
|
dirfd
|
||||||
|
_dirfd = dirfd
|
||||||
_dll_crt0@0
|
_dll_crt0@0
|
||||||
dll_crt0__FP11per_process
|
dll_crt0__FP11per_process
|
||||||
cygwin_dll_init
|
cygwin_dll_init
|
||||||
|
@ -9,6 +9,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|||||||
details. */
|
details. */
|
||||||
|
|
||||||
#include "winsup.h"
|
#include "winsup.h"
|
||||||
|
#include <sys/fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -61,6 +62,18 @@ writable_directory (const char *file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" int
|
||||||
|
dirfd (DIR *dir)
|
||||||
|
{
|
||||||
|
if (dir->__d_cookie != __DIRENT_COOKIE)
|
||||||
|
{
|
||||||
|
set_errno (EBADF);
|
||||||
|
syscall_printf ("-1 = dirfd (%p)", dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return dir->__d_dirent->d_fd;
|
||||||
|
}
|
||||||
|
|
||||||
/* opendir: POSIX 5.1.2.1 */
|
/* opendir: POSIX 5.1.2.1 */
|
||||||
extern "C" DIR *
|
extern "C" DIR *
|
||||||
opendir (const char *dirname)
|
opendir (const char *dirname)
|
||||||
@ -114,6 +127,7 @@ opendir (const char *dirname)
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
strcpy (dir->__d_dirname, real_dirname.get_win32 ());
|
strcpy (dir->__d_dirname, real_dirname.get_win32 ());
|
||||||
|
dir->__d_dirent->d_fd = open (dir->__d_dirname, O_RDONLY | O_DIROPEN);
|
||||||
/* FindFirstFile doesn't seem to like duplicate /'s. */
|
/* FindFirstFile doesn't seem to like duplicate /'s. */
|
||||||
len = strlen (dir->__d_dirname);
|
len = strlen (dir->__d_dirname);
|
||||||
if (len == 0 || SLASH_P (dir->__d_dirname[len - 1]))
|
if (len == 0 || SLASH_P (dir->__d_dirname[len - 1]))
|
||||||
@ -290,6 +304,9 @@ closedir (DIR * dir)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dir->__d_dirent->d_fd >= 0)
|
||||||
|
close (dir->__d_dirent->d_fd);
|
||||||
|
|
||||||
/* Reset the marker in case the caller tries to use `dir' again. */
|
/* Reset the marker in case the caller tries to use `dir' again. */
|
||||||
dir->__d_cookie = 0;
|
dir->__d_cookie = 0;
|
||||||
|
|
||||||
|
@ -141,10 +141,11 @@ details. */
|
|||||||
41: __signgam
|
41: __signgam
|
||||||
42: sys_errlist, sys_nerr
|
42: sys_errlist, sys_nerr
|
||||||
43: sigsetjmp, siglongjmp fixed
|
43: sigsetjmp, siglongjmp fixed
|
||||||
|
44: Export dirfd
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CYGWIN_VERSION_API_MAJOR 0
|
#define CYGWIN_VERSION_API_MAJOR 0
|
||||||
#define CYGWIN_VERSION_API_MINOR 43
|
#define CYGWIN_VERSION_API_MINOR 44
|
||||||
|
|
||||||
/* There is also a compatibity version number associated with the
|
/* There is also a compatibity version number associated with the
|
||||||
shared memory regions. It is incremented when incompatible
|
shared memory regions. It is incremented when incompatible
|
||||||
|
Loading…
x
Reference in New Issue
Block a user