aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/uclibc/uclibc-git/0001-Revert-utent.c-wtent.c-move-functions-from-utxent.c.patch
blob: 4ac765c33484e7daacc5fcd45283b44f4aa58a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
Upstream-Status: Pending

From 096abf14d2dc978607ccd8a0d7f42da65d8991f3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 9 Sep 2012 22:00:04 -0700
Subject: [PATCH] Revert "utent.c, wtent.c: move functions from utxent.c"

This reverts commit 84135275cfeebc0b233c1c96eeada4d4178a0b18.
---
 include/utmp.h          |    8 +++++
 libc/misc/utmp/utent.c  |   80 +++++++++++------------------------------------
 libc/misc/utmp/utxent.c |    4 +--
 libc/misc/utmp/wtent.c  |   14 ++-------
 4 files changed, 30 insertions(+), 76 deletions(-)

Index: git/include/utmp.h
===================================================================
--- git.orig/include/utmp.h	2013-01-21 16:37:18.000000000 -0800
+++ git/include/utmp.h	2013-01-21 16:40:56.987583099 -0800
@@ -56,30 +56,37 @@
 /* Append entry UTMP to the wtmp-like file WTMP_FILE.  */
 extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
      __THROW;
+libc_hidden_proto(updwtmp)
 
 /* Change name of the utmp file to be examined.  */
 extern int utmpname (const char *__file) __THROW;
+libc_hidden_proto(utmpname)
 
 /* Read next entry from a utmp-like file.  */
 extern struct utmp *getutent (void) __THROW;
+libc_hidden_proto(getutent)
 
 /* Reset the input stream to the beginning of the file.  */
 extern void setutent (void) __THROW;
+libc_hidden_proto(setutent)
 
 /* Close the current open file.  */
 extern void endutent (void) __THROW;
+libc_hidden_proto(endutent)
 
 /* Search forward from the current point in the utmp file until the
    next entry with a ut_type matching ID->ut_type.  */
 extern struct utmp *getutid (const struct utmp *__id) __THROW;
+libc_hidden_proto(getutid)
 
 /* Search forward from the current point in the utmp file until the
    next entry with a ut_line matching LINE->ut_line.  */
 extern struct utmp *getutline (const struct utmp *__line) __THROW;
+libc_hidden_proto(getutline)
 
 /* Write out entry pointed to by UTMP_PTR into the utmp file.  */
 extern struct utmp *pututline (const struct utmp *__utmp_ptr) __THROW;
-
+libc_hidden_proto(pututline)
 
 #if 0 /* def	__USE_MISC */
 /* Reentrant versions of the file for handling utmp files.  */
Index: git/libc/misc/utmp/utent.c
===================================================================
--- git.orig/libc/misc/utmp/utent.c	2013-01-21 16:37:18.000000000 -0800
+++ git/libc/misc/utmp/utent.c	2013-01-21 16:38:14.035578638 -0800
@@ -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 *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 @@
     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 @@
     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 @@
     __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 @@
     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 @@
     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 @@
     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 @@
        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 @@
     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 @@
     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)
Index: git/libc/misc/utmp/utxent.c
===================================================================
--- git.orig/libc/misc/utmp/utxent.c	2013-01-21 16:37:18.000000000 -0800
+++ git/libc/misc/utmp/utxent.c	2013-01-21 16:38:14.035578638 -0800
@@ -13,7 +13,6 @@
 #include <utmpx.h>
 #include <utmp.h>
 
-#if 0 /* moved to utent.c */
 void setutxent(void)
 {
 	setutent ();
@@ -49,12 +48,10 @@
 	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 @@
 	utmpx->ut_time = utmp->ut_time;
 #endif
 }
+
Index: git/libc/misc/utmp/wtent.c
===================================================================
--- git.orig/libc/misc/utmp/wtent.c	2013-01-21 16:37:18.000000000 -0800
+++ git/libc/misc/utmp/wtent.c	2013-01-21 16:38:14.035578638 -0800
@@ -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 @@
 }
 #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 @@
 	}
     }
 }
-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)