Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
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
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 @@ -124,6 +124,31 @@ else version( FreeBSD )
const(char)* inet_ntop(int, in void*, char*, socklen_t);
int inet_pton(int, in char*, void*);
}
else version( DragonFlyBSD )
{
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 @@ -235,6 +260,10 @@ else version( FreeBSD )
{
enum INET6_ADDRSTRLEN = 46;
}
else version( DragonFlyBSD )
{
enum INET6_ADDRSTRLEN = 46;
}
else version( Solaris )
{
enum INET6_ADDRSTRLEN = 46;
Expand Down
39 changes: 39 additions & 0 deletions src/core/sys/posix/dirent.d
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,36 @@ else version( FreeBSD )

dirent* readdir(DIR*);
}
else version( DragonFlyBSD )
{
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,
DT_DBF = 15, /* database record file */
}

struct dirent
{
ino_t d_fileno; /* file number of entry */
ushort d_reclen; /* strlen(d_name) */
ubyte d_type; /* file type, see blow */
ubyte d_unused1; /* padding, reserved */
uint d_unused2; /* reserved */
char[256] d_name; /* name, NUL-terminated */
}

alias void* DIR;

dirent* readdir(DIR*);
}
else version (Solaris)
{
struct dirent
Expand Down Expand Up @@ -245,6 +275,10 @@ else version( FreeBSD )
{
int readdir_r(DIR*, dirent*, dirent**);
}
else version( DragonFlyBSD )
{
int readdir_r(DIR*, dirent*, dirent**);
}
else version (Solaris)
{
static if (__USE_LARGEFILE64)
Expand Down Expand Up @@ -284,6 +318,11 @@ else version( FreeBSD )
void seekdir(DIR*, c_long);
c_long telldir(DIR*);
}
else version( DragonFlyBSD )
{
void seekdir(DIR*, c_long);
c_long telldir(DIR*);
}
else version (OSX)
{
}
Expand Down
21 changes: 21 additions & 0 deletions src/core/sys/posix/dlfcn.d
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ else version( FreeBSD )
void* dli_saddr;
}
}
else version( DragonFlyBSD )
{
enum RTLD_LAZY = 1;
enum RTLD_NOW = 2;
enum RTLD_GLOBAL = 0x100;
enum RTLD_LOCAL = 0;

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( Solaris )
{
enum RTLD_LAZY = 1;
Expand Down
89 changes: 89 additions & 0 deletions src/core/sys/posix/fcntl.d
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,95 @@ else version( FreeBSD )
int creat(in char*, mode_t);
int open(in char*, int, ...);
}
else version( DragonFlyBSD )
{
enum O_RDONLY = 0x0000;
enum O_WRONLY = 0x0001;
enum O_RDWR = 0x0002;
enum O_ACCMODE = 0x0003;

enum FREAD = 0x0001;
enum FWRITE = 0x0002;
enum O_NONBLOCK = 0x0000004;
enum O_APPEND = 0x0000008;
enum O_SHLOCK = 0x0000010;
enum O_EXLOCK = 0x0000020;
enum O_ASYNC = 0x0000040;
enum O_FSYNC = 0x0000080;
enum O_SYNC = 0x0000080;
enum O_NOFOLLOW = 0x0000100;
enum O_CREAT = 0x0000200;
enum O_TRUNC = 0x0000400;
enum O_EXCL = 0x0000800;
enum O_NOCTTY = 0x0008000;
enum O_DIRECT = 0x0010000;
enum O_CLOEXEC = 0x0020000;
enum O_FBLOCKING = 0x0040000;
enum O_FNONBLOCKING = 0x0080000;
enum O_FAPPEND = 0x0100000;
enum O_FOFFSET = 0x0200000;
enum O_FSYNCWRITE = 0x0400000;
enum O_FASYNCWRITE = 0x0800000;
enum O_DIRECTORY = 0x8000000;

enum FAPPEND = O_APPEND;
enum FASYNC = O_ASYNC;
enum FFSYNC = O_FSYNC;
enum FNONBLOCK = O_NONBLOCK;
enum FNDELAY = O_NONBLOCK;
enum O_NDELAY = O_NONBLOCK;
enum FPOSIXSHM = O_NOFOLLOW;

enum FCNTLFLAGS = (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|O_DIRECT);

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_SETLK = 8;
enum F_SETLKW = 9;
enum F_OGETLK = F_GETLK;
enum F_OSETLK = F_SETLK;
enum F_OSETLKW = F_SETLKW;
enum F_DUP2FD = 10;
//enum F_GETLK = 11;
//enum F_SETLK = 12;
//enum F_SETLKW = 13;
enum F_DUPFD_CLOEXEC = 17;
enum F_DUP2FD_CLOEXEC = 18;

enum FD_CLOEXEC = 1;

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

enum LOCK_SH = 0x01;
enum LOCK_EX = 0x02;
enum LOCK_NB = 0x04;
enum LOCK_UN = 0x08;

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

alias oflock = flock;

int creat(in char*, mode_t);
int open(in char*, int, ...);
//int fcntl(int, int, ...); /*defined below*/
//int flock(int, 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 @@ -68,6 +68,16 @@ else version( FreeBSD )
char** gr_mem;
}
}
else version( DragonFlyBSD )
{
struct group
{
char* gr_name;
char* gr_passwd;
gid_t gr_gid;
char** gr_mem;
}
}
else version( Solaris )
{
struct group
Expand Down Expand Up @@ -119,6 +129,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( DragonFlyBSD )
{
int getgrnam_r(in char*, group*, char*, size_t, group**);
int getgrgid_r(gid_t, group*, char*, size_t, group**);
}
else version( Solaris )
{
int getgrnam_r(in char*, group*, char*, int, group**);
Expand Down Expand Up @@ -159,6 +174,12 @@ else version( FreeBSD )
@trusted void endgrent();
@trusted void setgrent();
}
else version( DragonFlyBSD )
{
group* getgrent();
@trusted void endgrent();
@trusted void setgrent();
}
else version( Solaris )
{
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 @@ -82,6 +82,21 @@ else version( FreeBSD )
if_nameindex_t* if_nameindex();
void if_freenameindex(if_nameindex_t*);
}
else version( DragonFlyBSD )
{
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
101 changes: 101 additions & 0 deletions src/core/sys/posix/netdb.d
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,107 @@ else version( FreeBSD )
enum EAI_SYSTEM = 11;
enum EAI_OVERFLOW = 14;
}
else version( DragonFlyBSD )
{
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in h_errno).
*/
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;
}

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;
}

struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype = SOCK_STREAM; /* socktype default value required to be able to perform getAddrInfo on DragonFlyBSD
* without socktype set, you get 'servname not supported for ai_socktype'
*/
int ai_protocol;
socklen_t ai_addrlen;
char* ai_canonname;
sockaddr* ai_addr;
addrinfo* ai_next;
}

enum IPPORT_RESERVED = 1024;

enum NETDB_INTERNAL = -1;
enum NETDB_SUCCESS = 0;
enum HOST_NOT_FOUND = 1;
enum TRY_AGAIN = 2;
enum NO_RECOVERY = 3;
enum NO_DATA = 4;
enum NO_ADDRESS = NO_DATA;

//enum EAI_ADDRFAMILY = 1; // deprecated
enum EAI_AGAIN = 2;
enum EAI_BADFLAGS = 3;
enum EAI_FAIL = 4;
enum EAI_FAMILY = 5;
enum EAI_MEMORY = 6;
//enum EAI_NODATA = 7; // deprecated
enum EAI_NONAME = 8;
enum EAI_SERVICE = 9;
enum EAI_SOCKTYPE = 10;
enum EAI_SYSTEM = 11;
enum EAI_BADHINTS = 12;
enum EAI_PROTOCOL = 13;
enum EAI_OVERFLOW = 14;

enum AI_PASSIVE = 0x001;
enum AI_CANONNAME = 0x002;
enum AI_NUMERICHOST = 0x004;
enum AI_NUMERICSERV = 0x008;
enum AI_MASK = (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG); // valid flags for addrinfo (not a standard def, apps should not use it)
enum AI_ALL = 0x100;
enum AI_V4MAPPED_CFG = 0x200;
enum AI_ADDRCONFIG = 0x400;
enum AI_V4MAPPED = 0x800;
enum AI_DEFAULT = (AI_V4MAPPED_CFG | AI_ADDRCONFIG);

enum NI_MAXHOST = 1025; // non-standard
enum NI_MAXSERV = 32; // non-standard

enum NI_NOFQDN = 0x01;
enum NI_NUMERICHOST = 0x02;
enum NI_NAMEREQD = 0x04;
enum NI_NUMERICSERV = 0x08;
enum NI_DGRAM = 0x10;
//enum NI_WITHSCOPEID = 0x20; // deprecated
enum NI_NUMERICSCOPE = 0x40;

}
else version (Solaris)
{
struct hostent
Expand Down
Loading