Skip to content
This repository was archived by the owner on Oct 12, 2022. 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
3 changes: 3 additions & 0 deletions posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ MANIFEST= \
src/core/sys/posix/sys/uio.d \
src/core/sys/posix/sys/un.d \
src/core/sys/posix/sys/wait.d \
src/core/sys/posix/sys/utsname.d \
\
src/core/sys/windows/dbghelp.d \
src/core/sys/windows/dll.d \
Expand Down Expand Up @@ -277,6 +278,7 @@ SRC_D_MODULES = \
core/sys/posix/sys/stat \
core/sys/posix/sys/wait \
core/sys/posix/netdb \
core/sys/posix/sys/utsname \
core/sys/posix/netinet/in_ \
\
core/sync/barrier \
Expand Down Expand Up @@ -481,6 +483,7 @@ IMPORTS=\
$(IMPDIR)/core/sys/posix/sys/uio.di \
$(IMPDIR)/core/sys/posix/sys/un.di \
$(IMPDIR)/core/sys/posix/sys/wait.di \
$(IMPDIR)/core/sys/posix/sys/utsname.di \
\
$(IMPDIR)/core/sys/windows/dbghelp.di \
$(IMPDIR)/core/sys/windows/dll.di \
Expand Down
55 changes: 55 additions & 0 deletions src/core/sys/posix/sys/utsname.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module core.sys.posix.sys.utsname;

extern (C)
{
version(linux)
{
private enum utsNameLength = 65;

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];

char __domainname[utsNameLength];
}

int uname(utsname* __name);
}
else version(OSX)
{
private enum utsNameLength = 256;

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];
}

int uname(utsname* __name);
}
else version(FreeBSD)
{
private enum utsNameLength = 32;

struct utsname
{
char sysname[utsNameLength];
char nodename[utsNameLength];
char release[utsNameLength];
// The field name is version but version is a keyword in D.
char update[utsNameLength];
char machine[utsNameLength];
}

int uname(utsname* __name);
}
}
9 changes: 9 additions & 0 deletions src/core/sys/windows/windows.d
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,15 @@ enum
THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE,
}

enum : DWORD
{
MAX_COMPUTERNAME_LENGTH = 15,
}

export BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD nSize);
export BOOL GetComputerNameW(LPWSTR lpBuffer, LPDWORD nSize);
export BOOL SetComputerNameA(LPCSTR lpComputerName);
export BOOL SetComputerNameW(LPCWSTR lpComputerName);
export BOOL GetUserNameA(LPSTR lpBuffer, LPDWORD lpnSize);
export BOOL GetUserNameW(LPWSTR lpBuffer, LPDWORD lpnSize);
export HANDLE GetCurrentThread();
Expand Down
5 changes: 5 additions & 0 deletions win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ MANIFEST= \
src\core\sys\posix\sys\uio.d \
src\core\sys\posix\sys\un.d \
src\core\sys\posix\sys\wait.d \
src\core\sys\posix\sys\utsname.d \
\
src\core\sys\windows\dbghelp.d \
src\core\sys\windows\dll.d \
Expand Down Expand Up @@ -460,6 +461,7 @@ IMPORTS=\
$(IMPDIR)\core\sys\posix\sys\uio.di \
$(IMPDIR)\core\sys\posix\sys\un.di \
$(IMPDIR)\core\sys\posix\sys\wait.di \
$(IMPDIR)\core\sys\posix\sys\utsname.di \
\
$(IMPDIR)\core\sys\windows\dbghelp.di \
$(IMPDIR)\core\sys\windows\dll.di \
Expand Down Expand Up @@ -757,6 +759,9 @@ $(IMPDIR)\core\sys\posix\sys\un.di : src\core\sys\posix\sys\un.d
$(IMPDIR)\core\sys\posix\sys\wait.di : src\core\sys\posix\sys\wait.d
$(DMD) -c -d -o- -Isrc -Iimport -Hf$@ $**

$(IMPDIR)\core\sys\posix\sys\utsname.di : src\core\sys\posix\sys\utsname.d
$(DMD) -c -d -o- -Isrc -Iimport -Hf$@ $**

$(IMPDIR)\core\sys\posix\termios.di : src\core\sys\posix\termios.d
$(DMD) -c -d -o- -Isrc -Iimport -Hf$@ $**

Expand Down