* dcrt0.cc (initial_env): Use PATH_MAX instead of CYG_MAX_PATH for path

name buffer size.
	(dll_crt0_1): Allocate new_argv0 with PATH_MAX size.
	* exceptions.cc (debugger_command): Set size to 2 * PATH_MAX + 20;
	(error_start_init): Use PATH_MAX instead of CYG_MAX_PATH for path
	name buffer size.
	* external.cc (fillout_pinfo): Always fill out ep.progname 0-terminated.
	Fill out ep.progname_long.
	* fhandler_process.cc (fhandler_process::fill_filebuf): Allocate
	buffer for executable filename with PATH_MAX size.
	* pinfo.cc: Throughout use PATH_MAX instead of CYG_MAX_PATH.
	* pinfo.h (class _pinfo): Set progname size to PATH_MAX.
	* smallprint.cc: Include limits.h.  Use PATH_MAX instead of CYG_MAX_PATH
	for path name buffer size.
	* strace.cc (strace::vsprntf): Ditto.
	* include/sys/cygwin.h (EXTERNAL_PINFO_VERSION_32_LP): Define.
	(EXTERNAL_PINFO_VERSION): Set to EXTERNAL_PINFO_VERSION_32_LP.
	(struct external_pinfo): Add progname_long member.
	* include/sys/dirent.h: Correctly include limits.h instead of
	sys/limits.h.
This commit is contained in:
Corinna Vinschen 2007-12-06 18:24:06 +00:00
parent 6320370052
commit 36093cfbbf
11 changed files with 53 additions and 23 deletions

View File

@ -1,3 +1,26 @@
2007-12-06 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (initial_env): Use PATH_MAX instead of CYG_MAX_PATH for path
name buffer size.
(dll_crt0_1): Allocate new_argv0 with PATH_MAX size.
* exceptions.cc (debugger_command): Set size to 2 * PATH_MAX + 20;
(error_start_init): Use PATH_MAX instead of CYG_MAX_PATH for path
name buffer size.
* external.cc (fillout_pinfo): Always fill out ep.progname 0-terminated.
Fill out ep.progname_long.
* fhandler_process.cc (fhandler_process::fill_filebuf): Allocate
buffer for executable filename with PATH_MAX size.
* pinfo.cc: Throughout use PATH_MAX instead of CYG_MAX_PATH.
* pinfo.h (class _pinfo): Set progname size to PATH_MAX.
* smallprint.cc: Include limits.h. Use PATH_MAX instead of CYG_MAX_PATH
for path name buffer size.
* strace.cc (strace::vsprntf): Ditto.
* include/sys/cygwin.h (EXTERNAL_PINFO_VERSION_32_LP): Define.
(EXTERNAL_PINFO_VERSION): Set to EXTERNAL_PINFO_VERSION_32_LP.
(struct external_pinfo): Add progname_long member.
* include/sys/dirent.h: Correctly include limits.h instead of
sys/limits.h.
2007-12-05 Corinna Vinschen <corinna@vinschen.de> 2007-12-05 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tty.cc (fhandler_tty_slave::open): Use MAX_PATH instead of * fhandler_tty.cc (fhandler_tty_slave::open): Use MAX_PATH instead of

View File

