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