OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [reent/] [writer.c] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/* Reentrant versions of write system call. */
2
 
3
#include <reent.h>
4
#include <unistd.h>
5
#include <_syslist.h>
6
 
7
/* Some targets provides their own versions of this functions.  Those
8
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
9
 
10
#ifdef _REENT_ONLY
11
#ifndef REENTRANT_SYSCALLS_PROVIDED
12
#define REENTRANT_SYSCALLS_PROVIDED
13
#endif
14
#endif
15
 
16
#ifndef REENTRANT_SYSCALLS_PROVIDED
17
 
18
/* We use the errno variable used by the system dependent layer.  */
19
#undef errno
20
extern int errno;
21
 
22
/*
23
FUNCTION
24
        <<_write_r>>---Reentrant version of write
25
 
26
INDEX
27
        _write_r
28
 
29
ANSI_SYNOPSIS
30
        #include <reent.h>
31
        _ssize_t _write_r(struct _reent *<[ptr]>,
32
                          int <[fd]>, const void *<[buf]>, size_t <[cnt]>);
33
 
34
TRAD_SYNOPSIS
35
        #include <reent.h>
36
        _ssize_t _write_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>)
37
        struct _reent *<[ptr]>;
38
        int <[fd]>;
39
        char *<[buf]>;
40
        size_t <[cnt]>;
41
 
42
DESCRIPTION
43
        This is a reentrant version of <<write>>.  It
44
        takes a pointer to the global data block, which holds
45
        <<errno>>.
46
*/
47
 
48
_ssize_t
49
_DEFUN (_write_r, (ptr, fd, buf, cnt),
50
     struct _reent *ptr _AND
51
     int fd _AND
52
     _CONST _PTR buf _AND
53
     size_t cnt)
54
{
55
  _ssize_t ret;
56
 
57
  errno = 0;
58
  if ((ret = (_ssize_t)_write (fd, buf, cnt)) == -1 && errno != 0)
59
    ptr->_errno = errno;
60
  return ret;
61
}
62
 
63
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.