added nall's sparc32-semctl patch
authorSeemant Kulleen <seemant@gentoo.org>
Tue, 29 Oct 2002 09:17:34 +0000 (09:17 +0000)
committerSeemant Kulleen <seemant@gentoo.org>
Tue, 29 Oct 2002 09:17:34 +0000 (09:17 +0000)
sys-libs/glibc/ChangeLog
sys-libs/glibc/files/2.2.5/glibc-2.2.5-sparc32-semctl.patch [new file with mode: 0644]
sys-libs/glibc/glibc-2.2.5-r7.ebuild

index 817daaa0638de95023f7eb6d8da2f015e9d4b1e2..31fcf3e13379b2c5b1036a2539e1b7bd7b4c15b1 100644 (file)
@@ -1,6 +1,6 @@
 # ChangeLog for sys-libs/glibc
 # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.21 2002/10/26 00:53:09 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.22 2002/10/29 09:17:34 seemant Exp $
 
 *glibc-2.3.1-r1 (26 Oct 2002)
 
 
 *glibc-2.2.5-r7 (13 Oct 2002)
 
+  29 Oct 2002; Seemant Kulleen <seemant@gentoo.org> glibc-2.2.5-r7.ebuild :
+
+  Added semctl patch for sparc.  Thanks to nall <nall@gentoo.org> for
+  finding this at:
+  http://sources.redhat.com/ml/libc-hacker/2002-04/msg00071.html
+
   13 Oct 2002; Martin Schlemmer <azarah@gentoo.org> glibc-2.2.5-r7.ebuild :
 
   Some cleanups.  Tidy ebuild.  Move all patches to ${FILESDIR}/${PV/.
diff --git a/sys-libs/glibc/files/2.2.5/glibc-2.2.5-sparc32-semctl.patch b/sys-libs/glibc/files/2.2.5/glibc-2.2.5-sparc32-semctl.patch
new file mode 100644 (file)
index 0000000..9a83b09
--- /dev/null
@@ -0,0 +1,209 @@
+--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c.jj     Fri Feb 11 20:44:42 2000
++++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c        Thu Apr 25 22:52:00 2002
+@@ -1 +1,205 @@
+-#include &lt;sysdeps/unix/sysv/linux/i386/semctl.c&gt;
++/* Semctl for architectures where word sized unions are passed indirectly
++   Copyright (C) 1995, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++   Contributed by Ulrich Drepper &lt;drepper@gnu.ai.mit.edu&gt;, August 1995.
++
++   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 &lt;errno.h&gt;
++#include &lt;stdarg.h&gt;
++#include &lt;sys/sem.h&gt;
++#include &lt;ipc_priv.h&gt;
++
++#include &lt;sysdep.h&gt;
++#include &lt;string.h&gt;
++#include &lt;sys/syscall.h&gt;
++
++#include &quot;kernel-features.h&quot;
++#include &lt;shlib-compat.h&gt;
++
++struct __old_semid_ds
++{
++  struct __old_ipc_perm sem_perm;     /* operation permission struct */
++  __time_t sem_otime;                 /* last semop() time */
++  __time_t sem_ctime;                 /* last time changed by semctl() */
++  struct sem *__sembase;              /* ptr to first semaphore in array */
++  struct sem_queue *__sem_pending;    /* pending operations */
++  struct sem_queue *__sem_pending_last; /* last pending operation */
++  struct sem_undo *__undo;            /* ondo requests on this array */
++  unsigned short int sem_nsems;               /* number of semaphores in set */
++};
++
++/* Define a `union semun' suitable for Linux here.  */
++union semun
++{
++  int val;                    /* value for SETVAL */
++  struct semid_ds *buf;               /* buffer for IPC_STAT &amp; IPC_SET */
++  unsigned short int *array;  /* array for GETALL &amp; SETALL */
++  struct seminfo *__buf;      /* buffer for IPC_INFO */
++};
++
++#include &lt;bp-checks.h&gt;
++#include &lt;bp-semctl.h&gt;          /* definition of CHECK_SEMCTL needs union semum */
++
++#ifdef __NR_getuid32
++# if __ASSUME_32BITUIDS == 0
++/* This variable is shared with all files that need to check for 32bit
++   uids.  */
++extern int __libc_missing_32bit_uids;
++# endif
++#endif
++
++/* Return identifier for array of NSEMS semaphores associated with
++   KEY.  */
++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
++int __old_semctl (int semid, int semnum, int cmd, ...);
++#endif
++int __new_semctl (int semid, int semnum, int cmd, ...);
++
++#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
++int
++__old_semctl (int semid, int semnum, int cmd, ...)
++{
++  union semun arg;
++  va_list ap;
++
++  /* Get the argument only if required.  */
++  arg.buf = NULL;
++  switch (cmd)
++    {
++    case SETVAL:      /* arg.val */
++    case GETALL:      /* arg.array */
++    case SETALL:
++    case IPC_STAT:    /* arg.buf */
++    case IPC_SET:
++    case SEM_STAT:
++    case IPC_INFO:    /* arg.__buf */
++    case SEM_INFO:
++      va_start (ap, cmd);
++      arg = va_arg (ap, union semun);
++      va_end (ap);
++      break;
++    }
++
++  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
++                       CHECK_SEMCTL (&amp;arg, semid, cmd));
++}
++compat_symbol (libc, __old_semctl, semctl, GLIBC_2_0);
++#endif
++
++int
++__new_semctl (int semid, int semnum, int cmd, ...)
++{
++  union semun arg;
++  va_list ap;
++
++  /* Get the argument only if required.  */
++  arg.buf = NULL;
++  switch (cmd)
++    {
++    case SETVAL:      /* arg.val */
++    case GETALL:      /* arg.array */
++    case SETALL:
++    case IPC_STAT:    /* arg.buf */
++    case IPC_SET:
++    case SEM_STAT:
++    case IPC_INFO:    /* arg.__buf */
++    case SEM_INFO:
++      va_start (ap, cmd);
++      arg = va_arg (ap, union semun);
++      va_end (ap);
++      break;
++    }
++
++#if __ASSUME_32BITUIDS &gt; 0
++  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
++                       CHECK_SEMCTL (&amp;arg, semid, cmd | __IPC_64));
++#else
++  switch (cmd) {
++    case SEM_STAT:
++    case IPC_STAT:
++    case IPC_SET:
++      break;
++    default:
++      return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
++                           CHECK_SEMCTL (&amp;arg, semid, cmd));
++  }
++
++  {
++    int result;
++    struct __old_semid_ds old;
++    struct semid_ds *buf;
++
++#ifdef __NR_getuid32
++    if (__libc_missing_32bit_uids &lt;= 0)
++      {
++      if (__libc_missing_32bit_uids &lt; 0)
++        {
++          int save_errno = errno;
++
++          /* Test presence of new IPC by testing for getuid32 syscall.  */
++          result = INLINE_SYSCALL (getuid32, 0);
++          if (result == -1 &amp;&amp; errno == ENOSYS)
++            __libc_missing_32bit_uids = 1;
++          else
++            __libc_missing_32bit_uids = 0;
++          __set_errno(save_errno);
++        }
++      if (__libc_missing_32bit_uids &lt;= 0)
++        {
++          result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64,
++                                   CHECK_SEMCTL (&amp;arg, semid, cmd | __IPC_64));
++          return result;
++        }
++      }
++#endif
++
++    buf = arg.buf;
++    arg.buf = (struct semid_ds *)&amp;old;
++    if (cmd == IPC_SET)
++      {
++      old.sem_perm.uid = buf-&gt;sem_perm.uid;
++      old.sem_perm.gid = buf-&gt;sem_perm.gid;
++      old.sem_perm.mode = buf-&gt;sem_perm.mode;
++      if (old.sem_perm.uid != buf-&gt;sem_perm.uid ||
++          old.sem_perm.gid != buf-&gt;sem_perm.gid)
++        {
++          __set_errno (EINVAL);
++          return -1;
++        }
++      }
++    result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd,
++                           CHECK_SEMCTL (&amp;arg, semid, cmd));
++    if (result != -1 &amp;&amp; cmd != IPC_SET)
++      {
++      memset(buf, 0, sizeof(*buf));
++      buf-&gt;sem_perm.__key = old.sem_perm.__key;
++      buf-&gt;sem_perm.uid = old.sem_perm.uid;
++      buf-&gt;sem_perm.gid = old.sem_perm.gid;
++      buf-&gt;sem_perm.cuid = old.sem_perm.cuid;
++      buf-&gt;sem_perm.cgid = old.sem_perm.cgid;
++      buf-&gt;sem_perm.mode = old.sem_perm.mode;
++      buf-&gt;sem_perm.__seq = old.sem_perm.__seq;
++      buf-&gt;sem_otime = old.sem_otime;
++      buf-&gt;sem_ctime = old.sem_ctime;
++      buf-&gt;sem_nsems = old.sem_nsems;
++      }
++    return result;
++  }
++#endif
++}
++
++versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2);
index 2fdde482cfa03d10c13378b9285ede353bfef8d2..c8b3d4987d58554fa68ebcaa1eb2a1503f180bc6 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2002 Gentoo Technologies, Inc.
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.2.5-r7.ebuild,v 1.18 2002/10/20 05:45:34 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.2.5-r7.ebuild,v 1.19 2002/10/29 09:17:34 seemant Exp $
 
 IUSE="nls pic build"
 
@@ -138,6 +138,13 @@ src_unpack() {
                einfo "Applying seemant's sparc64-fixups patch..."
                cd ${S}; patch -p1 < ${FILESDIR}/${PV}/${P}-sparc64-fixups.diff > /dev/null || die
        fi
+
+       if use sparc > /dev/null
+       then
+               einfo "Applying nall's sparc32-semctl patch..."
+               cd ${S} 
+               patch -p1 < ${FILESDIR}/${PV}${P}-sparc32-semctl.patch > /dev/null || die
+       fi
 }
 
 src_compile() {