#include <ibcs/unistd.h>
#include <sysdeps.h>
#define ASSEMBLY_FILE
#include <errno.h>

	.text
	.align	2
#ifdef ELF_LIBRARY
	.globl	SYMBOL_NAME(_wait)
	.type SYMBOL_NAME(_wait),@function
	.weak wait
	wait = _wait
SYMBOL_NAME_LABEL(_wait)
#else
	.globl	SYMBOL_NAME(wait)
SYMBOL_NAME_LABEL(wait)
#endif
/*
 *  The waitpid function is denoted by having the ZF PF SF and OF
 *  flags set at the same time.  Since we are calling wait,
 * just clear the flags.
 */
	movb	$0x00,%ah		/* Set the bits			*/
	sahf				/* Load the flag reg.		*/
	movl	$__IBCS_wait,%eax
	.byte	0x9a,0,0,0,0,7,0
	movl	$0,%eax
	jnc	LF(1)
	dec	%eax
	STORE_NUMBER($ENOMEM,ERRNO)
LL(1)
	ret
