+2001-07-17 Ulrich Drepper <drepper@redhat.com>
+
+ * inet/rcmd.c (iruserfopen): Disable implicit locking for the stream.
+ * inet/ruserpass.c (ruserpass): Likewise.
+ * nss/nsswitch.c (nss_parse_file): Likewise.
+ * resolv/res_hconf.c (_res_hconf_init): Likewise.
+ * resolv/res_init.c (__res_vinit): Likewise.
+ * gmon/bb_exit_func.c (__bb_exit_func): Likewise.
+ * misc/getpass.c (getpass): Likewise.
+ * misc/getusershell.c (initshells): Likewise.
+ * misc/getttyent.c (setttyent): Likewise.
+ * misc/mntent_r.c (__setmntent): Likewise.
+ * time/getdate.c (__getdate_r): Likewise.
+ * time/tzfile.c (__tzfile_read): Likewise.
+ * iconv/gconv_conf.c (read_conf_file): Likewise.
+ * intl/localealias.c (read_alias_file): Disable implicit locking
+ for the stream. Use _unlocked functions for glibc.
+ * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Disable
+ implicit locking for the stream.
+ (__get_nprocs_conf): Likewise.
+ (phys_pages_info): Likewise.
+
2001-07-16 Ulrich Drepper <drepper@redhat.com>
* nscd/connections.c: Print messages caused by user application
-/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@cs.arizona.edu).
#include <sys/types.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <string.h>
#define OUT_NAME "gmon.out"
perror (OUT_NAME);
return;
}
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
memcpy (&ghdr.version, &version, sizeof (version));
fwrite_unlocked (&ghdr, sizeof (ghdr), 1, fp);
#include <search.h>
#include <stddef.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
if (fp == NULL)
return;
+ /* No threads reading from this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
/* Process the known entries of the file. Comments start with `#' and
end with the end of the line. Empty lines are ignored. */
while (!feof_unlocked (fp))
#include <pwd.h>
#include <errno.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <ctype.h>
#include <string.h>
#include <libintl.h>
return NULL;
}
+ /* No threads use this stream. */
+ __fsetlocking (res, FSETLOCKING_BYCALLER);
+
return res;
}
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
warn("%s", buf);
return (0);
}
+ /* No threads use this stream. */
+ __fsetlocking (cfile, FSETLOCKING_BYCALLER);
if (__gethostname(myname, sizeof(myname)) < 0)
myname[0] = '\0';
mydomain = __strchrnul(myname, '.');
#include <ctype.h>
#include <stdio.h>
+#if defined _LIBC || defined HAVE___FSETLOCKING
+# include <stdio_ext.h>
+#endif
#include <sys/types.h>
#ifdef __GNUC__
# define mempcpy __mempcpy
# endif
# define HAVE_MEMPCPY 1
+# define HAVE___FSETLOCKING 1
/* We need locking here since we can be called from different places. */
# include <bits/libc-lock.h>
# define internal_function
#endif
+/* Some optimizations for glibc. */
+#ifdef _LIBC
+# define FEOF(fp) feof_unlocked (fp)
+# define FGETS(buf, n, fp) fgets_unlocked (buf, n, fp)
+#else
+# define FEOF(fp) feof (fp)
+# define FGETS(buf, n, fp) fgets (buf, n, fp)
+#endif
+
/* For those losing systems which don't have `alloca' we have to add
some additional code emulating it. */
#ifdef HAVE_ALLOCA
if (fp == NULL)
return 0;
+#ifdef HAVE___FSETLOCKING
+ /* No threads present. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+#endif
+
added = 0;
- while (!feof (fp))
+ while (!FEOF (fp))
{
/* It is a reasonable approach to use a fix buffer here because
a) we are only interested in the first two fields
char *value;
char *cp;
- if (fgets (buf, sizeof buf, fp) == NULL)
+ if (FGETS (buf, sizeof buf, fp) == NULL)
/* EOF reached. */
break;
{
char altbuf[BUFSIZ];
do
- if (fgets (altbuf, sizeof altbuf, fp) == NULL)
+ if (FGETS (altbuf, sizeof altbuf, fp) == NULL)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
break;
-/* Copyright (C) 1992,93,94,95,96,97,98,99 Free Software Foundation, Inc.
+/* Copyright (C) 1992,93,94,95,96,97,98,99,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
02111-1307 USA. */
#include <stdio.h>
+#include <stdio_ext.h>
#include <termios.h>
#include <unistd.h>
out = stderr;
}
else
- out = in;
+ {
+ /* We do the locking ourselves. */
+ __fsetlocking (tf, FSETLOCKING_BYCALLER);
+
+ out = in;
+ }
flockfile (out);
#include <ttyent.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <ctype.h>
#include <string.h>
if (tf) {
(void)rewind(tf);
return (1);
- } else if ((tf = fopen(_PATH_TTYS, "r")))
+ } else if ((tf = fopen(_PATH_TTYS, "r"))) {
+ /* We do the locking ourselves. */
+ __fsetlocking (tf, FSETLOCKING_BYCALLER);
return (1);
+ }
return (0);
}
#include <sys/file.h>
#include <sys/stat.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
strings = NULL;
return (char **) okshells;
}
+ /* No threads using this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
sp = shells;
cp = strings;
flen = statb.st_size;
/* Utilities for reading/writing fstab, mtab, etc.
- Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <alloca.h>
#include <mntent.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <string.h>
#include <sys/types.h>
FILE *
__setmntent (const char *file, const char *mode)
{
- return fopen (file, mode);
+ FILE *result = fopen (file, mode);
+
+ if (result != NULL)
+ /* We do the locking ourselves. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+ return result;
}
weak_alias (__setmntent, setmntent)
#include <bits/libc-lock.h>
#include <search.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
if (fp == NULL)
return NULL;
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
result = (name_database *) malloc (sizeof (name_database));
if (result == NULL)
return NULL;
-/* Copyright (C) 1993, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@azstarnet.com).
#include <ctype.h>
#include <memory.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <net/if.h>
_res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND;
else
{
+ /* No threads using this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
while (fgets_unlocked (buf, sizeof (buf), fp))
{
++line_num;
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
line[sizeof(name) - 1] == '\t'))
if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
/* read the config file */
while (fgets_unlocked(buf, sizeof(buf), fp) != NULL) {
/* skip comments */
#include <mntent.h>
#include <paths.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
fp = fopen (proc_cpuinfo, "r");
if (fp != NULL)
{
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
GET_NPROCS_PARSER (fp, buffer, result);
fclose (fp);
}
fp = fopen (proc_cpuinfo, "r");
if (fp != NULL)
{
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
GET_NPROCS_CONF_PARSER (fp, buffer, result);
fclose (fp);
}
fp = fopen (proc_meminfo, "r");
if (fp != NULL)
{
+ /* No threads use this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
result = 0;
/* Read all lines and count the lines starting with the
string "processor". We don't have to fear extremely long
/* Convert a string representation of time to a time value.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
#include <limits.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
if (fp == NULL)
return 2;
+ /* No threads reading this stream. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
line = NULL;
len = 0;
do
-/* Copyright (C) 1991,92,93,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993, 1995-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <assert.h>
#include <limits.h>
#include <stdio.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
if (f == NULL)
return;
+ /* No threads reading this stream. */
+ __fsetlocking (f, FSETLOCKING_BYCALLER);
+
if (fread_unlocked ((void *) &tzhead, sizeof (tzhead), 1, f) != 1)
goto lose;