summaryrefslogtreecommitdiffstats
path: root/winsup
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2012-02-22 01:58:24 +0000
committerYaakov Selkowitz <yselkowi@redhat.com>2012-02-22 01:58:24 +0000
commite587f14b6f60bbf702a1a13c4399446d9654b708 (patch)
tree9a4817c4093d18a2d8356c171b3533a01b570962 /winsup
parentde6ebe0e8bf427356df9e3ecd9dc9fa9d2ca8053 (diff)
downloadcygnal-e587f14b6f60bbf702a1a13c4399446d9654b708.tar.gz
cygnal-e587f14b6f60bbf702a1a13c4399446d9654b708.tar.bz2
cygnal-e587f14b6f60bbf702a1a13c4399446d9654b708.zip
* cygwin.din (scandirat): Export.
* posix.sgml (std-gnu): Add scandirat. * syscalls.cc (scandirat): New function. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. * include/sys/dirent.h (scandirat): Declare.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog10
-rw-r--r--winsup/cygwin/cygwin.din1
-rw-r--r--winsup/cygwin/include/cygwin/version.h3
-rw-r--r--winsup/cygwin/include/sys/dirent.h6
-rw-r--r--winsup/cygwin/posix.sgml1
-rw-r--r--winsup/cygwin/syscalls.cc16
6 files changed, 34 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b677e67d4..fc456da26 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,11 @@
+2012-02-21 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+
+ * cygwin.din (scandirat): Export.
+ * posix.sgml (std-gnu): Add scandirat.
+ * syscalls.cc (scandirat): New function.
+ * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
+ * include/sys/dirent.h (scandirat): Declare.
+
2012-02-21 Corinna Vinschen <corinna@vinschen.de>
Based on an idea from Nick Lowe <nick.lowe@gmail.com>:
@@ -165,7 +173,7 @@
Explain how and why.
* thread.h (PTHREAD_DEFAULT_STACKSIZE): Change definition. Explain why.
-2012-02-12 Yaakov Selkowitz <yselkowitz@users.sourceforg.net>
+2012-02-12 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* include/pthread.h: Include time.h as required by POSIX.
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index 3b99ed853..22b4ea94a 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -1406,6 +1406,7 @@ scalbnf NOSIGFE
_scalbnf = scalbnf NOSIGFE
scandir SIGFE
_scandir = scandir SIGFE
+scandirat SIGFE
scanf SIGFE
_scanf = scanf SIGFE
scanf_r = _scanf_r SIGFE
diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h
index 1d73f79d5..be5855843 100644
--- a/winsup/cygwin/include/cygwin/version.h
+++ b/winsup/cygwin/include/cygwin/version.h
@@ -428,12 +428,13 @@ details. */
257: Export getpt.
258: Export get_current_dir_name.
259: Export pthread_sigqueue.
+ 260: Export scandirat.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 259
+#define CYGWIN_VERSION_API_MINOR 260
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible
diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h
index 70a9e63b1..aabcd37e4 100644
--- a/winsup/cygwin/include/sys/dirent.h
+++ b/winsup/cygwin/include/sys/dirent.h
@@ -1,6 +1,6 @@
/* Posix dirent.h for WIN32.
- Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2010 Red Hat, Inc.
+ Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2010, 2012 Red Hat, Inc.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
@@ -69,6 +69,10 @@ int scandir (const char *__dir,
int (*select) (const struct dirent *),
int (*compar) (const struct dirent **, const struct dirent **));
+int scandirat (int __dirfd, const char *__dir, struct dirent ***__namelist,
+ int (*select) (const struct dirent *),
+ int (*compar) (const struct dirent **, const struct dirent **));
+
int alphasort (const struct dirent **__a, const struct dirent **__b);
#ifdef _DIRENT_HAVE_D_TYPE
/* File types for `d_type'. */
diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml
index bba9f0704..5bb27d7c7 100644
--- a/winsup/cygwin/posix.sgml
+++ b/winsup/cygwin/posix.sgml
@@ -1136,6 +1136,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
pthread_sigqueue
ptsname_r
removexattr
+ scandirat
setxattr
strchrnul
sysinfo
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 8cdadb2d7..21037fa10 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -39,6 +39,7 @@ details. */
#include <wctype.h>
#include <unistd.h>
#include <sys/wait.h>
+#include <dirent.h>
#include "ntdll.h"
#undef fstat
@@ -4437,6 +4438,21 @@ renameat (int olddirfd, const char *oldpathname,
}
extern "C" int
+scandirat (int dirfd, const char *pathname, struct dirent ***namelist,
+ int (*select) (const struct dirent *),
+ int (*compar) (const struct dirent **, const struct dirent **))
+{
+ tmp_pathbuf tp;
+ myfault efault;
+ if (efault.faulted (EFAULT))
+ return -1;
+ char *path = tp.c_get ();
+ if (gen_full_path_at (path, dirfd, pathname))
+ return -1;
+ return scandir (pathname, namelist, select, compar);
+}
+
+extern "C" int
symlinkat (const char *oldpath, int newdirfd, const char *newpathname)
{
tmp_pathbuf tp;