2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Add a segment to the resident list.
8 #include "dos_intern.h"
10 #include <proto/exec.h>
12 /*****************************************************************************
15 #include <dos/dosextens.h>
16 #include <proto/dos.h>
18 AROS_LH3(BOOL
, AddSegment
,
21 AROS_LHA(CONST_STRPTR
, name
, D1
),
22 AROS_LHA(BPTR
, seg
, D2
),
23 AROS_LHA(LONG
, type
, D3
),
26 struct DosLibrary
*, DOSBase
, 129, Dos
)
29 Adds a program segment to the system resident list. You can later
30 use these segments to run programs.
32 The name field should refer to a NULL terminated strings, which
33 will be copied. The type field determines the type of resident
34 program. Normal programs should have type >= 0, system segments
35 should have type == CMD_SYSTEM.
37 Note that all other values of type are reserved.
40 name - Name of the segment. This is used by FindSegment().
42 type - What type of segment (initial use count).
45 Segment will have been added to the DOS resident list.
55 Uses Forbid() based locking.
58 FindSegment(), RemSegment()
62 *****************************************************************************/
67 int namelen
= strlen(name
)+1;
69 sptr
= AllocVec(sizeof(struct Segment
) + namelen
- 4,
70 MEMF_CLEAR
| MEMF_PUBLIC
);
78 CopyMem(name
, sptr
->seg_Name
, namelen
);
80 CopyMem(name
, &sptr
->seg_Name
[1], namelen
);
81 *sptr
->seg_Name
= namelen
;
84 /* Sigh, we just add the segment to the start of the list */
87 sptr
->seg_Next
= DOSBase
->dl_ResList
;
88 DOSBase
->dl_ResList
= MKBADDR(sptr
);