Linux updates (#14170)

* Add posix_memalign()

* Add linux-specific open() flags

O_TMPFILE: since Linux 3.11
O_PATH: since Linux 2.6.39
O_NOATIME: since Linux 2.6.8
O_DIRECT: since Linux 2.4.10

* Fix Stat type

* Fix POSIX AF_INET* const generation
This commit is contained in:
wltsmrz
2020-05-05 02:23:49 +09:00
committed by GitHub
parent 44f377ff5e
commit c817e85f4c
4 changed files with 33 additions and 14 deletions

View File

@@ -20,6 +20,8 @@ const
cfile = """
/* Generated by detect.nim */
#define _GNU_SOURCE
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
@@ -119,10 +121,14 @@ proc v(name: string, typ = "cint", no_other = false) =
addf(tl,
"#ifdef $3\n fprintf(f, \"const $1* = $2(%ld)\\n\", $3);\n#endif\n",
n, t, name)
of "cint", "cshort", "InAddrScalar", "TSa_Family":
of "cint", "cshort", "TSa_Family":
addf(tl,
"#ifdef $3\n fprintf(f, \"const $1* = $2(%d)\\n\", $3);\n#endif\n",
n, t, name)
of "InAddrScalar":
addf(tl,
"#ifdef $3\n fprintf(f, \"const $1* = $2(%u)\\n\", $3);\n#endif\n",
n, t, name)
else:
addf(tl,
"#ifdef $3\n fprintf(f, \"const $1* = cast[$2](%d)\\n\", $3);\n#endif\n",
@@ -256,6 +262,10 @@ v("O_RDONLY")
v("O_RDWR")
v("O_WRONLY")
v("O_CLOEXEC")
v("O_DIRECT")
v("O_PATH")
v("O_NOATIME")
v("O_TMPFILE")
v("POSIX_FADV_NORMAL")
v("POSIX_FADV_SEQUENTIAL")
v("POSIX_FADV_RANDOM")
@@ -433,6 +443,7 @@ header("<netinet/in.h>")
v("IPPROTO_IP")
v("IPPROTO_IPV6")
v("IPPROTO_ICMP")
v("IPPROTO_ICMPV6")
v("IPPROTO_RAW")
v("IPPROTO_TCP")
v("IPPROTO_UDP")
@@ -631,10 +642,10 @@ v("MSG_NOSIGNAL", no_other = true)
v("MSG_PEEK")
v("MSG_TRUNC")
v("MSG_WAITALL")
v("AF_INET", "TSa_Family")
v("AF_INET6", "TSa_Family")
v("AF_UNIX", "TSa_Family")
v("AF_UNSPEC", "TSa_Family")
v("AF_INET")
v("AF_INET6")
v("AF_UNIX")
v("AF_UNSPEC")
v("SHUT_RD")
v("SHUT_RDWR")
v("SHUT_WR")