From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16392 invoked by alias); 10 Mar 2004 15:09:19 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 16367 invoked from network); 10 Mar 2004 15:09:19 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 10 Mar 2004 15:09:19 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i2AD0And001262; Wed, 10 Mar 2004 14:00:10 +0100 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i2AD0AqY001260; Wed, 10 Mar 2004 14:00:10 +0100 Date: Wed, 10 Mar 2004 15:09:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] vfork for s390{,x} and sparc{,64} Message-ID: <20040310130010.GV3822@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2004-03/txt/msg00048.txt.bz2 Hi! s390{,x} tested so far with LD_PRELOAD, sparc* untested, but hopefully correct. 2004-03-10 Jakub Jelinek * sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S: Include tcb-offsets.h. (__vfork): Negate PID if non-zero and set to INT_MIN if zero before syscall, set to the old value in the parent afterwards. * sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: New file. * sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S: Include tcb-offsets.h. (__vfork): Negate PID if non-zero and set to INT_MIN if zero before syscall, set to the old value in the parent afterwards. * sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: New file. * sysdeps/s390/tcb-offsets.sym: Add PID. * sysdeps/unix/sysv/linux/sparc/pt-vfork.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S: New file. * sysdeps/sparc/tcb-offsets.sym: Add PID. --- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S.jj 2003-02-05 10:30:25.000000000 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-vfork.S 2004-03-10 15:12:54.620536936 +0100 @@ -22,6 +22,7 @@ #include #include #include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -29,9 +30,18 @@ and the process ID of the new process to the old process. */ ENTRY (__vfork) + ear %r4,%a0 + l %r3,PID(%r4) + lcr %r1,%r3 + st %r1,PID(%r4) + /* Do vfork system call. */ svc SYS_ify (vfork) + ltr %r2,%r2 + je 1f + st %r3,PID(%r4) +1: /* Check for error. */ lhi %r4,-4095 clr %r2,%r4 --- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S.jj 2004-03-10 14:47:00.934896220 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S 2004-03-10 15:13:00.661454951 +0100 @@ -0,0 +1,57 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#define _ERRNO_H 1 +#include +#include +#include +#include + +/* Clone the calling process, but without copying the whole address space. + The calling process is suspended until the new process exits or is + replaced by a call to `execve'. Return -1 for errors, 0 to the new process, + and the process ID of the new process to the old process. */ + +ENTRY (__vfork) + ear %r4,%a0 + lhi %r1,1 + icm %r3,15,PID(%r4) + sll %r1,31 + je 1f + lcr %r1,%r3 +1: st %r1,PID(%r4) + + /* Do vfork system call. */ + svc SYS_ify (vfork) + + ltr %r2,%r2 + je 1f + st %r3,PID(%r4) +1: + /* Check for error. */ + lhi %r4,-4095 + clr %r2,%r4 + jnl SYSCALL_ERROR_LABEL + + /* Normal return. */ + br %r14 +PSEUDO_END(__vfork) + +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S.jj 2003-02-05 10:31:40.000000000 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-vfork.S 2004-03-10 15:13:09.115940677 +0100 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Martin Schwidefsky , 2003. @@ -22,6 +22,7 @@ #include #include #include +#include /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is @@ -29,9 +30,21 @@ and the process ID of the new process to the old process. */ ENTRY (__vfork) + + ear %r4,%a0 + sllg %r4,%r4,32 + ear %r4,%a1 + l %r3,PID(%r4) + lcr %r1,%r3 + st %r1,PID(%r4) + /* Do vfork system call. */ svc SYS_ify (vfork) + ltgr %r2,%r2 + je 1f + st %r3,PID(%r4) +1: /* Check for error. */ lghi %r4,-4095 clgr %r2,%r4 --- libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S.jj 2004-03-10 13:52:41.566358203 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S 2004-03-10 15:13:16.118686429 +0100 @@ -0,0 +1,59 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#define _ERRNO_H 1 +#include +#include +#include +#include + +/* Clone the calling process, but without copying the whole address space. + The calling process is suspended until the new process exits or is + replaced by a call to `execve'. Return -1 for errors, 0 to the new process, + and the process ID of the new process to the old process. */ + +ENTRY (__vfork) + + ear %r4,%a0 + sllg %r4,%r4,32 + ear %r4,%a1 + icm %r3,15,PID(%r4) + llilh %r1,32768 + je 1f + lcr %r1,%r3 +1: st %r1,PID(%r4) + + /* Do vfork system call. */ + svc SYS_ify (vfork) + + ltgr %r2,%r2 + je 1f + st %r3,PID(%r4) +1: + /* Check for error. */ + lghi %r4,-4095 + clgr %r2,%r4 + jnl SYSCALL_ERROR_LABEL + + /* Normal return. */ + br %r14 +PSEUDO_END(__vfork) + +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S.jj 2004-03-10 15:10:23.816548571 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S 2004-03-10 15:25:44.565662865 +0100 @@ -0,0 +1,42 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#include + + .text +ENTRY(__vfork) + ld [%g7 + PID], %o5 + sub %g0, %o5, %o4 + st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x10 + bcs,a __syscall_error_handler + st %o5, [%g7 + PID] + SYSCALL_ERROR_HANDLER + sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a 1f + st %o5, [%g7 + PID] +1: retl + nop + +PSEUDO_END (__vfork) +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S.jj 2004-03-10 15:22:46.683503437 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S 2004-03-10 15:25:30.150242109 +0100 @@ -0,0 +1,45 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#include + + .text +ENTRY(__vfork) + ld [%g7 + PID], %o5 + cmp %o5, 0 + bne 1f + sub %g0, %o5, %o4 + sethi %hi(0x80000000), %o4 +1: st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x10 + bcs,a __syscall_error_handler + st %o5, [%g7 + PID] + SYSCALL_ERROR_HANDLER + sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a 1f + st %o5, [%g7 + PID] +1: retl + nop + +PSEUDO_END (__vfork) +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S.jj 2004-03-10 15:28:46.271149409 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S 2004-03-10 15:29:19.749158604 +0100 @@ -0,0 +1,42 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#include + + .text +ENTRY(__vfork) + ld [%g7 + PID], %o5 + sub %g0, %o5, %o4 + st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x6d + bcs,a,pn %xcc, __syscall_error_handler + st %o5, [%g7 + PID] + SYSCALL_ERROR_HANDLER + sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a,pt %icc, 1f + st %o5, [%g7 + PID] +1: retl + nop + +PSEUDO_END (__vfork) +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S.jj 2004-03-10 15:22:46.000000000 +0100 +++ libc/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S 2004-03-10 15:28:38.062618287 +0100 @@ -0,0 +1,45 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek , 2004. + + 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 +#include + + .text +ENTRY(__vfork) + ld [%g7 + PID], %o5 + sethi %hi(0x80000000), %o3 + cmp %o5, 0 + sub %g0, %o5, %o4 + move %icc, %o3, %o4 + st %o4, [%g7 + PID] + + LOADSYSCALL(vfork) + ta 0x6d + bcs,a,pn %xcc, __syscall_error_handler + st %o5, [%g7 + PID] + SYSCALL_ERROR_HANDLER + sub %o1, 1, %o1 + andcc %o0, %o1, %o0 + bne,a,pt %icc, 1f + st %o5, [%g7 + PID] +1: retl + nop + +PSEUDO_END (__vfork) +weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S.jj 2003-08-31 19:36:48.000000000 +0200 +++ libc/nptl/sysdeps/unix/sysv/linux/sparc/pt-vfork.S 2004-03-10 15:23:58.726601816 +0100 @@ -1,28 +0,0 @@ -/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek , 1999. - - 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 - -PSEUDO (__vfork, vfork, 0) - sub %o1, 1, %o1 - retl - and %o0, %o1, %o0 - -PSEUDO_END (__vfork) -weak_alias (__vfork, vfork) --- libc/nptl/sysdeps/s390/tcb-offsets.sym.jj 2003-02-05 10:25:05.000000000 +0100 +++ libc/nptl/sysdeps/s390/tcb-offsets.sym 2004-03-10 14:22:09.788550460 +0100 @@ -2,3 +2,4 @@ #include MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) +PID offsetof (struct pthread, pid) --- libc/nptl/sysdeps/sparc/tcb-offsets.sym.jj 2003-08-31 19:27:24.000000000 +0200 +++ libc/nptl/sysdeps/sparc/tcb-offsets.sym 2004-03-10 15:12:09.136683635 +0100 @@ -2,3 +2,4 @@ #include MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) +PID offsetof (struct pthread, pid) Jakub