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)
163 /**********************************************************************
164 **************** Program Execution and Error Handling ****************
165 **********************************************************************/
167 /* Return conditions for programs. */
169 /* Program succeeded. */
170 #define RETURN_WARN 5
171 /* Program succeeded, but there was something not quite right. This value
172 may also be used to express a boolean state (RETURN_WARN meaning TRUE,
173 RETURN_OK meaning FALSE). */
174 #define RETURN_ERROR 10
175 /* Program succeeded partly. This may be returned, if the user aborts a
176 program or some external data were wrong. */
177 #define RETURN_FAIL 20
178 /* Program execution failed. Normally used, if some system resources could
182 /* Secondary errors codes as used for IoErr(), SetIoErr() and in
183 Process->pr_Result2. The term 'object' refers to files of all kinds
184 (ie plain files, directories, links, etc). */
186 /* This is used, if something went wrong, but it is unknown what exactly
187 went wrong. This is especially useful for emulation devices, when the
188 underlying system returned an error that the emulation side does not
190 #define ERROR_UNKNOWN 100
193 /* General system errors */
195 #define ERROR_NO_FREE_STORE 103
196 /* Too many tasks are already running. */
197 #define ERROR_TASK_TABLE_FULL 105
199 /* Errors concerning ReadArgs(). See also <dos/rdargs.h>. */
200 /* Supplied template is broken */
201 #define ERROR_BAD_TEMPLATE 114
202 /* A supplied argument that was expected to be numeric, was not numeric.
203 This is also returned by some functions to expresss that a supplied
204 number is out of range (ie to express application internal errors). */
205 #define ERROR_BAD_NUMBER 115
206 /* An argument that has to be supplied (ie signed with the '/A' flag) was
208 #define ERROR_REQUIRED_ARG_MISSING 116
209 /* Keyword was specified, but not its contents. */
210 #define ERROR_KEY_NEEDS_ARG 117
211 /* There were more arguments than the template needs. */
212 #define ERROR_TOO_MANY_ARGS 118
213 /* An odd number of quotation marks was supplied. */
214 #define ERROR_UNMATCHED_QUOTES 119
215 /* Either the command-line was longer than hardcoded line length limit or the
216 maximum number of multiple arguments (flag '/M') was exceeded. This can
217 also indicate that some argument is too long or a supplied buffer is too
219 #define ERROR_LINE_TOO_LONG 120
221 /* Errors in files. */
222 /* You tried to execute a file that is not an executable. */
223 #define ERROR_FILE_NOT_OBJECT 121
224 /* A library or device could not be opened or that library or device is
226 #define ERROR_INVALID_RESIDENT_LIBRARY 122
227 #define ERROR_NO_DEFAULT_DIR 201
228 /* The accessed object is already in use (eg locked) by another task. */
229 #define ERROR_OBJECT_IN_USE 202
230 /* You tried to overwrite an object. */
231 #define ERROR_OBJECT_EXISTS 203
232 /* The given directory or the path of a given object does not exist. */
233 #define ERROR_DIR_NOT_FOUND 204
234 /* The given object does not exist. */
235 #define ERROR_OBJECT_NOT_FOUND 205
237 /* Miscellaneous errors. */
238 #define ERROR_BAD_STREAM_NAME 206
239 /* The given object is too large for the operation to be made. Object is
240 this context are for example components of path-names. */
241 #define ERROR_OBJECT_TOO_LARGE 207
242 /* This is usually used to indicate that a filesystem does not support a
243 certain action, but may generally also be used by functions. */
244 #define ERROR_ACTION_NOT_KNOWN 209
245 /* A path component was invalid (eg there were multiple colons in a path
247 #define ERROR_INVALID_COMPONENT_NAME 210
248 #define ERROR_INVALID_LOCK 211
249 /* You tried to perform an action on an object, which this kind of object
250 does not support (eg makedir on a file). */
251 #define ERROR_OBJECT_WRONG_TYPE 212
252 /* Writing failed, because the volume is not validated. */
253 #define ERROR_DISK_NOT_VALIDATED 213
254 /* Writing failed, because the volume is write-protected. */
255 #define ERROR_DISK_WRITE_PROTECTED 214
256 /* You tried to move/rename a file across different devices. Rename does only
257 work on the same device, as only the inode-data has to be changed to
258 perform that action. */
259 #define ERROR_RENAME_ACROSS_DEVICES 215
260 /* You tried to delete a directory that still contains some files. Delete
261 these files first. */
262 #define ERROR_DIRECTORY_NOT_EMPTY 216
263 /* A recursive directory search could not be performed, because the stack
265 #define ERROR_TOO_MANY_LEVELS 217
266 /* You tried to access a device that is currently not mounted. */
267 #define ERROR_DEVICE_NOT_MOUNTED 218
268 /* An error occured, while executing Seek(). */
269 #define ERROR_SEEK_ERROR 219
270 /* The supplied file comment was longer than the hardcoded length limit for
272 #define ERROR_COMMENT_TOO_BIG 220
273 /* A write-operation could not be performed, because the volume has no space
275 #define ERROR_DISK_FULL 221
276 /* You tried to delete a delete-protected object. */
277 #define ERROR_DELETE_PROTECTED 222
278 /* You tried to write to a write-protected object. This does not mean that
279 the volume, you wanted to write to, is write-protected! */
280 #define ERROR_WRITE_PROTECTED 223
281 /* You tried to read a read-protected object. */
282 #define ERROR_READ_PROTECTED 224
283 /* Accessed disk is unreadable. */
284 #define ERROR_NOT_A_DOS_DISK 225
285 /* You tried to perform an action on a device, which has no volume mounted
286 (eg an empty disk drive). */
287 #define ERROR_NO_DISK 226
288 /* This does not indicate an error, but is returned by several functions to
289 indicate that the last entry of a list was reached. */
290 #define ERROR_NO_MORE_ENTRIES 232
291 /* Given action can not be performed on a given object, because it is a
292 soft-link. This is usually only used by filesystem handlers and is catched
293 by dos. Applications should not see this. */
294 #define ERROR_IS_SOFT_LINK 233
295 /* Given action can not be performed on a given object, because it is a link.
297 #define ERROR_OBJECT_LINKED 234
298 /* There was a bad hunk in a file that was to load. */
299 #define ERROR_BAD_HUNK 235
300 /* Indicates that a function does not implement a certain functionality.
301 There are more special error conditions (ERROR_BAD_NUMBER and
302 ERROR_ACTION_NOT_KNOWN), which should be preferred, if applicable. */
303 #define ERROR_NOT_IMPLEMENTED 236
304 /* You tried to access a record that was not locked. */
305 #define ERROR_RECORD_NOT_LOCKED 240
306 /* Somebody already locked a part of the record, you wanted to lock. */
307 #define ERROR_LOCK_COLLISION 241
308 /* LockRecord() timed out. */
309 #define ERROR_LOCK_TIMEOUT 242
310 /* An error occured, while unlocking a record. */
311 #define ERROR_UNLOCK_ERROR 243
313 /* Further errors are defined in dosasl.h amd filesystem.h as well */
315 /* Maximum length of strings got from Fault(). Note that they should be
316 shorter than 60 characters. */
319 /* Signals that are set, if the user presses the corresponding keys on
320 the controlling terminal. They may also be sent by using Signal().
321 For more information see <exec/tasks.h>. */
322 #define SIGBREAKB_CTRL_C 12 /* CTRL-c, usually meaning program abortion. */
323 #define SIGBREAKB_CTRL_D 13 /* CTRL-d */
324 #define SIGBREAKB_CTRL_E 14 /* CTRL-e, usually meaning that the application
325 should iconify itself. */
326 #define SIGBREAKB_CTRL_F 15 /* CTRL-f, usually meaning that the application
327 should uniconify itself. */
329 #define SIGBREAKF_CTRL_C (1L<<SIGBREAKB_CTRL_C)
330 #define SIGBREAKF_CTRL_D (1L<<SIGBREAKB_CTRL_D)
331 #define SIGBREAKF_CTRL_E (1L<<SIGBREAKB_CTRL_E)
332 #define SIGBREAKF_CTRL_F (1L<<SIGBREAKB_CTRL_F)
334 /**********************************************************************
335 ********************** Constants for Functions ***********************
336 **********************************************************************/
338 /* Modes for Open(). */
339 /* Try to open old file. If it does not exist, Open() returns an error. */
340 #define MODE_OLDFILE 1005
341 /* A new file is created, even if a file with the supplied name does
343 #define MODE_NEWFILE 1006
344 /* An old file is opened. If it does not exist, a new one is created. */
345 #define MODE_READWRITE 1004
347 /* Locking mechanism as used in Lock() */
348 /* Non-exclusive lock, other tasks may lock this file as well. This is used
349 for read-only operations. */
350 #define SHARED_LOCK -2
351 #define ACCESS_READ SHARED_LOCK
352 /* Exclusive lock, other tasks may not lock this file. This is used for write
354 #define EXCLUSIVE_LOCK -1
355 #define ACCESS_WRITE EXCLUSIVE_LOCK
357 /* Returned by SameLock(). See autodocs for description. */
358 #define LOCK_DIFFERENT -1
360 #define LOCK_SAME_VOLUME 1
362 /* Used in MakeLink() */
367 #define OFFSET_BEGINNING -1
368 #define OFFSET_CURRENT 0
371 /* Limits of the "int" type */
372 #define MAXINT ((int)(((unsigned int)~0)/2))
373 #define MININT (-MAXINT - 1)
375 /* Used in ChangeMode() */
376 #define CHANGE_LOCK 0
379 /* Returned by ReadItem() */
380 #define ITEM_EQUAL -2
381 #define ITEM_ERROR -1
382 #define ITEM_NOTHING 0
383 #define ITEM_UNQUOTED 1
384 #define ITEM_QUOTED 2
386 /* The types for AllocDosObject() and FreeDosObject(). They specifiy which
387 kind of structure is to be allocated. */
388 #define DOS_FILEHANDLE 0 /* struct FileHandle <dos/dosextens.h> */
389 #define DOS_EXALLCONTROL 1 /* struct ExAllControl <dos/exall.h> */
390 #define DOS_FIB 2 /* struct FileInfoBlock (see above) */
391 #define DOS_STDPKT 3 /* struct DosPacket <dos/dosextens.h> */
392 #define DOS_CLI 4 /* struct CommandLineInterface <dos/dosextens.h> */
393 #define DOS_RDARGS 5 /* struct RDArgs <dos/rdargs.h> */
395 #endif /* DOS_DOS_H */