summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch')
-rw-r--r--meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch106
1 files changed, 106 insertions, 0 deletions
diff --git a/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch b/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
new file mode 100644
index 0000000000..85efaf2260
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-git/utmp-locking.patch
@@ -0,0 +1,106 @@
1diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
2index 136ac69..a35bb2b 100644
3--- a/libc/misc/utmp/utent.c
4+++ b/libc/misc/utmp/utent.c
5@@ -34,7 +34,7 @@ static const char default_file_name[] = _PATH_UTMP;
6 static const char *static_ut_name = default_file_name;
7
8 /* This function must be called with the LOCK held */
9-static void __setutent_nolock(void)
10+static void __setutent_unlocked(void)
11 {
12 if (static_fd < 0) {
13 static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
14@@ -56,12 +56,12 @@ static void __setutent_nolock(void)
15 static void __setutent(void)
16 {
17 __UCLIBC_MUTEX_LOCK(utmplock);
18- __setutent_nolock();
19+ __setutent_unlocked();
20 __UCLIBC_MUTEX_UNLOCK(utmplock);
21 }
22 #else
23 static void __setutent(void);
24-strong_alias(__setutent_nolock,__setutent)
25+strong_alias(__setutent_unlocked,__setutent)
26 #endif
27 strong_alias(__setutent,setutent)
28
29@@ -70,7 +70,7 @@ strong_alias(__setutent,setutxent)
30 #endif
31
32 /* This function must be called with the LOCK held */
33-static struct utmp *__getutent_lock(void)
34+static struct utmp *__getutent_unlocked(void)
35 {
36 if (static_fd < 0) {
37 __setutent();
38@@ -91,13 +91,13 @@ static struct utmp *__getutent(void)
39 struct utmp *ret;
40
41 __UCLIBC_MUTEX_LOCK(utmplock);
42- ret = __getutent_lock();
43+ ret = __getutent_unlocked();
44 __UCLIBC_MUTEX_UNLOCK(utmplock);
45 return ret;
46 }
47 #else
48 static struct utmp *__getutent(void);
49-strong_alias(__getutent_lock,__getutent)
50+strong_alias(__getutent_unlocked,__getutent)
51 #endif
52 strong_alias(__getutent,getutent)
53
54@@ -123,7 +123,7 @@ strong_alias(__endutent,endutxent)
55 #endif
56
57 /* This function must be called with the LOCK held */
58-static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
59+static struct utmp *__getutid_unlocked(const struct utmp *utmp_entry)
60 {
61 struct utmp *lutmp;
62 unsigned type;
63@@ -133,7 +133,7 @@ static struct utmp *__getutid_lock(const struct utmp *utmp_entry)
64 type = utmp_entry->ut_type - 1;
65 type /= 4;
66
67- while ((lutmp = __getutent()) != NULL) {
68+ while ((lutmp = __getutent_unlocked()) != NULL) {
69 if (type == 0 && lutmp->ut_type == utmp_entry->ut_type) {
70 /* one of RUN_LVL, BOOT_TIME, NEW_TIME, OLD_TIME */
71 return lutmp;
72@@ -152,13 +152,13 @@ static struct utmp *__getutid(const struct utmp *utmp_entry)
73 struct utmp *ret;
74
75 __UCLIBC_MUTEX_LOCK(utmplock);
76- ret = __getutid_lock(utmp_entry);
77+ ret = __getutid_unlocked(utmp_entry);
78 __UCLIBC_MUTEX_UNLOCK(utmplock);
79 return ret;
80 }
81 #else
82 static struct utmp *__getutid(const struct utmp *utmp_entry);
83-strong_alias(__getutid_lock,__getutid)
84+strong_alias(__getutid_unlocked,__getutid)
85 #endif
86 strong_alias(__getutid,getutid)
87
88@@ -174,7 +174,7 @@ static struct utmp *__getutline(const struct utmp *utmp_entry)
89 struct utmp *lutmp;
90
91 __UCLIBC_MUTEX_LOCK(utmplock);
92- while ((lutmp = __getutent()) != NULL) {
93+ while ((lutmp = __getutent_unlocked()) != NULL) {
94 if (lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) {
95 if (strncmp(lutmp->ut_line, utmp_entry->ut_line, sizeof(lutmp->ut_line)) == 0) {
96 break;
97@@ -200,7 +200,7 @@ static struct utmp *__pututline(const struct utmp *utmp_entry)
98 the file pointer where they want it, everything will work out. */
99 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
100
101- if (__getutid(utmp_entry) != NULL)
102+ if (__getutid_unlocked(utmp_entry) != NULL)
103 lseek(static_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
104 else
105 lseek(static_fd, (off_t) 0, SEEK_END);
106