2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
9 /******************************************************************************
26 Print list of all libraries.
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: LibList 41.3 (11.3.2015)\n";
71 static int addlib(struct Library
*lib
, struct lib
**l
, STRPTR
*e
)
76 (*l
)->version
= lib
->lib_Version
;
77 (*l
)->revision
= lib
->lib_Revision
;
78 (*l
)->opencnt
= lib
->lib_OpenCnt
;
79 (*l
)->flags
= lib
->lib_Flags
;
81 s1
= lib
->lib_Node
.ln_Name
;
104 static int fillbuffer(struct lib
**buffer
, IPTR size
)
106 STRPTR end
=(STRPTR
)*buffer
+size
;
108 #if defined(__AROSPLATFORM_SMP__)
109 void *ExecLockBase
= OpenResource("execlock.resource");
112 #if defined(__AROSPLATFORM_SMP__)
114 ObtainSystemLock(&SysBase
->LibList
, SPINLOCK_MODE_READ
, LOCKF_FORBID
);
120 for(lib
=(struct Library
*)SysBase
->LibList
.lh_Head
;
121 lib
->lib_Node
.ln_Succ
!=NULL
;
122 lib
=(struct Library
*)lib
->lib_Node
.ln_Succ
)
124 if(!addlib(lib
,buffer
,&end
))
126 #if defined(__AROSPLATFORM_SMP__)
128 ReleaseSystemLock(&SysBase
->LibList
, LOCKF_FORBID
);
137 #if defined(__AROSPLATFORM_SMP__)
139 ReleaseSystemLock(&SysBase
->LibList
, LOCKF_FORBID
);
154 struct lib
*buffer
,*libs
,*libs2
;
155 LONG error
=RETURN_OK
;
157 for(size
=2048;;size
+=2048)
159 buffer
=AllocVec(size
,MEMF_ANY
);
162 FPuts(Output(),"Not Enough memory for library buffer\n");
163 SetIoErr(ERROR_NO_FREE_STORE
);
168 if(fillbuffer(&libs
,size
))
170 #if (__WORDSIZE == 64)
171 FPuts(Output()," Address Version Rev OpenCnt Flags name\n");
173 FPuts(Output(),"address\t\tversion\trev\topencnt\tflags\tname\n");
175 for(libs2
=buffer
;libs2
<libs
;libs2
++)
177 #if (__WORDSIZE == 64)
178 Printf("0x%012.ix %7ld %4ld %7ld 0x%02lx %s\n",
180 Printf("0x%08.ix\t%ld\t%ld\t%ld\t0x%lx\t%s\n",
182 libs2
->address
, (ULONG
)libs2
->version
,
183 (ULONG
)libs2
->revision
,
184 (ULONG
)libs2
->opencnt
,
187 if(SetSignal(0L,SIGBREAKF_CTRL_C
) & SIGBREAKF_CTRL_C
)
190 SetIoErr(ERROR_BREAK
);
200 if (error
!= RETURN_OK
)
202 PrintFault(IoErr(), NULL
);