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 <picolibc.h>
17 
18 #include <errno.h>
19 #include <sys/types.h>
20 #include <sys/stat.h>
21 #include <sys/time.h>
22 
23 #undef errno
24 extern int errno;
25 
26 int
close(int fd)27 close(int fd) {
28   return -1;
29 }
30 
31 int
fstat(int fd,struct stat * buf)32 fstat (int fd, struct stat *buf) {
33   return -1;
34 }
35 
36 int
gettimeofday(struct timeval * tv,void * tz)37 gettimeofday (struct timeval *tv, void *tz) {
38   return -1;
39 }
40 
41 int
getpid(void)42 getpid (void) {
43   return 0;
44 }
45 
46 int
isatty(int fd)47 isatty (int fd) {
48   return fd == 1;
49 }
50 
51 int
kill(int pid,int sig)52 kill (int pid, int sig) {
53   errno = ESRCH;
54   return -1;
55 }
56 
57 off_t
lseek(int fd,off_t offset,int whence)58 lseek(int fd, off_t offset, int whence) {
59   return 0;
60 }
61 
62 int
open(const char * pathname,int flags,...)63 open (const char *pathname, int flags, ...) {
64   return -1;
65 }
66 
67 int
read(int fd,void * buf,size_t count)68 read(int fd, void *buf, size_t count) {
69   return 0;
70 }
71 
72 int
stat(const char * file,struct stat * pstat)73 stat (const char *file, struct stat *pstat) {
74   errno = EACCES;
75   return -1;
76 }
77 
78 void
sync(void)79 sync (void) {
80 }
81 
82 int
unlink(const char * pathname)83 unlink (const char *pathname) {
84   return -1;
85 }
86