2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
5 Desc: Find a resident segment.
8 #include "dos_intern.h"
11 /*****************************************************************************
14 #include <dos/dosextens.h>
15 #include <proto/dos.h>
17 AROS_LH3(struct Segment
*, FindSegment
,
20 AROS_LHA(CONST_STRPTR
, name
, D1
),
21 AROS_LHA(struct Segment
*, seg
, D2
),
22 AROS_LHA(BOOL
, system
, D3
),
25 struct DosLibrary
*, DOSBase
, 130, Dos
)
28 Search for a resident segment by name and type. FindSegment() will
29 return the first segment that exactly matches the name and type.
31 You can continue searching by specifying the last returned segment
35 name - Name of the segment to search for.
36 seg - Start search from this point.
37 system - Search for a system segment.
40 Will return the segment structure if a match is found, otherwise
44 FindSegment() does no locking of the segment list. You should
45 lock yourself. FindSegment() also does not increment the value
46 of the seg_UC field. If the value of seg_UC > 0, you MUST
47 perform user counting in order to prevent the segment from being
55 AddSegment(), RemSegment()
59 *****************************************************************************/
63 /* Segment seg was the last match, lets start from the next one */
65 seg
= BADDR(seg
->seg_Next
);
67 seg
= BADDR(DOSBase
->dl_ResList
);
73 (system
|| (system
== FALSE
&& (seg
->seg_UC
>=0))) &&
74 (strcasecmp( name
, AROS_BSTR_ADDR(seg
->seg_Name
)) == 0)
77 /* We have a matching segment */
80 seg
= BADDR(seg
->seg_Next
);