Cygwin: access: Fix X_OK behaviour for backup operators and admins
[newlib-cygwin.git] / newlib / libc / sys / h8500hms / syscalls.c
blob0f3471ab05c520f0515550b25684d1df47feb42b
2 #include <_ansi.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <unistd.h>
7 int
8 _read (file, ptr, len)
9 int file;
10 char *ptr;
11 size_t len;
14 return 0;
18 int
19 _lseek (file, ptr, dir)
20 int file;
21 int ptr;
22 int dir;
25 return 0;
29 static
30 writechar (c)
31 char c;
35 register int n asm ("r3");
36 n = c;
37 asm ("clr.w r1;mov.w %0,r0; mov.w #6,r3; trapa #15": :"g" (n) : "r3","r1","r0");
42 int
43 _write (file, ptr, len)
44 int file;
45 char *ptr;
46 size_t len;
49 int todo;
51 for (todo = 0; todo < len; todo++)
53 writechar (*ptr++);
55 return len;
61 int
62 _close (file)
63 int file;
66 return -1;
71 caddr_t
72 _sbrk (incr)
73 size_t incr;
75 extern char end; /* Defined by the linker */
76 static char *heap_end;
77 char *prev_heap_end;
79 if (heap_end == 0)
81 heap_end = &end;
83 prev_heap_end = heap_end;
84 if (heap_end + incr > stack_ptr)
86 _write (1, "Heap and stack collision\n", 25);
87 abort ();
89 heap_end += incr;
90 return (caddr_t) prev_heap_end;
95 int
96 _isatty (file)
97 int file;
99 return 1;
104 int
105 _fstat (file, stat)
106 int file;
107 struct stat *stat;
110 stat->st_mode = S_IFCHR;
111 return 0;
114 int
115 _open (path, flags)
116 const char *path;
117 int flags;
120 return 0;
124 void
125 _exit (status)
126 int status;
128 asm (" mov.w #33,r3; trapa #15");