Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1396 from redstar/systemz2
Browse files Browse the repository at this point in the history
Add more SystemZ declarations.
  • Loading branch information
dnadlinger committed Sep 23, 2015
2 parents 00fb481 + b099fd3 commit 92ccb0f
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/core/stdc/fenv.d
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@ version( GNUFP )
alias fenv_t = double;
alias fexcept_t = uint;
}
// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/s390/fpu/bits/fenv.h
else version (SystemZ)
{
struct fenv_t
{
fexcept_t __fpc;
void* __unused;
}

alias fexcept_t = uint;
}
else
{
static assert(0, "Unimplemented architecture");
Expand Down
8 changes: 7 additions & 1 deletion src/core/sys/linux/link.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version (linux):
extern (C):
nothrow:

import core.stdc.stdint : uintptr_t, uint32_t;
import core.stdc.stdint : uintptr_t, uint32_t, uint64_t;
import core.sys.linux.config : __WORDSIZE;
import core.sys.linux.dlfcn : Lmid_t;
import core.sys.linux.elf;
Expand Down Expand Up @@ -63,6 +63,12 @@ else version (AArch64)
alias __WORDSIZE __ELF_NATIVE_CLASS;
alias uint32_t Elf_Symndx;
}
else version (SystemZ)
{
// http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h
alias __WORDSIZE __ELF_NATIVE_CLASS;
alias uint64_t Elf_Symndx;
}
else
static assert(0, "unimplemented");
// <bits/elfclass.h>
Expand Down
13 changes: 13 additions & 0 deletions src/core/sys/posix/fcntl.d
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,19 @@ version( CRuntime_Glibc )
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else version (SystemZ)
{
enum O_CREAT = 0x40; // octal 0100
enum O_EXCL = 0x80; // octal 0200
enum O_NOCTTY = 0x100; // octal 0400
enum O_TRUNC = 0x200; // octal 01000

enum O_APPEND = 0x400; // octal 02000
enum O_NONBLOCK = 0x800; // octal 04000
enum O_SYNC = 0x101000; // octal 04010000
enum O_DSYNC = 0x1000; // octal 010000
enum O_RSYNC = O_SYNC;
}
else
static assert(0, "unimplemented");

Expand Down
60 changes: 60 additions & 0 deletions src/core/sys/posix/sys/stat.d
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,66 @@ version( CRuntime_Glibc )
else
static assert(stat_t.sizeof == 128);
}
else version (SystemZ)
{
private
{
alias __dev_t = ulong;
alias __ino_t = c_ulong;
alias __ino64_t = ulong;
alias __mode_t = uint;
alias __nlink_t = uint;
alias __uid_t = uint;
alias __gid_t = uint;
alias __off_t = c_long;
alias __off64_t = long;
alias __blksize_t = int;
alias __blkcnt_t = c_long;
alias __blkcnt64_t = long;
alias __timespec = timespec;
alias __time_t = time_t;
}
struct stat_t
{
__dev_t st_dev;
__ino_t st_ino;
__nlink_t st_nlink;
__mode_t st_mode;
__uid_t st_uid;
__gid_t st_gid;
int __glibc_reserved0;
__dev_t st_rdev;
__off_t st_size;
static if (__USE_XOPEN2K8)
{
__timespec st_atim;
__timespec st_mtim;
__timespec st_ctim;
extern(D)
{
@property ref time_t st_atime() { return st_atim.tv_sec; }
@property ref time_t st_mtime() { return st_mtim.tv_sec; }
@property ref time_t st_ctime() { return st_ctim.tv_sec; }
}
}
else
{
__time_t st_atime;
c_ulong st_atimensec;
__time_t st_mtime;
c_ulong st_mtimensec;
__time_t st_ctime;
c_ulong st_ctimensec;
}
__blksize_t st_blksize;
__blkcnt_t st_blocks;
c_long[3] __glibc_reserved;
}
static if(__USE_XOPEN2K8)
static assert(stat_t.sizeof == 144);
else
static assert(stat_t.sizeof == 144);
}
else
static assert(0, "unimplemented");

Expand Down

0 comments on commit 92ccb0f

Please sign in to comment.