mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 04:08:32 +00:00
Improve system call support
This commit is contained in:
parent
63b867bd2f
commit
3085ac7837
65 changed files with 900 additions and 544 deletions
|
@ -22,6 +22,7 @@
|
|||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/sysv/consts/f.h"
|
||||
#include "libc/sysv/consts/fd.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
@ -53,3 +54,12 @@ TEST(fcntl_setfl, testChangeAppendStatus) {
|
|||
EXPECT_STREQ("foobar", buf);
|
||||
EXPECT_NE(-1, close(fd));
|
||||
}
|
||||
|
||||
TEST(fcntl, getfd) {
|
||||
ASSERT_SYS(0, 3, open("/dev/null", O_RDWR));
|
||||
ASSERT_SYS(0, 0, fcntl(3, F_GETFD));
|
||||
ASSERT_SYS(0, 4, open("/dev/null", O_RDWR | O_CLOEXEC));
|
||||
ASSERT_SYS(0, FD_CLOEXEC, fcntl(4, F_GETFD));
|
||||
ASSERT_SYS(0, 0, close(4));
|
||||
ASSERT_SYS(0, 0, close(3));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue