Skip to content

Commit

Permalink
options/glibc: Add utmpx paths
Browse files Browse the repository at this point in the history
options/linux: Define more utmpx stuff
  • Loading branch information
Dennisbonke committed Feb 26, 2024
1 parent 6492ba5 commit be7b5a2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions options/glibc/include/paths.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@
#define _PATH_VARRUN "/var/run/"
#define _PATH_VARTMP "/var/tmp/"

#ifdef _GNU_SOURCE
#define _PATH_UTMPX _PATH_UTMP
#define _PATH_WTMPX _PATH_WTMP
#endif

#endif // _PATHS_H
13 changes: 13 additions & 0 deletions options/linux/generic/utmpx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,44 @@
#include <stddef.h>
#include <errno.h>
#include <utmpx.h>
#include <mlibc/debug.hpp>

void updwtmpx(const char *, const struct utmpx *) {
// Empty as musl does
mlibc::infoLogger() << "\e[31mmlibc: updwtmpx() is a stub\e[39m" << frg::endlog;
}

void endutxent(void) {
// Empty as musl does
mlibc::infoLogger() << "\e[31mmlibc: endutxent() is a stub\e[39m" << frg::endlog;
}

void setutxent(void) {
// Empty as musl does
mlibc::infoLogger() << "\e[31mmlibc: setutxent() is a stub\e[39m" << frg::endlog;
}

struct utmpx *getutxent(void) {
// return NULL as musl does
mlibc::infoLogger() << "\e[31mmlibc: getutxent() is a stub\e[39m" << frg::endlog;
return NULL;
}

struct utmpx *pututxline(const struct utmpx *) {
// return NULL as musl does
mlibc::infoLogger() << "\e[31mmlibc: pututxline() is a stub\e[39m" << frg::endlog;
return NULL;
}

int utmpxname(const char *) {
// return -1 as musl does
mlibc::infoLogger() << "\e[31mmlibc: utmpxname() is a stub\e[39m" << frg::endlog;
errno = ENOSYS;
return -1;
}

struct utmpx *getutxid(const struct utmpx *) {
// return NULL as musl does
mlibc::infoLogger() << "\e[31mmlibc: getutxid() is a stub\e[39m" << frg::endlog;
return NULL;
}
8 changes: 8 additions & 0 deletions options/linux/include/utmpx.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ struct utmpx {
char __unused[20];
};

#define e_exit __e_exit
#define e_termination __e_termination

#ifndef __MLIBC_ABI_ONLY

void updwtmpx(const char *, const struct utmpx *);
int utmpxname(const char *);
struct utmpx *pututxline(const struct utmpx *);
struct utmpx *getutxent(void);
struct utmpx *getutxid(const struct utmpx *id);
void setutxent(void);
void endutxent(void);

Expand All @@ -49,6 +53,10 @@ void endutxent(void);
#define USER_PROCESS 7
#define DEAD_PROCESS 8

#ifdef _GNU_SOURCE
#define ACCOUNTING 9
#endif

#define __UT_HOSTSIZE 256
#define __UT_NAMESIZE 32
#define __UT_LINESIZE 32
Expand Down

0 comments on commit be7b5a2

Please sign in to comment.