mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-07 11:04:17 +00:00
@@ -352,15 +352,28 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
|
||||
// The highest reserved port number.
|
||||
IPPORT_RESERVED :: 1024
|
||||
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
when ODIN_OS == .Linux || ODIN_OS == .OpenBSD {
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
}
|
||||
} else {
|
||||
addrinfo :: struct {
|
||||
ai_flags: Addrinfo_Flags, /* [PSX] input flags */
|
||||
ai_family: AF, /* [PSX] address family of socket */
|
||||
ai_socktype: Sock, /* [PSX] socket type */
|
||||
ai_protocol: Protocol, /* [PSX] protocol of socket */
|
||||
ai_addrlen: socklen_t, /* [PSX] length of socket address */
|
||||
ai_canonname: cstring, /* [PSX] canonical name of service location */
|
||||
ai_addr: ^sockaddr, /* [PSX] binary address */
|
||||
ai_next: ^addrinfo, /* [PSX] pointer to next in list */
|
||||
}
|
||||
}
|
||||
|
||||
when ODIN_OS == .Darwin {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stddef.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <glob.h>
|
||||
@@ -70,6 +71,7 @@ int main(int argc, char *argv[])
|
||||
printf("protoent %zu %zu\n", sizeof(struct protoent), _Alignof(struct protoent));
|
||||
printf("servent %zu %zu\n", sizeof(struct servent), _Alignof(struct servent));
|
||||
printf("addrinfo %zu %zu\n", sizeof(struct addrinfo), _Alignof(struct addrinfo));
|
||||
printf("ai_canonname %zu\n", offsetof(struct addrinfo, ai_canonname));
|
||||
|
||||
printf("pollfd %zu %zu\n", sizeof(struct pollfd), _Alignof(struct pollfd));
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ main :: proc() {
|
||||
fmt.println("protoent", size_of(posix.protoent), align_of(posix.protoent))
|
||||
fmt.println("servent", size_of(posix.servent), align_of(posix.servent))
|
||||
fmt.println("addrinfo", size_of(posix.addrinfo), align_of(posix.addrinfo))
|
||||
fmt.println("ai_canonname", offset_of(posix.addrinfo, ai_canonname))
|
||||
|
||||
fmt.println("pollfd", size_of(posix.pollfd), align_of(posix.pollfd))
|
||||
fmt.println("passwd", size_of(posix.passwd), align_of(posix.passwd))
|
||||
|
||||
Reference in New Issue
Block a user