aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-11-07 03:47:50 +0000
committerChristopher Faylor <me@cgf.cx>2002-11-07 03:47:50 +0000
commit2c5347b2ae6e3a67056155f468bf8cecdcfa51a5 (patch)
tree66d04c4724ed462033d793ad6b696d2584eb7619
parent3f6dc9877b6acd6d3e3ca475ddf816208bfd4ada (diff)
downloadnewlib-unlabeled-1.24.2.zip
newlib-unlabeled-1.24.2.tar.gz
newlib-unlabeled-1.24.2.tar.bz2
* include/cygwin/version.h: Bump API minor number for below export.github/unlabeled-1.24.2unlabeled-1.24.2
* cygwin.din (pututline): New exported function. * syscalls.cc (login): Use pututiline(). (setutent): Open utmp as read/write. (endutent): Check if utmp file is open. (utmpname): call endutent() to close current utmp file. (getutid): Enable all cases, use strncmp() to compare ut_id fields. (pututline): New. * tty.cc (create_tty_master): Set ut_pid to current pid. * fhandler.h (fhandler_serial::vmin_): Declare as size_t. * fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for minchars. (fhandler_serial::ioctl): Set errno if the ClearCommError fails. (fhandler_serial::tcsetattr): Use correct value for vmin_. (fhandler_serial::tcgetattr): Ditto. * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL WSARecvFrom with fromlen = NULL.
-rw-r--r--winsup/cygwin/fhandler_process.cc32
1 files changed, 14 insertions, 18 deletions
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index a9e8d2f..7cbfaa3 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -42,7 +42,6 @@ static const int PROCESS_SID = 10;
static const int PROCESS_CTTY = 11;
static const int PROCESS_STAT = 12;
static const int PROCESS_STATM = 13;
-static const int PROCESS_CMDLINE = 14;
static const char * const process_listing[] =
{
@@ -60,7 +59,6 @@ static const char * const process_listing[] =
"ctty",
"stat",
"statm",
- "cmdline",
NULL
};
@@ -266,7 +264,8 @@ fhandler_process::fill_filebuf ()
case PROCESS_CTTY:
case PROCESS_PPID:
{
- filebuf = (char *) realloc (filebuf, bufalloc = 40);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
int num;
switch (fileid)
{
@@ -296,18 +295,10 @@ fhandler_process::fill_filebuf ()
filesize = strlen (filebuf);
break;
}
- case PROCESS_CMDLINE:
- {
- if (filebuf)
- free (filebuf);
- filebuf = p->cmdline (filesize);
- if (!*filebuf)
- filebuf = strdup ("<defunct>");
- break;
- }
case PROCESS_EXENAME:
{
- filebuf = (char *) realloc (filebuf, bufalloc = MAX_PATH);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = MAX_PATH);
if (p->process_state & (PID_ZOMBIE | PID_EXITED))
strcpy (filebuf, "<defunct>");
else
@@ -326,7 +317,8 @@ fhandler_process::fill_filebuf ()
}
case PROCESS_WINPID:
{
- filebuf = (char *) realloc (filebuf, bufalloc = 40);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 40);
__small_sprintf (filebuf, "%d\n", p->dwProcessId);
filesize = strlen (filebuf);
break;
@@ -334,7 +326,8 @@ fhandler_process::fill_filebuf ()
case PROCESS_WINEXENAME:
{
int len = strlen (p->progname);
- filebuf = (char *) realloc (filebuf, bufalloc = (len + 2));
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = (len + 2));
strcpy (filebuf, p->progname);
filebuf[len] = '\n';
filesize = len + 1;
@@ -342,19 +335,22 @@ fhandler_process::fill_filebuf ()
}
case PROCESS_STATUS:
{
- filebuf = (char *) realloc (filebuf, bufalloc = 2048);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
filesize = format_process_status (*p, filebuf, bufalloc);
break;
}
case PROCESS_STAT:
{
- filebuf = (char *) realloc (filebuf, bufalloc = 2048);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
filesize = format_process_stat (*p, filebuf, bufalloc);
break;
}
case PROCESS_STATM:
{
- filebuf = (char *) realloc (filebuf, bufalloc = 2048);
+ if (!filebuf)
+ filebuf = (char *) cmalloc (HEAP_BUF, bufalloc = 2048);
filesize = format_process_statm (*p, filebuf, bufalloc);
break;
}