2.9
[glibc/nacl-glibc.git] / sysdeps / unix / bsd / i386 / wait3.S
blob5988340cc1578b35e8de50a9c876b5f421b7388e
1 /* Copyright (C) 1991, 1992, 1993, 1995, 1997 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
19 #include <sysdep.h>
21 /* <sysdeps/unix/bsd/sequent/i386/sysdep.h> defines this to put the first
22    two arguments into registers.  Since the arguments to wait3 are
23    transferred magically through the same registers, we want to disable this.
24    This allows us to avoid rewriting this file for that system.  */
26 #undef  ARGS_2
27 #define ARGS_2  /* Special-case no-op.  */
29 .text
30 .globl syscall_error
31 .align 4
32 ENTRY (__wait3)
33         mov 8(%esp), %ecx       /* Flags.  */
34         mov 12(%esp), %edx      /* rusage pointer.  */
35         pushl $0xdf; popf       /* Set all the condition codes.  */
36         DO_CALL (wait, 2)       /* Do the system call.  */
37         je syscall_error        /* Check for error.  */
38         mov 4(%esp), scratch    /* Status pointer.  */
39         orl scratch, scratch    /* Is it nil?  */
40         je done                 /* Yup; return.  */
41         mov r1, 0(scratch)      /* Non-nil; store the status in it.  */
42 done:   ret
44 weak_alias (__wait3, wait3)