source: branches/libc-0.6/src/emx/src/lib/sys/syscalls.h@ 3373

Last change on this file since 3373 was 3373, checked in by bird, 19 years ago

Wait for spawned/execed child so it can finish inherting us. Close file handles on exec. Fixes #168.Fixes #167.

  • Property cvs2svn:cvs-rev set to 1.17
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.0 KB
Line 
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
13struct __libc_thread;
14typedef 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)
30typedef 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
44struct heap_obj
45{
46 ULONG base; /* Base address */
47 ULONG end; /* End address */
48 ULONG brk; /* Address of first unused byte */
49};
50
51EXTERN unsigned _sys_uflags INIT (0);
52EXTERN unsigned long _sys_clock0_ms INIT (0);
53EXTERN long _sys_ino INIT (0x100000);
54EXTERN int _sys_pid;
55EXTERN 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 */
65EXTERN 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
70EXTERN 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
75EXTERN struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS];
76
77/* This is the number of heap objects. */
78
79EXTERN 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
84extern 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
94long _sys_p2t(FTIME t, FDATE d);
95
96#endif /* _OS2EMX_H */
97
98void _sys_get_clock (unsigned long *ms);
99
100/** @group Heap stuff.
101 * @{ */
102ULONG _sys_expand_heap_obj_by (ULONG incr);
103ULONG _sys_expand_heap_by (ULONG incr, ULONG sbrk_model);
104ULONG _sys_shrink_heap_to (ULONG new_brk);
105ULONG _sys_shrink_heap_by (ULONG decr, ULONG sbrk_model);
106ULONG _sys_shrink_heap_obj_by (ULONG decr);
107#ifdef _SYS_FMUTEX_H
108/** This mutex semaphore protects the heap. */
109EXTERN _fmutex _sys_heap_fmutex;
110/** Mutex semaphore protecting the list of high memory big blocks. */
111EXTERN _fmutex _sys_gmtxHimem;
112#endif
113/** @} */
114
115
116/** @group Init Functions
117 * @{ */
118extern void __init(int fFlags);
119extern int __init_dll(int fFlags, unsigned long hmod);
120extern void /*volatile*/_sys_init_ret(void *stack) __attribute__((__noreturn__));
121extern int _sys_init_environ(const char *pszEnv);
122extern void _sys_init_largefileio(void);
123extern 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);
129void __libc_fhInheritDone(void);
130/** @} */
131
132/** @group Term Functions
133 * @{ */
134extern int _sys_term_filehandles(void);
135/** @} */
136
137/** @group Error code and errno Functions.
138 * @{ */
139extern void _sys_set_errno(unsigned long rc);
140extern int __libc_native2errno(unsigned long rc);
141/** @} */
142
143/** @group Exec, Spawn and Fork stuff.
144 * @{ */
145#ifdef _SYS_FMUTEX_H
146EXTERN _fmutex __libc_gmtxExec INIT({0});
147#endif
148void __libc_fhExecDone(void);
149/** @} */
150
Note: See TracBrowser for help on using the repository browser.