diff options
author | Christopher Faylor <me@cgf.cx> | 2005-08-20 10:19:55 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2005-08-20 10:19:55 +0400 |
commit | d9a227643589484cfccd75174482a7f2e96f49d5 (patch) | |
tree | 9538a97eb6010b3ddca0b89e6bec28be2351258a /winsup/cygwin/fhandler_process.cc | |
parent | 683ef953925b1d05e49bd9e75147ebc02e9cb82c (diff) |
* cygerrno.h (geterrno_from_win_error): Change declaration to default to using
GetLastError and EACCESS.
* cygwin.din: Export readdir_r.
* include/cygwin/version.h: Bump API version number to 138.
* syscalls.cc (readdir_worker): New function, renamed from old readdir()
function.
(readdir): Use readdir_worker.
(readdir_r): New function.
* fhandler.h (fhandler_base::readdir): Accommodate second argument indicating
dirent buffer.
(fhandler_disk_file::readdir): Ditto.
(fhandler_cygdrive::readdir): Ditto.
(fhandler_proc::readdir): Ditto.
(fhandler_netdrive::readdir): Ditto.
(fhandler_registry::readdir): Ditto.
(fhandler_process::readdir): Ditto.
* fhandler.cc (fhandler_base::readdir): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Ditto.
* fhandler_cygdrive.cc (fhandler_cygdrive::readdir): Ditto.
* fhandler_proc.cc (fhandler_proc::readdir): Ditto.
* fhandler_netdrive.cc (fhandler_netdrive::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
Diffstat (limited to 'winsup/cygwin/fhandler_process.cc')
-rw-r--r-- | winsup/cygwin/fhandler_process.cc | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 7cc53302f..1585c2fea 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -209,30 +209,28 @@ fhandler_process::opendir () return dir; } -struct dirent * -fhandler_process::readdir (DIR * dir) +int +fhandler_process::readdir (DIR *dir, dirent *de) { + int res = ENMFILE; if (fileid == PROCESS_FD) { if (dir->__d_position >= 2 + filesize / sizeof (int)) - return NULL; + goto out; } else if (dir->__d_position >= PROCESS_LINK_COUNT) - return NULL; + goto out; if (fileid == PROCESS_FD && dir->__d_position > 1) { int *p = (int *) filebuf; - __small_sprintf (dir->__d_dirent->d_name, "%d", p[dir->__d_position++ - 2]); - syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir, - dir->__d_dirent->d_name); + __small_sprintf (de->d_name, "%d", p[dir->__d_position++ - 2]); } else - { - strcpy (dir->__d_dirent->d_name, process_listing[dir->__d_position++]); - syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir, - dir->__d_dirent->d_name); - } - return dir->__d_dirent; + strcpy (de->d_name, process_listing[dir->__d_position++]); + res = 0; +out: + syscall_printf ("%d = readdir (%p, %p) (%s)", dir, de, de->d_name); + return res; } int |