fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / stdio / getchar_u.c
blobf36f88810859617c8c4dd4a7408be4dacbfa814b
1 /*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
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.
19 FUNCTION
20 <<getchar_unlocked>>---non-thread-safe version of getchar (macro)
22 INDEX
23 getchar_unlocked
25 POSIX_SYNOPSIS
26 #include <stdio.h>
27 int getchar_unlocked();
29 DESCRIPTION
30 <<getchar_unlocked>> is a non-thread-safe version of <<getchar>>
31 declared in <<stdio.h>>. <<getchar_unlocked>> may only safely be used
32 within a scope protected by flockfile() (or ftrylockfile()) and
33 funlockfile(). These functions may safely be used in a multi-threaded
34 program if and only if they are called while the invoking thread owns
35 the ( FILE *) object, as is the case after a successful call to the
36 flockfile() or ftrylockfile() functions. If threads are disabled,
37 then <<getchar_unlocked>> is equivalent to <<getchar>>.
39 RETURNS
40 See <<getchar>>.
42 PORTABILITY
43 POSIX 1003.1 requires <<getchar_unlocked>>. <<getchar_unlocked>> may
44 be implemented as a macro.
46 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
47 <<lseek>>, <<read>>, <<sbrk>>, <<write>>. */
49 #if defined(LIBC_SCCS) && !defined(lint)
50 static char sccsid[] = "%W% (Berkeley) %G%";
51 #endif /* LIBC_SCCS and not lint */
54 * A subroutine version of the macro getchar_unlocked.
57 #include <stdio.h>
58 #include <reent.h>
60 #undef getchar_unlocked
62 int
63 _getchar_unlocked_r (f)
64 struct _reent *f;
66 return getc_unlocked (_stdin_r (f));
69 #ifndef _REENT_ONLY
71 int
72 getchar_unlocked ()
74 /* CHECK_INIT is called (eventually) by __srefill. */
76 return _getchar_unlocked_r (_REENT);
79 #endif