Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-07-01 03:02:58 +0400
committerChristopher Faylor <me@cgf.cx>2002-07-01 03:02:58 +0400
commitfdf0b5de282128ded84921263ceb35d634a9dbbd (patch)
treef12201f3aa2a0f61d48d44ede554db8872406dff
parentccacec81dbe42adbb78fd7399c69a900ac8a5859 (diff)
* fhandler.h (fhandler_process::pid): New field.
(fhandler_process::fstat): Remove unneeded array. Set pid element. (fhandler_process::open): Ditto. (fhandler_process::fill_filebuf): Handle case where 'p' field is NULL.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler.h4
-rw-r--r--winsup/cygwin/fhandler_process.cc22
3 files changed, 26 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index cb7448b4c..f9204135a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2002-06-30 Christopher Faylor <cgf@redhat.com>
+ * fhandler.h (fhandler_process::pid): New field.
+ (fhandler_process::fstat): Remove unneeded array. Set pid element.
+ (fhandler_process::open): Ditto.
+ (fhandler_process::fill_filebuf): Handle case where 'p' field is NULL.
+
+2002-06-30 Christopher Faylor <cgf@redhat.com>
+
* fhandler.h (fhandler_process::p): New field.
(fhandler_process:fill_filebuf): Revert to same definition as virtual
in parent class.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index d04966a36..ebb07a8df 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1107,7 +1107,6 @@ class fhandler_proc: public fhandler_virtual
void fill_filebuf ();
};
-class pinfo;
class fhandler_registry: public fhandler_proc
{
public:
@@ -1125,9 +1124,10 @@ class fhandler_registry: public fhandler_proc
void fill_filebuf ();
};
-struct _pinfo;
+class pinfo;
class fhandler_process: public fhandler_proc
{
+ pid_t pid;
pinfo *p;
public:
fhandler_process ();
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index f2b896314..a0ba4af90 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -100,12 +100,11 @@ fhandler_process::fstat (struct __stat64 *buf, path_conv *pc)
int file_type = exists ();
(void) fhandler_base::fstat (buf, pc);
path += proc_len + 1;
- int pid = atoi (path);
- winpids pids;
+ pid = atoi (path);
pinfo p (pid);
if (!p)
{
- set_errno(ENOENT);
+ set_errno (ENOENT);
return -1;
}
@@ -154,8 +153,7 @@ fhandler_process::readdir (DIR * dir)
int
fhandler_process::open (path_conv *pc, int flags, mode_t mode)
{
- int process_file_no = -1, pid;
- winpids pids;
+ int process_file_no = -1;
int res = fhandler_virtual::open (pc, flags, mode);
if (!res)
@@ -249,6 +247,17 @@ out:
void
fhandler_process::fill_filebuf ()
{
+ pinfo pmaybe;
+
+ if (!p)
+ {
+ pmaybe.init (pid);
+ p = &pmaybe;
+ }
+
+ if (!p)
+ return;
+
switch (fileid)
{
case PROCESS_UID:
@@ -349,6 +358,9 @@ fhandler_process::fill_filebuf ()
break;
}
}
+
+ if (p == &pmaybe)
+ p = NULL;
}
static