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.
This commit is contained in:
parent
a673eba664
commit
6b7cd251c7
|
@ -1,3 +1,22 @@
|
|||
2002-06-02 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
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.
|
||||
|
||||
2002-06-02 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* dll_init.cc (dll_list::detach): Don't run destructor on exit.
|
||||
|
||||
2002-06-01 Christopher Faylor <cgf@redhat.com>
|
||||
|
||||
* fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into
|
||||
|
|
|
@ -18,7 +18,6 @@ details. */
|
|||
#define _COMPILING_NEWLIB
|
||||
#include <dirent.h>
|
||||
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
|
|
|
@ -18,6 +18,7 @@ details. */
|
|||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "pinfo.h"
|
||||
|
||||
extern void __stdcall check_sanity_and_sync (per_process *);
|
||||
|
||||
|
@ -183,6 +184,9 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
|
|||
void
|
||||
dll_list::detach (dll *d)
|
||||
{
|
||||
if (!myself || myself->process_state == PID_EXITED)
|
||||
return;
|
||||
|
||||
if (d->count <= 0)
|
||||
system_printf ("WARNING: try to detach an already detached dll ...\n");
|
||||
else if (--d->count == 0)
|
||||
|
|
|
@ -24,7 +24,6 @@ details. */
|
|||
|
||||
#define USE_SYS_TYPES_FD_SET
|
||||
#include <winsock.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygerrno.h"
|
||||
#include "perprocess.h"
|
||||
|
|
|
@ -15,7 +15,6 @@ details. */
|
|||
#include <fcntl.h>
|
||||
#include <sys/cygwin.h>
|
||||
#include <cygwin/version.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "perprocess.h"
|
||||
#include "security.h"
|
||||
|
|
|
@ -17,7 +17,6 @@ details. */
|
|||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "environ.h"
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ details. */
|
|||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "shared_info.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
|
|
@ -1091,6 +1091,7 @@ class fhandler_proc: public fhandler_virtual
|
|||
void fill_filebuf ();
|
||||
};
|
||||
|
||||
class pinfo;
|
||||
class fhandler_registry: public fhandler_proc
|
||||
{
|
||||
public:
|
||||
|
@ -1111,16 +1112,13 @@ class fhandler_registry: public fhandler_proc
|
|||
struct _pinfo;
|
||||
class fhandler_process: public fhandler_proc
|
||||
{
|
||||
private:
|
||||
pid_t saved_pid;
|
||||
_pinfo *saved_p;
|
||||
public:
|
||||
fhandler_process ();
|
||||
int exists();
|
||||
struct dirent *readdir (DIR *);
|
||||
int open (path_conv *real_path, int flags, mode_t mode = 0);
|
||||
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
|
||||
void fill_filebuf ();
|
||||
void fill_filebuf (pinfo& p);
|
||||
};
|
||||
|
||||
typedef union
|
||||
|
|
|
@ -24,7 +24,6 @@ details. */
|
|||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "shared_info.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include <assert.h>
|
||||
|
||||
|
|
|
@ -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 (pinfo (atoi (path)))
|
||||
return FH_PROCESS;
|
||||
|
||||
if (!proc_exists (p))
|
||||
continue;
|
||||
bool has_subdir = false;
|
||||
while (*path)
|
||||
if (SLASH_P (*path++))
|
||||
{
|
||||
has_subdir = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (p->pid == pid)
|
||||
return FH_PROCESS;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ details. */
|
|||
#include "cygerrno.h"
|
||||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "path.h"
|
||||
#include "shared_info.h"
|
||||
|
@ -157,7 +156,6 @@ fhandler_process::open (path_conv *pc, int flags, mode_t mode)
|
|||
{
|
||||
int process_file_no = -1, pid;
|
||||
winpids pids;
|
||||
_pinfo *p;
|
||||
|
||||
int res = fhandler_virtual::open (pc, flags, mode);
|
||||
if (!res)
|
||||
|
@ -218,29 +216,23 @@ fhandler_process::open (path_conv *pc, int flags, mode_t mode)
|
|||
res = 0;
|
||||
goto out;
|
||||
}
|
||||
for (unsigned i = 0; i < pids.npids; i++)
|
||||
|
||||
{
|
||||
pinfo p (pid);
|
||||
if (!p)
|
||||
{
|
||||
p = pids[i];
|
||||
|
||||
if (!proc_exists (p))
|
||||
continue;
|
||||
|
||||
if (p->pid == pid)
|
||||
goto found;
|
||||
set_errno (ENOENT);
|
||||
res = 0;
|
||||
goto out;
|
||||
}
|
||||
set_errno (ENOENT);
|
||||
res = 0;
|
||||
goto out;
|
||||
found:
|
||||
fileid = process_file_no;
|
||||
saved_pid = pid;
|
||||
saved_p = p;
|
||||
fill_filebuf ();
|
||||
|
||||
fill_filebuf (p);
|
||||
|
||||
if (flags & O_APPEND)
|
||||
position = filesize;
|
||||
else
|
||||
position = 0;
|
||||
}
|
||||
|
||||
success:
|
||||
res = 1;
|
||||
|
@ -252,15 +244,8 @@ out:
|
|||
}
|
||||
|
||||
void
|
||||
fhandler_process::fill_filebuf ()
|
||||
fhandler_process::fill_filebuf (pinfo& p)
|
||||
{
|
||||
// has this process gone away?
|
||||
if (!proc_exists (saved_p) || saved_p->pid != saved_pid)
|
||||
{
|
||||
if (filebuf)
|
||||
cfree(filebuf);
|
||||
filesize = 0; bufalloc = (size_t) -1;
|
||||
}
|
||||
switch (fileid)
|
||||
{
|
||||
case PROCESS_UID:
|
||||
|
@ -276,22 +261,22 @@ fhandler_process::fill_filebuf ()
|
|||
switch (fileid)
|
||||
{
|
||||
case PROCESS_PPID:
|
||||
num = saved_p->ppid;
|
||||
num = p->ppid;
|
||||
break;
|
||||
case PROCESS_UID:
|
||||
num = saved_p->uid;
|
||||
num = p->uid;
|
||||
break;
|
||||
case PROCESS_PGID:
|
||||
num = saved_p->pgid;
|
||||
num = p->pgid;
|
||||
break;
|
||||
case PROCESS_SID:
|
||||
num = saved_p->sid;
|
||||
num = p->sid;
|
||||
break;
|
||||
case PROCESS_GID:
|
||||
num = saved_p->gid;
|
||||
num = p->gid;
|
||||
break;
|
||||
case PROCESS_CTTY:
|
||||
num = saved_p->ctty;
|
||||
num = p->ctty;
|
||||
break;
|
||||
default: // what's this here for?
|
||||
num = 0;
|
||||
|
@ -305,11 +290,11 @@ fhandler_process::fill_filebuf ()
|
|||
{
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = MAX_PATH);
|
||||
if (saved_p->process_state & (PID_ZOMBIE | PID_EXITED))
|
||||
if (p->process_state & (PID_ZOMBIE | PID_EXITED))
|
||||
strcpy (filebuf, "<defunct>");
|
||||
else
|
||||
{
|
||||
mount_table->conv_to_posix_path (saved_p->progname, filebuf, 1);
|
||||
mount_table->conv_to_posix_path (p->progname, filebuf, 1);
|
||||
int len = strlen (filebuf);
|
||||
if (len > 4)
|
||||
{
|
||||
|
@ -325,16 +310,16 @@ fhandler_process::fill_filebuf ()
|
|||
{
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
|
||||
__small_sprintf (filebuf, "%d\n", saved_p->dwProcessId);
|
||||
__small_sprintf (filebuf, "%d\n", p->dwProcessId);
|
||||
filesize = strlen (filebuf);
|
||||
break;
|
||||
}
|
||||
case PROCESS_WINEXENAME:
|
||||
{
|
||||
int len = strlen (saved_p->progname);
|
||||
int len = strlen (p->progname);
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = (len + 2));
|
||||
strcpy (filebuf, saved_p->progname);
|
||||
strcpy (filebuf, p->progname);
|
||||
filebuf[len] = '\n';
|
||||
filesize = len + 1;
|
||||
break;
|
||||
|
@ -343,23 +328,23 @@ fhandler_process::fill_filebuf ()
|
|||
{
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||
filesize = format_process_status (saved_p, filebuf, bufalloc);
|
||||
filesize = format_process_status (p, filebuf, bufalloc);
|
||||
break;
|
||||
}
|
||||
case PROCESS_STAT:
|
||||
{
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||
filesize = format_process_stat (saved_p, filebuf, bufalloc);
|
||||
filesize = format_process_stat (p, filebuf, bufalloc);
|
||||
break;
|
||||
}
|
||||
case PROCESS_STATM:
|
||||
{
|
||||
if (!filebuf)
|
||||
filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
|
||||
filesize = format_process_statm (saved_p, filebuf, bufalloc);
|
||||
filesize = format_process_statm (p, filebuf, bufalloc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ details. */
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
|
|
|
@ -20,7 +20,6 @@ details. */
|
|||
#include "dtable.h"
|
||||
#include "cygerrno.h"
|
||||
#include "cygheap.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "sys/cygwin.h"
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ details. */
|
|||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygheap.h"
|
||||
#include <sys/termios.h>
|
||||
|
|
|
@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
|
|||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef _PINFO_H
|
||||
#define _PINFO_H
|
||||
/* Signal constants (have to define them here, unfortunately) */
|
||||
|
||||
enum
|
||||
|
@ -152,7 +154,11 @@ public:
|
|||
_pinfo *operator * () const {return procinfo;}
|
||||
operator _pinfo * () const {return procinfo;}
|
||||
// operator bool () const {return (int) h;}
|
||||
#ifdef _SIGPROC_H
|
||||
int remember () {destroy = 0; return proc_subproc (PROC_ADDCHILD, (DWORD) this);}
|
||||
#else
|
||||
int remember () {system_printf ("remember is not here"); return 0;}
|
||||
#endif
|
||||
HANDLE shared_handle () {return h;}
|
||||
};
|
||||
|
||||
|
@ -206,3 +212,4 @@ int __stdcall fixup_shms_after_fork ();
|
|||
|
||||
void __stdcall fill_rusage (struct rusage *, HANDLE);
|
||||
void __stdcall add_rusage (struct rusage *, struct rusage *);
|
||||
#endif /*_PINFO_H*/
|
||||
|
|
|
@ -19,7 +19,6 @@ details. */
|
|||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "thread.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
|
||||
static unsigned pipecount;
|
||||
|
|
|
@ -17,7 +17,6 @@ details. */
|
|||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include "cygerrno.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "psapi.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <sched.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
/* for getpid */
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -28,7 +28,6 @@ details. */
|
|||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygheap.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ details. */
|
|||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygheap.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ details. */
|
|||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygheap.h"
|
||||
#include <ntdef.h>
|
||||
|
|
|
@ -15,7 +15,6 @@ details. */
|
|||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <errno.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
|
|
|
@ -8,6 +8,8 @@ This software is a copyrighted work licensed under the terms of the
|
|||
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#ifndef _SIGPROC_H
|
||||
#define _SIGPROC_H
|
||||
#include <signal.h>
|
||||
|
||||
#define EXIT_SIGNAL 0x010000
|
||||
|
@ -124,3 +126,4 @@ extern char myself_nowait_nonmain_dummy[];
|
|||
|
||||
#define myself_nowait ((_pinfo *)myself_nowait_dummy)
|
||||
#define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)
|
||||
#endif /*_SIGPROC_H*/
|
||||
|
|
|
@ -14,7 +14,6 @@ details. */
|
|||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include <ctype.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "perprocess.h"
|
||||
#include "cygwin_version.h"
|
||||
|
|
|
@ -37,7 +37,6 @@ details. */
|
|||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "perprocess.h"
|
||||
#include "security.h"
|
||||
|
|
|
@ -20,7 +20,6 @@ details. */
|
|||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
#include "path.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "hires.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ details. */
|
|||
#include "path.h"
|
||||
#include "dtable.h"
|
||||
#include "cygheap.h"
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "cygwin/cygserver_transport.h"
|
||||
#include "cygwin/cygserver.h"
|
||||
|
|
|
@ -19,7 +19,6 @@ details. */
|
|||
#include <lm.h>
|
||||
#include <errno.h>
|
||||
#include <sys/cygwin.h>
|
||||
#include "sigproc.h"
|
||||
#include "pinfo.h"
|
||||
#include "security.h"
|
||||
#include "fhandler.h"
|
||||
|
|
Loading…
Reference in New Issue