@ -542,7 +542,7 @@ break_here ()
static void static void
initial_env () initial_env ()
{ {
char buf[CYG_MAX_PATH]; char buf[PATH_MAX];
if (GetEnvironmentVariable ("CYGWIN_TESTING", buf, sizeof (buf) - 1)) if (GetEnvironmentVariable ("CYGWIN_TESTING", buf, sizeof (buf) - 1))
_cygwin_testing = 1; _cygwin_testing = 1;
@ -553,7 +553,7 @@ initial_env ()
{ {
DWORD ms = atoi (buf); DWORD ms = atoi (buf);
buf[0] = '\0'; buf[0] = '\0';
len = GetModuleFileName (NULL, buf, CYG_MAX_PATH); len = GetModuleFileName (NULL, buf, PATH_MAX);
console_printf ("Sleeping %d, pid %u %s\n", ms, GetCurrentProcessId (), buf); console_printf ("Sleeping %d, pid %u %s\n", ms, GetCurrentProcessId (), buf);
Sleep (ms); Sleep (ms);
if (!strace.active () && !dynamically_loaded) if (!strace.active () && !dynamically_loaded)
@ -561,8 +561,8 @@ initial_env ()
} }
if (GetEnvironmentVariable ("CYGWIN_DEBUG", buf, sizeof (buf) - 1)) if (GetEnvironmentVariable ("CYGWIN_DEBUG", buf, sizeof (buf) - 1))
{ {
char buf1[CYG_MAX_PATH]; char buf1[PATH_MAX];
len = GetModuleFileName (NULL, buf1, CYG_MAX_PATH); len = GetModuleFileName (NULL, buf1, PATH_MAX);
strlwr (buf1); strlwr (buf1);
strlwr (buf); strlwr (buf);
char *p = strpbrk (buf, ":="); char *p = strpbrk (buf, ":=");
@ -871,7 +871,7 @@ dll_crt0_1 (void *)
win32 style. */ win32 style. */
if ((strchr (__argv[0], ':')) || (strchr (__argv[0], '\\'))) if ((strchr (__argv[0], ':')) || (strchr (__argv[0], '\\')))
{ {
char *new_argv0 = (char *) malloc (CYG_MAX_PATH); char *new_argv0 = (char *) malloc (PATH_MAX);
cygwin_conv_to_posix_path (__argv[0], new_argv0); cygwin_conv_to_posix_path (__argv[0], new_argv0);
__argv[0] = (char *) realloc (new_argv0, strlen (new_argv0) + 1); __argv[0] = (char *) realloc (new_argv0, strlen (new_argv0) + 1);
} }

View File

@ -35,7 +35,7 @@ details. */
#define CALL_HANDLER_RETRY 20 #define CALL_HANDLER_RETRY 20
char debugger_command[2 * CYG_MAX_PATH + 20]; char debugger_command[2 * PATH_MAX + 20];
extern "C" { extern "C" {
extern void sigdelayed (); extern void sigdelayed ();
@ -118,8 +118,8 @@ error_start_init (const char *buf)
return; return;
} }
char pgm[CYG_MAX_PATH]; char pgm[PATH_MAX];
if (!GetModuleFileName (NULL, pgm, CYG_MAX_PATH)) if (!GetModuleFileName (NULL, pgm, PATH_MAX))
strcpy (pgm, "cygwin1.dll"); strcpy (pgm, "cygwin1.dll");
for (char *p = strchr (pgm, '\\'); p; p = strchr (p, '\\')) for (char *p = strchr (pgm, '\\'); p; p = strchr (p, '\\'))
*p = '/'; *p = '/';

View File

@ -88,7 +88,8 @@ fillout_pinfo (pid_t pid, int winpid)
ep.start_time = p->start_time; ep.start_time = p->start_time;
ep.rusage_self = p->rusage_self; ep.rusage_self = p->rusage_self;
ep.rusage_children = p->rusage_children; ep.rusage_children = p->rusage_children;
strcpy (ep.progname, p->progname); ep.progname[0] = '\0';
strncat (ep.progname, p->progname, MAX_PATH - 1);
ep.strace_mask = 0; ep.strace_mask = 0;
ep.version = EXTERNAL_PINFO_VERSION; ep.version = EXTERNAL_PINFO_VERSION;
@ -96,6 +97,8 @@ fillout_pinfo (pid_t pid, int winpid)
ep.uid32 = p->uid; ep.uid32 = p->uid;
ep.gid32 = p->gid; ep.gid32 = p->gid;
strcpy (ep.progname_long, p->progname);
break; break;
} }
} }

View File

@ -442,7 +442,7 @@ fhandler_process::fill_filebuf ()
case PROCESS_EXENAME: case PROCESS_EXENAME:
case PROCESS_EXE: case PROCESS_EXE:
{ {
filebuf = (char *) crealloc_abort (filebuf, bufalloc = CYG_MAX_PATH); filebuf = (char *) crealloc_abort (filebuf, bufalloc = PATH_MAX);
if (p->process_state & PID_EXITED) if (p->process_state & PID_EXITED)
strcpy (filebuf, "<defunct>"); strcpy (filebuf, "<defunct>");
else else

View File

@ -226,7 +226,8 @@ extern int cygwin_attach_handle_to_fd (char *, int, HANDLE, mode_t, DWORD);
#define EXTERNAL_PINFO_VERSION_16_BIT 0 #define EXTERNAL_PINFO_VERSION_16_BIT 0
#define EXTERNAL_PINFO_VERSION_32_BIT 1 #define EXTERNAL_PINFO_VERSION_32_BIT 1
#define EXTERNAL_PINFO_VERSION EXTERNAL_PINFO_VERSION_32_BIT #define EXTERNAL_PINFO_VERSION_32_LP 2
#define EXTERNAL_PINFO_VERSION EXTERNAL_PINFO_VERSION_32_LP
#ifndef _SYS_TYPES_H #ifndef _SYS_TYPES_H
typedef unsigned short __uid16_t; typedef unsigned short __uid16_t;
@ -262,6 +263,9 @@ struct external_pinfo
/* Only available if version >= EXTERNAL_PINFO_VERSION_32_BIT */ /* Only available if version >= EXTERNAL_PINFO_VERSION_32_BIT */
__uid32_t uid32; __uid32_t uid32;
__gid32_t gid32; __gid32_t gid32;
/* Only available if version >= EXTERNAL_PINFO_VERSION_32_LP */
char progname_long[PATH_MAX];
}; };
#endif /*__CYGWIN__*/ #endif /*__CYGWIN__*/
#endif /*WINVER*/ #endif /*WINVER*/

View File

