1 /*
2  * Support file for nvptx in newlib.
3  * Copyright (c) 2014-2018 Mentor Graphics.
4  *
5  * The authors hereby grant permission to use, copy, modify, distribute,
6  * and license this software and its documentation for any purpose, provided
7  * that existing copyright notices are retained in all copies and that this
8  * notice is included verbatim in any distributions. No written agreement,
9  * license, or royalty fee is required for any of the authorized uses.
10  * Modifications to this software may be copyrighted by their authors
11  * and need not follow the licensing terms described here, provided that
12  * the new terms are clearly indicated on the first page of each file where
13  * they apply.
14  */
15 
16 #include <errno.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <sys/time.h>
20 
21 #undef errno
22 extern int errno;
23 
24 int
close(int fd)25 close(int fd) {
26   return -1;
27 }
28 
29 int
fstat(int fd,struct stat * buf)30 fstat (int fd, struct stat *buf) {
31   return -1;
32 }
33 
34 int
gettimeofday(struct timeval * tv,void * tz)35 gettimeofday (struct timeval *tv, void *tz) {
36   return -1;
37 }
38 
39 int
getpid(void)40 getpid (void) {
41   return 0;
42 }
43 
44 int
isatty(int fd)45 isatty (int fd) {
46   return fd == 1;
47 }
48 
49 int
kill(int pid,int sig)50 kill (int pid, int sig) {
51   errno = ESRCH;
52   return -1;
53 }
54 
55 off_t
lseek(int fd,off_t offset,int whence)56 lseek(int fd, off_t offset, int whence) {
57   return 0;
58 }
59 
60 int
open(const char * pathname,int flags,...)61 open (const char *pathname, int flags, ...) {
62   return -1;
63 }
64 
65 int
read(int fd,void * buf,size_t count)66 read(int fd, void *buf, size_t count) {
67   return 0;
68 }
69 
70 int
stat(const char * file,struct stat * pstat)71 stat (const char *file, struct stat *pstat) {
72   errno = EACCES;
73   return -1;
74 }
75 
76 void
sync(void)77 sync (void) {
78 }
79 
80 int
unlink(const char * pathname)81 unlink (const char *pathname) {
82   return -1;
83 }
84