This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] S/390: Fix 31/64 bit utmp compat problem v2
- From: "Andreas Krebbel" <Andreas dot Krebbel at de dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com
- Cc: jakub at redhat dot com, schwidefsky at de dot ibm dot com
- Date: Mon, 28 Apr 2008 17:08:15 +0200
- Subject: [PATCH] S/390: Fix 31/64 bit utmp compat problem v2
Hello,
here is a revised patch for the S/390 utmp 32/64 bit problem.
I've changed the default version tag to GLIBC_2.9 and now use the 64
bit utmp for 32 and 64 bit as suggested by Jakub.
I've tested the patch on i686, x86_64, s390 and s390x by diffing the
make check output.
Ok?
Bye,
-Andreas-
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/Versions.def libc-q/Versions.def
--- libc-q.orig/Versions.def 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/Versions.def 2008-04-28 13:22:37.000000000 +0200
@@ -25,6 +25,7 @@ libc {
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
+ GLIBC_2.9
%ifdef USE_IN_LIBIO
HURD_CTHREADS_0.3
%endif
@@ -105,6 +106,7 @@ librt {
}
libutil {
GLIBC_2.0
+ GLIBC_2.9
}
ld {
GLIBC_2.0
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutent.c libc-q/login/getutent.c
--- libc-q.orig/login/getutent.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutent.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
/* Local buffer to store the result. */
libc_freeres_ptr (static struct utmp *buffer);
@@ -42,4 +43,4 @@ __getutent (void)
return result;
}
-weak_alias (__getutent, getutent)
+utmp_compat_symbol (__getutent, getutent)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutent_r.c libc-q/login/getutent_r.c
--- libc-q.orig/login/getutent_r.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutent_r.c 2008-04-28 13:22:37.000000000 +0200
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
#include "utmp-private.h"
@@ -152,7 +153,7 @@ __getutent_r (struct utmp *buffer, struc
return retval;
}
-weak_alias (__getutent_r, getutent_r)
+utmp_compat_symbol (__getutent_r, getutent_r)
struct utmp *
@@ -168,7 +169,7 @@ __pututline (const struct utmp *data)
return buffer;
}
-weak_alias (__pututline, pututline)
+utmp_compat_symbol (__pututline, pututline)
void
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutid.c libc-q/login/getutid.c
--- libc-q.orig/login/getutid.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutid.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
/* Local buffer to store the result. */
libc_freeres_ptr (static struct utmp *buffer);
@@ -40,4 +41,4 @@ __getutid (const struct utmp *id)
return result;
}
-weak_alias (__getutid, getutid)
+utmp_compat_symbol (__getutid, getutid)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutid_r.c libc-q/login/getutid_r.c
--- libc-q.orig/login/getutid_r.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutid_r.c 2008-04-28 13:22:37.000000000 +0200
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
#include "utmp-private.h"
@@ -60,4 +61,4 @@ __getutid_r (const struct utmp *id, stru
return -1;
#endif
}
-weak_alias (__getutid_r, getutid_r)
+utmp_compat_symbol (__getutid_r, getutid_r)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutline.c libc-q/login/getutline.c
--- libc-q.orig/login/getutline.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutline.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
/* Local buffer to store the result. */
libc_freeres_ptr (static struct utmp *buffer);
@@ -41,4 +42,4 @@ __getutline (const struct utmp *line)
return result;
}
-weak_alias (__getutline, getutline)
+utmp_compat_symbol (__getutline, getutline)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutline_r.c libc-q/login/getutline_r.c
--- libc-q.orig/login/getutline_r.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutline_r.c 2008-04-28 13:22:37.000000000 +0200
@@ -22,6 +22,7 @@
#include <bits/libc-lock.h>
#include <utmp.h>
+#include "utmp-compat.h"
#include "utmp-private.h"
@@ -43,4 +44,4 @@ __getutline_r (const struct utmp *line,
return retval;
}
-weak_alias (__getutline_r, getutline_r)
+utmp_compat_symbol (__getutline_r, getutline_r)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutmp.c libc-q/login/getutmp.c
--- libc-q.orig/login/getutmp.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutmp.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,9 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
/* Copy the information in UTMPX to UTMP. */
void
-getutmp (const struct utmpx *utmpx, struct utmp *utmp)
+__getutmp (const struct utmpx *utmpx, struct utmp *utmp)
{
#if _HAVE_UT_TYPE - 0
utmp->ut_type = utmpx->ut_type;
@@ -44,3 +46,4 @@ getutmp (const struct utmpx *utmpx, stru
utmp->ut_time = utmpx->ut_time;
#endif
}
+utmp_compat_symbol (__getutmp, getutmp)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutmpx.c libc-q/login/getutmpx.c
--- libc-q.orig/login/getutmpx.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutmpx.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,9 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
/* Copy the information in UTMP to UTMPX. */
void
-getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
+__getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
{
memset (utmpx, 0, sizeof (struct utmpx));
@@ -46,3 +48,4 @@ getutmpx (const struct utmp *utmp, struc
utmpx->ut_time = utmp->ut_time;
#endif
}
+utmp_compat_symbol (__getutmpx, getutmpx)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutxent.c libc-q/login/getutxent.c
--- libc-q.orig/login/getutxent.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutxent.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,8 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
struct utmpx *
-getutxent (void)
+__getutxent (void)
{
return (struct utmpx *) __getutent ();
}
+utmp_compat_symbol (__getutxent, getutxent)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutxid.c libc-q/login/getutxid.c
--- libc-q.orig/login/getutxid.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutxid.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,8 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
struct utmpx *
-getutxid (const struct utmpx *id)
+__getutxid (const struct utmpx *id)
{
return (struct utmpx *) __getutid ((const struct utmp *) id);
}
+utmp_compat_symbol (__getutxid, getutxid)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/getutxline.c libc-q/login/getutxline.c
--- libc-q.orig/login/getutxline.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/getutxline.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,8 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
struct utmpx *
-getutxline (const struct utmpx *line)
+__getutxline (const struct utmpx *line)
{
return (struct utmpx *) __getutline ((const struct utmp *) line);
}
+utmp_compat_symbol (__getutxline, getutxline)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/login.c libc-q/login/login.c
--- libc-q.orig/login/login.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/login.c 2008-04-28 13:22:37.000000000 +0200
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <utmp.h>
+#include "utmp-compat.h"
/* Return the result of ttyname in the buffer pointed to by TTY, which should
be of length BUF_LEN. If it is too long to fit in this buffer, a
@@ -79,7 +80,7 @@ tty_name (int fd, char **tty, size_t buf
}
void
-login (const struct utmp *ut)
+__login (const struct utmp *ut)
{
#ifdef PATH_MAX
char _tty[PATH_MAX + UT_LINESIZE];
@@ -142,3 +143,4 @@ login (const struct utmp *ut)
/* Update the WTMP file. Here we have to add a new entry. */
updwtmp (_PATH_WTMP, ©);
}
+utmp_compat_symbol (__login, login)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/pututxline.c libc-q/login/pututxline.c
--- libc-q.orig/login/pututxline.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/pututxline.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,8 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
struct utmpx *
-pututxline (const struct utmpx *utmpx)
+__pututxline (const struct utmpx *utmpx)
{
return (struct utmpx *) __pututline ((const struct utmp *) utmpx);
}
+utmp_compat_symbol (__pututxline, pututxline)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/updwtmp.c libc-q/login/updwtmp.c
--- libc-q.orig/login/updwtmp.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/updwtmp.c 2008-04-28 13:22:37.000000000 +0200
@@ -19,6 +19,7 @@
#include <utmp.h>
+#include "utmp-compat.h"
#include "utmp-private.h"
#ifndef TRANSFORM_UTMP_FILE_NAME
@@ -32,4 +33,4 @@ __updwtmp (const char *wtmp_file, const
(*__libc_utmp_file_functions.updwtmp) (file_name, utmp);
}
-weak_alias (__updwtmp, updwtmp)
+utmp_compat_symbol (__updwtmp, updwtmp)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/updwtmpx.c libc-q/login/updwtmpx.c
--- libc-q.orig/login/updwtmpx.c 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/login/updwtmpx.c 2008-04-28 13:22:37.000000000 +0200
@@ -20,8 +20,11 @@
#include <utmp.h>
#include <utmpx.h>
+#include "utmp-compat.h"
+
void
-updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
+__updwtmpx (const char *wtmpx_file, const struct utmpx *utmpx)
{
__updwtmp (wtmpx_file, (const struct utmp *) utmpx);
}
+utmp_compat_symbol (__updwtmpx, updwtmpx)
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/login/utmp-compat.h libc-q/login/utmp-compat.h
--- libc-q.orig/login/utmp-compat.h 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/login/utmp-compat.h 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,30 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <bits/wordsize.h>
+#include <libc-symbols.h>
+
+/* __UTMP_COMPAT_BASE contains the version tag of the glibc version at
+ which the utmp 32 bit compat functions were added. */
+#ifdef __UTMP_COMPAT_BASE
+# define utmp_compat_symbol(name, alias) \
+ default_symbol_version (name, alias, __UTMP_COMPAT_BASE);
+#else
+# define utmp_compat_symbol(name, alias) weak_alias (name, alias)
+#endif
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/gnu/bits/utmp.h libc-q/sysdeps/gnu/bits/utmp.h
--- libc-q.orig/sysdeps/gnu/bits/utmp.h 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/sysdeps/gnu/bits/utmp.h 2008-04-28 13:22:37.000000000 +0200
@@ -39,6 +39,8 @@ struct lastlog
{
#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
int32_t ll_time;
+#elif __WORDSIZE == 32 && defined __WORDSIZE_COMPAT64
+ int64_t ll_time;
#else
__time_t ll_time;
#endif
@@ -77,6 +79,13 @@ struct utmp
int32_t tv_sec; /* Seconds. */
int32_t tv_usec; /* Microseconds. */
} ut_tv; /* Time entry was made. */
+#elif __WORDSIZE == 32 && defined __WORDSIZE_COMPAT64
+ int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int64_t tv_sec; /* Seconds. */
+ int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
#else
long int ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/gnu/bits/utmpx.h libc-q/sysdeps/gnu/bits/utmpx.h
--- libc-q.orig/sysdeps/gnu/bits/utmpx.h 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/sysdeps/gnu/bits/utmpx.h 2008-04-28 13:22:37.000000000 +0200
@@ -74,6 +74,13 @@ struct utmpx
__int32_t tv_sec; /* Seconds. */
__int32_t tv_usec; /* Microseconds. */
} ut_tv; /* Time entry was made. */
+#elif __WORDSIZE == 32 && defined __WORDSIZE_COMPAT64
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
#else
long int ut_session; /* Session ID, used for windowing. */
struct timeval ut_tv; /* Time entry was made. */
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/s390/s390-32/bits/wordsize.h libc-q/sysdeps/s390/s390-32/bits/wordsize.h
--- libc-q.orig/sysdeps/s390/s390-32/bits/wordsize.h 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/sysdeps/s390/s390-32/bits/wordsize.h 2008-04-28 13:22:37.000000000 +0200
@@ -4,6 +4,7 @@
# define __WORDSIZE 64
#else
# define __WORDSIZE 32
+# define __WORDSIZE_COMPAT64 1
#endif
#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
@@ -16,3 +17,5 @@
# define __NO_LONG_DOUBLE_MATH 1
# endif
#endif
+
+#define __UTMP_COMPAT_BASE GLIBC_2.9
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/Makefile libc-q/sysdeps/unix/sysv/linux/s390/s390-32/Makefile
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/Makefile 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/Makefile 2008-04-28 13:22:37.000000000 +0200
@@ -1,3 +1,8 @@
+ifeq ($(subdir),login)
+sysdep_routines += utmp32 utmpx32
+libutil-routines += login32
+endif
+
ifeq ($(subdir),misc)
sysdep_headers += sys/elf.h
endif
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/Versions libc-q/sysdeps/unix/sysv/linux/s390/s390-32/Versions
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/Versions 2008-04-28 13:18:35.000000000 +0200
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/Versions 2008-04-28 13:22:37.000000000 +0200
@@ -26,4 +26,28 @@ libc {
GLIBC_2.3.3 {
posix_fadvise64; posix_fallocate64;
}
+ GLIBC_2.9 {
+ updwtmp;
+ getutent;
+ getutid;
+ getutline;
+ pututline;
+ updwtmp;
+ getutent_r;
+ getutid_r;
+ getutline_r;
+ getutxent;
+ getutxid;
+ getutxline;
+ pututxline;
+ updwtmpx;
+ getutmp;
+ getutmpx;
+ }
+}
+
+libutil {
+ GLIBC_2.9 {
+ login;
+ }
}
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/login32.c libc-q/sysdeps/unix/sysv/linux/s390/s390-32/login32.c
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/login32.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/login32.c 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,37 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <utmp.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Write the given entry into utmp and wtmp. */
+void
+__login32 (__const struct utmp32 *__entry)
+{
+ const struct utmp in64;
+
+ __utmp_convert32to64 (__entry, &in64);
+ login (&in64);
+}
+
+symbol_version (__login32, login, GLIBC_2.0);
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp-convert.h 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,83 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* This file provides functions converting between the 31 and 64 bit
+ struct utmp variants. */
+
+#ifndef _UTMP_CONVERT_H
+#define _UTMP_CONVERT_H 1
+
+#include <string.h>
+
+#include "utmp32.h"
+
+static inline void
+__utmp_convert64to32 (const struct utmp *from, struct utmp32 *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int32_t)from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int32_t)from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int32_t)from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+static inline void
+__utmp_convert32to64 (const struct utmp32 *from, struct utmp *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int64_t)from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int64_t)from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int64_t)from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+#endif /* utmp-convert.h */
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.c 2008-04-28 14:57:47.000000000 +0200
@@ -0,0 +1,180 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMP32_OUT(OUT) \
+ static struct utmp32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmp32)); \
+ if (OUT == NULL) \
+ { \
+ __set_errno (ENOMEM); \
+ return NULL; \
+ } \
+ }
+
+#define ACCESS_UTMP_ENTRY(FUNC, FIELD) \
+ struct utmp in64; \
+ struct utmp *out64; \
+ ALLOCATE_UTMP32_OUT (out32); \
+ \
+ __utmp_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ __utmp_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_type matching ID->ut_type. */
+struct utmp32 *
+__getutid32 (__const struct utmp32 *__id)
+{
+ ACCESS_UTMP_ENTRY (getutid, __id)
+}
+symbol_version (__getutid32, getutid, GLIBC_2.0);
+
+/* Search forward from the current point in the utmp file until the
+ next entry with a ut_line matching LINE->ut_line. */
+struct utmp32 *
+__getutline32 (__const struct utmp32 *__line)
+{
+ ACCESS_UTMP_ENTRY (getutline, __line)
+}
+symbol_version (__getutline32, getutline, GLIBC_2.0);
+
+/* Write out entry pointed to by UTMP_PTR into the utmp file. */
+struct utmp32 *
+__pututline32 (__const struct utmp32 *__utmp_ptr)
+{
+ ACCESS_UTMP_ENTRY (pututline, __utmp_ptr)
+}
+symbol_version (__pututline32, pututline, GLIBC_2.0);
+
+/* Read next entry from a utmp-like file. */
+struct utmp32 *
+__getutent32 ()
+{
+ struct utmp *out64;
+ ALLOCATE_UTMP32_OUT (out32);
+
+ out64 = getutent ();
+ if (!out64)
+ return NULL;
+
+ __utmp_convert64to32 (out64, out32);
+ return out32;
+}
+symbol_version (__getutent32, getutent, GLIBC_2.0);
+
+/* Reentrant versions of the file for handling utmp files. */
+
+int
+__getutent_r32 (struct utmp32 *__buffer, struct utmp32 **__result)
+{
+ struct utmp out64, *out64p;
+ int ret;
+
+ ret = getutent_r (&out64, &out64p);
+ if (ret == -1)
+ {
+ *__result = NULL;
+ return -1;
+ }
+
+ __utmp_convert64to32 (out64p, __buffer);
+ *__result = __buffer;
+
+ return 0;
+}
+symbol_version (__getutent_r32, getutent_r, GLIBC_2.0);
+
+int
+__getutid_r32 (__const struct utmp32 *__id, struct utmp32 *__buffer,
+ struct utmp32 **__result)
+{
+ struct utmp in64, out64, *out64p;
+ int ret;
+
+ __utmp_convert32to64 (__id, &in64);
+
+ ret = getutid_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *__result = NULL;
+ return -1;
+ }
+
+ __utmp_convert64to32 (out64p, __buffer);
+ *__result = __buffer;
+
+ return 0;
+}
+symbol_version (__getutid_r32, getutid_r, GLIBC_2.0);
+
+int
+__getutline_r32 (__const struct utmp32 *__line,
+ struct utmp32 *__buffer, struct utmp32 **__result)
+{
+ struct utmp in64, out64, *out64p;
+ int ret;
+
+ __utmp_convert64to32 (__line, &in64);
+
+ ret = getutline_r (&in64, &out64, &out64p);
+ if (ret == -1)
+ {
+ *__result = NULL;
+ return -1;
+ }
+
+ __utmp_convert32to64 (out64p, __buffer);
+ *__result = __buffer;
+
+ return 0;
+
+}
+symbol_version (__getutline_r32, getutline_r, GLIBC_2.0);
+
+/* Append entry UTMP to the wtmp-like file WTMP_FILE. */
+void
+__updwtmp32 (__const char *__wtmp_file, __const struct utmp32 *__utmp)
+{
+ const struct utmp in32;
+
+ __utmp_convert32to64 (__utmp, &in32);
+ updwtmp (__wtmp_file, &in32);
+}
+symbol_version (__updwtmp32, updwtmp, GLIBC_2.0);
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmp32.h 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,53 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UTMP32_H
+#define _UTMP32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmp.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmp32
+{
+ short int ut_type; /* Type of login. */
+ pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[UT_NAMESIZE]; /* Username. */
+ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ int32_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ int32_t tv_sec; /* Seconds. */
+ int32_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+
+#endif /* utmp32.h */
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx-convert.h 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,82 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+
+/* This file provides functions converting between the 31 and 64 bit
+ struct utmp variants. */
+
+#ifndef _UTMPX_CONVERT_H
+#define _UTMPX_CONVERT_H 1
+
+#include <string.h>
+#include "utmpx32.h"
+
+static inline void
+__utmpx_convert64to32 (const struct utmpx *from, struct utmpx32 *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int32_t)from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int32_t)from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int32_t)from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+static inline void
+__utmpx_convert32to64 (const struct utmpx32 *from, struct utmpx *to)
+{
+#if _HAVE_UT_TYPE - 0
+ to->ut_type = from->ut_type;
+#endif
+#if _HAVE_UT_PID - 0
+ to->ut_pid = from->ut_pid;
+#endif
+ memcpy (to->ut_line, from->ut_line, __UT_LINESIZE);
+ memcpy (to->ut_user, from->ut_user, __UT_NAMESIZE);
+#if _HAVE_UT_ID - 0
+ memcpy (to->ut_id, from->ut_id, 4);
+#endif
+#if _HAVE_UT_HOST - 0
+ memcpy (to->ut_host, from->ut_host, __UT_HOSTSIZE);
+#endif
+ to->ut_exit = from->ut_exit;
+ to->ut_session = (int64_t)from->ut_session;
+#if _HAVE_UT_TV - 0
+ to->ut_tv.tv_sec = (int64_t)from->ut_tv.tv_sec;
+ to->ut_tv.tv_usec = (int64_t)from->ut_tv.tv_usec;
+#endif
+ memcpy (to->ut_addr_v6, from->ut_addr_v6, 4 * 4);
+}
+
+#endif /* utmpx-convert.h */
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.c 2008-04-28 14:58:10.000000000 +0200
@@ -0,0 +1,140 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sys/types.h>
+#include <utmp.h>
+#include <errno.h>
+#include <libc-symbols.h>
+
+#include "utmp32.h"
+#include "utmp-convert.h"
+
+#include "utmpx32.h"
+#include "utmpx-convert.h"
+
+/* Allocate a static buffer to be returned to the caller. As well as
+ with the existing version of these functions the caller has to be
+ aware that the contents of this buffer will change with subsequent
+ calls. */
+#define ALLOCATE_UTMPX32_OUT(OUT) \
+ static struct utmpx32 *OUT = NULL; \
+ \
+ if (OUT == NULL) \
+ { \
+ OUT = malloc (sizeof (struct utmpx32)); \
+ if (OUT == NULL) \
+ { \
+ __set_errno (ENOMEM); \
+ return NULL; \
+ } \
+ }
+
+#define ACCESS_UTMPX_ENTRY(FUNC, FIELD) \
+ struct utmpx in64; \
+ struct utmpx *out64; \
+ ALLOCATE_UTMPX32_OUT (out32); \
+ \
+ __utmpx_convert32to64 (FIELD, &in64); \
+ out64 = FUNC (&in64); \
+ \
+ if (out64 == NULL) \
+ return NULL; \
+ \
+ __utmpx_convert64to32 (out64, out32); \
+ \
+ return out32;
+
+
+/* Get the next entry from the user accounting database. */
+struct utmpx32 *
+__getutxent32 ()
+{
+ struct utmpx *out64;
+ ALLOCATE_UTMPX32_OUT (out32);
+
+ out64 = getutxent ();
+ if (!out64)
+ return NULL;
+
+ __utmpx_convert64to32 (out64, out32);
+ return out32;
+
+}
+symbol_version (__getutxent32, getutxent, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to ID. */
+struct utmpx32 *
+__getutxid32 (__const struct utmpx32 *__id)
+{
+ ACCESS_UTMPX_ENTRY (getutxid, __id);
+}
+symbol_version (__getutxid32, getutxid, GLIBC_2.1);
+
+/* Get the user accounting database entry corresponding to LINE. */
+struct utmpx32 *
+__getutxline32 (__const struct utmpx32 *__line)
+{
+ ACCESS_UTMPX_ENTRY (getutxline, __line);
+}
+symbol_version (__getutxline32, getutxline, GLIBC_2.1);
+
+/* Write the entry UTMPX into the user accounting database. */
+struct utmpx32 *
+__pututxline32 (__const struct utmpx32 *__utmpx)
+{
+ ACCESS_UTMPX_ENTRY (pututxline, __utmpx);
+}
+symbol_version (__pututxline32, pututxline, GLIBC_2.1);
+
+/* Append entry UTMP to the wtmpx-like file WTMPX_FILE. */
+void
+__updwtmpx32 (__const char *__wtmpx_file, __const struct utmpx32 *__utmpx)
+{
+ struct utmpx in64;
+
+ __utmpx_convert32to64 (__utmpx, &in64);
+ updwtmpx (__wtmpx_file, &in64);
+}
+symbol_version (__updwtmpx32, updwtmpx, GLIBC_2.1);
+
+/* Copy the information in UTMPX to UTMP. */
+void
+__getutmp32 (__const struct utmpx32 *__utmpx, struct utmp32 *__utmp)
+{
+ struct utmpx in64;
+ struct utmp out64;
+
+ __utmpx_convert32to64 (__utmpx, &in64);
+ getutmp (&in64, &out64);
+ __utmp_convert64to32 (&out64, __utmp);
+}
+symbol_version (__getutmp32, getutmp, GLIBC_2.1.1);
+
+/* Copy the information in UTMP to UTMPX. */
+void
+__getutmpx32 (__const struct utmp32 *__utmp, struct utmpx32 *__utmpx)
+{
+ struct utmp in64;
+ struct utmpx out64;
+
+ __utmp_convert32to64 (__utmp, &in64);
+ getutmpx (&in64, &out64);
+ __utmpx_convert64to32 (&out64, __utmpx);
+}
+symbol_version (__getutmpx32, getutmpx, GLIBC_2.1.1);
diff -purN --exclude='*~' --exclude=.pc --exclude=patches libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h
--- libc-q.orig/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h 1970-01-01 01:00:00.000000000 +0100
+++ libc-q/sysdeps/unix/sysv/linux/s390/s390-32/utmpx32.h 2008-04-28 13:22:37.000000000 +0200
@@ -0,0 +1,52 @@
+/* The `struct utmp' type, describing entries in the utmp file. GNU version.
+ Copyright (C) 1993, 1996, 1997, 1998, 1999, 2002, 2008
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _UTMPX32_H
+#define _UTMPX32_H 1
+
+#include <paths.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <bits/wordsize.h>
+#include <utmpx.h>
+
+/* The structure describing an entry in the user accounting database. */
+struct utmpx32
+{
+ short int ut_type; /* Type of login. */
+ __pid_t ut_pid; /* Process ID of login process. */
+ char ut_line[__UT_LINESIZE]; /* Devicename. */
+ char ut_id[4]; /* Inittab ID. */
+ char ut_user[__UT_NAMESIZE]; /* Username. */
+ char ut_host[__UT_HOSTSIZE]; /* Hostname for remote login. */
+ struct __exit_status ut_exit; /* Exit status of a process marked
+ as DEAD_PROCESS. */
+ __int64_t ut_session; /* Session ID, used for windowing. */
+ struct
+ {
+ __int64_t tv_sec; /* Seconds. */
+ __int64_t tv_usec; /* Microseconds. */
+ } ut_tv; /* Time entry was made. */
+
+ __int32_t ut_addr_v6[4]; /* Internet address of remote host. */
+ char __unused[20]; /* Reserved for future use. */
+};
+
+#endif /* utmpx32.h */