Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options/glibc: Add utmpx paths #913

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Dennisbonke marked this conversation as resolved.
Show resolved Hide resolved
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
Loading