fix config file path
[AROS.git] / compiler / clib / getppid.c
blob095ce2a70f1d05936b29506263dd8ce76da453ce
1 /*
2 Copyright © 2004-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <sys/types.h>
8 #include <exec/tasks.h>
9 #include <proto/exec.h>
11 #include <assert.h>
13 #include "__vfork.h"
14 #include "__arosc_privdata.h"
16 /*****************************************************************************
18 NAME */
19 #include <unistd.h>
21 pid_t getppid(
23 /* SYNOPSIS */
24 void)
26 /* FUNCTION
28 INPUTS
30 RESULT
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 ******************************************************************************/
44 struct aroscbase *aroscbase = __aros_getbase_aroscbase();
45 struct Task *ParentTask;
46 struct ETask *eThisTask;
47 struct ETask *et;
49 if(aroscbase->acb_flags & PRETEND_CHILD)
51 struct vfork_data *udata = aroscbase->acb_vfork_data;
52 eThisTask = GetETask(udata->child);
54 else
55 eThisTask = GetETask(FindTask(NULL));
56 assert(eThisTask);
57 ParentTask = (struct Task *)eThisTask->et_Parent;
58 if(!ParentTask)
59 return (pid_t) 1;
60 et = GetETask(ParentTask);
61 assert(et);
62 return (pid_t) et->et_UniqueID;