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>2001-09-06 07:39:18 +0400
committerChristopher Faylor <me@cgf.cx>2001-09-06 07:39:18 +0400
commit4ce15a498010f678c71cefdf2a2ac0db58f4fa93 (patch)
tree67498c2416dddf7295358edc848708c05ac3d047 /winsup/cygwin
parent0fb61528c94f959e5c1bfc9aeab7e09d0dcbf54b (diff)
* cygheap.h (init_cygheap): Move bucket array here from cygheap.cc.
* cygheap.cc: Throughout use bucket array from cygheap. * sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save DLL space. (sigproc_fixup_after_fork): Free zombie array after a fork. * sigproc.h (sigproc_fixup_after_fork): Declare. * dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid stack corruption. * fhandler.cc (fhandler_base::open): Ditto. * path.cc (symlink): Ditto.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog17
-rw-r--r--winsup/cygwin/cygheap.cc14
-rw-r--r--winsup/cygwin/cygheap.h1
-rw-r--r--winsup/cygwin/dir.cc2
-rw-r--r--winsup/cygwin/fhandler.cc2
-rw-r--r--winsup/cygwin/fork.cc1
-rw-r--r--winsup/cygwin/passwd.cc6
-rw-r--r--winsup/cygwin/path.cc2
-rw-r--r--winsup/cygwin/security.cc2
-rw-r--r--winsup/cygwin/sigproc.cc19
-rw-r--r--winsup/cygwin/sigproc.h1
11 files changed, 49 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 43e9ff462..d256cc263 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,20 @@
+Wed Sep 5 23:36:03 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * cygheap.h (init_cygheap): Move bucket array here from cygheap.cc.
+ * cygheap.cc: Throughout use bucket array from cygheap.
+
+ * sigproc.cc (proc_subproc): Dynamically allocate zombie buffer to save
+ DLL space.
+ (sigproc_fixup_after_fork): Free zombie array after a fork.
+ * sigproc.h (sigproc_fixup_after_fork): Declare.
+
+2001-09-06 Egor Duda <deo@logos-m.ru>
+
+ * dir.cc (mkdir): Expand buffer for security descriptor to 4K to avoid
+ stack corruption.
+ * fhandler.cc (fhandler_base::open): Ditto.
+ * path.cc (symlink): Ditto.
+
Wed Sep 5 21:35:00 2001 Corinna Vinschen <corinna@vinschen.de>
* winver.rc: Change copyright to include 2001.
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 94d0dc0bd..8c45b1bce 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -35,9 +35,7 @@ struct cygheap_entry
char data[0];
};
-#define NBUCKETS 32
-static char *buckets[NBUCKETS] = {0};
-
+#define NBUCKETS (sizeof (cygheap->buckets) / sizeof (cygheap->buckets[0]))
#define N0 ((_cmalloc_entry *) NULL)
#define to_cmalloc(s) ((_cmalloc_entry *) (((char *) (s)) - (int) (N0->data)))
@@ -202,10 +200,10 @@ _cmalloc (int size)
continue;
cygheap_protect->acquire ();
- if (buckets[b])
+ if (cygheap->buckets[b])
{
- rvc = (_cmalloc_entry *) buckets[b];
- buckets[b] = rvc->ptr;
+ rvc = (_cmalloc_entry *) cygheap->buckets[b];
+ cygheap->buckets[b] = rvc->ptr;
rvc->b = b;
}
else
@@ -227,8 +225,8 @@ _cfree (void *ptr)
cygheap_protect->acquire ();
_cmalloc_entry *rvc = to_cmalloc (ptr);
DWORD b = rvc->b;
- rvc->ptr = buckets[b];
- buckets[b] = (char *) rvc;
+ rvc->ptr = cygheap->buckets[b];
+ cygheap->buckets[b] = (char *) rvc;
cygheap_protect->release ();
}
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index 5a3aeac37..5b385f5c1 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -152,6 +152,7 @@ struct cwdstuff
struct init_cygheap
{
_cmalloc_entry *chain;
+ char *buckets[32];
cygheap_root root;
cygheap_user user;
mode_t umask;
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 9d21cdc19..f716f23ba 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -339,7 +339,7 @@ mkdir (const char *dir, mode_t mode)
if (allow_ntsec && real_dir.has_acls ())
set_security_attribute (S_IFDIR | ((mode & 07777) & ~cygheap->umask),
- &sa, alloca (256), 256);
+ &sa, alloca (4096), 4096);
if (CreateDirectoryA (real_dir.get_win32 (), &sa))
{
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 4060a3819..115a4c796 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -387,7 +387,7 @@ fhandler_base::open (int flags, mode_t mode)
/* If the file should actually be created and ntsec is on,
set files attributes. */
if (flags & O_CREAT && get_device () == FH_DISK && allow_ntsec && has_acls ())
- set_security_attribute (mode, &sa, alloca (256), 256);
+ set_security_attribute (mode, &sa, alloca (4096), 4096);
x = CreateFileA (get_win32_name (), access, shared,
&sa, creation_distribution,
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 834c356d7..173c02b1b 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -279,6 +279,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls)
debug_fixup_after_fork ();
pinfo_fixup_after_fork ();
cygheap->fdtab.fixup_after_fork (hParent);
+ sigproc_fixup_after_fork ();
signal_fixup_after_fork ();
MALLOC_CHECK;
diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc
index f7b0853ad..4fe7166aa 100644
--- a/winsup/cygwin/passwd.cc
+++ b/winsup/cygwin/passwd.cc
@@ -27,9 +27,9 @@ details. */
/* Read /etc/passwd only once for better performance. This is done
on the first call that needs information from it. */
-static struct passwd *passwd_buf = NULL; /* passwd contents in memory */
-static int curr_lines = 0;
-static int max_lines = 0;
+static struct passwd *passwd_buf; /* passwd contents in memory */
+static int curr_lines;
+static int max_lines;
/* Set to loaded when /etc/passwd has been read in by read_etc_passwd ().
Set to emulated if passwd is emulated. */
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 25d2174bd..7e32ae8ec 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2461,7 +2461,7 @@ symlink (const char *topath, const char *frompath)
if (allow_ntsec && win32_path.has_acls ())
set_security_attribute (S_IFLNK | S_IRWXU | S_IRWXG | S_IRWXO,
- &sa, alloca (256), 256);
+ &sa, alloca (4096), 4096);
h = CreateFileA(win32_path, GENERIC_WRITE, 0, &sa,
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 24501fa7b..f208ebeec 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -44,7 +44,7 @@ details. */
extern BOOL allow_ntea;
-BOOL allow_ntsec = FALSE;
+BOOL allow_ntsec;
/* allow_smbntsec is handled exclusively in path.cc (path_conv::check).
It's defined here because of it's strong relationship to allow_ntsec.
The default is TRUE to reflect the old behaviour. */
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 768d6f1fd..b3c69ffd5 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -46,7 +46,7 @@ details. */
#define no_signals_available() (!hwait_sig || !sig_loop_wait)
-#define ZOMBIEMAX ((int) (sizeof (zombies) / sizeof (zombies[0])) - 1)
+#define ZOMBIEMAX 4096
/*
* Global variables
@@ -102,9 +102,9 @@ Static HANDLE wait_sig_inited = NULL; // Control synchronization of
Static HANDLE events[PSIZE + 1] = {0}; // All my children's handles++
#define hchildren (events + 1) // Where the children handles begin
Static pinfo pchildren[PSIZE]; // All my children info
-Static pinfo zombies[16384]; // All my deceased children info
Static int nchildren = 0; // Number of active children
-Static int nzombies = 0; // Number of deceased children
+static pinfo *zombies; // All my deceased children info
+static int nzombies; // Number of deceased children
Static waitq waitq_head = {0, 0, 0, 0, 0, 0, 0};// Start of queue for wait'ing threads
Static waitq waitq_main; // Storage for main thread
@@ -303,6 +303,8 @@ proc_subproc (DWORD what, DWORD val)
int thiszombie;
thiszombie = nzombies;
+ if (!zombies)
+ zombies = (pinfo *) malloc (sizeof (pinfo) * ZOMBIEMAX);
zombies[nzombies] = pchildren[val]; // Add to zombie array
zombies[nzombies++]->process_state = PID_ZOMBIE;// Walking dead
@@ -1302,6 +1304,17 @@ wait_subproc (VOID *)
return 0;
}
+void __stdcall
+sigproc_fixup_after_fork ()
+{
+ if (zombies)
+ {
+ free (zombies);
+ nzombies = 0;
+ zombies = NULL;
+ }
+}
+
extern "C" {
/* Provide a stack frame when calling WaitFor* functions */
diff --git a/winsup/cygwin/sigproc.h b/winsup/cygwin/sigproc.h
index 5726a4519..c9b5cad3e 100644
--- a/winsup/cygwin/sigproc.h
+++ b/winsup/cygwin/sigproc.h
@@ -115,6 +115,7 @@ int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_addre
bool exception = 0) __attribute__ ((regparm(3)));
void __stdcall signal_fixup_after_fork ();
void __stdcall signal_fixup_after_exec (bool);
+void __stdcall sigproc_fixup_after_fork ();
extern char myself_nowait_dummy[];
extern char myself_nowait_nonmain_dummy[];