2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: Remove a segment from the system list.
9 #include "dos_intern.h"
10 #include <aros/config.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <dos/dosextens.h>
17 #include <proto/dos.h>
19 AROS_LH1(LONG
, RemSegment
,
22 AROS_LHA(struct Segment
*, seg
, D1
),
25 struct DosLibrary
*, DOSBase
, 131, Dos
)
28 Remove the segment seg from the DOS resident command list.
30 The segment to be removed should be in the list, and should
31 have a usercount of 0. System or internal segment cannot be
32 removed (although they can be replaced).
35 seg - Segment to remove.
38 != 0 Segment was removed
39 == 0 Segment was not removed (not in list, or not free).
48 AddSegment(), FindSegment()
52 *****************************************************************************/
56 /* Make sure segment is freeable */
57 #if AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT
58 if (seg
->seg_UC
== 0 || seg
->seg_UC
== 1)
63 struct Segment
*next
, *prev
;
64 struct DosInfo
*dinf
= BADDR(DOSBase
->dl_Root
->rn_Info
);
67 next
= BADDR(dinf
->di_ResList
);
74 prev
->seg_Next
= next
->seg_Next
;
78 dinf
->di_ResList
= next
->seg_Next
;
80 UnLoadSeg(seg
->seg_Seg
);
86 next
= BADDR(next
->seg_Next
);