From 6b7cd251c7f03394208d65451ef1bed91905026f Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 2 Jun 2002 06:07:01 +0000 Subject: Remove unneeded sigproc.h includes throughout. * fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument. * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search for given pid. (fhandler_proc::readdir): Assume that pid exists if it shows up in the winpid list. * fhandler_process.cc (fhandler_process::open): Simplify search for given pid. Call fill_filebuf with pinfo argument. (fhandler_process::fill_filebuf): Pass pinfo here and assume that it exists. * pinfo.h (pinfo::remember): Define differently if sigproc.h is not included. * dll_init.cc (dll_list::detach): Don't run destructor on exit. --- winsup/cygwin/fhandler_proc.cc | 63 +++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 41 deletions(-) (limited to 'winsup/cygwin/fhandler_proc.cc') diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index aa2324ef5..5d0a5a591 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -19,7 +19,6 @@ details. */ #include "security.h" #include "fhandler.h" #include "path.h" -#include "sigproc.h" #include "pinfo.h" #include "dtable.h" #include "cygheap.h" @@ -101,34 +100,24 @@ fhandler_proc::get_proc_fhandler (const char *path) return proc_fhandlers[i]; } - int pid = atoi (path); - winpids pids; - for (unsigned i = 0; i < pids.npids; i++) - { - _pinfo *p = pids[i]; - - if (!proc_exists (p)) - continue; - - if (p->pid == pid) - return FH_PROCESS; - } + if (pinfo (atoi (path))) + return FH_PROCESS; - bool has_subdir = false; - while (*path) - if (SLASH_P (*path++)) - { - has_subdir = true; - break; - } + bool has_subdir = false; + while (*path) + if (SLASH_P (*path++)) + { + has_subdir = true; + break; + } - if (has_subdir) - /* The user is trying to access a non-existent subdirectory of /proc. */ - return FH_BAD; - else - /* Return FH_PROC so that we can return EROFS if the user is trying to create - a file. */ - return FH_PROC; + if (has_subdir) + /* The user is trying to access a non-existent subdirectory of /proc. */ + return FH_BAD; + else + /* Return FH_PROC so that we can return EROFS if the user is trying to create + a file. */ + return FH_PROC; } /* Returns 0 if path doesn't exist, >0 if path is a directory, @@ -203,20 +192,12 @@ fhandler_proc::readdir (DIR * dir) winpids pids; int found = 0; for (unsigned i = 0; i < pids.npids; i++) - { - _pinfo *p = pids[i]; - - if (!proc_exists (p)) - continue; - - if (found == dir->__d_position - PROC_LINK_COUNT) - { - __small_sprintf (dir->__d_dirent->d_name, "%d", p->pid); - dir->__d_position++; - return dir->__d_dirent; - } - found++; - } + if (found++ == dir->__d_position - PROC_LINK_COUNT) + { + __small_sprintf (dir->__d_dirent->d_name, "%d", pids[i]->pid); + dir->__d_position++; + return dir->__d_dirent; + } set_errno (ENMFILE); return NULL; } -- cgit v1.2.3