]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/backends/minimal_io/write.c
update
[l4.git] / l4 / pkg / uclibc / lib / backends / minimal_io / write.c
1 /**
2  * \file   dietlibc/lib/backends/minimal_io/write.c
3  * \brief  
4  *
5  * \date   08/10/2004
6  * \author Martin Pohlack  <mp26@os.inf.tu-dresden.de>
7  */
8 /*
9  * (c) 2004-2009 Technische Universität Dresden
10  * This file is part of TUD:OS and distributed under the terms of the
11  * GNU Lesser General Public License 2.1.
12  * Please see the COPYING-LGPL-2.1 file for details.
13  */
14 #include <errno.h>
15 #include <stdio.h>
16 #include <unistd.h>
17
18 #include <l4/sys/kdebug.h>
19
20 ssize_t write(int fd, const void *buf, size_t count)
21 {
22     // just accept write to stdout and stderr
23     if ((fd == STDOUT_FILENO) || (fd == STDERR_FILENO))
24     {
25         outnstring((const char*)buf, count);
26         return count;
27     }
28
29     // writes to other fds shall fail fast
30     errno = EBADF;
31     return -1;
32 }