* cygheap.h (cygheap_types): Add HEAP_COMMUNE.

* fhandler_proc.cc: Use cygheap rather than user heap for allocation of filebuf
throughout.
* fhandler_registry.cc: Ditto.
* fhandler_virtual.cc: Ditto.
* fhandler_process.cc: Ditto.
(get_mem_values): Use malloc/realloc/free rather than new.
* pinfo.cc (_pinfo::commune_send): Allocate on cygwin heap rather than user
heap.  Avoid calling ReadFile when correct number of characters have been read
or suffer buffer corruption.
(_pinfo::fd): Allocate on cygwin heap rather than user heap.
(_pinfo::fds): Ditto.
(_pinfo::root): Ditto.
(_pinfo::cwd): Ditto.
(_pinfo::cmdline): Ditto.
* devices.h (FH_DEV): New define.
* devices.in: Detect lone /dev.
* devices.cc: Regenerate.
* path.cc (path_conv::check): Treat FH_DEV as a special case.
This commit is contained in:
Christopher Faylor
2005-08-24 04:38:39 +00:00
parent db7f135b03
commit 14c4d65ef1
11 changed files with 954 additions and 891 deletions

View File

@@ -342,7 +342,7 @@ fhandler_proc::fill_filebuf ()
uname (&uts_name);
bufalloc = strlen (uts_name.sysname) + 1 + strlen (uts_name.release) +
1 + strlen (uts_name.version) + 2;
filebuf = (char *) realloc (filebuf, bufalloc);
filebuf = (char *) crealloc (filebuf, bufalloc);
filesize = __small_sprintf (filebuf, "%s %s %s\n", uts_name.sysname,
uts_name.release, uts_name.version);
}
@@ -350,13 +350,13 @@ fhandler_proc::fill_filebuf ()
}
case PROC_UPTIME:
{
filebuf = (char *) realloc (filebuf, bufalloc = 80);
filebuf = (char *) crealloc (filebuf, bufalloc = 80);
filesize = format_proc_uptime (filebuf, bufalloc);
break;
}
case PROC_STAT:
{
filebuf = (char *) realloc (filebuf, bufalloc = 16384);
filebuf = (char *) crealloc (filebuf, bufalloc = 16384);
filesize = format_proc_stat (filebuf, bufalloc);
break;
}
@@ -367,32 +367,32 @@ fhandler_proc::fill_filebuf ()
* Windows 95/98/me does have the KERNEL/CPUUsage performance counter
* which is similar.
*/
filebuf = (char *) realloc (filebuf, bufalloc = 16);
filebuf = (char *) crealloc (filebuf, bufalloc = 16);
filesize = __small_sprintf (filebuf, "%u.%02u %u.%02u %u.%02u\n",
0, 0, 0, 0, 0, 0);
break;
}
case PROC_MEMINFO:
{
filebuf = (char *) realloc (filebuf, bufalloc = 2048);
filebuf = (char *) crealloc (filebuf, bufalloc = 2048);
filesize = format_proc_meminfo (filebuf, bufalloc);
break;
}
case PROC_CPUINFO:
{
filebuf = (char *) realloc (filebuf, bufalloc = 16384);
filebuf = (char *) crealloc (filebuf, bufalloc = 16384);
filesize = format_proc_cpuinfo (filebuf, bufalloc);
break;
}
case PROC_PARTITIONS:
{
filebuf = (char *) realloc (filebuf, bufalloc = 4096);
filebuf = (char *) crealloc (filebuf, bufalloc = 4096);
filesize = format_proc_partitions (filebuf, bufalloc);
break;
}
case PROC_SELF:
{
filebuf = (char *) realloc (filebuf, bufalloc = 32);
filebuf = (char *) crealloc (filebuf, bufalloc = 32);
filesize = __small_sprintf (filebuf, "%d", getpid ());
}
}