summaryrefslogtreecommitdiffstats
path: root/lib/unlocked-io.h
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2004-11-12 00:49:51 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2004-11-12 00:49:51 (GMT)
commitfbf1e60f477460205c2002bb34b87f9e1e3b0faf (patch)
tree96d568de54259a8b1f8e6a88dbb533037ef730e5 /lib/unlocked-io.h
parentdbe8fb585697e3a7c073cef083ff2fb027b76968 (diff)
downloadmonitoring-plugins-fbf1e60f477460205c2002bb34b87f9e1e3b0faf.tar.gz
Update to using coreutils 5.2.1 libraries and snprintf.c from samba 3.0.8
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@895 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/unlocked-io.h')
-rw-r--r--lib/unlocked-io.h66
1 files changed, 54 insertions, 12 deletions
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index a7240fb..36a7a48 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -1,21 +1,20 @@
1/* Prefer faster, non-thread-safe stdio functions if available. 1/* Prefer faster, non-thread-safe stdio functions if available.
2 2
3 Copyright (C) 2001, 2002 Free Software Foundation, Inc. 3 Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify it 5 This program is free software; you can redistribute it and/or modify
6 under the terms of the GNU Library General Public License as published 6 it under the terms of the GNU General Public License as published by
7 by the Free Software Foundation; either version 2, or (at your option) 7 the Free Software Foundation; either version 2, or (at your option)
8 any later version. 8 any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 Library General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public 15 You should have received a copy of the GNU General Public License along
16 License along with this program; if not, write to the Free Software 16 with this program; if not, write to the Free Software Foundation,
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 USA. */
19 18
20/* Written by Jim Meyering. */ 19/* Written by Jim Meyering. */
21 20
@@ -28,63 +27,106 @@
28 27
29# if USE_UNLOCKED_IO 28# if USE_UNLOCKED_IO
30 29
31/* These are wrappers for functions/macros from GNU libc. 30/* These are wrappers for functions/macros from the GNU C library, and
31 from other C libraries supporting POSIX's optional thread-safe functions.
32
32 The standard I/O functions are thread-safe. These *_unlocked ones are 33 The standard I/O functions are thread-safe. These *_unlocked ones are
33 more efficient but not thread-safe. That they're not thread-safe is 34 more efficient but not thread-safe. That they're not thread-safe is
34 fine since all of the applications in this package are single threaded. */ 35 fine since all of the applications in this package are single threaded.
36
37 Also, some code that is shared with the GNU C library may invoke
38 the *_unlocked functions directly. On hosts that lack those
39 functions, invoke the non-thread-safe versions instead. */
40
41# include <stdio.h>
35 42
36# if HAVE_DECL_CLEARERR_UNLOCKED 43# if HAVE_DECL_CLEARERR_UNLOCKED
37# undef clearerr 44# undef clearerr
38# define clearerr(x) clearerr_unlocked (x) 45# define clearerr(x) clearerr_unlocked (x)
46# else
47# define clearerr_unlocked(x) clearerr (x)
39# endif 48# endif
40# if HAVE_DECL_FEOF_UNLOCKED 49# if HAVE_DECL_FEOF_UNLOCKED
41# undef feof 50# undef feof
42# define feof(x) feof_unlocked (x) 51# define feof(x) feof_unlocked (x)
52# else
53# define feof_unlocked(x) feof (x)
43# endif 54# endif
44# if HAVE_DECL_FERROR_UNLOCKED 55# if HAVE_DECL_FERROR_UNLOCKED
45# undef ferror 56# undef ferror
46# define ferror(x) ferror_unlocked (x) 57# define ferror(x) ferror_unlocked (x)
58# else
59# define ferror_unlocked(x) ferror (x)
47# endif 60# endif
48# if HAVE_DECL_FFLUSH_UNLOCKED 61# if HAVE_DECL_FFLUSH_UNLOCKED
49# undef fflush 62# undef fflush
50# define fflush(x) fflush_unlocked (x) 63# define fflush(x) fflush_unlocked (x)
64# else
65# define fflush_unlocked(x) fflush (x)
51# endif 66# endif
52# if HAVE_DECL_FGETS_UNLOCKED 67# if HAVE_DECL_FGETS_UNLOCKED
53# undef fgets 68# undef fgets
54# define fgets(x,y,z) fgets_unlocked (x,y,z) 69# define fgets(x,y,z) fgets_unlocked (x,y,z)
70# else
71# define fgets_unlocked(x,y,z) fgets (x,y,z)
55# endif 72# endif
56# if HAVE_DECL_FPUTC_UNLOCKED 73# if HAVE_DECL_FPUTC_UNLOCKED
57# undef fputc 74# undef fputc
58# define fputc(x,y) fputc_unlocked (x,y) 75# define fputc(x,y) fputc_unlocked (x,y)
76# else
77# define fputc_unlocked(x,y) fputc (x,y)
59# endif 78# endif
60# if HAVE_DECL_FPUTS_UNLOCKED 79# if HAVE_DECL_FPUTS_UNLOCKED
61# undef fputs 80# undef fputs
62# define fputs(x,y) fputs_unlocked (x,y) 81# define fputs(x,y) fputs_unlocked (x,y)
82# else
83# define fputs_unlocked(x,y) fputs (x,y)
63# endif 84# endif
64# if HAVE_DECL_FREAD_UNLOCKED 85# if HAVE_DECL_FREAD_UNLOCKED
65# undef fread 86# undef fread
66# define fread(w,x,y,z) fread_unlocked (w,x,y,z) 87# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
88# else
89# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
67# endif 90# endif
68# if HAVE_DECL_FWRITE_UNLOCKED 91# if HAVE_DECL_FWRITE_UNLOCKED
69# undef fwrite 92# undef fwrite
70# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) 93# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
94# else
95# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
71# endif 96# endif
72# if HAVE_DECL_GETC_UNLOCKED 97# if HAVE_DECL_GETC_UNLOCKED
73# undef getc 98# undef getc
74# define getc(x) getc_unlocked (x) 99# define getc(x) getc_unlocked (x)
100# else
101# define getc_unlocked(x) getc (x)
75# endif 102# endif
76# if HAVE_DECL_GETCHAR_UNLOCKED 103# if HAVE_DECL_GETCHAR_UNLOCKED
77# undef getchar 104# undef getchar
78# define getchar() getchar_unlocked () 105# define getchar() getchar_unlocked ()
106# else
107# define getchar_unlocked() getchar ()
79# endif 108# endif
80# if HAVE_DECL_PUTC_UNLOCKED 109# if HAVE_DECL_PUTC_UNLOCKED
81# undef putc 110# undef putc
82# define putc(x,y) putc_unlocked (x,y) 111# define putc(x,y) putc_unlocked (x,y)
112# else
113# define putc_unlocked(x,y) putc (x,y)
83# endif 114# endif
84# if HAVE_DECL_PUTCHAR_UNLOCKED 115# if HAVE_DECL_PUTCHAR_UNLOCKED
85# undef putchar 116# undef putchar
86# define putchar(x) putchar_unlocked (x) 117# define putchar(x) putchar_unlocked (x)
118# else
119# define putchar_unlocked(x) putchar (x)
87# endif 120# endif
88 121
122# undef flockfile
123# define flockfile(x) ((void) 0)
124
125# undef ftrylockfile
126# define ftrylockfile(x) 0
127
128# undef funlockfile
129# define funlockfile(x) ((void) 0)
130
89# endif /* USE_UNLOCKED_IO */ 131# endif /* USE_UNLOCKED_IO */
90#endif /* UNLOCKED_IO_H */ 132#endif /* UNLOCKED_IO_H */