revert between 56095 -> 55830 in arch
[AROS.git] / compiler / posixc / __fdesc.h
blobeb6c8d6b330391ab50ef707785cd6f65458136ab
1 #ifndef ___FDESC_H
2 #define ___FDESC_H
4 /*
5 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: file descriptors handling internals - header file
9 Lang: english
12 #include <dos/dos.h>
14 /* file control block - one per file handle */
15 typedef struct _fcb
17 BPTR handle;// if privflags has flag _FCB_ISDIR: BCPL pointer to struct FileLock
18 // otherwise: BCPL pointer to struct FileHandle
19 int flags;
20 unsigned int opencount;
21 unsigned int privflags;
22 } fcb;
24 /* privflags */
25 #define _FCB_ISDIR ((unsigned int)1<<0)
26 #define _FCB_DONTCLOSE_FH ((unsigned int)1<<1)
27 #define _FCB_FLUSHONREAD ((unsigned int)1<<2)
28 #define _FCB_CONSOLERAW ((unsigned int)1<<3)
30 #define FLUSHONREADCHECK \
31 if (__builtin_expect(fdesc->fcb->privflags & _FCB_FLUSHONREAD, 0)) \
32 { \
33 fdesc->fcb->privflags &= ~_FCB_FLUSHONREAD; \
34 Flush(fdesc->fcb->handle); \
37 /* file descriptor structure - one per descriptor */
38 typedef struct _fdesc
40 fcb *fcb;
41 int fdflags;
42 } fdesc;
44 struct PosixCIntBase;
45 int __getfdslots(void);
46 void __getfdarray(APTR *arrayptr, int *slotsptr);
47 void __setfdarray(APTR array, int slots);
48 void __setfdarraybase(struct PosixCIntBase *PosixCBase2);
49 fdesc *__getfdesc(register int fd);
50 void __setfdesc(register int fd, fdesc *fdesc);
51 int __getfdslot(int wanted_fd);
52 int __getfirstfd(register int startfd);
53 int __open(int wanted_fd, const char *pathname, int flags, int mode);
54 void __updatestdio(void);
55 LONG __oflags2amode(int flags);
56 fdesc *__alloc_fdesc(void);
57 void __free_fdesc(fdesc *fdesc);
58 void __close_on_exec_fdescs(void);
60 #endif /* ___FDESC_H */