tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / compiler / posixc / getpid.c
blob75ae81a723547613bc76952daa1c67f81195b961
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX.1-2008 function getpid().
6 */
8 #include <proto/exec.h>
9 #include <assert.h>
11 #include "__vfork.h"
12 #include "__posixc_intbase.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 PosixCIntBase *PosixCBase =
44 (struct PosixCIntBase *)__aros_getbase_PosixCBase();
45 struct ETask *et;
47 if(PosixCBase->flags & PRETEND_CHILD)
49 struct vfork_data *udata = PosixCBase->vfork_data;
50 et = GetETask(udata->child);
52 else
53 et = GetETask(FindTask(NULL));
54 assert(et);
55 return (pid_t) et->et_UniqueID;
56 } /* getpid */