| 1 | /* sys/syscalls.h (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes
|
|---|
| 2 | sys/filefind.c (libc) -- Copyright (c) 2003 by Andrew Zabolotny
|
|---|
| 3 | sys/filefind.c (libc) -- Copyright (c) 2003 by Knut St. Osmundsen
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #include "libc-alias.h"
|
|---|
| 7 | #include <sys/signal.h>
|
|---|
| 8 | #include <sys/types.h>
|
|---|
| 9 | #include <InnoTekLIBC/sharedpm.h>
|
|---|
| 10 |
|
|---|
| 11 | #ifndef __LIBC_THREAD_DECLARED
|
|---|
| 12 | #define __LIBC_THREAD_DECLARED
|
|---|
| 13 | struct __libc_thread;
|
|---|
| 14 | typedef struct __libc_thread *__LIBC_PTHREAD, **__LIBC_PPTHREAD;
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | #if !defined (NULL)
|
|---|
| 18 | #define NULL ((void *)0)
|
|---|
| 19 | #endif
|
|---|
| 20 |
|
|---|
| 21 | #if !defined (INIT)
|
|---|
| 22 | #define EXTERN extern
|
|---|
| 23 | #define INIT(x)
|
|---|
| 24 | #endif
|
|---|
| 25 |
|
|---|
| 26 | #define BEGIN do {
|
|---|
| 27 | #define END } while (0)
|
|---|
| 28 |
|
|---|
| 29 | #if !defined (_OS2EMX_H)
|
|---|
| 30 | typedef unsigned long ULONG;
|
|---|
| 31 | #endif
|
|---|
| 32 |
|
|---|
| 33 | /* This macro is used for accessing FDATE or FTIME values as
|
|---|
| 34 | USHORT. */
|
|---|
| 35 |
|
|---|
| 36 | #define XUSHORT(x) (*(USHORT *)&(x))
|
|---|
| 37 |
|
|---|
| 38 | /* Maximum number of heap objects (16 = 512 / 32). */
|
|---|
| 39 |
|
|---|
| 40 | #define MAX_HEAP_OBJS 16
|
|---|
| 41 |
|
|---|
| 42 | /* This structure describes one heap object. */
|
|---|
| 43 |
|
|---|
| 44 | struct heap_obj
|
|---|
| 45 | {
|
|---|
| 46 | ULONG base; /* Base address */
|
|---|
| 47 | ULONG end; /* End address */
|
|---|
| 48 | ULONG brk; /* Address of first unused byte */
|
|---|
| 49 | };
|
|---|
| 50 |
|
|---|
| 51 | EXTERN unsigned _sys_uflags INIT (0);
|
|---|
| 52 | EXTERN unsigned long _sys_clock0_ms INIT (0);
|
|---|
| 53 | EXTERN long _sys_ino INIT (0x100000);
|
|---|
| 54 | EXTERN int _sys_pid;
|
|---|
| 55 | EXTERN int _sys_ppid;
|
|---|
| 56 |
|
|---|
| 57 | /** Virtual address limit and high memory indicator.
|
|---|
| 58 | *
|
|---|
| 59 | * Zero means limit is 512MB.
|
|---|
| 60 | * Non zero means more that 512MB. The value is then the size of then the user
|
|---|
| 61 | * address space size in bytes.
|
|---|
| 62 | *
|
|---|
| 63 | * Initiated by __init_dll().
|
|---|
| 64 | */
|
|---|
| 65 | EXTERN unsigned long _sys_gcbVirtualAddressLimit;
|
|---|
| 66 |
|
|---|
| 67 | /* The top heap object. This points into _sys_heap_objs[] or is NULL.
|
|---|
| 68 | While this variable is NULL, no memory has been allocated. */
|
|---|
| 69 |
|
|---|
| 70 | EXTERN struct heap_obj *_sys_top_heap_obj;
|
|---|
| 71 |
|
|---|
| 72 | /* This array holds information on all the heap objects. The heap
|
|---|
| 73 | objects are managed in LIFO fashion. */
|
|---|
| 74 |
|
|---|
| 75 | EXTERN struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS];
|
|---|
| 76 |
|
|---|
| 77 | /* This is the number of heap objects. */
|
|---|
| 78 |
|
|---|
| 79 | EXTERN unsigned _sys_heap_obj_count;
|
|---|
| 80 |
|
|---|
| 81 | /* This variable can be initialized by the application to control the
|
|---|
| 82 | size of the heap object(s). */
|
|---|
| 83 |
|
|---|
| 84 | extern unsigned _sys_heap_size;
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | #if defined (_OS2EMX_H)
|
|---|
| 88 |
|
|---|
| 89 | /** Test if a DOS/OS2 file time is zero. */
|
|---|
| 90 | #define FTIMEZEROP(x) (*(PUSHORT)&(x) == 0)
|
|---|
| 91 | /** Test if a DOS/OS2 file date is zero. */
|
|---|
| 92 | #define FDATEZEROP(x) (*(PUSHORT)&(x) == 0)
|
|---|
| 93 |
|
|---|
| 94 | long _sys_p2t(FTIME t, FDATE d);
|
|---|
| 95 |
|
|---|
| 96 | #endif /* _OS2EMX_H */
|
|---|
| 97 |
|
|---|
| 98 | void _sys_get_clock (unsigned long *ms);
|
|---|
| 99 |
|
|---|
| 100 | /** @group Heap stuff.
|
|---|
| 101 | * @{ */
|
|---|
| 102 | ULONG _sys_expand_heap_obj_by (ULONG incr);
|
|---|
| 103 | ULONG _sys_expand_heap_by (ULONG incr, ULONG sbrk_model);
|
|---|
| 104 | ULONG _sys_shrink_heap_to (ULONG new_brk);
|
|---|
| 105 | ULONG _sys_shrink_heap_by (ULONG decr, ULONG sbrk_model);
|
|---|
| 106 | ULONG _sys_shrink_heap_obj_by (ULONG decr);
|
|---|
| 107 | #ifdef _SYS_FMUTEX_H
|
|---|
| 108 | /** This mutex semaphore protects the heap. */
|
|---|
| 109 | EXTERN _fmutex _sys_heap_fmutex;
|
|---|
| 110 | /** Mutex semaphore protecting the list of high memory big blocks. */
|
|---|
| 111 | EXTERN _fmutex _sys_gmtxHimem;
|
|---|
| 112 | #endif
|
|---|
| 113 | /** @} */
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | /** @group Init Functions
|
|---|
| 117 | * @{ */
|
|---|
| 118 | extern void __init(int fFlags);
|
|---|
| 119 | extern int __init_dll(int fFlags, unsigned long hmod);
|
|---|
| 120 | extern void /*volatile*/_sys_init_ret(void *stack) __attribute__((__noreturn__));
|
|---|
| 121 | extern int _sys_init_environ(const char *pszEnv);
|
|---|
| 122 | extern void _sys_init_largefileio(void);
|
|---|
| 123 | extern int __libc_fhInit(void);
|
|---|
| 124 | /** @} */
|
|---|
| 125 |
|
|---|
| 126 | /** @defgroup grp_sys_inherit Inherit Function
|
|---|
| 127 | * @{ */
|
|---|
| 128 | __LIBC_PSPMINHFHBHDR __libc_fhInheritPack(size_t *pcb, char **ppszStrings, size_t *pcbStrings);
|
|---|
| 129 | void __libc_fhInheritDone(void);
|
|---|
| 130 | /** @} */
|
|---|
| 131 |
|
|---|
| 132 | /** @group Term Functions
|
|---|
| 133 | * @{ */
|
|---|
| 134 | extern int _sys_term_filehandles(void);
|
|---|
| 135 | /** @} */
|
|---|
| 136 |
|
|---|
| 137 | /** @group Error code and errno Functions.
|
|---|
| 138 | * @{ */
|
|---|
| 139 | extern void _sys_set_errno(unsigned long rc);
|
|---|
| 140 | extern int __libc_native2errno(unsigned long rc);
|
|---|
| 141 | /** @} */
|
|---|
| 142 |
|
|---|
| 143 | /** @group Exec, Spawn and Fork stuff.
|
|---|
| 144 | * @{ */
|
|---|
| 145 | #ifdef _SYS_FMUTEX_H
|
|---|
| 146 | EXTERN _fmutex __libc_gmtxExec INIT({0});
|
|---|
| 147 | #endif
|
|---|
| 148 | void __libc_fhExecDone(void);
|
|---|
| 149 | /** @} */
|
|---|
| 150 |
|
|---|