Re-enabled use of AROS.Boot file due to lack of general enthusiasm for
[cake.git] / compiler / clib / getpid.c
bloba4a8653b5558e8c0555dde720698891a5af63afb
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function getpid().
6 */
8 #include <proto/exec.h>
9 #include <assert.h>
11 #include "__vfork.h"
12 #include "__arosc_privdata.h"
14 /*****************************************************************************
16 NAME */
17 #include <sys/types.h>
18 #include <unistd.h>
20 pid_t getpid (
22 /* SYNOPSIS */
25 /* FUNCTION
26 Returns the process ID of the calling process
28 RESULT
29 The process ID of the calling process.
31 NOTES
33 EXAMPLE
35 BUGS
37 SEE ALSO
39 INTERNALS
41 ******************************************************************************/
43 struct ETask *et;
45 if(__get_arosc_privdata()->acpd_flags & PRETEND_CHILD)
47 struct vfork_data *udata = __get_arosc_privdata()->acpd_vfork_data;
48 et = GetETask(udata->child);
50 else
51 et = GetETask(FindTask(NULL));
52 assert(et);
53 return (pid_t) et->et_UniqueID;
54 } /* getpid */