mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +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
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/calls/struct/timeval.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
|
@ -84,6 +85,15 @@ TEST(timespec_tonanos, test) {
|
|||
EXPECT_EQ(INT64_MIN, timespec_tonanos((struct timespec){INT64_MIN, 0}));
|
||||
}
|
||||
|
||||
TEST(timeval_toseconds, test) {
|
||||
ASSERT_EQ(0, timeval_toseconds((struct timeval){0, 0}));
|
||||
ASSERT_EQ(1, timeval_toseconds((struct timeval){0, 1}));
|
||||
ASSERT_EQ(1, timeval_toseconds((struct timeval){0, 2}));
|
||||
ASSERT_EQ(1, timeval_toseconds((struct timeval){1, 0}));
|
||||
ASSERT_EQ(2, timeval_toseconds((struct timeval){1, 1}));
|
||||
ASSERT_EQ(INT64_MAX, timeval_toseconds(timeval_max));
|
||||
}
|
||||
|
||||
static long mod(long x, long y) {
|
||||
if (y == -1) return 0;
|
||||
return x - y * (x / y - (x % y && (x ^ y) < 0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue