Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/core/stdc/tgmath.d
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,6 @@ version( NetBSD )
// alias core.stdc.complex.crealf creal;
// alias core.stdc.complex.creall creal;
}

else version( OpenBSD )
{
///
Expand Down
29 changes: 29 additions & 0 deletions src/core/sys/posix/arpa/inet.d
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,31 @@ else version( FreeBSD )
const(char)* inet_ntop(int, in void*, char*, socklen_t);
int inet_pton(int, in char*, void*);
}
else version(NetBSD)
{
alias uint16_t in_port_t;
alias uint32_t in_addr_t;

struct in_addr
{
in_addr_t s_addr;
}

enum INET_ADDRSTRLEN = 16;

@trusted pure
{
uint32_t htonl(uint32_t);
uint16_t htons(uint16_t);
uint32_t ntohl(uint32_t);
uint16_t ntohs(uint16_t);
}

in_addr_t inet_addr(in char*);
char* inet_ntoa(in_addr);
const(char)* inet_ntop(int, in void*, char*, socklen_t);
int inet_pton(int, in char*, void*);
}
else version( Solaris )
{
alias uint16_t in_port_t;
Expand Down Expand Up @@ -220,6 +245,10 @@ else version( FreeBSD )
{
enum INET6_ADDRSTRLEN = 46;
}
else version(NetBSD)
{
enum INET6_ADDRSTRLEN = 46;
}
else version( Solaris )
{
enum INET6_ADDRSTRLEN = 46;
Expand Down
46 changes: 46 additions & 0 deletions src/core/sys/posix/dirent.d
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,35 @@ else version( FreeBSD )

dirent* readdir(DIR*);
}
else version(NetBSD)
{
enum
{
DT_UNKNOWN = 0,
DT_FIFO = 1,
DT_CHR = 2,
DT_DIR = 4,
DT_BLK = 6,
DT_REG = 8,
DT_LNK = 10,
DT_SOCK = 12,
DT_WHT = 14
}

struct dirent
{
ulong d_fileno;
ushort d_reclen;
ushort d_namlen;
ubyte d_type;
char[512] d_name;
}

alias void* DIR;

dirent* __readdir30(DIR*);
alias __readdir30 readdir;
}
else version( OpenBSD )
{
enum
Expand Down Expand Up @@ -283,6 +312,13 @@ version( OSX )
pragma(mangle, "rewinddir$INODE64$UNIX2003") void rewinddir(DIR*);
}
}
else version(NetBSD)
{
int closedir(DIR*);
DIR* __opendir30(in char*);
alias __opendir30 opendir;
void rewinddir(DIR*);
}
else
{
int closedir(DIR*);
Expand Down Expand Up @@ -321,6 +357,11 @@ else version( FreeBSD )
{
int readdir_r(DIR*, dirent*, dirent**);
}
else version(NetBSD)
{
int __readdir_r30(DIR*, dirent*, dirent**);
alias __readdir_r30 readdir_r;
}
else version( OpenBSD )
{
int readdir_r(DIR*, dirent*, dirent**);
Expand Down Expand Up @@ -364,6 +405,11 @@ else version( FreeBSD )
void seekdir(DIR*, c_long);
c_long telldir(DIR*);
}
else version(NetBSD)
{
void seekdir(DIR*, c_long);
c_long telldir(DIR*);
}
else version( OpenBSD )
{
void seekdir(DIR*, c_long);
Expand Down
23 changes: 23 additions & 0 deletions src/core/sys/posix/dlfcn.d
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,29 @@ else version( FreeBSD )
void* dli_saddr;
}
}
else version(NetBSD)
{
enum RTLD_LAZY = 1;
enum RTLD_NOW = 2;
enum RTLD_GLOBAL = 0x100;
enum RTLD_LOCAL = 0x200;
enum RTLD_NODELETE = 0x01000; /* Do not remove members. */
enum RTLD_NOLOAD = 0x02000;

int dlclose(void*);
char* dlerror();
void* dlopen(in char*, int);
void* dlsym(void*, in char*);
int dladdr(const(void)* addr, Dl_info* info);

struct Dl_info
{
const(char)* dli_fname;
void* dli_fbase;
const(char)* dli_sname;
void* dli_saddr;
}
}
else version( OpenBSD )
{
enum RTLD_LAZY = 1;
Expand Down
53 changes: 53 additions & 0 deletions src/core/sys/posix/fcntl.d
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,59 @@ else version( OpenBSD )
enum AT_SYMLINK_FOLLOW = 0x04;
enum AT_REMOVEDIR = 0x08;
}
else version(NetBSD)
{
enum F_DUPFD = 0;
enum F_GETFD = 1;
enum F_SETFD = 2;
enum F_GETFL = 3;
enum F_SETFL = 4;
enum F_GETOWN = 5;
enum F_SETOWN = 6;
enum F_GETLK = 7;
enum F_SETLK = 8;
enum F_SETLKW = 9;
enum F_CLOSEM = 10;
enum F_MAXFD = 11;
enum F_DUPFD_CLOEXEC= 12;
enum F_GETNOSIGPIPE = 13;
enum F_SETNOSIGPIPE = 14;

enum FD_CLOEXEC = 1;

enum F_RDLCK = 1;
enum F_UNLCK = 2;
enum F_WRLCK = 3;

enum O_CREAT = 0x0200;
enum O_EXCL = 0x0800;
enum O_NOCTTY = 0x8000;
enum O_TRUNC = 0x0400;

enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;

enum O_NONBLOCK = 0x0004;
enum O_APPEND = 0x0008;
enum O_SYNC = 0x0080;
//enum O_DSYNC
//enum O_RSYNC

struct flock
{
off_t l_start;
off_t l_len;
pid_t l_pid;
short l_type;
short l_whence;
}


int creat(in char*, mode_t);
int open(in char*, int, ...);
}
else version (Solaris)
{
enum F_DUPFD = 0;
Expand Down
21 changes: 21 additions & 0 deletions src/core/sys/posix/grp.d
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ else version( FreeBSD )
char** gr_mem;
}
}
else version(NetBSD)
{
struct group
{
char* gr_name;
char* gr_passwd;
gid_t gr_gid;
char** gr_mem;
}
}
else version( OpenBSD )
{
struct group
Expand Down Expand Up @@ -138,6 +148,11 @@ else version( FreeBSD )
int getgrnam_r(in char*, group*, char*, size_t, group**);
int getgrgid_r(gid_t, group*, char*, size_t, group**);
}
else version(NetBSD)
{
int getgrnam_r(in char*, group*, char*, size_t, group**);
int getgrgid_r(gid_t, group*, char*, size_t, group**);
}
else version( OpenBSD )
{
int getgrnam_r(in char*, group*, char*, size_t, group**);
Expand Down Expand Up @@ -183,6 +198,12 @@ else version( FreeBSD )
@trusted void endgrent();
@trusted void setgrent();
}
else version(NetBSD)
{
group* getgrent();
@trusted void endgrent();
@trusted void setgrent();
}
else version( OpenBSD )
{
group* getgrent();
Expand Down
15 changes: 15 additions & 0 deletions src/core/sys/posix/net/if_.d
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ else version( FreeBSD )
if_nameindex_t* if_nameindex();
void if_freenameindex(if_nameindex_t*);
}
else version(NetBSD)
{
struct if_nameindex_t
{
uint if_index;
char* if_name;
}

enum IF_NAMESIZE = 16;

uint if_nametoindex(in char*);
char* if_indextoname(uint, char*);
if_nameindex_t* if_nameindex();
void if_freenameindex(if_nameindex_t*);
}
else version( CRuntime_Bionic )
{
enum IF_NAMESIZE = 16;
Expand Down
107 changes: 107 additions & 0 deletions src/core/sys/posix/netdb.d
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,113 @@ else version( FreeBSD )
enum EAI_SYSTEM = 11;
enum EAI_OVERFLOW = 14;
}
else version(NetBSD)
{
struct hostent
{
char* h_name;
char** h_aliases;
int h_addrtype;
int h_length;
char** h_addr_list;
extern (D) char* h_addr() @property { return h_addr_list[0]; } // non-standard
}

struct netent
{
char* n_name;
char** n_aliases;
int n_addrtype;
uint32_t n_net;
/+ todo
#if (defined(__sparc__) && defined(_LP64)) || \
(defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
int __n_pad0; /* ABI compatibility */
#endif
uint32_t n_net; /*%< network # */
#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
(defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
int __n_pad0; /* ABI compatibility */
#endif

+/
}

struct protoent
{
char* p_name;
char** p_aliases;
int p_proto;
}

struct servent
{
char* s_name;
char** s_aliases;
int s_port;
char* s_proto;
}

enum IPPORT_RESERVED = 1024;

//h_errno

enum HOST_NOT_FOUND = 1;
enum NO_DATA = 4;
enum NO_RECOVERY = 3;
enum TRY_AGAIN = 2;

struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
/+todo
#if defined(__sparc__) && defined(_LP64)
int __ai_pad0; /* ABI compatibility */
#endif
+/
socklen_t ai_addrlen;
/+todo
#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
int __ai_pad0; /* ABI compatibility */
#endif
+/
char* ai_canonname;
sockaddr* ai_addr;
addrinfo* ai_next;
}

enum AI_PASSIVE = 0x1;
enum AI_CANONNAME = 0x2;
enum AI_NUMERICHOST = 0x4;
enum AI_NUMERICSERV = 0x8;
enum AI_V4MAPPED = 0x800;
enum AI_ALL = 0x100;
enum AI_ADDRCONFIG = 0x400;

enum NI_NOFQDN = 0x1;
enum NI_NUMERICHOST = 0x2;
enum NI_NAMEREQD = 0x4;
enum NI_NUMERICSERV = 0x8;
enum NI_DGRAM = 0x10;
enum NI_WITHSCOPEID = 0x00000020;
enum NI_NUMERICSCOPE = 0x00000040;
enum NI_MAXHOST = 1025; // non-standard
enum NI_MAXSERV = 32; // non-standard

enum EAI_AGAIN = 2;
enum EAI_BADFLAGS = 3;
enum EAI_FAIL = 4;
enum EAI_FAMILY = 5;
enum EAI_MEMORY = 6;
enum EAI_NONAME = 8;
enum EAI_SERVICE = 9;
enum EAI_SOCKTYPE = 10;
enum EAI_SYSTEM = 11;
enum EAI_OVERFLOW = 14;
}
else version( OpenBSD )
{
struct hostent
Expand Down
Loading