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
13 # include <aros/config.h>
16 # include <exec/types.h>
19 # include <exec/tasks.h>
22 # include <exec/ports.h>
24 #ifndef EXEC_LIBRARIES_H
25 # include <exec/libraries.h>
27 #ifndef EXEC_DEVICES_H
28 # include <exec/devices.h>
30 #ifndef EXEC_SEMAPHORES
31 # include <exec/semaphores.h>
33 #ifndef DEVICES_TIMER_H
34 # include <devices/timer.h>
36 #ifndef EXEC_INTERRUPTS_H
37 # include <exec/interrupts.h>
43 /**********************************************************************
44 ***************************** DosLibrary *****************************
45 **********************************************************************/
47 /* This is how the base of dos.library looks like. */
50 /* A normal library-base as defined in <exec/libraries.h>. */
51 struct Library dl_lib
;
53 struct RootNode
* dl_Root
;
55 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
56 /* The following fields are not used by AROS and are just there to
57 guarantee binary compatibility. DO NOT USE THESE FIELDS IN ANY WAY.
58 Original names were: dl_GV, dl_A2, dl_A5 and dl_A6 */
63 /* The following fields are PRIVATE! */
64 struct ErrorString
* dl_Errors
;
65 struct Device
* dl_TimerBase
;
66 struct Library
* dl_UtilityBase
;
67 struct Library
* dl_IntuitionBase
;
69 /* These are AROS specific extensions. They are all PRIVATE! */
70 struct timerequest dl_TimerIO
;
72 struct SignalSemaphore dl_DosListLock
;
73 struct DosList
* dl_DevInfo
;
74 struct ExecBase
* dl_SysBase
;
76 struct Device
* dl_NulHandler
;
77 struct Unit
* dl_NulLock
;
79 struct SignalSemaphore dl_LDObjectsListSigSem
;
80 struct List dl_LDObjectsList
;
81 struct Interrupt dl_LDHandler
;
82 struct MsgPort
* dl_LDDemonPort
;
83 struct Process
* dl_LDDemonTask
;
90 /* The flags are the same, as they were in RootNode->rn_Flags. See below
94 /* Resident segment list **PRIVATE** */
98 /* dl_Flags/rn_Flags */
99 #define RNB_WILDSTAR 24 /* Activate '*' as wildcard character. */
100 #define RNF_WILDSTAR (1L << RNB_WILDSTAR)
105 /* (IPTR *) Pointer to an array containing pointers to CLI processes.
106 The CLI process number is equal to the index of that array. The
107 first field (index 0) contains the maximal number of CLI processes.
108 See also rn_CliList. */
110 /* (void *) Pointer to the SegList for CLIs. */
111 BPTR rn_ConsoleSegment
;
112 /* The current time. */
113 struct DateStamp rn_Time
;
114 /* (APTR) The SegList of the process that handles validation of devices.
117 /* (struct DosInfo *) see below for DosInfo */
119 BPTR rn_FileHandlerSegment
;
120 /* List of all CLI processes (struct CliProcList - see below). See also
122 struct MinList rn_CliList
;
123 /* Message port of boot filesystem. (PRIVATE) */
124 struct MsgPort
* rn_BootProc
;
125 /* (void *) Pointer to the SegList for shells. */
126 BPTR rn_ShellSegment
;
127 /* Additional flags (see above). */
130 /* RootNode arbitrator */
131 struct SignalSemaphore rn_RootLock
;
135 /* Structure that is linked into the rootnode's rn_CliList. Completely
136 private, of course! ... and it's not compatible to AmigaOS. */
140 struct Process
*ci_Process
;
144 /* The following structures in this sections are not used by AROS and may
145 be removed in the future. So BEWARE, if you use them. */
151 BPTR di_McName
; /* PRIVATE */
157 /* The following semaphores are PRIVATE. */
158 struct SignalSemaphore di_DevLock
;
159 struct SignalSemaphore di_EntryLock
;
160 struct SignalSemaphore di_DeleteLock
;
162 #define di_ResList di_McName
166 /**********************************************************************
167 ***************************** Processes ******************************
168 **********************************************************************/
170 /* Standard process structure. Processes are just extended tasks. */
173 /* Embedded task structure as defined in <exec/tasks.h>. */
176 /* Processes standard message-port. Used for various puposes. */
177 struct MsgPort pr_MsgPort
;
178 WORD pr_Pad
; /* PRIVATE */
179 /* SegList array, used by this process. (void **) */
181 /* StackSize of the current process. */
184 /* CLI process number. This may be 0, in which case the process is not
185 connected to a CLI. */
187 /* Pointer to upper end of stack. (void *) */
189 /* Secondary return-value, as defined in <dos/dos.h>. As of now this
190 field is declared PRIVATE. Use IoErr()/SetIoErr() to access it. */
192 /* Lock of the current directory. As of now this is declared READ-ONLY.
193 Use CurrentDir() to set it. (struct FileLock *) */
195 /* Standard input file. As of now this is declared WRITE-ONLY. Use
196 Input() to query it. */
198 /* Standard output file. As of now this is declared WRITE-ONLY. Use
199 Output() to query it. */
201 /* Task to handle the console associated with process. */
203 /* The task that is responsible for handling the filesystem. */
204 APTR pr_FileSystemTask
;
205 /* CLI the process is connected to. (struct CommandLineInterface *) */
208 /* Function to be called, when process waits for a packet-message. */
210 /* Standard-Window of process. */
212 /* Lock to home-directory of process. (struct FileLock *) */
214 LONG pr_Flags
; /* see below */
216 /* Code that is called, when the process exits. pr_ExitData takes an
217 argument to be passed to this code. */
218 void (* pr_ExitCode
)();
220 /* Arguments passed to the process from caller. */
223 /* List of local environment variables. This list should be in
224 alphabetical order. Multiple entries may have the same name, if they
225 are of different types. See <dos/var.h> for more information. */
226 struct MinList pr_LocalVars
;
227 ULONG pr_ShellPrivate
;
228 /* Standard error file. May be NULL, in which case pr_COS is to be used.
229 Use this instead of Output() to report errors. */
233 /* pr_Flags (all PRIVATE) They mainly descibe what happens if the process
234 exits, i.e. which resources the process should clean itself. The flags
235 are self-explaining. */
236 #define PRB_FREESEGLIST 0
237 #define PRB_FREECURRDIR 1
238 #define PRB_FREECLI 2
239 #define PRB_CLOSEINPUT 3
240 #define PRB_CLOSEOUTPUT 4
241 #define PRB_FREEARGS 5
242 #define PRB_CLOSEERROR 6
243 #define PRB_SYNCHRONOUS 7
244 #define PRB_WAITINGFORCHILD 8 /* This one is subject to change! */
246 #define PRF_FREESEGLIST (1L << PRB_FREESEGLIST)
247 #define PRF_FREECURRDIR (1L << PRB_FREECURRDIR)
248 #define PRF_FREECLI (1L << PRB_FREECLI)
249 #define PRF_CLOSEINPUT (1L << PRB_CLOSEINPUT)
250 #define PRF_CLOSEOUTPUT (1L << PRB_CLOSEOUTPUT)
251 #define PRF_FREEARGS (1L << PRB_FREEARGS)
252 #define PRF_CLOSEERROR (1L << PRB_CLOSEERROR)
253 #define PRF_SYNCHRONOUS (1L << PRB_SYNCHRONOUS)
254 #define PRF_WAITINGFORCHILD (1L << PRB_WAITINGFORCHILD)
256 /* Structure used for CLIs and Shells. Allocate this structure with
257 AllocDosObject() only! */
258 struct CommandLineInterface
260 /* Secondary error code, set by last command. */
262 /* Name of the current directory. */
264 /* Lock of the first directory in path. (struct FileLock *) */
266 /* Error code, the last command returned. See <dos/dos.h> for
269 /* Name of the command that is currently executed. */
270 BSTR cli_CommandName
;
271 /* Fail-Level as set by the command "FailAt". */
273 /* Current prompt in the CLI window. */
275 /* Standard/Default input file. (struct FileLock *) */
276 BPTR cli_StandardInput
;
277 /* Current input file. (struct FileLock *) */
278 BPTR cli_CurrentInput
;
279 /* Name of the file that is currently executed. */
280 BSTR cli_CommandFile
;
281 /* TRUE if the currently CLI is connected to a controlling terminal,
283 LONG cli_Interactive
;
284 /* FALSE if there is no controlling terminal, otherwise TRUE. */
286 /* Current output file. (struct FileLock *) */
287 BPTR cli_CurrentOutput
;
288 /* Default stack size as set by the command "Stack". */
289 LONG cli_DefaultStack
;
290 /* Standard/Default output file. (struct FileLock *) */
291 BPTR cli_StandardOutput
;
292 /* SegList of currently loaded command. */
295 /* Here begins the aros specific part */
296 /* Standard/Default Error file. (struct FileLock *) */
297 BPTR cli_StandardError
;
300 /* CLI_DEFAULTSTACK_UNIT * cli_DefaultStack = stack in bytes */
302 #define CLI_DEFAULTSTACK_UNIT sizeof(LONG)
304 /* Devices process structure as returned by GetDeviceProc(). */
307 struct MsgPort
* dvp_Port
;
308 BPTR dvp_Lock
; /* struct FileLock * */
309 ULONG dvp_Flags
; /* see below */
310 struct DosList
* dvp_DevNode
; /* PRIVATE */
314 #define DVPB_UNLOCK 0
315 #define DVPB_ASSIGN 1
316 #define DVPF_UNLOCK (1L<<DVPB_UNLOCK)
317 #define DVPF_ASSIGN (1L<<DVPB_ASSIGN)
319 /**********************************************************************
320 ******************************* Files ********************************
321 **********************************************************************/
323 /* Standard file-handle as returned by Open() (as BPTR). Generally said, you
324 should not use this structure in any way and only use library-calls to
325 access files. Note that this structure is very different to the structure
326 used in AmigaOS! Treat this structure as PRIVATE. If you want to create
327 this structure nevertheless, use AllocDosObject(). */
330 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
331 /* The following three fields are not used by AROS and are just there for
332 compatibility reasons. So keep your hands away. The original names
333 were: fh_Link, fh_Port and fh_Type */
334 struct Message
* fh_NoAROS1
;
335 struct MsgPort
* fh_NoAROS2
[2];
342 /* The following four fields have different names and a different
343 function than their AmigaOS equivalents. The original names were:
344 fh_Funcs/fh_Func1, fh_Func2, fh_Func3, fh_Args/fh_Arg1 and fh_Arg2 */
346 ULONG fh_Flags
; /* see below */
347 /* This is a pointer to a filesystem handler. See <dos/filesystems.h> for
349 struct Device
* fh_Device
;
351 /* SDuvan: Added this and removed the #if below. This field allows us
352 to emulate packets -- specifically it makes it possible
353 to implement the ***Pkt() functions */
354 struct FileHandle
*fh_CompatibilityHack
;
356 /* A private pointer to a device specific filehandle structure. See
357 <dos/filesystems.h> for more information. */
358 struct Unit
* fh_Unit
;
359 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
360 LONG fh_NoAROS3
; /* not used by AROS */
364 #define fh_Arg1 fh_CompatibilityHack
366 /* fh_Flags. The flags are AROS specific and therefore PRIVATE.. */
367 #define FHF_WRITE (~0UL/2+1)
370 #define FHF_LINEBUF 4
373 /* Structure of a lock, as returned by Lock() and similar functions. This
374 structure is not used by AROS. Lock() also returns a struct FileHandle! */
378 BPTR fl_Link
; /* (struct FileLock *) Pointer to next lock. */
381 struct MsgPort
* fl_Task
;
382 BPTR fl_Volume
; /* (struct DeviceList * - see below) */
387 /* Constants, defining of what kind a file is. These constants are used in
388 many structures, including FileInfoBlock (<dos/dos.h>) and ExAllData
390 #define ST_PIPEFILE -5 /* File is a pipe */
391 #define ST_LINKFILE -4 /* Hard link to a file */
392 #define ST_FILE -3 /* Plain file */
393 #define ST_ROOT 1 /* Root directory of filesystem */
394 #define ST_USERDIR 2 /* Normal directory */
395 #define ST_SOFTLINK 3 /* Soft link (may be a file or directory) */
396 #define ST_LINKDIR 4 /* Hard link to a directory */
398 /**********************************************************************
399 ****************************** DosLists ******************************
400 **********************************************************************/
402 /* This structure is returned by LockDosList() and similar calls. This
403 structure is different to the AmigaOS one. But this structure is PRIVATE
404 anyway. Use system-calls for dos list-handling. */
407 /* PRIVATE pointer to next entry. In AmigaOS this used to be a BPTR. */
408 struct DosList
* dol_Next
;
409 /* Type of the current node (see below). */
412 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
413 /* The next field is not used by AROS. Its original name was:
417 /* The lock passed to AssignLock(). Only set if the type is
421 /* This union combines all the different types. */
423 /* See struct DevInfo below. */
430 /* See struct DeviceList below. */
432 struct DateStamp dol_VolumeDate
;
437 /* Structure used for assigns. */
439 /* The name for the late or nonbinding assign. */
440 UBYTE
*dol_AssignName
;
441 /* A list of locks, used by AssignAdd(). */
442 struct AssignList
*dol_List
;
446 /* This field is called dol_Name in AmigaOS. It is now named dol_OldName
447 to give you a hint that something has changed. Additionally to the
448 old nasty BSTR there is now a new clean STRPTR for the same purpose.
450 1. Change your sources to reflect this change thus getting rid of
452 2. just define dol_OldName to dol_Name before including this file
453 to stay downwards compatible. */
456 /* The following fields are new to AROS. */
458 struct Device
* dol_Device
;
459 struct Unit
* dol_Unit
;
461 /* #define dol_Name dol_OldName */
463 /* dol_Type/dl_Type/dvi_Type. Given to MakeDosEntry(). */
464 #define DLT_DEVICE 0 /* A real filesystem (or similar) */
465 #define DLT_DIRECTORY 1 /* Just a simple assign */
466 #define DLT_VOLUME 2 /* Volume node (for removable media) */
467 #define DLT_LATE 3 /* Late binding assign (not yet) */
468 #define DLT_NONBINDING 4 /* Nonbinding assign (not yet) */
471 /* The following structures are essentially the same as DosList above. The
472 difference is that they support just one type of entry. You can use them
473 instead of DosList, if you have a list, containing just one type of
474 entries. For more information see above. */
476 /* Structure that describes a volume.
477 ATTENTION: This struture does currently work on 32bit computers only due to
478 the fact that dl_unused does not compensate the missing pointers
479 in this structure. In DevInfo we have three pointer and three
480 longwords, while in this structure we have only two pointers and
484 struct DeviceList
* dl_Next
;
485 LONG dl_Type
; /* see above, always = DLT_VOLUME */
487 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
488 /* This field was dl_Task */
489 struct MsgPort
* dl_NoAROS1
;
493 /* Embedded DateStamp structured as defined in <dos/dos.h>. At this
494 date the volume was created. */
495 struct DateStamp dl_VolumeDate
;
496 /* (void *) List of all locks on the volume. */
498 /* Type of the disk. (see <dos/dos.h> for definitions) */
500 IPTR dl_unused
; /* PRIVATE */
505 struct Device
* dl_Device
;
506 struct Unit
* dl_Unit
;
508 /* #define dl_Name dl_OldName */
511 /* Structure that describes a device. This is essentially the same structure
512 as DeviceNode, defined in <dos/filehandler.h>. */
515 struct DevInfo
* dvi_Next
;
516 LONG dvi_Type
; /* see above, always = DLT_DEVICE */
518 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
519 struct MsgPort
* dvi_NoAROS1
;
523 BSTR dvi_Handler
; /* Device name for handler. */
524 LONG dvi_NoAROS3
[2]; /* PRIVATE */
525 BPTR dvi_Startup
; /* (struct FileSysStartupMsg * - defined in
526 <dos/filehandler.h>) */
527 BPTR dvi_NoAROS4
[2]; /* PRIVATE */
532 struct Device
* dvi_Device
;
533 struct Unit
* dvi_Unit
;
535 /* #define dvi_Name dvi_OldName */
538 /* Dos list scanning and locking modes as used in LockDosList() */
539 /* Specify either LDF_READ, if you want a non-exclusive lock, or LDF_WRITE,
540 if you want an exclusive lock (i.e. if you want to modify the list).
542 #define LDB_READ 0 /* Non-exclusive/read lock */
543 #define LDB_WRITE 1 /* Exclusive/write lock */
544 /* Specify which list(s) to lock. */
545 #define LDB_DEVICES 2 /* Device list */
546 #define LDB_VOLUMES 3 /* Volume list */
547 #define LDB_ASSIGNS 4 /* Assign list */
551 #define LDF_READ (1L<<LDB_READ)
552 #define LDF_WRITE (1L<<LDB_WRITE)
553 #define LDF_DEVICES (1L<<LDB_DEVICES)
554 #define LDF_VOLUMES (1L<<LDB_VOLUMES)
555 #define LDF_ASSIGNS (1L<<LDB_ASSIGNS)
556 #define LDF_ENTRY (1L<<LDB_ENTRY)
557 #define LDF_DELETE (1L<<LDB_DELETE)
558 #define LDF_ALL (LDF_DEVICES | LDF_VOLUMES | LDF_ASSIGNS)
561 /* Used for assigns that point to multiple directories. */
564 struct AssignList
* al_Next
; /* Pointer to next assign node. */
565 BPTR al_Lock
; /* (struct FileLock *) Lock of on of the
569 /**********************************************************************
570 ********************** Low Level File Handling ***********************
571 **********************************************************************/
573 /* This section is OBSOLETE and is not implemented in AROS! AROS uses a
574 different concept for filesystem-handling. See <dos/filesystem.h> for
575 more information. Use the structures and defines in this section only, if
576 you are programming just for AmigaOS. */
579 /* Allocate this structure with AllocDosObject(). */
582 struct Message
* dp_Link
; /* Pointer to a standard exec message. */
583 struct MsgPort
* dp_Port
; /* Reply-Port of that packet. */
585 LONG dp_Type
; /* see below */
586 LONG dp_Res1
; /* Normal return value. */
587 LONG dp_Res2
; /* Secondary return value (as returned by IoErr()). See
588 <dos/dos.h> for possible values. */
590 /* The actual data. */
599 #define dp_Action dp_Type
600 #define dp_Status dp_Res1
601 #define dp_Status2 dp_Res2
602 #define dp_BufAddr dp_Arg1
605 /* These are defined for packet emulation purposes only! AROS doesn't use
606 packets at all, but emulates (some of) them via DoPkt(), SendPkt() and
607 others to function like they did in AmigaOS */
611 #define ACTION_STARTUP 0
612 #define ACTION_GET_BLOCK 2 /* Obsolete */
613 #define ACTION_SET_MAP 4
615 #define ACTION_EVENT 6
616 #define ACTION_CURRENT_VOLUME 7
617 #define ACTION_LOCATE_OBJECT 8
618 #define ACTION_RENAME_DISK 9
619 #define ACTION_FREE_LOCK 15
620 #define ACTION_DELETE_OBJECT 16
621 #define ACTION_RENAME_OBJECT 17
622 #define ACTION_MORE_CACHE 18
623 #define ACTION_COPY_DIR 19
624 #define ACTION_WAIT_CHAR 20
625 #define ACTION_SET_PROTECT 21
626 #define ACTION_CREATE_DIR 22
627 #define ACTION_EXAMINE_OBJECT 23
628 #define ACTION_EXAMINE_NEXT 24
629 #define ACTION_DISK_INFO 25
630 #define ACTION_INFO 26
631 #define ACTION_FLUSH 27
632 #define ACTION_SET_COMMENT 28
633 #define ACTION_PARENT 29
634 #define ACTION_TIMER 30
635 #define ACTION_INHIBIT 31
636 #define ACTION_DISK_TYPE 32
637 #define ACTION_DISK_CHANGE 33
638 #define ACTION_SET_DATE 34
639 #define ACTION_SAME_LOCK 40
641 #define ACTION_WRITE 'W'
642 #define ACTION_READ 'R'
644 #define ACTION_SCREEN_MODE 994
645 #define ACTION_CHANGE_SIGNAL 995
646 #define ACTION_READ_RETURN 1001
647 #define ACTION_WRITE_RETURN 1002
648 #define ACTION_FINDUPDATE 1004
649 #define ACTION_FINDINPUT 1005
650 #define ACTION_FINDOUTPUT 1006
651 #define ACTION_END 1007
652 #define ACTION_SEEK 1008
653 #define ACTION_FORMAT 1020
654 #define ACTION_MAKE_LINK 1021
655 #define ACTION_SET_FILE_SIZE 1022
656 #define ACTION_WRITE_PROTECT 1023
657 #define ACTION_READ_LINK 1024
658 #define ACTION_FH_FROM_LOCK 1026
659 #define ACTION_IS_FILESYSTEM 1027
660 #define ACTION_CHANGE_MODE 1028
661 #define ACTION_COPY_DIR_FH 1030
662 #define ACTION_PARENT_FH 1031
663 #define ACTION_EXAMINE_ALL 1033
664 #define ACTION_EXAMINE_FH 1034
665 #define ACTION_EXAMINE_ALL_END 1035
666 #define ACTION_SET_OWNER 1036
668 #define ACTION_LOCK_RECORD 2008
669 #define ACTION_FREE_RECORD 2009
671 #define ACTION_ADD_NOTIFY 4097
672 #define ACTION_REMOVE_NOTIFY 4098
674 #define ACTION_SERIALIZE_DISK 4200
676 /* Structure for easy handling of DosPackets. DosPackets don´t have to be in
677 this structure, but this struture may ease the use of it. */
678 struct StandardPacket
680 struct Message sp_Msg
;
681 struct DosPacket sp_Pkt
;
685 /* NOTE: AROS doesn't use startup packets. This will ONLY make a difference
686 for shell writers... */
688 /* Types of command execution */
689 #define RUN_EXECUTE -1
690 #define RUN_SYSTEM -2
691 #define RUN_SYSTEM_ASYNCH -3
694 /**********************************************************************
695 ****************************** Segments ******************************
696 **********************************************************************/
698 /* Resident list structure as returned by AddSegment(). */
701 BPTR seg_Next
; /* Pointer to next segment. */
702 LONG seg_UC
; /* Usage count/type */
703 BPTR seg_Seg
; /* Actual Segment */
704 UBYTE seg_Name
[4]; /* The first characters of the name (BSTR). */
707 #define CMD_SYSTEM -1
708 #define CMD_INTERNAL -2
709 #define CMD_DISABLED -999
711 /**********************************************************************
712 *************************** Error Handling ***************************
713 **********************************************************************/
721 /* Return values for ErrorReport(). */
722 #define REPORT_STREAM 0
723 #define REPORT_TASK 1
724 #define REPORT_LOCK 2
725 #define REPORT_VOLUME 3
726 #define REPORT_INSERT 4
728 #define ABORT_BUSY 288
729 #define ABORT_DISK_ERROR 296
731 #endif /* DOS_DOSEXTENS_H */