summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-24 00:09:45 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-24 00:09:45 +0100
commit9277fe13156a6ff2b055fe8a58d2863115c36b6a (patch)
treee18028ac10b9c1650a9d1e8f4f4789556c268b7d /libc/misc
parent63729418992d5f63965a88fa2ac3570e3d270479 (diff)
Revert "utent.c, wtent.c: move functions from utxent.c"
This reverts commit 84135275cfeebc0b233c1c96eeada4d4178a0b18. This change is said to make systemd deadlock (cannot reproduce this) Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Conflicts: include/utmp.h
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/utmp/utent.c80
-rw-r--r--libc/misc/utmp/utxent.c4
-rw-r--r--libc/misc/utmp/wtent.c14
3 files changed, 22 insertions, 76 deletions
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index a35bb2b84..07ca44eb2 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -19,9 +19,6 @@
#include <errno.h>
#include <string.h>
#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
#include <not-cancel.h>
#include <bits/uClibc_mutex.h>
@@ -34,7 +31,7 @@ static const char default_file_name[] = _PATH_UTMP;
static const char *static_ut_name = default_file_name;
/* This function must be called with the LOCK held */
-static void __setutent_unlocked(void)
+static void __setutent(void)
{
if (static_fd < 0) {
static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
@@ -53,24 +50,19 @@ static void __setutent_unlocked(void)
lseek(static_fd, 0, SEEK_SET);
}
#if defined __UCLIBC_HAS_THREADS__
-static void __setutent(void)
+void setutent(void)
{
__UCLIBC_MUTEX_LOCK(utmplock);
- __setutent_unlocked();
+ __setutent();
__UCLIBC_MUTEX_UNLOCK(utmplock);
}
#else
-static void __setutent(void);
-strong_alias(__setutent_unlocked,__setutent)
-#endif
strong_alias(__setutent,setutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__setutent,setutxent)
#endif
+libc_hidden_def(setutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutent_unlocked(void)
+static struct utmp *__getutent(void)
{
if (static_fd < 0) {
__setutent();
@@ -86,27 +78,19 @@ static struct utmp *__getutent_unlocked(void)
return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutent(void)
+struct utmp *getutent(void)
{
struct utmp *ret;
__UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutent_unlocked();
+ ret = __getutent();
__UCLIBC_MUTEX_UNLOCK(utmplock);
return ret;
}
#else
-static struct utmp *__getutent(void);
-strong_alias(__getutent_unlocked,__getutent)
-#endif
strong_alias(__getutent,getutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxent(void)
-{
- return (struct utmpx *) __getutent ();
-}
#endif
+libc_hidden_def(getutent)
static void __endutent(void)
{
@@ -117,13 +101,10 @@ static void __endutent(void)
__UCLIBC_MUTEX_UNLOCK(utmplock);
}
strong_alias(__endutent,endutent)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__endutent,endutxent)
-#endif
+libc_hidden_def(endutent)
/* This function must be called with the LOCK held */
-static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
+static struct utmp *__getutid(const struct utmp *utmp_entry)
{
struct utmp *lutmp;
unsigned type;
@@ -133,7 +114,7 @@ static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
type = utmp_entry->ut_type - 1;
type /= 4;
- while ((lutmp = __getutent_unlocked()) != NULL) {
+ while ((lutmp = __getutent()) != NULL) {
if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
/* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
return lutmp;
@@ -147,34 +128,26 @@ static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
return NULL;
}
#if defined __UCLIBC_HAS_THREADS__
-static struct utmp *__getutid(const struct utmp *utmp_entry)
+struct utmp *getutid(const struct utmp *utmp_entry)
{
struct utmp *ret;
__UCLIBC_MUTEX_LOCK(utmplock);
- ret = __getutid_unlocked(utmp_entry);
+ ret = __getutid(utmp_entry);
__UCLIBC_MUTEX_UNLOCK(utmplock);
return ret;
}
#else
-static struct utmp *__getutid(const struct utmp *utmp_entry);
-strong_alias(__getutid_unlocked,__getutid)
-#endif
strong_alias(__getutid,getutid)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxid(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __getutid ((const struct utmp *) utmp_entry);
-}
#endif
+libc_hidden_def(getutid)
static struct utmp *__getutline(const struct utmp *utmp_entry)
{
struct utmp *lutmp;
__UCLIBC_MUTEX_LOCK(utmplock);
- while ((lutmp = __getutent_unlocked()) != NULL) {
+ while ((lutmp = __getutent()) != NULL) {
if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
break;
@@ -185,13 +158,7 @@ static struct utmp *__getutline(const struct utmp *utmp_entry)
return lutmp;
}
strong_alias(__getutline,getutline)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *getutxline(const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __getutline ((const struct utmp *) utmp_entry);
-}
-#endif
+libc_hidden_def(getutline)
static struct utmp *__pututline(const struct utmp *utmp_entry)
{
@@ -200,7 +167,7 @@ static struct utmp *__pututline(const struct utmp *utmp_entry)
the file pointer where they want it, everything will work out. */
lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
- if (__getutid_unlocked(utmp_entry) != NULL)
+ if (__getutid(utmp_entry) != NULL)
lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
else
lseek(static_fd, (off_t) 0, SEEK_END);
@@ -211,13 +178,7 @@ static struct utmp *__pututline(const struct utmp *utmp_entry)
return (struct utmp *)utmp_entry;
}
strong_alias(__pututline,pututline)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-struct utmpx *pututxline (const struct utmpx *utmp_entry)
-{
- return (struct utmpx *) __pututline ((const struct utmp *) utmp_entry);
-}
-#endif
+libc_hidden_def(pututline)
static int __utmpname(const char *new_ut_name)
{
@@ -241,7 +202,4 @@ static int __utmpname(const char *new_ut_name)
return 0; /* or maybe return -(static_ut_name != new_ut_name)? */
}
strong_alias(__utmpname,utmpname)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-strong_alias(__utmpname,utmpxname)
-#endif
+libc_hidden_def(utmpname)
diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
index 71157ccd8..a0e80a662 100644
--- a/libc/misc/utmp/utxent.c
+++ b/libc/misc/utmp/utxent.c
@@ -13,7 +13,6 @@
#include <utmpx.h>
#include <utmp.h>
-#if 0 /* moved to utent.c */
void setutxent(void)
{
setutent ();
@@ -49,12 +48,10 @@ int utmpxname (const char *new_ut_name)
return utmpname (new_ut_name);
}
-/* moved to wtent.c */
void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
{
updwtmp (wtmpx_file, (const struct utmp *) utmpx);
}
-#endif
/* Copy the information in UTMPX to UTMP. */
void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
@@ -107,3 +104,4 @@ void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
utmpx->ut_time = utmp->ut_time;
#endif
}
+
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
index 9b3ad5084..b5e4ee576 100644
--- a/libc/misc/utmp/wtent.c
+++ b/libc/misc/utmp/wtent.c
@@ -11,9 +11,6 @@
#include <time.h>
#include <unistd.h>
#include <utmp.h>
-#ifdef __UCLIBC_HAS_UTMPX__
-# include <utmpx.h>
-#endif
#include <fcntl.h>
#include <sys/file.h>
#include <not-cancel.h>
@@ -36,7 +33,7 @@ void logwtmp (const char *line, const char *name, const char *host)
}
#endif
-static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
+void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
{
int fd;
@@ -49,11 +46,4 @@ static void __updwtmp(const char *wtmp_file, const struct utmp *lutmp)
}
}
}
-strong_alias(__updwtmp,updwtmp)
-
-#ifdef __UCLIBC_HAS_UTMPX__
-void updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
-{
- __updwtmp (wtmpx_file, (const struct utmp *) utmpx);
-}
-#endif
+libc_hidden_def(updwtmp)