2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
9 /******************************************************************************
26 Prints a list of all resources.
44 ******************************************************************************/
46 #include <exec/memory.h>
47 #include <exec/tasks.h>
48 #include <exec/execbase.h>
49 #include <proto/exec.h>
50 #include <dos/dosextens.h>
51 #include <proto/dos.h>
53 #if defined(__AROSPLATFORM_SMP__)
54 #include <aros/types/spinlock_s.h>
55 #include <proto/execlock.h>
56 #include <resources/execlock.h>
59 const TEXT version
[] = "$VER: reslist 41.3 (11.3.2015)\n";
67 static int addres(struct Node
*r
, struct res
**l
, STRPTR
*e
)
96 static int fillbuffer(struct res
**buffer
, IPTR size
)
98 #if defined(__AROSPLATFORM_SMP__)
99 void *ExecLockBase
= OpenResource("execlock.resource");
101 STRPTR end
=(STRPTR
)*buffer
+size
;
103 #if defined(__AROSPLATFORM_SMP__)
105 ObtainSystemLock(&SysBase
->ResourceList
, SPINLOCK_MODE_READ
, LOCKF_FORBID
);
111 for(r
=(struct Node
*)SysBase
->ResourceList
.lh_Head
;
113 r
=(struct Node
*)r
->ln_Succ
)
115 if(!addres(r
,buffer
,&end
))
117 #if defined(__AROSPLATFORM_SMP__)
119 ReleaseSystemLock(&SysBase
->ResourceList
, LOCKF_FORBID
);
128 #if defined(__AROSPLATFORM_SMP__)
130 ReleaseSystemLock(&SysBase
->ResourceList
, LOCKF_FORBID
);
144 struct res
*buffer
,*ress
,*ress2
;
145 for(size
=2048;;size
+=2048)
147 buffer
=AllocVec(size
,MEMF_ANY
);
150 FPuts(Output(),"Not Enough memory for library buffer\n");
154 if(fillbuffer(&ress
,size
))
156 #if (__WORDSIZE == 64)
157 FPuts(Output()," Address Name\n");
159 FPuts(Output()," Address Name\n");
161 for(ress2
=buffer
;ress2
<ress
;ress2
++)
163 #if (__WORDSIZE == 64)
164 Printf("0x%012.ix %s\n",
166 Printf("0x%08.ix %s\n",
168 ress2
->address
, ress2
->name
);