mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 00:02:28 +00:00
Improve Windows Console I/O
- Blocking read operations on the Windows Console can now EINTR - Blocking read operations on Windows pipes now EINTR more reliably - setitimer() will no longer be inherited across fork() on Windows - It's now possible to use ECHO when the console is in raw mode - The ECHOCTL flag now works correctly on the Windows Console - The ICRNL flag now works correctly on the Windows Console - pread() and pwrite() will now raise ESPIPE on Windows - Opening /dev/tty on Windows is improved (untested) - Overlapped I/O is now implemented in a better way
This commit is contained in:
parent
decf216655
commit
33d280c8ba
34 changed files with 580 additions and 376 deletions
|
@ -21,18 +21,21 @@
|
|||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/calls/ucontext.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sysv/consts/itimer.h"
|
||||
#include "libc/sysv/consts/sa.h"
|
||||
#include "libc/sysv/consts/sicode.h"
|
||||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/testlib/subprocess.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
bool gotsig;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
ASSERT_SYS(0, 0, pledge("stdio", 0));
|
||||
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
|
||||
}
|
||||
|
||||
void OnSigAlrm(int sig, siginfo_t *si, void *ctx) {
|
||||
|
@ -59,3 +62,15 @@ TEST(setitimer, testSingleShot) {
|
|||
EXPECT_EQ(0, sigaction(SIGUSR1, &oldalrm, 0));
|
||||
EXPECT_EQ(true, gotsig);
|
||||
}
|
||||
|
||||
TEST(setitimer, notInheritedAcrossFork) {
|
||||
struct itimerval disarm = {0};
|
||||
struct itimerval singleshot = {{0}, {100}};
|
||||
ASSERT_SYS(0, 0, setitimer(ITIMER_REAL, &singleshot, 0));
|
||||
SPAWN(fork);
|
||||
struct itimerval it;
|
||||
ASSERT_SYS(0, 0, setitimer(ITIMER_REAL, 0, &it));
|
||||
ASSERT_TRUE(timeval_iszero(it.it_value));
|
||||
EXITS(0);
|
||||
ASSERT_SYS(0, 0, setitimer(ITIMER_REAL, &disarm, 0));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue