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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [putc_u.c] - Blame information for rev 308

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

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
 
18
/*
19
FUNCTION
20
<<putc_unlocked>>---non-thread-safe version of putc (macro)
21
 
22
INDEX
23
        putc_unlocked
24
INDEX
25
        _putc_unlocked_r
26
 
27
SYNOPSIS
28
        #include <stdio.h>
29
        int putc_unlocked(int <[ch]>, FILE *<[fp]>);
30
 
31
        #include <stdio.h>
32
        int _putc_unlocked_r(struct _reent *<[ptr]>, int <[ch]>, FILE *<[fp]>);
33
 
34
DESCRIPTION
35
<<putc_unlocked>> is a non-thread-safe version of <<putc>> declared in
36
<<stdio.h>>.  <<putc_unlocked>> may only safely be used within a scope
37
protected by flockfile() (or ftrylockfile()) and funlockfile().  These
38
functions may safely be used in a multi-threaded program if and only
39
if they are called while the invoking thread owns the ( FILE *)
40
object, as is the case after a successful call to the flockfile() or
41
ftrylockfile() functions.  If threads are disabled, then
42
<<putc_unlocked>> is equivalent to <<putc>>.
43
 
44
The function <<_putc_unlocked_r>> is simply the reentrant version of
45
<<putc_unlocked>> that takes an additional reentrant structure pointer
46
argument: <[ptr]>.
47
 
48
RETURNS
49
See <<putc>>.
50
 
51
PORTABILITY
52
POSIX 1003.1 requires <<putc_unlocked>>.  <<putc_unlocked>> may be
53
implemented as a macro, so arguments should not have side-effects.
54
 
55
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
56
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
57
*/
58
 
59
#if defined(LIBC_SCCS) && !defined(lint)
60
static char sccsid[] = "%W% (Berkeley) %G%";
61
#endif /* LIBC_SCCS and not lint */
62
 
63
#include <_ansi.h>
64
#include <stdio.h>
65
 
66
/*
67
 * A subroutine version of the macro putc_unlocked.
68
 */
69
 
70
#undef putc_unlocked
71
 
72
int
73
_DEFUN(_putc_unlocked_r, (ptr, c, fp),
74
       struct _reent *ptr _AND
75
       int c _AND
76
       register FILE *fp)
77
{
78
  /* CHECK_INIT is (eventually) called by __swbuf.  */
79
 
80
  return __sputc_r (ptr, c, fp);
81
}
82
 
83
#ifndef _REENT_ONLY
84
int
85
_DEFUN(putc_unlocked, (c, fp),
86
       int c _AND
87
       register FILE *fp)
88
{
89
  /* CHECK_INIT is (eventually) called by __swbuf.  */
90
 
91
  return __sputc_r (_REENT, c, fp);
92
}
93
#endif /* !_REENT_ONLY */

powered by: WebSVN 2.1.0

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