aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/cygwin.yml2
-rw-r--r--libgloss/riscv/internal_syscall.h2
-rw-r--r--newlib/libc/include/sys/unistd.h2
-rw-r--r--newlib/libc/machine/riscv/memcpy-asm.S12
-rw-r--r--newlib/libc/machine/riscv/memmove.S28
-rw-r--r--newlib/libc/machine/riscv/memset.S16
-rw-r--r--newlib/libc/machine/riscv/rv_string.h6
-rw-r--r--newlib/libc/machine/riscv/setjmp.S4
-rw-r--r--newlib/libc/machine/riscv/strcmp.S4
-rw-r--r--winsup/cygwin/fhandler/base.cc49
-rw-r--r--winsup/cygwin/fhandler/console.cc54
-rw-r--r--winsup/cygwin/fhandler/pty.cc30
-rw-r--r--winsup/cygwin/fhandler/socket_local.cc2
-rw-r--r--winsup/cygwin/fhandler/termios.cc31
-rw-r--r--winsup/cygwin/include/sys/termios.h1
-rw-r--r--winsup/cygwin/local_includes/fhandler.h9
-rw-r--r--winsup/cygwin/local_includes/tty.h6
-rw-r--r--winsup/cygwin/release/3.6.215
-rw-r--r--winsup/cygwin/uinfo.cc21
-rw-r--r--winsup/utils/kill.cc4
20 files changed, 221 insertions, 77 deletions
diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index 53dd06d..b5b1e16 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -29,7 +29,7 @@ jobs:
# install build tools
- name: Install build tools
run: |
- dnf install -y autoconf automake make patch perl mingw${{ matrix.pkgarch }}-gcc-c++ mingw${{ matrix.pkgarch }}-winpthreads-static mingw${{ matrix.pkgarch }}-zlib-static
+ dnf install -y autoconf automake gawk make patch perl mingw${{ matrix.pkgarch }}-gcc-c++ mingw${{ matrix.pkgarch }}-winpthreads-static mingw${{ matrix.pkgarch }}-zlib-static
# enable 'dnf copr'
- name: Enable 'dnf copr'
diff --git a/libgloss/riscv/internal_syscall.h b/libgloss/riscv/internal_syscall.h
index 080c8c8..254880b 100644
--- a/libgloss/riscv/internal_syscall.h
+++ b/libgloss/riscv/internal_syscall.h
@@ -24,7 +24,7 @@ __syscall_error(long a0)
static inline long
__internal_syscall(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
{
-#ifdef __riscv_32e
+#ifdef __riscv_abi_rve
register long syscall_id asm("t0") = n;
#else
register long syscall_id asm("a7") = n;
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index 771a4bd..4cf9f06 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -215,7 +215,7 @@ int setpgrp (void);
#if defined(__CYGWIN__) && __BSD_VISIBLE
/* Stub for Linux libbsd compatibility. */
#define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e))
-static inline void setproctitle_init (int _c, char *_a[], char *_e[]) {}
+static __inline void setproctitle_init (int _c, char *_a[], char *_e[]) {}
void setproctitle (const char *, ...)
_ATTRIBUTE ((__format__ (__printf__, 1, 2)));
diff --git a/newlib/libc/machine/riscv/memcpy-asm.S b/newlib/libc/machine/riscv/memcpy-asm.S
index 5571e47..2771285 100644
--- a/newlib/libc/machine/riscv/memcpy-asm.S
+++ b/newlib/libc/machine/riscv/memcpy-asm.S
@@ -14,15 +14,15 @@
.global memcpy
.type memcpy, @function
memcpy:
- mv t1, a0
+ mv a3, a0
beqz a2, 2f
1:
- lb t2, 0(a1)
- sb t2, 0(t1)
- add a2, a2, -1
- add t1, t1, 1
- add a1, a1, 1
+ lbu a4, 0(a1)
+ sb a4, 0(a3)
+ addi a2, a2, -1
+ addi a3, a3, 1
+ addi a1, a1, 1
bnez a2, 1b
2:
diff --git a/newlib/libc/machine/riscv/memmove.S b/newlib/libc/machine/riscv/memmove.S
index 66d9cd4..061472c 100644
--- a/newlib/libc/machine/riscv/memmove.S
+++ b/newlib/libc/machine/riscv/memmove.S
@@ -14,26 +14,26 @@
.global memmove
.type memmove, @function
memmove:
- beqz a2, 2f
+ beqz a2, .Ldone /* in case there are 0 bytes to be copied, return immediately */
- mv t1, a0
+ mv a4, a0 /* copy the destination address over to a4, since memmove should return that address in a0 at the end */
li a3, 1
- bgtu a1, a0, 1f
+ bgtu a1, a0, .Lcopy /* in case of source address > destination address, copy from start to end of the specified memory area */
- li a3, -1
- addi a4, a2 , -1
- add t1, t1, a4
- add a1, a1, a4
+ li a3, -1 /* otherwhise, start copying from the end of the specified memory area in order to prevent data loss in case of overlapping memory areas.*/
+ add a4, a4, a2 /* add the number of bytes to be copied to both addresses. this gives us the address one byte past the end of the memory area we want to copy, */
+ add a1, a1, a2 /* therefore we need to subtract 1 from both addresses in the next step before starting the copying process. */
-1:
- lb t2, 0(a1)
- sb t2, 0(t1)
- add a2, a2, -1
- add t1, t1, a3
+.Lincrement:
+ add a4, a4, a3 /* in case of source address < destination address, increment both addresses by -1 before copying any data to obtain the correct start addresses */
add a1, a1, a3
- bnez a2, 1b
+.Lcopy:
+ lbu a5, 0(a1)
+ addi a2, a2, -1 /* copy bytes as long as a2 (= the number of bytes to be copied) > 0. the increment is done here to relax the RAW dependency between load and store */
+ sb a5, 0(a4)
+ bnez a2, .Lincrement
-2:
+.Ldone:
ret
.size memmove, .-memmove
diff --git a/newlib/libc/machine/riscv/memset.S b/newlib/libc/machine/riscv/memset.S
index a717ae7..3d207e7 100644
--- a/newlib/libc/machine/riscv/memset.S
+++ b/newlib/libc/machine/riscv/memset.S
@@ -14,16 +14,16 @@
.type memset, @function
memset:
#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
- mv t1, a0
- beqz a2, 2f
+ mv a3, a0
+ beqz a2, .Ldone
-1:
- sb a1, 0(t1)
- add a2, a2, -1
- add t1, t1, 1
- bnez a2, 1b
+.Lset:
+ sb a1, 0(a3)
+ addi a2, a2, -1
+ addi a3, a3, 1
+ bnez a2, .Lset
-2:
+.Ldone:
ret
#else
diff --git a/newlib/libc/machine/riscv/rv_string.h b/newlib/libc/machine/riscv/rv_string.h
index 362f66a..7754303 100644
--- a/newlib/libc/machine/riscv/rv_string.h
+++ b/newlib/libc/machine/riscv/rv_string.h
@@ -82,8 +82,8 @@ static __inline char *__libc_strcpy(char *dst, const char *src, bool ret_start)
if (!(*dst++ = src[0])) return dst0;
if (!(*dst++ = src[1])) return dst0;
if (!(*dst++ = src[2])) return dst0;
- if (!(*dst++ = src[3])) return dst0;
#if __riscv_xlen == 64
+ if (!(*dst++ = src[3])) return dst0;
if (!(*dst++ = src[4])) return dst0;
if (!(*dst++ = src[5])) return dst0;
if (!(*dst++ = src[6])) return dst0;
@@ -94,13 +94,13 @@ static __inline char *__libc_strcpy(char *dst, const char *src, bool ret_start)
if (!(*dst++ = src[0])) return dst - 1;
if (!(*dst++ = src[1])) return dst - 1;
if (!(*dst++ = src[2])) return dst - 1;
- if (!(*dst++ = src[3])) return dst - 1;
#if __riscv_xlen == 64
+ if (!(*dst++ = src[3])) return dst - 1;
if (!(*dst++ = src[4])) return dst - 1;
if (!(*dst++ = src[5])) return dst - 1;
if (!(*dst++ = src[6])) return dst - 1;
- dst0 = dst;
#endif
+ dst0 = dst;
}
*dst = 0;
diff --git a/newlib/libc/machine/riscv/setjmp.S b/newlib/libc/machine/riscv/setjmp.S
index eef242e..2d4ab6c 100644
--- a/newlib/libc/machine/riscv/setjmp.S
+++ b/newlib/libc/machine/riscv/setjmp.S
@@ -19,7 +19,7 @@ setjmp:
REG_S s0, 1*SZREG(a0)
REG_S s1, 2*SZREG(a0)
-#ifndef __riscv_32e
+#ifndef __riscv_abi_rve
REG_S s2, 3*SZREG(a0)
REG_S s3, 4*SZREG(a0)
REG_S s4, 5*SZREG(a0)
@@ -61,7 +61,7 @@ longjmp:
REG_L ra, 0*SZREG(a0)
REG_L s0, 1*SZREG(a0)
REG_L s1, 2*SZREG(a0)
-#ifndef __riscv_32e
+#ifndef __riscv_abi_rve
REG_L s2, 3*SZREG(a0)
REG_L s3, 4*SZREG(a0)
REG_L s4, 5*SZREG(a0)
diff --git a/newlib/libc/machine/riscv/strcmp.S b/newlib/libc/machine/riscv/strcmp.S
index cc29b7b..5d3370f 100644
--- a/newlib/libc/machine/riscv/strcmp.S
+++ b/newlib/libc/machine/riscv/strcmp.S
@@ -19,8 +19,8 @@ strcmp:
1:
lbu a2, 0(a0)
lbu a3, 0(a1)
- add a0, a0, 1
- add a1, a1, 1
+ addi a0, a0, 1
+ addi a1, a1, 1
bne a2, a3, 2f
bnez a2, 1b
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index 32aca2c..6c95e2b 100644
--- a/winsup/cygwin/fhandler/base.cc
+++ b/winsup/cygwin/fhandler/base.cc
@@ -720,29 +720,32 @@ fhandler_base::open (int flags, mode_t mode)
goto done;
}
- /* Fix up file attributes, they are desperately needed later.
-
- Originally we only did that in the FILE_CREATED case below, but that's
- insufficient:
-
- If two threads try to create the same file at the same time, it's
- possible that path_conv::check returns the file as non-existant, i. e.,
- pc.file_attributes () returns INVALID_FILE_ATTRIBUTES, 0xffffffff.
- However, one of the NtCreateFile will beat the other, so only one of
- them returns with FILE_CREATED.
-
- The other fhandler_base::open() will instead run into the O_TRUNC
- conditional (further below), blindly check for the SPARSE attribute
- and remove that bit. The result is that the attributes will be
- 0xfffffdff, i.e., everything but SPARSE. Most annoying is that
- pc.isdir() will return TRUE. Hilarity ensues.
-
- Note that we use a different IO_STATUS_BLOCK, so as not to overwrite
- io.Information... */
- if (!NT_SUCCESS (NtQueryInformationFile (fh, &io_bi, &fbi, sizeof fbi,
- FileBasicInformation)))
- fbi.FileAttributes = file_attributes | FILE_ATTRIBUTE_ARCHIVE;
- pc.file_attributes (fbi.FileAttributes);
+ if (get_device () == FH_FS)
+ {
+ /* Fix up file attributes, they are desperately needed later.
+
+ Originally we only did that in the FILE_CREATED case below, but that's
+ insufficient:
+
+ If two threads try to create the same file at the same time, it's
+ possible that path_conv::check returns the file as non-existant, i. e.,
+ pc.file_attributes () returns INVALID_FILE_ATTRIBUTES, 0xffffffff.
+ However, one of the NtCreateFile will beat the other, so only one of
+ them returns with FILE_CREATED.
+
+ The other fhandler_base::open() will instead run into the O_TRUNC
+ conditional (further below), blindly check for the SPARSE attribute
+ and remove that bit. The result is that the attributes will be
+ 0xfffffdff, i.e., everything but SPARSE. Most annoying is that
+ pc.isdir() will return TRUE. Hilarity ensues.
+
+ Note that we use a different IO_STATUS_BLOCK, so as not to overwrite
+ io.Information... */
+ if (!NT_SUCCESS (NtQueryInformationFile (fh, &io_bi, &fbi, sizeof fbi,
+ FileBasicInformation)))
+ fbi.FileAttributes = file_attributes | FILE_ATTRIBUTE_ARCHIVE;
+ pc.file_attributes (fbi.FileAttributes);
+ }
if (io.Information == FILE_CREATED)
{
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index a38487f..2e19e0d 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -509,7 +509,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
case not_signalled_but_done:
case done_with_debugger:
processed = true;
- ttyp->output_stopped = false;
+ ttyp->output_stopped &= ~BY_VSTOP;
if (ti.c_lflag & NOFLSH)
goto remove_record;
con.num_processed = 0;
@@ -932,7 +932,7 @@ fhandler_console::cleanup_for_non_cygwin_app (handle_set_t *p)
/* Cleaning-up console mode for non-cygwin app. */
/* conmode can be tty::restore when non-cygwin app is
exec'ed from login shell. */
- tty::cons_mode conmode = cons_mode_on_close ();
+ tty::cons_mode conmode = cons_mode_on_close (p);
set_output_mode (conmode, ti, p);
set_input_mode (conmode, ti, p);
set_disable_master_thread (con.owner == GetCurrentProcessId ());
@@ -1144,6 +1144,15 @@ fhandler_console::read (void *pv, size_t& buflen)
push_process_state process_state (PID_TTYIN);
+ if (get_ttyp ()->input_stopped && is_nonblocking ())
+ {
+ set_errno (EAGAIN);
+ buflen = (size_t) -1;
+ return;
+ }
+ while (get_ttyp ()->input_stopped)
+ cygwait (10);
+
size_t copied_chars = 0;
DWORD timeout = is_nonblocking () ? 0 :
@@ -1991,8 +2000,9 @@ fhandler_console::close (int flag)
acquire_output_mutex (mutex_timeout);
- if (shared_console_info[unit] && myself->ppid == 1
- && (dev_t) myself->ctty == get_device ())
+ if (shared_console_info[unit] && con.curr_input_mode != tty::restore
+ && (dev_t) myself->ctty == get_device ()
+ && cons_mode_on_close (&handle_set) == tty::restore)
{
set_output_mode (tty::restore, &get_ttyp ()->ti, &handle_set);
set_input_mode (tty::restore, &get_ttyp ()->ti, &handle_set);
@@ -2131,6 +2141,7 @@ fhandler_console::ioctl (unsigned int cmd, void *arg)
release_output_mutex ();
return -1;
case FIONREAD:
+ case TIOCINQ:
{
DWORD n;
int ret = 0;
@@ -2183,6 +2194,14 @@ fhandler_console::ioctl (unsigned int cmd, void *arg)
return 0;
}
break;
+ case TCXONC:
+ res = this->tcflow ((int)(intptr_t) arg);
+ release_output_mutex ();
+ return res;
+ case TCFLSH:
+ res = this->tcflush ((int)(intptr_t) arg);
+ release_output_mutex ();
+ return res;
}
release_output_mutex ();
@@ -4172,8 +4191,8 @@ fhandler_console::write (const void *vsrc, size_t len)
void
fhandler_console::doecho (const void *str, DWORD len)
{
- bool stopped = get_ttyp ()->output_stopped;
- get_ttyp ()->output_stopped = false;
+ int stopped = get_ttyp ()->output_stopped;
+ get_ttyp ()->output_stopped = 0;
write (str, len);
get_ttyp ()->output_stopped = stopped;
}
@@ -4704,10 +4723,31 @@ fhandler_console::fstat (struct stat *st)
}
tty::cons_mode
-fhandler_console::cons_mode_on_close ()
+fhandler_console::cons_mode_on_close (handle_set_t *p)
{
+ int unit = p->unit;
if (myself->ppid != 1) /* Execed from normal cygwin process. */
return tty::cygwin;
+ if (!process_alive (con.owner)) /* The Master process already died. */
+ return tty::restore;
+ if (con.owner == GetCurrentProcessId ()) /* Master process */
+ return tty::restore;
+
+ PROCESS_BASIC_INFORMATION pbi;
+ NTSTATUS status =
+ NtQueryInformationProcess (GetCurrentProcess (), ProcessBasicInformation,
+ &pbi, sizeof (pbi), NULL);
+ if (NT_SUCCESS (status)
+ && !process_alive ((DWORD) pbi.InheritedFromUniqueProcessId))
+ /* Execed from normal cygwin process and the parent has been exited. */
+ return tty::cygwin;
+
return tty::restore; /* otherwise, restore */
}
+
+int
+fhandler_console::tcdrain ()
+{
+ return 0;
+}
diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc
index 3128b92..b882b90 100644
--- a/winsup/cygwin/fhandler/pty.cc
+++ b/winsup/cygwin/fhandler/pty.cc
@@ -1304,6 +1304,15 @@ fhandler_pty_slave::read (void *ptr, size_t& len)
push_process_state process_state (PID_TTYIN);
+ if (get_ttyp ()->input_stopped && is_nonblocking ())
+ {
+ set_errno (EAGAIN);
+ len = (size_t) -1;
+ return;
+ }
+ while (get_ttyp ()->input_stopped)
+ cygwait (10);
+
if (ptr) /* Indicating not tcflush(). */
mask_switch_to_nat_pipe (true, true);
@@ -1650,6 +1659,7 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
retval = this->tcsetpgrp ((pid_t) (intptr_t) arg);
goto out;
case FIONREAD:
+ case TIOCINQ:
{
DWORD n;
if (!bytes_available (n))
@@ -1664,6 +1674,12 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
}
}
goto out;
+ case TCXONC:
+ retval = this->tcflow ((int)(intptr_t) arg);
+ goto out;
+ case TCFLSH:
+ retval = this->tcflush ((int)(intptr_t) arg);
+ goto out;
default:
return fhandler_base::ioctl (cmd, arg);
}
@@ -2342,6 +2358,7 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
case TIOCSPGRP:
return this->tcsetpgrp ((pid_t) (intptr_t) arg);
case FIONREAD:
+ case TIOCINQ:
{
DWORD n;
if (!bytes_available (n))
@@ -2352,6 +2369,10 @@ fhandler_pty_master::ioctl (unsigned int cmd, void *arg)
*(int *) arg = (int) n;
}
break;
+ case TCXONC:
+ return this->tcflow ((int)(intptr_t) arg);
+ case TCFLSH:
+ return this->tcflush ((int)(intptr_t) arg);
default:
return fhandler_base::ioctl (cmd, arg);
}
@@ -4194,3 +4215,12 @@ fhandler_pty_common::resume_from_temporarily_attach (DWORD resume_pid)
}
release_attach_mutex ();
}
+
+int
+fhandler_pty_common::tcdrain ()
+{
+ DWORD n;
+ while (bytes_available (n) && n > 0)
+ cygwait (10);
+ return 0;
+}
diff --git a/winsup/cygwin/fhandler/socket_local.cc b/winsup/cygwin/fhandler/socket_local.cc
index 270a1ef..ea5ee67 100644
--- a/winsup/cygwin/fhandler/socket_local.cc
+++ b/winsup/cygwin/fhandler/socket_local.cc
@@ -87,6 +87,8 @@ get_inet_addr_local (const struct sockaddr *in, int inlen,
addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
*outlen = sizeof addr;
memcpy (out, &addr, *outlen);
+ if (type)
+ *type = SOCK_DGRAM;
return 0;
}
diff --git a/winsup/cygwin/fhandler/termios.cc b/winsup/cygwin/fhandler/termios.cc
index a3cecdb..19d6220 100644
--- a/winsup/cygwin/fhandler/termios.cc
+++ b/winsup/cygwin/fhandler/termios.cc
@@ -491,16 +491,16 @@ fhandler_termios::process_stop_start (char c, tty *ttyp)
{
if (CCEQ (ti.c_cc[VSTOP], c))
{
- ttyp->output_stopped = true;
+ ttyp->output_stopped |= BY_VSTOP;
return true;
}
else if (CCEQ (ti.c_cc[VSTART], c))
{
restart_output:
- ttyp->output_stopped = false;
+ ttyp->output_stopped &= ~BY_VSTOP;
return true;
}
- else if ((ti.c_iflag & IXANY) && ttyp->output_stopped)
+ else if ((ti.c_iflag & IXANY) && (ttyp->output_stopped & BY_VSTOP))
goto restart_output;
}
if ((ti.c_lflag & ICANON) && (ti.c_lflag & IEXTEN)
@@ -540,7 +540,7 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
fallthrough;
case not_signalled_but_done:
case done_with_debugger:
- get_ttyp ()->output_stopped = false;
+ get_ttyp ()->output_stopped &= ~BY_VSTOP;
continue;
case not_signalled_with_nat_reader:
disable_eof_key = true;
@@ -915,3 +915,26 @@ fhandler_termios::get_console_process_id (DWORD pid, bool match,
}
return res_pri ?: res;
}
+
+int
+fhandler_termios::tcflow (int action)
+{
+ switch (action)
+ {
+ case TCOOFF:
+ get_ttyp ()->output_stopped |= BY_TCFLOW;
+ return 0;
+ case TCOON:
+ get_ttyp ()->output_stopped = 0;
+ return 0;
+ case TCIOFF:
+ get_ttyp ()->input_stopped |= BY_TCFLOW;
+ return 0;
+ case TCION:
+ get_ttyp ()->input_stopped = 0;
+ return 0;
+ default:
+ set_errno (EINVAL);
+ return -1;
+ }
+}
diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
index d1b4a0a..4c03042 100644
--- a/winsup/cygwin/include/sys/termios.h
+++ b/winsup/cygwin/include/sys/termios.h
@@ -18,6 +18,7 @@ details. */
#define TIOCMBIC 0x5417
#define TIOCMSET 0x5418
#define TIOCINQ 0x541B
+#define TCXONC 0x540A
#define TIOCSCTTY 0x540E
/* TIOCINQ is utilized instead of FIONREAD which has been
diff --git a/winsup/cygwin/local_includes/fhandler.h b/winsup/cygwin/local_includes/fhandler.h
index 8c71d84..03f20c8 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);
@@ -2368,7 +2370,7 @@ private:
void setup_pcon_hand_over ();
static void pcon_hand_over_proc ();
- static tty::cons_mode cons_mode_on_close ();
+ static tty::cons_mode cons_mode_on_close (handle_set_t *);
friend tty_min * tty_list::get_cttyp ();
};
@@ -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/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/release/3.6.2 b/winsup/cygwin/release/3.6.2
new file mode 100644
index 0000000..bceabca
--- /dev/null
+++ b/winsup/cygwin/release/3.6.2
@@ -0,0 +1,15 @@
+Fixes:
+------
+
+- Fix a high latency problem when trying to fetch SID info for SIDs
+ not resolved by Windows functions anyway.
+ Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257916.html
+
+- Fix connect(2) returning WSAEPROTOTYPE on abstract sockets.
+ Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013638.html
+
+- Fix the console states after the console is closed.
+ Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257909.html
+
+- Fix setting DOS attributes on devices.
+ Addresse: https://cygwin.com/pipermail/cygwin/2025-April/257940.html
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 27dc289..83883f9 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -1983,6 +1983,27 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, cyg_ldap *pldap)
break;
case SID_arg:
sid = *arg.sid;
+
+ /* SIDs we want to filter out before hitting LookupAccountSidW.
+ If the latency of the AD connection is high, LookupAccountSidW
+ might take a long time before returning with ERROR_NONE_MAPPED. */
+
+ /* Capability SIDs, just drop out, we don't handle them */
+ if (sid_id_auth (sid) == 15 /* SECURITY_APP_PACKAGE_AUTHORITY */
+ && sid_sub_auth (sid, 0) == SECURITY_CAPABILITY_BASE_RID)
+ return NULL;
+ /* IIS APPPOOL */
+ if (sid_id_auth (sid) == 5 /* SECURITY_NT_AUTHORITY */
+ && sid_sub_auth (sid, 0) == SECURITY_APPPOOL_ID_BASE_RID)
+ break;
+ /* AzureAD SIDs */
+ if (sid_id_auth (sid) == 12 /* AzureAD ID */
+ && sid_sub_auth (sid, 0) == 1 /* Azure ID base RID */)
+ break;
+ /* Samba user/group SIDs */
+ if (sid_id_auth (sid) == 22)
+ break;
+
ret = LookupAccountSidW (NULL, sid, name, &nlen, dom, &dlen, &acc_type);
if (!ret
&& cygheap->dom.member_machine ()
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
index bcabcd4..1e6ab5c 100644
--- a/winsup/utils/kill.cc
+++ b/winsup/utils/kill.cc
@@ -372,7 +372,9 @@ main (int argc, char **argv)
case '?':
if (gotasig) /* this is a negative pid, go ahead */
{
- --optind;
+ /* Reset optind because it points to the next argument if and
+ only if the pid has one digit. */
+ optind = av - argv;
goto out;
}
optreset = 1;