backport
[AROS.git] / test / aroscprivdata.c
blob0dfebe622b335b3182f74e45b8872678abd37169
1 #include <proto/dos.h>
2 #include <proto/exec.h>
3 #include <dos/bptr.h>
4 #include <dos/dos.h>
5 #include <string.h>
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include "../rom/exec/etask.h"
10 struct userdata
12 struct Task *parent;
15 void showuserdata(struct Task *this, struct Task *parent)
17 struct arosc_privdata *acpd = NULL;
18 acpd = GetIntETask(this)->iet_acpd;
19 printf("Task %p acpd: %p\n", this, acpd);
21 if(acpd == NULL)
23 printf("acpd is NULL, trying it in parent\n");
24 if (parent)
26 acpd = GetIntETask(parent)->iet_acpd;
27 printf("Parent %p acpd: %p\n", parent, acpd);
32 LONG secondchild()
34 struct Task *parent;
35 struct Task *this;
37 printf("Grandchild\n");
38 this = FindTask(0);
39 parent = ((struct userdata*)this->tc_UserData)->parent;
40 showuserdata(this, parent);
41 Forbid();
42 Signal(parent, SIGBREAKF_CTRL_F);
44 return 0;
47 LONG firstchild()
49 struct Task *parent;
50 struct Task *this;
51 struct Process *proc = NULL;
52 struct userdata taskdata;
54 printf("Child\n");
55 this = FindTask(0);
56 parent = ((struct userdata*)this->tc_UserData)->parent;
57 showuserdata(this, parent);
59 taskdata.parent = this;
61 proc = CreateNewProcTags(
62 NP_Entry, secondchild,
63 NP_Name, "Ikari Shinji",
64 NP_UserData, &taskdata,
65 TAG_DONE);
67 if ( proc != NULL ) {
68 Wait(SIGBREAKF_CTRL_F);
71 Forbid();
72 Signal(parent, SIGBREAKF_CTRL_F);
74 return 0;
77 int main(int argc, char ** argv)
79 struct Process *proc = NULL;
80 struct userdata taskdata;
81 struct Task *thisTask = FindTask(0);
82 taskdata.parent = thisTask;
84 proc = CreateNewProcTags(
85 NP_Entry, firstchild,
86 NP_Name, "Ayanami Rei",
87 NP_UserData, &taskdata,
88 TAG_DONE);
90 if ( proc != NULL ) {
91 Wait(SIGBREAKF_CTRL_F);
94 return 0;