]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/m2/pge-boot/Glibc.h
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / pge-boot / Glibc.h
CommitLineData
1eee94d3
GM
1/* do not edit automatically generated by mc from libc. */
2/* libc.def provides an interface to the C library functions.
3
83ffe9cd 4Copyright (C) 2001-2023 Free Software Foundation, Inc.
1eee94d3
GM
5Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6
7This file is part of GNU Modula-2.
8
9GNU Modula-2 is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 3, or (at your option)
12any later version.
13
14GNU Modula-2 is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17General Public License for more details.
18
19Under Section 7 of GPL version 3, you are granted additional
20permissions described in the GCC Runtime Library Exception, version
213.1, as published by the Free Software Foundation.
22
23You should have received a copy of the GNU General Public License and
24a copy of the GCC Runtime Library Exception along with this program;
25see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26<http://www.gnu.org/licenses/>. */
27
28
29#if !defined (_libc_H)
30# define _libc_H
31
32#include "config.h"
33#include "system.h"
34# ifdef __cplusplus
35extern "C" {
36# endif
37# if !defined (PROC_D)
38# define PROC_D
39 typedef void (*PROC_t) (void);
40 typedef struct { PROC_t proc; } PROC;
41# endif
42
43# include "GSYSTEM.h"
44
45# if defined (_libc_C)
46# define EXTERN
47# else
48# define EXTERN extern
49# endif
50
51typedef long int libc_time_t;
52
53typedef struct libc_tm_r libc_tm;
54
55typedef struct libc_timeb_r libc_timeb;
56
57typedef struct libc_exitP_p libc_exitP;
58
59typedef libc_tm *libc_ptrToTM;
60
61struct libc_tm_r {
62 int tm_sec;
63 int tm_min;
64 int tm_hour;
65 int tm_mday;
66 int tm_mon;
67 int tm_year;
68 int tm_wday;
69 int tm_yday;
70 int tm_isdst;
71 long int tm_gmtoff;
72 void *tm_zone;
73 };
74
75struct libc_timeb_r {
76 libc_time_t time_;
77 short unsigned int millitm;
78 short unsigned int timezone;
79 short unsigned int dstflag;
80 };
81
82typedef int (*libc_exitP_t) (void);
83typedef libc_exitP_t libc_exitP_C;
84
85struct libc_exitP_p { libc_exitP_t proc; };
86
87EXTERN ssize_t libc_write (int d, void * buf, size_t nbytes);
88EXTERN ssize_t libc_read (int d, void * buf, size_t nbytes);
89EXTERN int libc_system (void * a);
90
91/*
92 abort - generate a fault
93
94 abort() first closes all open files if possible, then sends
95 an IOT signal to the process. This signal usually results
96 in termination with a core dump, which may be used for
97 debugging.
98
99 It is possible for abort() to return control if is caught or
100 ignored, in which case the value returned is that of the
101 kill(2V) system call.
102*/
103
104EXTERN void libc_abort (void) __attribute__ ((noreturn));
105
106/*
107 malloc - memory allocator.
108
109 void *malloc(size_t size);
110
111 malloc() returns a pointer to a block of at least size
112 bytes, which is appropriately aligned. If size is zero,
113 malloc() returns a non-NULL pointer, but this pointer should
114 not be dereferenced.
115*/
116
117EXTERN void * libc_malloc (size_t size);
118
119/*
120 free - memory deallocator.
121
122 free (void *ptr);
123
124 free() releases a previously allocated block. Its argument
125 is a pointer to a block previously allocated by malloc,
126 calloc, realloc, malloc, or memalign.
127*/
128
129EXTERN void libc_free (void * ptr);
130EXTERN void * libc_realloc (void * ptr, size_t size);
131
132/*
133 isatty - does this descriptor refer to a terminal.
134*/
135
136EXTERN int libc_isatty (int fd);
137
138/*
139 exit - returns control to the invoking process. Result, r, is
140 returned.
141*/
142
143EXTERN void libc_exit (int r) __attribute__ ((noreturn));
144
145/*
146 getenv - returns the C string for the equivalent C environment
147 variable.
148*/
149
150EXTERN void * libc_getenv (void * s);
151
152/*
153 putenv - change or add an environment variable.
154*/
155
156EXTERN int libc_putenv (void * s);
157
158/*
159 getpid - returns the UNIX process identification number.
160*/
161
162EXTERN int libc_getpid (void);
163
164/*
165 dup - duplicates the file descriptor, d.
166*/
167
168EXTERN int libc_dup (int d);
169
170/*
171 close - closes the file descriptor, d.
172*/
173
174EXTERN int libc_close (int d);
175
176/*
177 open - open the file, filename with flag and mode.
178*/
179
180EXTERN int libc_open (void * filename, int oflag, ...);
181
182/*
183 creat - creates a new file
184*/
185
186EXTERN int libc_creat (void * filename, unsigned int mode);
187
188/*
189 lseek - calls unix lseek:
190
191 off_t lseek(int fildes, off_t offset, int whence);
192*/
193
194EXTERN long int libc_lseek (int fd, long int offset, int whence);
195
196/*
197 perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS).
198*/
199
200EXTERN void libc_perror (const char *string_, unsigned int _string_high);
201
202/*
203 readv - reads an io vector of bytes.
204*/
205
206EXTERN int libc_readv (int fd, void * v, int n);
207
208/*
209 writev - writes an io vector of bytes.
210*/
211
212EXTERN int libc_writev (int fd, void * v, int n);
213
214/*
215 getcwd - copies the absolute pathname of the
216 current working directory to the array pointed to by buf,
217 which is of length size.
218
219 If the current absolute path name would require a buffer
220 longer than size elements, NULL is returned, and errno is
221 set to ERANGE; an application should check for this error,
222 and allocate a larger buffer if necessary.
223*/
224
225EXTERN void * libc_getcwd (void * buf, size_t size);
226
227/*
228 chown - The owner of the file specified by path or by fd is
229 changed. Only the super-user may change the owner of a
230 file. The owner of a file may change the group of the
231 file to any group of which that owner is a member. The
232 super-user may change the group arbitrarily.
233
234 If the owner or group is specified as -1, then that ID is
235 not changed.
236
237 On success, zero is returned. On error, -1 is returned,
238 and errno is set appropriately.
239*/
240
241EXTERN int libc_chown (void * filename, int uid, int gid);
242
243/*
244 strlen - returns the length of string, a.
245*/
246
247EXTERN size_t libc_strlen (void * a);
248
249/*
250 strcpy - copies string, src, into, dest.
251 It returns dest.
252*/
253
254EXTERN void * libc_strcpy (void * dest, void * src);
255
256/*
257 strncpy - copies string, src, into, dest, copying at most, n, bytes.
258 It returns dest.
259*/
260
261EXTERN void * libc_strncpy (void * dest, void * src, unsigned int n);
262
263/*
264 unlink - removes file and returns 0 if successful.
265*/
266
267EXTERN int libc_unlink (void * file);
268
269/*
270 memcpy - copy memory area
271
272 SYNOPSIS
273
274 #include <string.h>
275
276 void *memcpy(void *dest, const void *src, size_t n);
277 It returns dest.
278*/
279
280EXTERN void * libc_memcpy (void * dest, void * src, size_t size);
281
282/*
283 memset - fill memory with a constant byte
284
285 SYNOPSIS
286
287 #include <string.h>
288
289 void *memset(void *s, int c, size_t n);
290 It returns s.
291*/
292
293EXTERN void * libc_memset (void * s, int c, size_t size);
294
295/*
296 memmove - copy memory areas which may overlap
297
298 SYNOPSIS
299
300 #include <string.h>
301
302 void *memmove(void *dest, const void *src, size_t n);
303 It returns dest.
304*/
305
306EXTERN void * libc_memmove (void * dest, void * src, size_t size);
307EXTERN int libc_printf (const char *format_, unsigned int _format_high, ...);
308
309/*
310 setenv - sets environment variable, name, to value.
311 It will overwrite an existing value if, overwrite,
312 is true. It returns 0 on success and -1 for an error.
313*/
314
315EXTERN int libc_setenv (void * name, void * value, int overwrite);
316
317/*
318 srand - initialize the random number seed.
319*/
320
321EXTERN void libc_srand (int seed);
322
323/*
324 rand - return a random integer.
325*/
326
327EXTERN int libc_rand (void);
328
329/*
330 time - returns a pointer to the time_t value. If, a,
331 is not NIL then the libc value is copied into
332 memory at address, a.
333*/
334
335EXTERN libc_time_t libc_time (void * a);
336
337/*
338 localtime - returns a pointer to the libc copy of the tm
339 structure.
340*/
341
342EXTERN void * libc_localtime (libc_time_t *t);
343
344/*
345 ftime - return date and time.
346*/
347
348EXTERN int libc_ftime (libc_timeb *t);
349
350/*
351 shutdown - shutdown a socket, s.
352 if how = 0, then no more reads are allowed.
353 if how = 1, then no more writes are allowed.
354 if how = 2, then mo more reads or writes are allowed.
355*/
356
357EXTERN int libc_shutdown (int s, int how);
358
359/*
360 rename - change the name or location of a file
361*/
362
363EXTERN int libc_rename (void * oldpath, void * newpath);
364
365/*
366 setjmp - returns 0 if returning directly, and non-zero
367 when returning from longjmp using the saved
368 context.
369*/
370
371EXTERN int libc_setjmp (void * env);
372
373/*
374 longjmp - restores the environment saved by the last call
375 of setjmp with the corresponding env argument.
376 After longjmp is completed, program execution
377 continues as if the corresponding call of setjmp
378 had just returned the value val. The value of
379 val must not be zero.
380*/
381
382EXTERN void libc_longjmp (void * env, int val);
383
384/*
385 atexit - execute, proc, when the function exit is called.
386*/
387
388EXTERN int libc_atexit (libc_exitP_C proc);
389
390/*
391 ttyname - returns a pointer to a string determining the ttyname.
392*/
393
394EXTERN void * libc_ttyname (int filedes);
395
396/*
397 sleep - calling thread sleeps for seconds.
398*/
399
400EXTERN unsigned int libc_sleep (unsigned int seconds);
401
402/*
403 execv - execute a file.
404*/
405
406EXTERN int libc_execv (void * pathname, void * argv);
407# ifdef __cplusplus
408}
409# endif
410
411# undef EXTERN
412#endif