From f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 7 Mar 2024 17:28:52 -0500 Subject: build: Build mlibc + add distclean target Signed-off-by: Ian Moffett --- lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp | 76 ---------------------------- 1 file changed, 76 deletions(-) delete mode 100644 lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp (limited to 'lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp') diff --git a/lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp b/lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp deleted file mode 100644 index ec74e22..0000000 --- a/lib/mlibc/sysdeps/ironclad/generic/utmpx.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int utmpx_file = -1; - -void updwtmpx(const char *, const struct utmpx *) { - // Empty as musl does -} - -void endutxent(void) { - if (utmpx_file >= 0) { - close(utmpx_file); - } -} - -void setutxent(void) { - if (utmpx_file < 0) { - utmpx_file = open(UTMPX_FILE, O_RDWR | O_CREAT, 0755); - } else { - lseek(utmpx_file, 0, SEEK_SET); - } -} - -struct utmpx returned; - -struct utmpx *getutxent(void) { - if (utmpx_file < 0) { - setutxent(); - if (utmpx_file < 0) { - return NULL; - } - } - - if (read(utmpx_file, &returned, sizeof(struct utmpx)) != sizeof(struct utmpx)) { - return NULL; - } - - return &returned; -} - -struct utmpx *pututxline(const struct utmpx *added) { - if (utmpx_file < 0) { - setutxent(); - if (utmpx_file < 0) { - return NULL; - } - } - - lseek(utmpx_file, 0, SEEK_END); - if (write(utmpx_file, added, sizeof(struct utmpx)) != sizeof(struct utmpx)) { - return NULL; - } - - return (struct utmpx *)added; -} - -int utmpxname(const char *path) { - if (utmpx_file > 0) { - close(utmpx_file); - } - - utmpx_file = open(path, O_RDWR | O_CREAT, 0755); - if (utmpx_file > 0) { - lseek(utmpx_file, 0, SEEK_END); - return 1; - } else { - return 0; - } -} -- cgit v1.2.3