mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-13 16:09:00 +08:00
46 lines
799 B
C
46 lines
799 B
C
#include <sys/stat.h>
|
|
|
|
#include "mcu.h"
|
|
|
|
int _fstat(int fd, struct stat *st) {
|
|
if (fd < 0) return -1;
|
|
st->st_mode = S_IFCHR;
|
|
return 0;
|
|
}
|
|
|
|
int _write(int fd, char *ptr, int len) {
|
|
(void) fd, (void) ptr, (void) len;
|
|
if (fd == 1) uart_write_buf(UART0, ptr, (size_t) len);
|
|
return len;
|
|
}
|
|
|
|
void *_sbrk(int incr) {
|
|
extern char _end;
|
|
static unsigned char *heap = NULL;
|
|
unsigned char *prev_heap;
|
|
if (heap == NULL) heap = (unsigned char *) &_end;
|
|
prev_heap = heap;
|
|
heap += incr;
|
|
return prev_heap;
|
|
}
|
|
|
|
int _close(int fd) {
|
|
(void) fd;
|
|
return -1;
|
|
}
|
|
|
|
int _isatty(int fd) {
|
|
(void) fd;
|
|
return 1;
|
|
}
|
|
|
|
int _read(int fd, char *ptr, int len) {
|
|
(void) fd, (void) ptr, (void) len;
|
|
return -1;
|
|
}
|
|
|
|
int _lseek(int fd, int ptr, int dir) {
|
|
(void) fd, (void) ptr, (void) dir;
|
|
return 0;
|
|
}
|