1 /*
2 * Simple libc-backend to satisfy write(1, x, y)
3 */
4 /*
5 * (c) 2009 Alexander Warg <warg@os.inf.tu-dresden.de>
6 * economic rights: Technische Universität Dresden (Germany)
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU Lesser General Public License 2.1.
9 * Please see the COPYING-LGPL-2.1 file for details.
10 */
11
12 #include <l4/re/env>
13 #include <sys/types.h>
14 #include <unistd.h>
15 #include <errno.h>
16
write(int fd,const void * buf,size_t count)17 extern "C" ssize_t write(int fd, const void *buf, size_t count)
18 {
19 if (fd == 1 || fd == 2)
20 {
21 L4Re::Env::env()->log()->printn((const char *)buf, count);
22 return count;
23 }
24
25 errno = EBADF;
26 return -1;
27 }
28
read(int,void *,size_t)29 extern "C" ssize_t read(int, void *, size_t)
30 {
31 errno = EBADF;
32 return -1;
33 }
34
lseek(int,__off_t,int)35 extern "C" __off_t lseek(int, __off_t, int) L4_NOTHROW
36 {
37 errno = EBADF;
38 return -1;
39 }
40
lseek64(int,__off64_t,int)41 extern "C" __off64_t lseek64(int, __off64_t, int) L4_NOTHROW
42 {
43 errno = EBADF;
44 return -1;
45 }
46