@ -12,7 +12,7 @@
#define _SYS_DIRENT_H #define _SYS_DIRENT_H
#include <sys/types.h> #include <sys/types.h>
#include <sys/limits.h> #include <limits.h>
#define __DIRENT_VERSION 2 #define __DIRENT_VERSION 2

View File

@ -392,7 +392,7 @@ DWORD WINAPI
commune_process (void *arg) commune_process (void *arg)
{ {
siginfo_t& si = *((siginfo_t *) arg); siginfo_t& si = *((siginfo_t *) arg);
char path[CYG_MAX_PATH]; char path[PATH_MAX];
DWORD nr; DWORD nr;
HANDLE& tothem = si._si_commune._si_write_handle; HANDLE& tothem = si._si_commune._si_write_handle;
HANDLE process_sync = HANDLE process_sync =
@ -439,8 +439,7 @@ commune_process (void *arg)
case PICOM_CWD: case PICOM_CWD:
{ {
sigproc_printf ("processing PICOM_CWD"); sigproc_printf ("processing PICOM_CWD");
unsigned int n = strlen (cygheap->cwd.get (path, 1, 1, unsigned int n = strlen (cygheap->cwd.get (path, 1, 1, PATH_MAX)) + 1;
CYG_MAX_PATH)) + 1;
if (!WriteFile (tothem, &n, sizeof n, &nr, NULL)) if (!WriteFile (tothem, &n, sizeof n, &nr, NULL))
sigproc_printf ("WriteFile sizeof cwd failed, %E"); sigproc_printf ("WriteFile sizeof cwd failed, %E");
else if (!WriteFile (tothem, path, n, &nr, NULL)) else if (!WriteFile (tothem, path, n, &nr, NULL))
@ -571,7 +570,7 @@ _pinfo::commune_request (__uint32_t code, ...)
} }
locked = true; locked = true;
char name_buf[CYG_MAX_PATH]; char name_buf[MAX_PATH];
request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX, request_sync = CreateSemaphore (&sec_none_nih, 0, LONG_MAX,
shared_name (name_buf, "commune", myself->pid)); shared_name (name_buf, "commune", myself->pid));
if (!request_sync) if (!request_sync)
@ -666,7 +665,7 @@ _pinfo::fd (int fd, size_t &n)
if (cfd < 0) if (cfd < 0)
s = cstrdup (""); s = cstrdup ("");
else else
s = cfd->get_proc_fd_name ((char *) cmalloc_abort (HEAP_COMMUNE, CYG_MAX_PATH)); s = cfd->get_proc_fd_name ((char *) cmalloc_abort (HEAP_COMMUNE, PATH_MAX));
n = strlen (s) + 1; n = strlen (s) + 1;
} }
return s; return s;
@ -737,8 +736,8 @@ _pinfo::cwd (size_t& n)
} }
else else
{ {
s = (char *) cmalloc_abort (HEAP_COMMUNE, CYG_MAX_PATH); s = (char *) cmalloc_abort (HEAP_COMMUNE, PATH_MAX);
cygheap->cwd.get (s, 1, 1, CYG_MAX_PATH); cygheap->cwd.get (s, 1, 1, PATH_MAX);
n = strlen (s) + 1; n = strlen (s) + 1;
} }
return s; return s;

View File

@ -64,7 +64,7 @@ public:
DWORD dwProcessId; DWORD dwProcessId;
/* Used to spawn a child for fork(), among other things. */ /* Used to spawn a child for fork(), among other things. */
char progname[CYG_MAX_PATH]; char progname[PATH_MAX];
/* User information. /* User information.
The information is derived from the GetUserName system call, The information is derived from the GetUserName system call,

View File

@ -13,6 +13,7 @@ details. */
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h>
#define LLMASK (0xffffffffffffffffULL) #define LLMASK (0xffffffffffffffffULL)
#define LMASK (0xffffffff) #define LMASK (0xffffffff)
@ -63,7 +64,7 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned
extern "C" int extern "C" int
__small_vsprintf (char *dst, const char *fmt, va_list ap) __small_vsprintf (char *dst, const char *fmt, va_list ap)
{ {
char tmp[CYG_MAX_PATH + 1]; char tmp[PATH_MAX];
char *orig = dst; char *orig = dst;
const char *s; const char *s;
PWCHAR w; PWCHAR w;
@ -168,7 +169,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
dst = rnargLL (dst, 16, 0, len, pad); dst = rnargLL (dst, 16, 0, len, pad);
break; break;
case 'P': case 'P':
if (!GetModuleFileName (NULL, tmp, CYG_MAX_PATH)) if (!GetModuleFileName (NULL, tmp, PATH_MAX))
s = "cygwin program"; s = "cygwin program";
else else
s = tmp; s = tmp;

View File

@ -154,7 +154,7 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap)
pn = NULL; pn = NULL;
char *p; char *p;
char progname[CYG_MAX_PATH]; char progname[PATH_MAX];
if (!pn) if (!pn)
GetModuleFileName (NULL, pn = progname, sizeof (progname)); GetModuleFileName (NULL, pn = progname, sizeof (progname));
if (!pn) if (!pn)