muimaster.library: support Listview_List in List
[AROS.git] / compiler / posixc / getppid.c
blobaab29c46a0df2f43f3e543aa55b25ac4bb3c843e
1 /*
2 Copyright © 2004-2013, 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 "__posixc_intbase.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 PosixCIntBase *PosixCBase =
45 (struct PosixCIntBase *)__aros_getbase_PosixCBase();
46 struct Task *ParentTask;
47 struct ETask *eThisTask;
48 struct ETask *et;
50 if(PosixCBase->flags & PRETEND_CHILD)
52 struct vfork_data *udata = PosixCBase->vfork_data;
53 eThisTask = GetETask(udata->child);
55 else
56 eThisTask = GetETask(FindTask(NULL));
57 assert(eThisTask);
58 ParentTask = (struct Task *)eThisTask->et_Parent;
59 if(!ParentTask)
60 return (pid_t) 1;
61 et = GetETask(ParentTask);
62 assert(et);
63 return (pid_t) et->et_UniqueID;