OSDN Git Service

Merge commit 'origin/master' into nptl
authorAustin Foxley <austinf@cetoncorp.com>
Tue, 6 Apr 2010 15:58:29 +0000 (08:58 -0700)
committerAustin Foxley <austinf@cetoncorp.com>
Tue, 6 Apr 2010 15:58:33 +0000 (08:58 -0700)
Conflicts:
libc/misc/utmp/utent.c
libc/sysdeps/linux/i386/bits/syscalls.h

Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
1  2 
libc/misc/utmp/utent.c
test/Rules.mak

@@@ -31,13 -41,14 +42,14 @@@ static struct utmp static_utmp
  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(void)
+ static_if_threaded void __setutent(void)
  {
      if (static_fd < 0) {
 -      static_fd = open(static_ut_name, O_RDWR | O_CLOEXEC);
 +      static_fd = open_not_cancel_2(static_ut_name, O_RDWR | O_CLOEXEC);
        if (static_fd < 0) {
 -          static_fd = open(static_ut_name, O_RDONLY | O_CLOEXEC);
 +          static_fd = open_not_cancel_2(static_ut_name, O_RDONLY | O_CLOEXEC);
            if (static_fd < 0) {
                return; /* static_fd remains < 0 */
            }
@@@ -71,12 -81,23 +82,23 @@@ static_if_threaded struct utmp *__getut
        }
      }
  
 -    if (read(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) {
 +    if (read_not_cancel(static_fd, &static_utmp, sizeof(static_utmp)) == sizeof(static_utmp)) {
-       ret = &static_utmp;
+       return &static_utmp;
      }
  
+     return NULL;
+ }
+ #if defined __UCLIBC_HAS_THREADS__
+ struct utmp *getutent(void)
+ {
+     struct utmp *ret;
+     __UCLIBC_MUTEX_LOCK(utmplock);
+     ret = __getutent();
+     __UCLIBC_MUTEX_UNLOCK(utmplock);
      return ret;
  }
+ #endif
  
  void endutent(void)
  {
diff --cc test/Rules.mak
Simple merge