1 #ifndef __ALT_SYS_WRAPPERS_H__
2 #define __ALT_SYS_WRAPPERS_H__
3 
4 /******************************************************************************
5 *                                                                             *
6 * License Agreement                                                           *
7 *                                                                             *
8 * Copyright (c) 2003 Altera Corporation, San Jose, California, USA.           *
9 * All rights reserved.                                                        *
10 *                                                                             *
11 * Permission is hereby granted, free of charge, to any person obtaining a     *
12 * copy of this software and associated documentation files (the "Software"),  *
13 * to deal in the Software without restriction, including without limitation   *
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,    *
15 * and/or sell copies of the Software, and to permit persons to whom the       *
16 * Software is furnished to do so, subject to the following conditions:        *
17 *                                                                             *
18 * The above copyright notice and this permission notice shall be included in  *
19 * all copies or substantial portions of the Software.                         *
20 *                                                                             *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  *
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,    *
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      *
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING     *
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER         *
27 * DEALINGS IN THE SOFTWARE.                                                   *
28 *                                                                             *
29 *                                                                             *
30 ******************************************************************************/
31 
32 /*
33  * This file provides the prototypes for the HAL 'UNIX style functions. The
34  * names of these functions are defined in alt_syscall.h. THese are defined to
35  * be the standard names when running the standalone HAL, e.g. open(), close()
36  * etc., but the names may be redefined as a part of an operating system port
37  * in order to avoid name clashes.
38  */
39 
40 #include "os/alt_syscall.h"
41 
42 #include <unistd.h>
43 #include <sys/times.h>
44 #include <sys/types.h>
45 #include <sys/stat.h>
46 #include <sys/time.h>
47 #include <sys/times.h>
48 
49 extern int     ALT_CLOSE (int __fd);
50 extern int     ALT_EXECVE (const char *__path,
51                            char * const __argv[],
52                            char * const __envp[]);
53 extern void    ALT_EXIT (int __status);
54 extern int     ALT_FSTAT (int file, struct stat *st);
55 extern int     ALT_FCNTL (int file, int cmd, ...);
56 extern pid_t   ALT_FORK (void);
57 extern pid_t   ALT_GETPID (void);
58 
59 #if defined (__GNUC__) && __GNUC__ >= 4
60 extern int     ALT_GETTIMEOFDAY (struct timeval  *ptimeval,
61                                  void *ptimezone);
62 #else
63 extern int     ALT_GETTIMEOFDAY (struct timeval  *ptimeval,
64                                  struct timezone *ptimezone);
65 #endif
66 
67 extern int     ALT_IOCTL (int file, int req, void* arg);
68 extern int     ALT_ISATTY (int file);
69 extern int     ALT_KILL (int pid, int sig);
70 extern int     ALT_LINK (const char *existing, const char *new);
71 extern off_t   ALT_LSEEK (int file, off_t ptr, int dir);
72 extern int     ALT_OPEN (const char* file, int flags, ...);
73 extern int     ALT_READ (int file, void *ptr, size_t len);
74 extern int     ALT_RENAME (char *existing, char *new);
75 extern void*   ALT_SBRK (ptrdiff_t incr);
76 extern int     ALT_SETTIMEOFDAY (const struct timeval  *t,
77                                  const struct timezone *tz);
78 extern int     ALT_STAT (const char *file, struct stat *st);
79 extern clock_t ALT_TIMES (struct tms *buf);
80 extern int     ALT_UNLINK (const char *name);
81 
82 #if defined (__GNUC__) && __GNUC__ >= 4
83 int ALT_USLEEP (useconds_t us);
84 #else
85 unsigned int   ALT_USLEEP (unsigned int us);
86 #endif
87 
88 extern int     ALT_WAIT (int *status);
89 extern int     ALT_WRITE (int file, const void *ptr, size_t len);
90 
91 
92 extern char** ALT_ENVIRON;
93 
94 /*
95  *
96  */
97 
98 #endif /* __ALT_SYS_WRAPPERS_H__ */
99