1 #ifndef DOS_DOSEXTENS_H
2 #define DOS_DOSEXTENS_H
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: LibBase and some important structures
12 # include <aros/config.h>
15 # include <exec/types.h>
18 # include <exec/tasks.h>
21 # include <exec/ports.h>
23 #ifndef EXEC_LIBRARIES_H
24 # include <exec/libraries.h>
26 #ifndef EXEC_DEVICES_H
27 # include <exec/devices.h>
29 #ifndef EXEC_SEMAPHORES
30 # include <exec/semaphores.h>
32 #ifndef DEVICES_TIMER_H
33 # include <devices/timer.h>
35 #ifndef EXEC_INTERRUPTS_H
36 # include <exec/interrupts.h>
42 /**********************************************************************
43 ***************************** DosLibrary *****************************
44 **********************************************************************/
46 /* This is how the base of dos.library looks like. */
49 /* A normal library-base as defined in <exec/libraries.h>. */
50 struct Library dl_lib
;
52 struct RootNode
* dl_Root
;
54 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
55 /* The following fields are not used by AROS and are just there to
56 guarantee binary compatibility. DO NOT USE THESE FIELDS IN ANY WAY.
57 Original names were: dl_GV, dl_A2, dl_A5 and dl_A6 */
62 /* The following fields are PRIVATE! */
63 struct ErrorString
* dl_Errors
;
64 struct Device
* dl_TimerBase
;
65 struct Library
* dl_UtilityBase
;
66 struct Library
* dl_IntuitionBase
;
68 /* These are AROS specific extensions. They are all PRIVATE! */
69 struct timerequest dl_TimerIO
;
71 struct SignalSemaphore dl_DosListLock
;
72 struct DosList
* dl_DevInfo
;
73 struct ExecBase
* dl_SysBase
;
75 struct Device
* dl_NulHandler
;
76 struct Unit
* dl_NulLock
;
78 struct SignalSemaphore dl_LDObjectsListSigSem
;
79 struct List dl_LDObjectsList
;
80 struct Interrupt dl_LDHandler
;
81 struct MsgPort
* dl_LDDemonPort
;
82 struct Process
* dl_LDDemonTask
;
88 /* The flags are the same, as they were in RootNode->rn_Flags. See below
92 /* Resident segment list **PRIVATE** */
96 /* dl_Flags/rn_Flags */
97 #define RNB_WILDSTAR 24 /* Activate '*' as wildcard character. */
98 #define RNF_WILDSTAR (1L << RNB_WILDSTAR)
103 /* (IPTR *) Pointer to an array containing pointers to CLI processes.
104 The CLI process number is equal to the index of that array. The
105 first field (index 0) contains the maximal number of CLI processes.
106 See also rn_CliList. */
108 /* (void *) Pointer to the SegList for CLIs. */
109 BPTR rn_ConsoleSegment
;
110 /* The current time. */
111 struct DateStamp rn_Time
;
112 /* (APTR) The SegList of the process that handles validation of devices.
115 /* (struct DosInfo *) see below for DosInfo */
117 BPTR rn_FileHandlerSegment
;
118 /* List of all CLI processes (struct CliProcList - see below). See also
120 struct MinList rn_CliList
;
121 /* Message port of boot filesystem. (PRIVATE) */
122 struct MsgPort
* rn_BootProc
;
123 /* (void *) Pointer to the SegList for shells. */
124 BPTR rn_ShellSegment
;
125 /* Additional flags (see above). */
128 /* RootNode arbitrator */
129 struct SignalSemaphore rn_RootLock
;
133 /* Structure that is linked into the rootnode's rn_CliList. Completely
134 private, of course! ... and it's not compatible to AmigaOS. */
138 struct Process
*ci_Process
;
142 /* The following structures in this sections are not used by AROS and may
143 be removed in the future. So BEWARE, if you use them. */
149 BPTR di_McName
; /* PRIVATE */
155 /* The following semaphores are PRIVATE. */
156 struct SignalSemaphore di_DevLock
;
157 struct SignalSemaphore di_EntryLock
;
158 struct SignalSemaphore di_DeleteLock
;
160 #define di_ResList di_McName
164 /**********************************************************************
165 ***************************** Processes ******************************
166 **********************************************************************/
168 /* Standard process structure. Processes are just extended tasks. */
171 /* Embedded task structure as defined in <exec/tasks.h>. */
174 /* Processes standard message-port. Used for various puposes. */
175 struct MsgPort pr_MsgPort
;
176 WORD pr_Pad
; /* PRIVATE */
177 /* SegList array, used by this process. (void **) */
179 /* StackSize of the current process. */
182 /* CLI process number. This may be 0, in which case the process is not
183 connected to a CLI. */
185 /* Pointer to upper end of stack. (void *) */
187 /* Secondary return-value, as defined in <dos/dos.h>. As of now this
188 field is declared PRIVATE. Use IoErr()/SetIoErr() to access it. */
190 /* Lock of the current directory. As of now this is declared READ-ONLY.
191 Use CurrentDir() to set it. (struct FileLock *) */
193 /* Standard input file. As of now this is declared WRITE-ONLY. Use
194 Input() to query it. */
196 /* Standard output file. As of now this is declared WRITE-ONLY. Use
197 Output() to query it. */
199 /* Task to handle the console associated with process. */
201 /* The task that is responsible for handling the filesystem. */
202 APTR pr_FileSystemTask
;
203 /* CLI the process is connected to. (struct CommandLineInterface *) */
206 /* Function to be called, when process waits for a packet-message. */
208 /* Standard-Window of process. */
210 /* Lock to home-directory of process. (struct FileLock *) */
212 LONG pr_Flags
; /* see below */
214 /* Code that is called, when the process exits. pr_ExitData takes an
215 argument to be passed to this code. */
216 void (* pr_ExitCode
)();
218 /* Arguments passed to the process from caller. */
221 /* List of local environment variables. This list should be in
222 alphabetical order. Multiple entries may have the same name, if they
223 are of different types. See <dos/var.h> for more information. */
224 struct MinList pr_LocalVars
;
225 ULONG pr_ShellPrivate
;
226 /* Standard error file. May be NULL, in which case pr_COS is to be used.
227 Use this instead of Output() to report errors. */
231 /* pr_Flags (all PRIVATE) They mainly descibe what happens if the process
232 exits, i.e. which resources the process should clean itself. The flags
233 are self-explaining. */
234 #define PRB_FREESEGLIST 0
235 #define PRB_FREECURRDIR 1
236 #define PRB_FREECLI 2
237 #define PRB_CLOSEINPUT 3
238 #define PRB_CLOSEOUTPUT 4
239 #define PRB_FREEARGS 5
240 #define PRB_CLOSEERROR 6
241 #define PRB_SYNCHRONOUS 7
242 #define PRF_FREESEGLIST (1L << PRB_FREESEGLIST)
243 #define PRF_FREECURRDIR (1L << PRB_FREECURRDIR)
244 #define PRF_FREECLI (1L << PRB_FREECLI)
245 #define PRF_CLOSEINPUT (1L << PRB_CLOSEINPUT)
246 #define PRF_CLOSEOUTPUT (1L << PRB_CLOSEOUTPUT)
247 #define PRF_FREEARGS (1L << PRB_FREEARGS)
248 #define PRF_CLOSEERROR (1L << PRB_CLOSEERROR)
249 #define PRF_SYNCHRONOUS (1L << PRB_SYNCHRONOUS)
251 /* Structure used for CLIs and Shells. Allocate this structure with
252 AllocDosObject() only! */
253 struct CommandLineInterface
255 /* Secondary error code, set by last command. */
257 /* Name of the current directory. */
259 /* Lock of the first directory in path. (struct FileLock *) */
261 /* Error code, the last command returned. See <dos/dos.h> for
264 /* Name of the command that is currently executed. */
265 BSTR cli_CommandName
;
266 /* Fail-Level as set by the command "FailAt". */
268 /* Current prompt in the CLI window. */
270 /* Standard/Default input file. (struct FileLock *) */
271 BPTR cli_StandardInput
;
272 /* Current input file. (struct FileLock *) */
273 BPTR cli_CurrentInput
;
274 /* Name of the file that is currently executed. */
275 BSTR cli_CommandFile
;
276 /* TRUE if the currently CLI is connected to a controlling terminal,
278 LONG cli_Interactive
;
279 /* FALSE if there is no controlling terminal, otherwise TRUE. */
281 /* Current output file. (struct FileLock *) */
282 BPTR cli_CurrentOutput
;
283 /* Default stack size as set by the command "Stack". */
284 LONG cli_DefaultStack
;
285 /* Standard/Default output file. (struct FileLock *) */
286 BPTR cli_StandardOutput
;
287 /* SegList of currently loaded command. */
290 /* Here begins the aros specific part */
291 /* Standard/Default Error file. (struct FileLock *) */
292 BPTR cli_StandardError
;
295 /* CLI_DEFAULTSTACK_UNIT * cli_DefaultStack = stack in bytes */
297 #define CLI_DEFAULTSTACK_UNIT sizeof(LONG)
299 /* Devices process structure as returned by GetDeviceProc(). */
302 struct MsgPort
* dvp_Port
;
303 BPTR dvp_Lock
; /* struct FileLock * */
304 ULONG dvp_Flags
; /* see below */
305 struct DosList
* dvp_DevNode
; /* PRIVATE */
309 #define DVPB_UNLOCK 0
310 #define DVPB_ASSIGN 1
311 #define DVPF_UNLOCK (1L<<DVPB_UNLOCK)
312 #define DVPF_ASSIGN (1L<<DVPB_ASSIGN)
314 /**********************************************************************
315 ******************************* Files ********************************
316 **********************************************************************/
318 /* Standard file-handle as returned by Open() (as BPTR). Generally said, you
319 should not use this structure in any way and only use library-calls to
320 access files. Note that this structure is very different to the structure
321 used in AmigaOS! Treat this structure as PRIVATE. If you want to create
322 this structure nevertheless, use AllocDosObject(). */
325 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
326 /* The following three fields are not used by AROS and are just there for
327 compatibility reasons. So keep your hands away. The original names
328 were: fh_Link, fh_Port and fh_Type */
329 struct Message
* fh_NoAROS1
;
330 struct MsgPort
* fh_NoAROS2
[2];
337 /* The following four fields have different names and a different
338 function than their AmigaOS equivalents. The original names were:
339 fh_Funcs/fh_Func1, fh_Func2, fh_Func3, fh_Args/fh_Arg1 and fh_Arg2 */
341 ULONG fh_Flags
; /* see below */
342 /* This is a pointer to a filesystem handler. See <dos/filesystems.h> for
344 struct Device
* fh_Device
;
346 /* SDuvan: Added this and removed the #if below. This field allows us
347 to emulate packets -- specifically it makes it possible
348 to implement the ***Pkt() functions */
349 struct FileHandle
*fh_CompatibilityHack
;
351 /* A private pointer to a device specific filehandle structure. See
352 <dos/filesystems.h> for more information. */
353 struct Unit
* fh_Unit
;
354 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
355 LONG fh_NoAROS3
; /* not used by AROS */
359 #define fh_Arg1 fh_CompatibilityHack
361 /* fh_Flags. The flags are AROS specific and therefore PRIVATE.. */
362 #define FHF_WRITE (~0UL/2+1)
365 #define FHF_LINEBUF 4
368 /* Structure of a lock, as returned by Lock() and similar functions. This
369 structure is not used by AROS. Lock() also returns a struct FileHandle! */
373 BPTR fl_Link
; /* (struct FileLock *) Pointer to next lock. */
376 struct MsgPort
* fl_Task
;
377 BPTR fl_Volume
; /* (struct DeviceList * - see below) */
382 /* Constants, defining of what kind a file is. These constants are used in
383 many structures, including FileInfoBlock (<dos/dos.h>) and ExAllData
385 #define ST_PIPEFILE -5 /* File is a pipe */
386 #define ST_LINKFILE -4 /* Hard link to a file */
387 #define ST_FILE -3 /* Plain file */
388 #define ST_ROOT 1 /* Root directory of filesystem */
389 #define ST_USERDIR 2 /* Normal directory */
390 #define ST_SOFTLINK 3 /* Soft link (may be a file or directory) */
391 #define ST_LINKDIR 4 /* Hard link to a directory */
393 /**********************************************************************
394 ****************************** DosLists ******************************
395 **********************************************************************/
397 /* This structure is returned by LockDosList() and similar calls. This
398 structure is different to the AmigaOS one. But this structure is PRIVATE
399 anyway. Use system-calls for dos list-handling. */
402 /* PRIVATE pointer to next entry. In AmigaOS this used to be a BPTR. */
403 struct DosList
* dol_Next
;
404 /* Type of the current node (see below). */
407 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
408 /* The next field is not used by AROS. Its original name was:
412 /* The lock passed to AssignLock(). Only set if the type is
416 /* This union combines all the different types. */
418 /* See struct DevInfo below. */
425 /* See struct DeviceList below. */
427 struct DateStamp dol_VolumeDate
;
432 /* Structure used for assigns. */
434 /* The name for the late or nonbinding assign. */
435 UBYTE
*dol_AssignName
;
436 /* A list of locks, used by AssignAdd(). */
437 struct AssignList
*dol_List
;
441 /* This field is called dol_Name in AmigaOS. It is now named dol_OldName
442 to give you a hint that something has changed. Additionally to the
443 old nasty BSTR there is now a new clean STRPTR for the same purpose.
445 1. Change your sources to reflect this change thus getting rid of
447 2. just define dol_OldName to dol_Name before including this file
448 to stay downwards compatible. */
451 /* The following fields are new to AROS. */
453 struct Device
* dol_Device
;
454 struct Unit
* dol_Unit
;
456 /* #define dol_Name dol_OldName */
458 /* dol_Type/dl_Type/dvi_Type. Given to MakeDosEntry(). */
459 #define DLT_DEVICE 0 /* A real filesystem (or similar) */
460 #define DLT_DIRECTORY 1 /* Just a simple assign */
461 #define DLT_VOLUME 2 /* Volume node (for removable media) */
462 #define DLT_LATE 3 /* Late binding assign (not yet) */
463 #define DLT_NONBINDING 4 /* Nonbinding assign (not yet) */
466 /* The following structures are essentially the same as DosList above. The
467 difference is that they support just one type of entry. You can use them
468 instead of DosList, if you have a list, containing just one type of
469 entries. For more information see above. */
471 /* Structure that describes a volume.
472 ATTENTION: This struture does currently work on 32bit computers only due to
473 the fact that dl_unused does not compensate the missing pointers
474 in this structure. In DevInfo we have three pointer and three
475 longwords, while in this structure we have only two pointers and
479 struct DeviceList
* dl_Next
;
480 LONG dl_Type
; /* see above, always = DLT_VOLUME */
482 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
483 /* This field was dl_Task */
484 struct MsgPort
* dl_NoAROS1
;
488 /* Embedded DateStamp structured as defined in <dos/dos.h>. At this
489 date the volume was created. */
490 struct DateStamp dl_VolumeDate
;
491 /* (void *) List of all locks on the volume. */
493 /* Type of the disk. (see <dos/dos.h> for definitions) */
495 IPTR dl_unused
; /* PRIVATE */
500 struct Device
* dl_Device
;
501 struct Unit
* dl_Unit
;
503 /* #define dl_Name dl_OldName */
506 /* Structure that describes a device. This is essentially the same structure
507 as DeviceNode, defined in <dos/filehandler.h>. */
510 struct DevInfo
* dvi_Next
;
511 LONG dvi_Type
; /* see above, always = DLT_DEVICE */
513 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
514 struct MsgPort
* dvi_NoAROS1
;
518 BSTR dvi_Handler
; /* Device name for handler. */
519 LONG dvi_NoAROS3
[2]; /* PRIVATE */
520 BPTR dvi_Startup
; /* (struct FileSysStartupMsg * - defined in
521 <dos/filehandler.h>) */
522 BPTR dvi_NoAROS4
[2]; /* PRIVATE */
527 struct Device
* dvi_Device
;
528 struct Unit
* dvi_Unit
;
530 /* #define dvi_Name dvi_OldName */
533 /* Dos list scanning and locking modes as used in LockDosList() */
534 /* Specify either LDF_READ, if you want a non-exclusive lock, or LDF_WRITE,
535 if you want an exclusive lock (i.e. if you want to modify the list).
537 #define LDB_READ 0 /* Non-exclusive/read lock */
538 #define LDB_WRITE 1 /* Exclusive/write lock */
539 /* Specify which list(s) to lock. */
540 #define LDB_DEVICES 2 /* Device list */
541 #define LDB_VOLUMES 3 /* Volume list */
542 #define LDB_ASSIGNS 4 /* Assign list */
546 #define LDF_READ (1L<<LDB_READ)
547 #define LDF_WRITE (1L<<LDB_WRITE)
548 #define LDF_DEVICES (1L<<LDB_DEVICES)
549 #define LDF_VOLUMES (1L<<LDB_VOLUMES)
550 #define LDF_ASSIGNS (1L<<LDB_ASSIGNS)
551 #define LDF_ENTRY (1L<<LDB_ENTRY)
552 #define LDF_DELETE (1L<<LDB_DELETE)
553 #define LDF_ALL (LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS)
556 /* Used for assigns that point to multiple directories. */
559 struct AssignList
* al_Next
; /* Pointer to next assign node. */
560 BPTR al_Lock
; /* (struct FileLock *) Lock of on of the
564 /**********************************************************************
565 ********************** Low Level File Handling ***********************
566 **********************************************************************/
568 /* This section is OBSOLETE and is not implemented in AROS! AROS uses a
569 different concept for filesystem-handling. See <dos/filesystem.h> for
570 more information. Use the structures and defines in this section only, if
571 you are programming just for AmigaOS. */
574 /* Allocate this structure with AllocDosObject(). */
577 struct Message
* dp_Link
; /* Pointer to a standard exec message. */
578 struct MsgPort
* dp_Port
; /* Reply-Port of that packet. */
580 LONG dp_Type
; /* see below */
581 LONG dp_Res1
; /* Normal return value. */
582 LONG dp_Res2
; /* Secondary return value (as returned by IoErr()). See
583 <dos/dos.h> for possible values. */
585 /* The actual data. */
594 #define dp_Action dp_Type
595 #define dp_Status dp_Res1
596 #define dp_Status2 dp_Res2
597 #define dp_BufAddr dp_Arg1
600 /* These are defined for packet emulation purposes only! AROS doesn't use
601 packets at all, but emulates (some of) them via DoPkt(), SendPkt() and
602 others to function like they did in AmigaOS */
606 #define ACTION_STARTUP 0
607 #define ACTION_GET_BLOCK 2 /* Obsolete */
608 #define ACTION_SET_MAP 4
610 #define ACTION_EVENT 6
611 #define ACTION_CURRENT_VOLUME 7
612 #define ACTION_LOCATE_OBJECT 8
613 #define ACTION_RENAME_DISK 9
614 #define ACTION_FREE_LOCK 15
615 #define ACTION_DELETE_OBJECT 16
616 #define ACTION_RENAME_OBJECT 17
617 #define ACTION_MORE_CACHE 18
618 #define ACTION_COPY_DIR 19
619 #define ACTION_WAIT_CHAR 20
620 #define ACTION_SET_PROTECT 21
621 #define ACTION_CREATE_DIR 22
622 #define ACTION_EXAMINE_OBJECT 23
623 #define ACTION_EXAMINE_NEXT 24
624 #define ACTION_DISK_INFO 25
625 #define ACTION_INFO 26
626 #define ACTION_FLUSH 27
627 #define ACTION_SET_COMMENT 28
628 #define ACTION_PARENT 29
629 #define ACTION_TIMER 30
630 #define ACTION_INHIBIT 31
631 #define ACTION_DISK_TYPE 32
632 #define ACTION_DISK_CHANGE 33
633 #define ACTION_SET_DATE 34
634 #define ACTION_SAME_LOCK 40
636 #define ACTION_WRITE 'W'
637 #define ACTION_READ 'R'
639 #define ACTION_SCREEN_MODE 994
640 #define ACTION_CHANGE_SIGNAL 995
641 #define ACTION_READ_RETURN 1001
642 #define ACTION_WRITE_RETURN 1002
643 #define ACTION_FINDUPDATE 1004
644 #define ACTION_FINDINPUT 1005
645 #define ACTION_FINDOUTPUT 1006
646 #define ACTION_END 1007
647 #define ACTION_SEEK 1008
648 #define ACTION_FORMAT 1020
649 #define ACTION_MAKE_LINK 1021
650 #define ACTION_SET_FILE_SIZE 1022
651 #define ACTION_WRITE_PROTECT 1023
652 #define ACTION_READ_LINK 1024
653 #define ACTION_FH_FROM_LOCK 1026
654 #define ACTION_IS_FILESYSTEM 1027
655 #define ACTION_CHANGE_MODE 1028
656 #define ACTION_COPY_DIR_FH 1030
657 #define ACTION_PARENT_FH 1031
658 #define ACTION_EXAMINE_ALL 1033
659 #define ACTION_EXAMINE_FH 1034
660 #define ACTION_EXAMINE_ALL_END 1035
661 #define ACTION_SET_OWNER 1036
663 #define ACTION_LOCK_RECORD 2008
664 #define ACTION_FREE_RECORD 2009
666 #define ACTION_ADD_NOTIFY 4097
667 #define ACTION_REMOVE_NOTIFY 4098
669 #define ACTION_SERIALIZE_DISK 4200
671 /* Structure for easy handling of DosPackets. DosPackets don´t have to be in
672 this structure, but this struture may ease the use of it. */
673 struct StandardPacket
675 struct Message sp_Msg
;
676 struct DosPacket sp_Pkt
;
680 /* NOTE: AROS doesn't use startup packets. This will ONLY make a difference
681 for shell writers... */
683 /* Types of command execution */
684 #define RUN_EXECUTE -1
685 #define RUN_SYSTEM -2
686 #define RUN_SYSTEM_ASYNCH -3
689 /**********************************************************************
690 ****************************** Segments ******************************
691 **********************************************************************/
693 /* Resident list structure as returned by AddSegment(). */
696 BPTR seg_Next
; /* Pointer to next segment. */
697 LONG seg_UC
; /* Usage count/type */
698 BPTR seg_Seg
; /* Actual Segment */
699 UBYTE seg_Name
[4]; /* The first characters of the name (BSTR). */
702 #define CMD_SYSTEM -1
703 #define CMD_INTERNAL -2
704 #define CMD_DISABLED -999
706 /**********************************************************************
707 *************************** Error Handling ***************************
708 **********************************************************************/
716 /* Return values for ErrorReport(). */
717 #define REPORT_STREAM 0
718 #define REPORT_TASK 1
719 #define REPORT_LOCK 2
720 #define REPORT_VOLUME 3
721 #define REPORT_INSERT 4
723 #define ABORT_BUSY 288
724 #define ABORT_DISK_ERROR 296
726 #endif /* DOS_DOSEXTENS_H */