5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
8 Desc: Basic DOS structures and constants
13 # include <exec/types.h>
16 # include <dos/bptr.h>
19 # include <aros/macros.h>
22 /* The name of the dos.library. Use this constant instead of the string. */
23 #define DOSNAME "dos.library"
25 /* These constants may be used, but preferably, you should only test for
26 (un-)equality against DOSFALSE (i.e. 0). */
28 #define DOSFALSE ( 0L)
30 /**********************************************************************
31 ******************************* Dates ********************************
32 **********************************************************************/
34 /* Other structures and defines for handling dates and time can be found in
37 /* Number of so-called "ticks" in a second. */
38 #define TICKS_PER_SECOND 50
40 /* DateStamp structure as used in different library-functions. This
41 structure sufficiently describes a system-date and -time (i.e. any
42 date since 1.1.1978). */
45 LONG ds_Days
; /* Number of days since 1.1.1978 */
46 LONG ds_Minute
; /* Number of minutes since midnight */
47 LONG ds_Tick
; /* Number of ticks (1/50 second) in the current minute
48 Note that this may not be exact */
51 /**********************************************************************
52 ******************************* Files ********************************
53 **********************************************************************/
55 /* The maximum length of filenames in AmigaOS. You should not depend on
56 this value, as it may change in future versions. */
57 #define MAXFILENAMELENGTH 108
59 /* The maximum length of comments in AmigaOS. You should not depend on
60 this value, as it may change in future versions. */
61 #define MAXCOMMENTLENGTH 80
63 /* Structure used to describe a directory entry. Note that not all fields
64 are supported by all filesystems. This structure should be allocated
65 with AllocDosObject(). */
69 /* See <dos/dosextens.h> for definitions. Generally: if this is >= 0
70 the file described is a directory, otherwise it is a plain file. */
71 LONG fib_DirEntryType
;
72 /* The filename (null-terminated). */
73 UBYTE fib_FileName
[MAXFILENAMELENGTH
];
74 LONG fib_Protection
; /* The protection bits (see below). */
76 LONG fib_Size
; /* The size of the file. */
77 LONG fib_NumBlocks
; /* Number of blocks used for file. */
78 struct DateStamp fib_Date
; /* Date of last change to file. */
79 UBYTE fib_Comment
[MAXCOMMENTLENGTH
]; /* The filecomment (null-terminated). */
80 UWORD fib_OwnerUID
; /* UserID of fileowner. */
81 UWORD fib_OwnerGID
; /* GroupID of fileowner. */
82 UBYTE fib_Reserved
[32]; /* PRIVATE */
85 /* Protection bits for files (fib_Protection). */
86 /* Flags for owner (they a low-active, i.e. not set means the action is
88 #define FIBB_DELETE 0 /* File is deleteable. */
89 #define FIBB_EXECUTE 1 /* File is executable (no scripts!). */
90 #define FIBB_WRITE 2 /* File is writable. */
91 #define FIBB_READ 3 /* File is readable. */
92 /* General flags, not owner-dependant. */
93 #define FIBB_ARCHIVE 4 /* File was archived (not used by OS). */
94 #define FIBB_PURE 5 /* Make program resident on execution. */
95 #define FIBB_SCRIPT 6 /* File is a script (DOS or ARexx). */
96 /* Flag number 7 is not defined. It used to describe different conditions
97 in different revisions of AmigaOS and was also misused as hidden flag.
98 Because of this confusion, this flag should not be used! */
99 /* Flags for group (meaning see above, these are high-active!). */
100 #define FIBB_GRP_DELETE 8
101 #define FIBB_GRP_EXECUTE 9
102 #define FIBB_GRP_WRITE 10
103 #define FIBB_GRP_READ 11
104 /* Flags for other/world (meaning see above, these are high-active!). */
105 #define FIBB_OTR_DELETE 12
106 #define FIBB_OTR_EXECUTE 13
107 #define FIBB_OTR_WRITE 14
108 #define FIBB_OTR_READ 15
110 #define FIBF_DELETE (1<<FIBB_DELETE)
111 #define FIBF_EXECUTE (1<<FIBB_EXECUTE)
112 #define FIBF_WRITE (1<<FIBB_WRITE)
113 #define FIBF_READ (1<<FIBB_READ)
114 #define FIBF_ARCHIVE (1<<FIBB_ARCHIVE)
115 #define FIBF_PURE (1<<FIBB_PURE)
116 #define FIBF_SCRIPT (1<<FIBB_SCRIPT)
117 #define FIBF_GRP_DELETE (1<<FIBB_GRP_DELETE)
118 #define FIBF_GRP_EXECUTE (1<<FIBB_GRP_EXECUTE)
119 #define FIBF_GRP_WRITE (1<<FIBB_GRP_WRITE)
120 #define FIBF_GRP_READ (1<<FIBB_GRP_READ)
121 #define FIBF_OTR_DELETE (1<<FIBB_OTR_DELETE)
122 #define FIBF_OTR_EXECUTE (1<<FIBB_OTR_EXECUTE)
123 #define FIBF_OTR_WRITE (1<<FIBB_OTR_WRITE)
124 #define FIBF_OTR_READ (1<<FIBB_OTR_READ)
126 /**********************************************************************
127 ****************************** Devices *******************************
128 **********************************************************************/
130 /* Structure used in Info(). Must be longword-aligned. */
133 LONG id_NumSoftErrors
; /* Number of soft errors on device. */
134 LONG id_UnitNumber
; /* Unit number of device. */
135 LONG id_DiskState
; /* State the current volume is in (see below). */
136 LONG id_NumBlocks
; /* Number of blocks on device. */
137 LONG id_NumBlocksUsed
; /* Number of blocks in use. */
138 LONG id_BytesPerBlock
; /* Bytes per block. */
139 LONG id_DiskType
; /* Type of disk (see below). */
141 LONG id_InUse
; /* Set, if device is in use. */
145 #define ID_WRITE_PROTECTED 80 /* Volume is write-protected. */
146 #define ID_VALIDATING 81 /* Volume is currently validating. */
147 #define ID_VALIDATED 82 /* Volume is ready to be read and written. */
149 /* Filesystem types as used for id_DiskType. These are multi-character
150 constants of identifier strings. They are self-descriptive. */
151 #define ID_NO_DISK_PRESENT (-1L)
152 #define ID_UNREADABLE_DISK AROS_MAKE_ID('B','A','D',0)
153 #define ID_DOS_DISK AROS_MAKE_ID('D','O','S',0)
154 #define ID_FFS_DISK AROS_MAKE_ID('D','O','S',1)
155 #define ID_INTER_DOS_DISK AROS_MAKE_ID('D','O','S',2)
156 #define ID_INTER_FFS_DISK AROS_MAKE_ID('D','O','S',3)
157 #define ID_FASTDIR_DOS_DISK AROS_MAKE_ID('D','O','S',4)
158 #define ID_FASTDIR_FFS_DISK AROS_MAKE_ID('D','O','S',5)
159 #define ID_NOT_REALLY_DOS AROS_MAKE_ID('N','D','O','S')
160 #define ID_KICKSTART_DISK AROS_MAKE_ID('K','I','C','K')
161 #define ID_MSDOS_DISK AROS_MAKE_ID('M','S','D',0)
162 #define ID_SFS_BE_DISK AROS_MAKE_ID('S','F','S',0)
163 #define ID_SFS_LE_DISK AROS_MAKE_ID('s','f','s',0)
165 /**********************************************************************
166 **************** Program Execution and Error Handling ****************
167 **********************************************************************/
169 /* Return conditions for programs. */
171 /* Program succeeded. */
172 #define RETURN_WARN 5
173 /* Program succeeded, but there was something not quite right. This value
174 may also be used to express a boolean state (RETURN_WARN meaning TRUE,
175 RETURN_OK meaning FALSE). */
176 #define RETURN_ERROR 10
177 /* Program succeeded partly. This may be returned, if the user aborts a
178 program or some external data were wrong. */
179 #define RETURN_FAIL 20
180 /* Program execution failed. Normally used, if some system resources could
184 /* Secondary errors codes as used for IoErr(), SetIoErr() and in
185 Process->pr_Result2. The term 'object' refers to files of all kinds
186 (ie plain files, directories, links, etc). */
188 /* This is used, if something went wrong, but it is unknown what exactly
189 went wrong. This is especially useful for emulation devices, when the
190 underlying system returned an error that the emulation side does not
192 #define ERROR_UNKNOWN 100
195 /* General system errors */
197 #define ERROR_NO_FREE_STORE 103
198 /* Too many tasks are already running. */
199 #define ERROR_TASK_TABLE_FULL 105
201 /* Errors concerning ReadArgs(). See also <dos/rdargs.h>. */
202 /* Supplied template is broken */
203 #define ERROR_BAD_TEMPLATE 114
204 /* A supplied argument that was expected to be numeric, was not numeric.
205 This is also returned by some functions to expresss that a supplied
206 number is out of range (ie to express application internal errors). */
207 #define ERROR_BAD_NUMBER 115
208 /* An argument that has to be supplied (ie signed with the '/A' flag) was
210 #define ERROR_REQUIRED_ARG_MISSING 116
211 /* Keyword was specified, but not its contents. */
212 #define ERROR_KEY_NEEDS_ARG 117
213 /* There were more arguments than the template needs. */
214 #define ERROR_TOO_MANY_ARGS 118
215 /* An odd number of quotation marks was supplied. */
216 #define ERROR_UNMATCHED_QUOTES 119
217 /* Either the command-line was longer than hardcoded line length limit or the
218 maximum number of multiple arguments (flag '/M') was exceeded. This can
219 also indicate that some argument is too long or a supplied buffer is too
221 #define ERROR_LINE_TOO_LONG 120
223 /* Errors in files. */
224 /* You tried to execute a file that is not an executable. */
225 #define ERROR_FILE_NOT_OBJECT 121
226 /* A library or device could not be opened or that library or device is
228 #define ERROR_INVALID_RESIDENT_LIBRARY 122
229 #define ERROR_NO_DEFAULT_DIR 201
230 /* The accessed object is already in use (eg locked) by another task. */
231 #define ERROR_OBJECT_IN_USE 202
232 /* You tried to overwrite an object. */
233 #define ERROR_OBJECT_EXISTS 203
234 /* The given directory or the path of a given object does not exist. */
235 #define ERROR_DIR_NOT_FOUND 204
236 /* The given object does not exist. */
237 #define ERROR_OBJECT_NOT_FOUND 205
239 /* Miscellaneous errors. */
240 #define ERROR_BAD_STREAM_NAME 206
241 /* The given object is too large for the operation to be made. Object is
242 this context are for example components of path-names. */
243 #define ERROR_OBJECT_TOO_LARGE 207
244 /* This is usually used to indicate that a filesystem does not support a
245 certain action, but may generally also be used by functions. */
246 #define ERROR_ACTION_NOT_KNOWN 209
247 /* A path component was invalid (eg there were multiple colons in a path
249 #define ERROR_INVALID_COMPONENT_NAME 210
250 #define ERROR_INVALID_LOCK 211
251 /* You tried to perform an action on an object, which this kind of object
252 does not support (eg makedir on a file). */
253 #define ERROR_OBJECT_WRONG_TYPE 212
254 /* Writing failed, because the volume is not validated. */
255 #define ERROR_DISK_NOT_VALIDATED 213
256 /* Writing failed, because the volume is write-protected. */
257 #define ERROR_DISK_WRITE_PROTECTED 214
258 /* You tried to move/rename a file across different devices. Rename does only
259 work on the same device, as only the inode-data has to be changed to
260 perform that action. */
261 #define ERROR_RENAME_ACROSS_DEVICES 215
262 /* You tried to delete a directory that still contains some files. Delete
263 these files first. */
264 #define ERROR_DIRECTORY_NOT_EMPTY 216
265 /* A recursive directory search could not be performed, because the stack
267 #define ERROR_TOO_MANY_LEVELS 217
268 /* You tried to access a device that is currently not mounted. */
269 #define ERROR_DEVICE_NOT_MOUNTED 218
270 /* An error occured, while executing Seek(). */
271 #define ERROR_SEEK_ERROR 219
272 /* The supplied file comment was longer than the hardcoded length limit for
274 #define ERROR_COMMENT_TOO_BIG 220
275 /* A write-operation could not be performed, because the volume has no space
277 #define ERROR_DISK_FULL 221
278 /* You tried to delete a delete-protected object. */
279 #define ERROR_DELETE_PROTECTED 222
280 /* You tried to write to a write-protected object. This does not mean that
281 the volume, you wanted to write to, is write-protected! */
282 #define ERROR_WRITE_PROTECTED 223
283 /* You tried to read a read-protected object. */
284 #define ERROR_READ_PROTECTED 224
285 /* Accessed disk is unreadable. */
286 #define ERROR_NOT_A_DOS_DISK 225
287 /* You tried to perform an action on a device that has no volume mounted
288 (eg. an empty disk drive). */
289 #define ERROR_NO_DISK 226
290 /* This does not indicate an error, but is returned by several functions to
291 indicate that the last entry of a list was reached. */
292 #define ERROR_NO_MORE_ENTRIES 232
293 /* Given action can not be performed on a given object, because it is a
294 soft-link. This is usually only used by filesystem handlers and is catched
295 by dos. Applications should not see this. */
296 #define ERROR_IS_SOFT_LINK 233
297 /* Given action can not be performed on a given object, because it is a link.
299 #define ERROR_OBJECT_LINKED 234
300 /* There was a bad hunk in a file that was to load. */
301 #define ERROR_BAD_HUNK 235
302 /* Indicates that a function does not implement a certain functionality.
303 There are more special error conditions (ERROR_BAD_NUMBER and
304 ERROR_ACTION_NOT_KNOWN), which should be preferred, if applicable. */
305 #define ERROR_NOT_IMPLEMENTED 236
306 /* You tried to access a record that was not locked. */
307 #define ERROR_RECORD_NOT_LOCKED 240
308 /* Somebody already locked a part of the record, you wanted to lock. */
309 #define ERROR_LOCK_COLLISION 241
310 /* LockRecord() timed out. */
311 #define ERROR_LOCK_TIMEOUT 242
312 /* An error occured, while unlocking a record. */
313 #define ERROR_UNLOCK_ERROR 243
315 /* Further errors are defined in dosasl.h amd filesystem.h as well */
317 /* Maximum length of strings got from Fault(). Note that they should be
318 shorter than 60 characters. */
321 /* Signals that are set, if the user presses the corresponding keys on
322 the controlling terminal. They may also be sent by using Signal().
323 For more information see <exec/tasks.h>. */
324 #define SIGBREAKB_CTRL_C 12 /* CTRL-c, usually meaning program abortion. */
325 #define SIGBREAKB_CTRL_D 13 /* CTRL-d */
326 #define SIGBREAKB_CTRL_E 14 /* CTRL-e, usually meaning that the application
327 should iconify itself. */
328 #define SIGBREAKB_CTRL_F 15 /* CTRL-f, usually meaning that the application
329 should uniconify itself. */
331 #define SIGBREAKF_CTRL_C (1L<<SIGBREAKB_CTRL_C)
332 #define SIGBREAKF_CTRL_D (1L<<SIGBREAKB_CTRL_D)
333 #define SIGBREAKF_CTRL_E (1L<<SIGBREAKB_CTRL_E)
334 #define SIGBREAKF_CTRL_F (1L<<SIGBREAKB_CTRL_F)
336 /**********************************************************************
337 ********************** Constants for Functions ***********************
338 **********************************************************************/
340 /* Modes for Open(). */
341 /* Try to open old file. If it does not exist, Open() returns an error. */
342 #define MODE_OLDFILE 1005
343 /* A new file is created, even if a file with the supplied name does
345 #define MODE_NEWFILE 1006
346 /* An old file is opened. If it does not exist, a new one is created. */
347 #define MODE_READWRITE 1004
349 /* Locking mechanism as used in Lock() */
350 /* Non-exclusive lock, other tasks may lock this file as well. This is used
351 for read-only operations. */
352 #define SHARED_LOCK -2
353 #define ACCESS_READ SHARED_LOCK
354 /* Exclusive lock, other tasks may not lock this file. This is used for write
356 #define EXCLUSIVE_LOCK -1
357 #define ACCESS_WRITE EXCLUSIVE_LOCK
359 /* Returned by SameLock(). See autodocs for description. */
360 #define LOCK_DIFFERENT -1
362 #define LOCK_SAME_VOLUME 1
364 /* Used in MakeLink() */
369 #define OFFSET_BEGINNING -1
370 #define OFFSET_CURRENT 0
373 /* Limits of the "int" type */
374 #define MAXINT ((int)(((unsigned int)~0)/2))
375 #define MININT (-MAXINT - 1)
377 /* Used in ChangeMode() */
378 #define CHANGE_LOCK 0
381 /* Returned by ReadItem() */
382 #define ITEM_EQUAL -2
383 #define ITEM_ERROR -1
384 #define ITEM_NOTHING 0
385 #define ITEM_UNQUOTED 1
386 #define ITEM_QUOTED 2
388 /* The types for AllocDosObject() and FreeDosObject(). They specifiy which
389 kind of structure is to be allocated. */
390 #define DOS_FILEHANDLE 0 /* struct FileHandle <dos/dosextens.h> */
391 #define DOS_EXALLCONTROL 1 /* struct ExAllControl <dos/exall.h> */
392 #define DOS_FIB 2 /* struct FileInfoBlock (see above) */
393 #define DOS_STDPKT 3 /* struct DosPacket <dos/dosextens.h> */
394 #define DOS_CLI 4 /* struct CommandLineInterface <dos/dosextens.h> */
395 #define DOS_RDARGS 5 /* struct RDArgs <dos/rdargs.h> */
397 #endif /* DOS_DOS_H */