$OpenBSD$

Index: runtime/druntime/src/core/stdc/stdio.d
--- runtime/druntime/src/core/stdc/stdio.d.orig
+++ runtime/druntime/src/core/stdc/stdio.d
@@ -25,6 +25,10 @@ private
   {
     import core.sys.posix.sys.types;
   }
+  else version (OpenBSD)
+  {
+    import core.sys.posix.sys.types;
+  }
   else version (DragonFlyBSD)
   {
     import core.sys.posix.sys.types;
@@ -170,6 +174,30 @@ else version ( FreeBSD )
         long        _mbstateL;
     }
 }
+else version (OpenBSD)
+{
+    enum
+    {
+        ///
+        BUFSIZ       = 1024,
+        ///
+        EOF          = -1,
+        ///
+        FOPEN_MAX    = 20,
+        ///
+        FILENAME_MAX = 1024,
+        ///
+        TMP_MAX      = 0x7fffffff,
+        ///
+        L_tmpnam     = 1024
+    }
+
+    struct __sbuf
+    {
+        ubyte *_base;
+        int _size;
+    }
+}
 else version ( DragonFlyBSD )
 {
     enum
@@ -452,6 +480,46 @@ else version( FreeBSD )
     ///
     alias shared(__sFILE) FILE;
 }
+else version (OpenBSD)
+{
+    ///
+    alias fpos_t = off_t;
+
+    ///
+    struct __sFILE
+    {
+        ubyte*          _p;
+        int             _r;
+        int             _w;
+        short           _flags;
+        short           _file;
+        __sbuf          _bf;
+        int             _lbfsize;
+
+        void*           _cookie;
+        int     function(void*)                _close;
+        int     function(void*, char*, int)    _read;
+        fpos_t  function(void*, fpos_t, int)   _seek;
+        int     function(void*, in char*, int) _write;
+
+        __sbuf          _ext;
+        ubyte*          _up;
+        int             _ur;
+
+        ubyte[3]        _ubuf;
+        ubyte[1]        _nbuf;
+
+        __sbuf          _lb;
+
+        int             _blksize;
+        fpos_t          _offset;
+    }
+
+    ///
+    alias __sFILE _iobuf;
+    ///
+    alias shared(__sFILE) FILE;
+}
 else version( DragonFlyBSD )
 {
     alias off_t fpos_t;
@@ -756,6 +824,27 @@ else version( FreeBSD )
     ///
     alias __stderrp stderr;
 }
+else version (OpenBSD)
+{
+    enum
+    {
+        ///
+        _IOFBF = 0,
+        ///
+        _IOLBF = 1,
+        ///
+        _IONBF = 2,
+    }
+
+    private extern shared FILE[3] __sF;
+
+    ///
+    shared stdin  = &__sF[0];
+    ///
+    shared stdout = &__sF[1];
+    ///
+    shared stderr = &__sF[2];
+}
 else version( DragonFlyBSD )
 {
     enum
@@ -1072,6 +1161,45 @@ else version( FreeBSD )
     int  snprintf(char* s, size_t n, in char* format, ...);
     ///
     int  vsnprintf(char* s, size_t n, in char* format, va_list arg);
+}
+else version (OpenBSD)
+{
+    // No unsafe pointer manipulation.
+    @trusted
+    {
+        ///
+        void rewind(FILE*);
+        ///
+        pure void clearerr(FILE*);
+        ///
+        pure int  feof(FILE*);
+        ///
+        pure int  ferror(FILE*);
+        ///
+        int  fileno(FILE*);
+    }
+
+    enum __SLBF = 0x0001;
+    enum __SNBF = 0x0002;
+    enum __SRD  = 0x0004;
+    enum __SWR  = 0x0008;
+    enum __SRW  = 0x0010;
+    enum __SEOF = 0x0020;
+    enum __SERR = 0x0040;
+    enum __SMBF = 0x0080;
+    enum __SAPP = 0x0100;
+    enum __SSTR = 0x0200;
+    enum __SOPT = 0x0400;
+    enum __SNPT = 0x0800;
+    enum __SOFF = 0x1000;
+    enum __SMOD = 0x2000;
+    enum __SALC = 0x4000;
+    enum __SIGN = 0x8000;
+
+    ///
+    int  snprintf(scope char* s, size_t n, scope const char* format, ...);
+    ///
+    int  vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
 }
 else version( DragonFlyBSD )
 {
