Unverified Commit 63de88ed authored by John Ericson's avatar John Ericson Committed by GitHub
Browse files

openbsd.sys (OpenBSD kernel): init (#353935)

parents 4aad3e8c 34065832
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
{
  mkDerivation,
  lib,
  flex,
  byacc,
  compatHook,
}:
mkDerivation {
  path = "usr.sbin/config";

  extraNativeBuildInputs = [
    flex
    byacc
    compatHook
  ];

  postPatch = ''
    rm $BSDSRCDIR/usr.sbin/config/ukc.c
    rm $BSDSRCDIR/usr.sbin/config/ukcutil.c
    rm $BSDSRCDIR/usr.sbin/config/cmd.c
    rm $BSDSRCDIR/usr.sbin/config/exec_elf.c
  '';

  buildPhase = ''
    for f in *.l; do flex $f; done
    for f in *.y; do yacc -H ''${f%.y}.h $f; done
    for f in *.c; do $CC -I$TMP/include -DMAKE_BOOTSTRAP -c $f; done
    $CC *.o -o config
  '';

  meta.platforms = lib.platforms.linux;
}
+25 −0
Original line number Diff line number Diff line
{
  mkDerivation,
  lib,
  flex,
  byacc,
  compatHook,
}:
mkDerivation {
  path = "usr.bin/ctags";

  extraNativeBuildInputs = [
    flex
    byacc
    compatHook
  ];

  buildPhase = ''
    for f in *.l; do flex $f; done
    for f in *.y; do yacc -H ''${f%.y}.h $f; done
    for f in *.c; do $CC -I$TMP/include -DMAKE_BOOTSTRAP -c $f; done
    $CC *.o -o ctags
  '';

  meta.platforms = lib.platforms.linux;
}
+30 −0
Original line number Diff line number Diff line
#pragma once
#include_next <err.h>

#include <errno.h>
#include <stdarg.h>
static inline void __attribute__((__format__(printf, 3, 4)))
errc(int eval, int code, const char *fmt, ...) {
  // verr uses the error code from errno
  // No need to keep the old value since this is noreturn anyway
  errno = code;

  va_list args;
  va_start(args, fmt);
  verr(eval, fmt, args);
  va_end(args);
}

static inline void __attribute__((__format__(printf, 2, 3)))
warnc(int code, const char *fmt, ...) {
  // verr uses the error code from errno
  int old_errno = errno;
  errno = code;

  va_list args;
  va_start(args, fmt);
  vwarn(fmt, args);
  va_end(args);

  errno = old_errno;
}
+6 −0
Original line number Diff line number Diff line
#pragma once
#include_next <fcntl.h>

// Linux doesn't let you lock during open, make these do nothing
#define O_EXLOCK 0
#define O_SHLOCK 0
+4 −0
Original line number Diff line number Diff line
#include_next <sys/cdefs.h>

#define __packed __attribute__((__packed__))
#define __aligned(x) __attribute__((__aligned__(x)))
Loading