From 5d7e815eb49dcba4ba9d2582fd23a9c64e007ea3 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Tue, 2 Nov 2021 21:50:36 -0400 Subject: [PATCH] lib: add Uname, a constructor for utsname Signed-off-by: Zygo Blaxell --- include/crucible/uname.h | 14 ++++++++++++++ lib/Makefile | 1 + lib/uname.cc | 11 +++++++++++ 3 files changed, 26 insertions(+) create mode 100644 include/crucible/uname.h create mode 100644 lib/uname.cc diff --git a/include/crucible/uname.h b/include/crucible/uname.h new file mode 100644 index 0000000..fc65b66 --- /dev/null +++ b/include/crucible/uname.h @@ -0,0 +1,14 @@ +#ifndef CRUCIBLE_UNAME_H +#define CRUCIBLE_UNAME_H + +#include + +namespace crucible { + using namespace std; + + struct Uname : public utsname { + Uname(); + }; +} + +#endif diff --git a/lib/Makefile b/lib/Makefile index b3acfa4..622abf9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -19,6 +19,7 @@ CRUCIBLE_OBJS = \ string.o \ task.o \ time.o \ + uname.o \ include ../makeflags -include ../localconf diff --git a/lib/uname.cc b/lib/uname.cc new file mode 100644 index 0000000..f8ed6ad --- /dev/null +++ b/lib/uname.cc @@ -0,0 +1,11 @@ +#include "crucible/error.h" +#include "crucible/uname.h" + +namespace crucible { + using namespace std; + + Uname::Uname() + { + DIE_IF_NON_ZERO(uname(static_cast(this))); + } +}