OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [stdio64/] [stdio64.c] - Blame information for rev 645

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

Line No. Rev Author Line
1 207 jeremybenn
/* No user fns here.  Pesch 15apr92. */
2
 
3
/*
4
 * Copyright (c) 1990 The Regents of the University of California.
5
 * All rights reserved.
6
 *
7
 * Redistribution and use in source and binary forms are permitted
8
 * provided that the above copyright notice and this paragraph are
9
 * duplicated in all such forms and that any documentation,
10
 * advertising materials, and other materials related to such
11
 * distribution and use acknowledge that the software was developed
12
 * by the University of California, Berkeley.  The name of the
13
 * University may not be used to endorse or promote products derived
14
 * from this software without specific prior written permission.
15
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
 */
19
 
20
#include <stdio.h>
21
#include <sys/types.h>
22
#include <fcntl.h>
23
#include <sys/unistd.h>
24
#include <errno.h>
25
#include "local.h"
26
 
27
#ifdef __LARGE64_FILES
28
_fpos64_t
29
_DEFUN(__sseek64, (ptr, cookie, offset, whence),
30
       struct _reent *ptr _AND
31
       void *cookie _AND
32
       _fpos64_t offset _AND
33
       int whence)
34
{
35
  register FILE *fp = (FILE *) cookie;
36
  register _off64_t ret;
37
 
38
  ret = _lseek64_r (ptr, fp->_file, (_off64_t) offset, whence);
39
  if (ret == (_fpos64_t)-1L)
40
    fp->_flags &= ~__SOFF;
41
  else
42
    {
43
      fp->_flags |= __SOFF;
44
      fp->_offset = ret;
45
    }
46
  return ret;
47
}
48
 
49
_READ_WRITE_RETURN_TYPE
50
_DEFUN(__swrite64, (ptr, cookie, buf, n),
51
       struct _reent *ptr _AND
52
       void *cookie _AND
53
       char const *buf _AND
54
       int n)
55
{
56
  register FILE *fp = (FILE *) cookie;
57
  int w;
58
#ifdef __SCLE
59
  int oldmode=0;
60
#endif
61
 
62
  if (fp->_flags & __SAPP)
63
    (void) _lseek64_r (ptr, fp->_file, (_off64_t)0, SEEK_END);
64
  fp->_flags &= ~__SOFF;        /* in case O_APPEND mode is set */
65
 
66
#ifdef __SCLE
67
  if (fp->_flags & __SCLE)
68
    oldmode = setmode(fp->_file, O_BINARY);
69
#endif
70
 
71
  w = _write_r (ptr, fp->_file, buf, n);
72
 
73
#ifdef __SCLE
74
  if (oldmode)
75
    setmode(fp->_file, oldmode);
76
#endif
77
 
78
  return w;
79
}
80
 
81
#endif /* __LARGE64_FILES */

powered by: WebSVN 2.1.0

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