* [PATCH] Add scandirat(3)
@ 2012-02-21 22:45 Yaakov (Cygwin/X)
2012-02-21 23:04 ` Eric Blake
2012-02-22 1:30 ` Christopher Faylor
0 siblings, 2 replies; 3+ messages in thread
From: Yaakov (Cygwin/X) @ 2012-02-21 22:45 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
scandirat(3) was added in glibc-2.15[1] and has supposedly been proposed
for addition to POSIX.1[2]. Patch attached.
Yaakov
[1] http://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS
[2] http://article.gmane.org/gmane.linux.man/2419
[-- Attachment #2: cygwin-scandirat.patch --]
[-- Type: text/x-patch, Size: 4250 bytes --]
2012-02-?? Yaakov Selkowitz <yselkowitz@...>
* 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.
Index: cygwin.din
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/cygwin.din,v
retrieving revision 1.253
diff -u -p -r1.253 cygwin.din
--- cygwin.din 28 Jan 2012 14:44:01 -0000 1.253
+++ cygwin.din 21 Feb 2012 11:36:15 -0000
@@ -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
Index: posix.sgml
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/posix.sgml,v
retrieving revision 1.75
diff -u -p -r1.75 posix.sgml
--- posix.sgml 6 Jan 2012 07:12:17 -0000 1.75
+++ posix.sgml 21 Feb 2012 11:36:15 -0000
@@ -1136,6 +1136,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008)
pthread_sigqueue
ptsname_r
removexattr
+ scandirat
setxattr
strchrnul
sysinfo
Index: syscalls.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/syscalls.cc,v
retrieving revision 1.622
diff -u -p -r1.622 syscalls.cc
--- syscalls.cc 14 Feb 2012 19:08:19 -0000 1.622
+++ syscalls.cc 21 Feb 2012 11:36:16 -0000
@@ -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 *oldp
}
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;
Index: include/cygwin/version.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/version.h,v
retrieving revision 1.363
diff -u -p -r1.363 version.h
--- include/cygwin/version.h 7 Feb 2012 16:50:19 -0000 1.363
+++ include/cygwin/version.h 21 Feb 2012 11:36:16 -0000
@@ -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
Index: include/sys/dirent.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/sys/dirent.h,v
retrieving revision 1.23
diff -u -p -r1.23 dirent.h
--- include/sys/dirent.h 6 Aug 2010 18:55:25 -0000 1.23
+++ include/sys/dirent.h 21 Feb 2012 11:36:16 -0000
@@ -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'. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add scandirat(3)
2012-02-21 22:45 [PATCH] Add scandirat(3) Yaakov (Cygwin/X)
@ 2012-02-21 23:04 ` Eric Blake
2012-02-22 1:30 ` Christopher Faylor
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2012-02-21 23:04 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
On 02/21/2012 03:44 PM, Yaakov (Cygwin/X) wrote:
> scandirat(3) was added in glibc-2.15[1] and has supposedly been proposed
> for addition to POSIX.1[2]. Patch attached.
I haven't yet seen anyone propose it for POSIX, but it would indeed be a
welcome addition there.
Also it would be a welcome addition to have pathconfat(), although this
hasn't yet happened on the Linux side of things, let alone any POSIX
proposal.
At any rate, +1 for having this in cygwin.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Add scandirat(3)
2012-02-21 22:45 [PATCH] Add scandirat(3) Yaakov (Cygwin/X)
2012-02-21 23:04 ` Eric Blake
@ 2012-02-22 1:30 ` Christopher Faylor
1 sibling, 0 replies; 3+ messages in thread
From: Christopher Faylor @ 2012-02-22 1:30 UTC (permalink / raw)
To: cygwin-patches
On Tue, Feb 21, 2012 at 04:44:58PM -0600, Yaakov (Cygwin/X) wrote:
>scandirat(3) was added in glibc-2.15[1] and has supposedly been proposed
>for addition to POSIX.1[2]. Patch attached.
>
>
>Yaakov
>
>[1] http://sourceware.org/git/?p=glibc.git;a=blob_plain;f=NEWS
>[2] http://article.gmane.org/gmane.linux.man/2419
>
>2012-02-?? Yaakov Selkowitz <yselkowitz@...>
>
> * 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.
Looks good. Please apply.
Thanks, as always.
cgf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-22 1:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21 22:45 [PATCH] Add scandirat(3) Yaakov (Cygwin/X)
2012-02-21 23:04 ` Eric Blake
2012-02-22 1:30 ` Christopher Faylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).