aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/local_includes
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/local_includes')
-rw-r--r--winsup/cygwin/local_includes/dll_init.h7
-rw-r--r--winsup/cygwin/local_includes/fhandler.h7
-rw-r--r--winsup/cygwin/local_includes/ntdll.h1
-rw-r--r--winsup/cygwin/local_includes/thread.h31
-rw-r--r--winsup/cygwin/local_includes/tty.h6
-rw-r--r--winsup/cygwin/local_includes/winlean.h4
6 files changed, 43 insertions, 13 deletions
diff --git a/winsup/cygwin/local_includes/dll_init.h b/winsup/cygwin/local_includes/dll_init.h
index 65f4213..0ca6cd2 100644
--- a/winsup/cygwin/local_includes/dll_init.h
+++ b/winsup/cygwin/local_includes/dll_init.h
@@ -34,7 +34,9 @@ struct per_module
typedef enum
{
DLL_NONE,
- DLL_SELF, /* main-program.exe, cygwin1.dll */
+ DLL_SELF, /* main-program.exe, cygwin1.dll */
+ DLL_NATIVE, /* dlopen'ed native DLLs. reload after fork, but otherwise
+ do nothing, just as with DLL_SELF. */
DLL_LINK,
DLL_LOAD,
DLL_ANY
@@ -57,7 +59,6 @@ struct dll
PWCHAR forkable_ntname;
WCHAR ntname[1]; /* must be the last data member */
- void detach ();
int init ();
bool stat_real_file_once ();
void nominate_forkable (PCWCHAR);
@@ -131,7 +132,7 @@ public:
int reload_on_fork;
dll *operator [] (PCWCHAR ntname);
dll *alloc (HINSTANCE, per_process *, dll_type);
- dll *find (void *);
+ dll *find (void *, bool = false);
void detach (void *);
void init ();
void load_after_fork (HANDLE);
diff --git a/winsup/cygwin/local_includes/fhandler.h b/winsup/cygwin/local_includes/fhandler.h
index 8c71d84..2177cec 100644
--- a/winsup/cygwin/local_includes/fhandler.h
+++ b/winsup/cygwin/local_includes/fhandler.h
@@ -1979,6 +1979,7 @@ class fhandler_termios: public fhandler_base
virtual off_t lseek (off_t, int);
pid_t tcgetsid ();
virtual int fstat (struct stat *buf);
+ int tcflow (int);
fhandler_termios (void *) {}
@@ -2143,12 +2144,12 @@ class dev_console
char cons_rabuf[40]; // cannot get longer than char buf[40] in char_command
char *cons_rapoi;
bool cursor_key_app_mode;
- bool disable_master_thread;
+ volatile bool disable_master_thread;
tty::cons_mode curr_input_mode;
tty::cons_mode curr_output_mode;
DWORD prev_input_mode;
DWORD prev_output_mode;
- bool master_thread_suspended;
+ volatile bool master_thread_suspended;
int num_processed; /* Number of input events in the current input buffer
already processed by cons_master_thread(). */
@@ -2273,6 +2274,7 @@ private:
int tcflush (int);
int tcsetattr (int a, const struct termios *t);
int tcgetattr (struct termios *t);
+ int tcdrain ();
int ioctl (unsigned int cmd, void *);
int init (HANDLE, DWORD, mode_t, int64_t = 0);
@@ -2391,6 +2393,7 @@ class fhandler_pty_common: public fhandler_termios
DWORD __acquire_output_mutex (const char *fn, int ln, DWORD ms);
void __release_output_mutex (const char *fn, int ln);
+ int tcdrain ();
int close (int flag = -1);
off_t lseek (off_t, int);
bool bytes_available (DWORD& n);
diff --git a/winsup/cygwin/local_includes/ntdll.h b/winsup/cygwin/local_includes/ntdll.h
index 4497fe5..97a83d1 100644
--- a/winsup/cygwin/local_includes/ntdll.h
+++ b/winsup/cygwin/local_includes/ntdll.h
@@ -268,6 +268,7 @@ typedef enum _FILE_INFORMATION_CLASS
FileLinkInformationExBypassAccessCheck, // 73
FileStorageReserveIdInformation, // 74
FileCaseSensitiveInformationForceAccessCheck, // 75
+ FileKnownFolderInformation, // 76
FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
diff --git a/winsup/cygwin/local_includes/thread.h b/winsup/cygwin/local_includes/thread.h
index b349628..3955609 100644
--- a/winsup/cygwin/local_includes/thread.h
+++ b/winsup/cygwin/local_includes/thread.h
@@ -221,13 +221,12 @@ public:
~pthread_key ();
static void fixup_before_fork ()
{
- keys.for_each (&pthread_key::_fixup_before_fork);
+ for_each (_fixup_before_fork);
}
static void fixup_after_fork ()
{
- keys.fixup_after_fork ();
- keys.for_each (&pthread_key::_fixup_after_fork);
+ for_each (_fixup_after_fork);
}
static void run_all_destructors ()
@@ -246,21 +245,39 @@ public:
for (int i = 0; i < PTHREAD_DESTRUCTOR_ITERATIONS; ++i)
{
iterate_dtors_once_more = false;
- keys.for_each (&pthread_key::run_destructor);
+ for_each (run_destructor);
if (!iterate_dtors_once_more)
break;
}
}
- /* List support calls */
- class pthread_key *next;
private:
- static List<pthread_key> keys;
+ int key_idx;
+ static class keys_list {
+ LONG64 seq;
+ LONG64 busy_cnt;
+ pthread_key *key;
+ static bool used (LONG64 seq1) { return (seq1 & 3) != 0; }
+ static bool ready (LONG64 seq1) { return (seq1 & 3) == 2; }
+ public:
+ keys_list () : seq (0), busy_cnt (INT64_MIN), key (NULL) {}
+ friend class pthread_key;
+ } keys[PTHREAD_KEYS_MAX];
void _fixup_before_fork ();
void _fixup_after_fork ();
void (*destructor) (void *);
void run_destructor ();
void *fork_buf;
+ static void for_each (void (pthread_key::*callback) ()) {
+ for (size_t cnt = 0; cnt < PTHREAD_KEYS_MAX; cnt++)
+ {
+ if (!keys_list::ready (keys[cnt].seq))
+ continue;
+ if (InterlockedIncrement64 (&keys[cnt].busy_cnt) > 0)
+ (keys[cnt].key->*callback) ();
+ InterlockedDecrement64 (&keys[cnt].busy_cnt);
+ }
+ }
};
class pthread_attr: public verifyable_object
diff --git a/winsup/cygwin/local_includes/tty.h b/winsup/cygwin/local_includes/tty.h
index 2a047d7..a418ab1 100644
--- a/winsup/cygwin/local_includes/tty.h
+++ b/winsup/cygwin/local_includes/tty.h
@@ -30,6 +30,9 @@ details. */
#define MIN_CTRL_C_SLOP 50
#endif
+#define BY_TCFLOW 2
+#define BY_VSTOP 1
+
typedef void *HPCON;
#include "devices.h"
@@ -43,7 +46,8 @@ class tty_min
public:
pid_t pgid;
- bool output_stopped; /* FIXME: Maybe do this with a mutex someday? */
+ volatile int output_stopped; /* FIXME: Maybe do this with a mutex someday? */
+ volatile int input_stopped;
fh_devices ntty;
ULONGLONG last_ctrl_c; /* tick count of last ctrl-c */
bool is_console;
diff --git a/winsup/cygwin/local_includes/winlean.h b/winsup/cygwin/local_includes/winlean.h
index 62b651b..500f569 100644
--- a/winsup/cygwin/local_includes/winlean.h
+++ b/winsup/cygwin/local_includes/winlean.h
@@ -111,6 +111,10 @@ details. */
#define DOMAIN_ALIAS_RID_DEVICE_OWNERS (__MSABI_LONG(0x00000247))
#endif
+#ifndef EXCEPTION_SOFTWARE_ORIGINATE
+#define EXCEPTION_SOFTWARE_ORIGINATE 0x80
+#endif
+
/* So-called "Microsoft Account" SIDs (S-1-11-...) have a netbios domain name
"MicrosoftAccounts". The new "Application Container SIDs" (S-1-15-...)
have a netbios domain name "APPLICATION PACKAGE AUTHORITY"