-Mon Nov 16 11:17:31 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+1998-11-16 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/opendir.c: Use o_directory_works differently. Treat
+ zero value as uninitialized so that variable can go into .bss.
+
+ * dirent/opendir-tst1.c: Print error strings to stdout.
+
+ * sysdeps/unix/sysv/linux/mmap64.c: New file. Empty.
+ * sysdeps/unix/sysv/linux/syscalls.list: Add mmap with mmap64 alias.
+ * sysdeps/unix/sysv/linux/arm/mmap.S: Add mmap64 alias.
+ * sysdeps/unix/sysv/linux/i386/mmap.S: Likewise.
+ * sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise.
+
+1998-11-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * time/tzfile.c (__tzfile_read): Check that types[i].isdst is in
+ range.
+
+1998-11-16 Ulrich Drepper <drepper@cygnus.com>
+
+ * libio/bits/stdio.h (fread_unlocked): Do handle zero size and number.
+ (fwrite_unlocked): Likewise.
+
+1998-11-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * libio/bits/stdio.h (fread_unlocked): Don't evaluate non-constant
+ twice. Don't bother handling zero size.
+ (frwite_unlocked): Likewise.
+
+1998-11-15 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * configure.in: Fix regex for makeinfo version string.
+
+1998-11-15 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * sunrpc/rpc_sample.c (write_sample_server): Avoid -Wparentheses
+ warning.
+ * sunrpc/rpc_svcout.c (write_program): Likewise.
+
+1998-11-15 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * time/Makefile (CFLAGS-test_time.c): Add -Wno-format.
+
+1998-11-16 Ulrich Drepper <drepper@cygnus.com
+
+ * misc/sys/mman.h: Pretty print prototypes.
+
+1998-11-15 Ulrich Drepper <drepper@cygnus.com
+
+ * misc/error.c (error): Don't use result of strerror_r call directly
+ since at least DEC Unix has a wrong return type.
+ Patch by Johan Danielsson <joda@pdc.kth.se>.
+
+1998-11-16 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/sysdep.h (INLINE_SYSCALL): Undo
last change.
[GNU gettext.* \([0-9]*\.[0-9.]*\)],
[0.[1-9][0-9].* | [1-9].*], MSGFMT=: aux_missing=t)
AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
- [GNU texinfo \([0-9][0-9.]*\)],
+ [GNU texinfo.* \([0-9][0-9.]*\)],
[3.1[1-9] | 3.[2-9][0-9]], MAKEINFO=: aux_missing=t)
if test -n "$critic_missing"; then
if (dirp != NULL)
{
/* Oh, oh, how can this work? */
- fputs ("`opendir' succeeded on a FIFO???\n", stderr);
+ fputs ("`opendir' succeeded on a FIFO???\n", stdout);
closedir (dirp);
return 1;
}
if (errno != ENOTDIR)
{
- fprintf (stderr, "`opendir' return error `%s' instead of `%s'\n",
+ fprintf (stdout, "`opendir' return error `%s' instead of `%s'\n",
strerror (errno), strerror (ENOTDIR));
return 1;
}
#if defined __USE_MISC && defined __GNUC__ && defined __OPTIMIZE__
/* Perform some simple optimizations. */
# define fread_unlocked(ptr, size, n, stream) \
- (__extension__ ((((__builtin_constant_p (size) \
- && ((size) == 0 || __builtin_constant_p (n))) \
- || (__builtin_constant_p (n) && (n) == 0)) \
- && (size_t) ((size) * (n)) <= 8) \
+ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \
+ && (size_t) ((size) * (n)) <= 8 && (size) != 0) \
? ({ char *__ptr = (char *) (ptr); \
FILE *__stream = (stream); \
- size_t __size = (size); \
- size_t __n = (n); \
- size_t __readres = __n; \
- size_t __cnt = __size * __n + 1; \
- while (--__cnt > 0) \
+ size_t __cnt; \
+ for (__cnt = (size) * (n); __cnt > 0; --__cnt) \
{ \
int __c = _IO_getc_unlocked (__stream); \
if (__c == EOF) \
- { \
- __readres = (__size * __n - __cnt) / __size; \
- break; \
- } \
+ break; \
*__ptr++ = __c; \
} \
- __readres; }) \
- : fread_unlocked (ptr, size, n, stream)))
+ ((size_t) ((size) * (n)) - __cnt) / (size); }) \
+ : (((__builtin_constant_p (size) && (size) == 0) \
+ || (__builtin_constant_p (n) && (n) == 0)) \
+ /* Evaluate all parameters once. */ \
+ ? ((void) (ptr), (void) (stream), (void) (size), \
+ (void) n, 0) \
+ : fread_unlocked (ptr, size, n, stream))))
# define fwrite_unlocked(ptr, size, n, stream) \
- (__extension__ ((((__builtin_constant_p (size) \
- && ((size) == 0 || __builtin_constant_p (n))) \
- || (__builtin_constant_p (n) && (n) == 0)) \
- && (size_t) ((size) * (n)) <= 8) \
+ (__extension__ ((__builtin_constant_p (size) && __builtin_constant_p (n) \
+ && (size_t) ((size) * (n)) <= 8 && (size) != 0) \
? ({ const char *__ptr = (const char *) (ptr); \
FILE *__stream = (stream); \
- size_t __size = (size); \
- size_t __n = (n); \
- size_t __writeres = __n; \
- size_t __cnt = __size * __n + 1; \
- while (--__cnt > 0) \
+ size_t __cnt; \
+ for (__cnt = (size) * (n); __cnt > 0; --__cnt) \
if (_IO_putc_unlocked (*__ptr++, __stream) == EOF) \
- { \
- __writeres = (__size * __n - __cnt) / __size; \
- break; \
- } \
- __writeres; }) \
- : fwrite_unlocked (ptr, size, n, stream)))
+ break; \
+ ((size_t) ((size) * (n)) - __cnt) / (size); }) \
+ : (((__builtin_constant_p (size) && (size) == 0) \
+ || (__builtin_constant_p (n) && (n) == 0)) \
+ /* Evaluate all parameters once. */ \
+ ? ((void) (ptr), (void) (stream), (void) (size), n) \
+ : fwrite_unlocked (ptr, size, n, stream))))
#endif
/* Define helper macro. */
+1998-11-15 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * linuxthreads.texi: Fix punctuation after xref.
+
1998-11-10 H.J. Lu <hjl@gnu.org>
* sysdeps/unix/sysv/linux/bits/local_lim.h: Undefine NR_OPEN
returned by @var{start_routine} as exit code.
The @var{attr} argument specifies thread attributes to be applied to the
-new thread. @xref{Thread Attributes} for details. The @var{attr}
+new thread. @xref{Thread Attributes}, for details. The @var{attr}
argument can also be @code{NULL}, in which case default attributes are
used: the created thread is joinable (not detached) and has an ordinary
(not realtime) scheduling policy.
Alternatively, you can enable @dfn{traps} for exceptions. In that case,
when an exception is raised, your program will receive the @code{SIGFPE}
signal. The default action for this signal is to terminate the
-program. @xref{Signal Handling} for how you can change the effect of
+program. @xref{Signal Handling}, for how you can change the effect of
the signal.
@findex matherr
This function should always be used instead of the direct formula
because it takes special care to avoid losing precision. It may also
take advantage of hardware support for this operation. See @code{hypot}
-in @xref{Exponents and Logarithms}.
+in @ref{Exponents and Logarithms}.
@end deftypefun
@node Normalization Functions
@chapter File System Interface
This chapter describes the GNU C library's functions for manipulating
-files. Unlike the input and output functions described in
-@ref{I/O on Streams} and @ref{Low-Level I/O}, these
-functions are concerned with operating on the files themselves, rather
-than on their contents.
+files. Unlike the input and output functions (@pxref{I/O on Streams};
+@pxref{Low-Level I/O}), these functions are concerned with operating
+on the files themselves, rather than on their contents.
Among the facilities described in this chapter are functions for
examining or modifying directories, functions for renaming and deleting
The order in which files appear in a directory tends to be fairly
random. A more useful program would sort the entries (perhaps by
alphabetizing them) before printing them; see
-@ref{Scanning Directory Content} and @ref{Array Sort Function}.
+@ref{Scanning Directory Content}, and @ref{Array Sort Function}.
@node Random Access Directory
Using @file{varargs.h} is almost the same as using @file{stdarg.h}.
There is no difference in how you call a variadic function;
-@xref{Calling Variadics}. The only difference is in how you define
+see @ref{Calling Variadics}. The only difference is in how you define
them. First of all, you must use old-style non-prototype syntax, like
this:
@end deftypefn
The other argument macros, @code{va_arg} and @code{va_end}, are the same
-in @file{varargs.h} as in @file{stdarg.h}; see @ref{Argument Macros} for
+in @file{varargs.h} as in @file{stdarg.h}; see @ref{Argument Macros}, for
details.
It does not work to include both @file{varargs.h} and @file{stdarg.h} in
Most IOCTLs are OS-specific and/or only used in special system utilities,
and are thus beyond the scope of this document. For an example of the use
-of an IOCTL, @xref{Out-of-Band Data}.
+of an IOCTL, see @ref{Out-of-Band Data}.
@item LC_CTYPE
This category applies to classification and conversion of characters,
and to multibyte and wide characters;
-see @ref{Character Handling} and @ref{Extended Characters}.
+see @ref{Character Handling}, and @ref{Extended Characters}.
@comment locale.h
@comment ISO
@comment XOPEN
@item LC_MESSAGES
This category applies to selecting the language used in the user
-interface for message translation (@ref{The Uniforum approach} and
-@ref{Message catalogs a la X/Open}).
+interface for message translation (@pxref{The Uniforum approach};
+@pxref{Message catalogs a la X/Open}).
@comment locale.h
@comment ISO
multiple of @var{boundary}. @xref{Aligned Memory Blocks}.
@item int mallopt (int @var{param}, int @var{value})
-Adjust a tunable parameter. @xref{Malloc Tunable Parameters}
+Adjust a tunable parameter. @xref{Malloc Tunable Parameters}.
@item int mcheck (void (*@var{abortfn}) (void))
Tell @code{malloc} to perform occasional consistency checks on
set/message number tuple must be unique the programmer must keep lists
of the messages at the same time the code is written. And the work
between several people working on the same project must be coordinated.
-In @ref{Common Usage} we will see some how these problems can be relaxed
-a bit.
+We will see some how these problems can be relaxed a bit (@pxref{Common
+Usage}).
@deftypefun int catclose (nl_catd @var{catalog_desc})
The @code{catclose} function can be used to free the resources
Please note that above we wrote ``message catalogs'' (plural). This is
a speciality of the GNU implementation of these functions and we will
-say more about this in section @xref{Locating gettext catalog} when we
-talk about the ways message catalogs are selected.
+say more about this when we talk about the ways message catalogs are
+selected (@pxref{Locating gettext catalog}).
The @code{gettext} function does not modify the value of the global
@var{errno} variable. This is necessary to make it possible to write
filesystem the @code{glob} implementation uses the user-supplied
functions specified in the structure pointed to by @var{pglob}
parameter. For more information about the functions refer to the
-sections about directory handling @ref{Accessing Directories} and
+sections about directory handling see @ref{Accessing Directories}, and
@ref{Reading Attributes}.
@comment glob.h
The @code{tsearch} function searches in the tree pointed to by
@code{*@var{rootp}} for an element matching @var{key}. The function
pointed to by @var{compar} is used to determine whether two elements
-match. @xref{Comparison Functions} for a specification of the functions
+match. @xref{Comparison Functions}, for a specification of the functions
which can be used for the @var{compar} parameter.
If the tree does not contain a matching entry the @var{key} value will
The first argument, @var{signum}, identifies the signal whose behavior
you want to control, and should be a signal number. The proper way to
specify a signal number is with one of the symbolic signal names
-described in @ref{Standard Signals}---don't use an explicit number, because
+(@pxref{Standard Signals})---don't use an explicit number, because
the numerical code for a given kind of signal may vary from operating
system to operating system.
@item
Option names are single alphanumeric characters (as for @code{isalnum};
-see @ref{Classification of Characters}).
+@pxref{Classification of Characters}).
@item
Certain options require an argument. For example, the @samp{-o} command
You can deal directly with the underlying representation of environment
objects to add more variables to the environment (for example, to
-communicate with another program you are about to execute; see
-@ref{Executing a File}).
+communicate with another program you are about to execute;
+@pxref{Executing a File}).
@comment unistd.h
@comment POSIX.1
@item
All open file descriptors in the process are closed. @xref{Low-Level I/O}.
Note that streams are not flushed automatically when the process
-terminates; @xref{I/O on Streams}.
+terminates; see @ref{I/O on Streams}.
@item
The low-order 8 bits of the return status code are saved to be reported
freed when the stream is open.
The argument @var{opentype} is the same as in @code{fopen}
-(@xref{Opening Streams}). If the @var{opentype} specifies
+(@pxref{Opening Streams}). If the @var{opentype} specifies
append mode, then the initial file position is set to the first null
character in the buffer. Otherwise the initial file position is at the
beginning of the buffer.
colons and the @code{TO FIX} string) are printed. But only one of the
three calls to @code{fmtmsg} produced output. The first call does not
print anything because the @var{label} parameter is not in the correct
-form. As specified in @ref{Printing Formatted Messages} the string must
-contain two fields, separated by a colon. The third @code{fmtmsg} call
+form. The string must contain two fields, separated by a colon
+(@pxref{Printing Formatted Messages}). The third @code{fmtmsg} call
produced no output since the class with the numeric value @code{6} is
not defined. Although a class with numeric value @code{5} is also not
defined by default, the call the @code{addseverity} introduces it and
@deftypefun {char *} ctime_r (const time_t *@var{time}, char *@var{buffer})
This function is similar to @code{ctime}, only that it places the result
in the string pointed to by @var{buffer}. It is equivalent to (written
-using gcc extensions, @xref{Statement Exprs,,,gcc,Porting and Using gcc}.):
+using gcc extensions, @pxref{Statement Exprs,,,gcc,Porting and Using gcc}):
@smallexample
(@{ struct tm tm; asctime_r (localtime_r (time, &tm), buf); @})
These functions let your program identify positively the user who is
running or the user who logged in this session. (These can differ when
-setuid programs are involved; @xref{Process Persona}.) The user cannot
+setuid programs are involved; see @ref{Process Persona}.) The user cannot
do anything to fool these functions.
For most purposes, it is more useful to use the environment variable
@subsection Netgroup Data
@cindex Netgroup
-Sometimes it is useful group users according to other criteria like the
-ones used in the @xref{Group Database}. E.g., it is useful to associate
-a certain group of users with a certain machine. On the other hand
-grouping of host names is not supported so far.
+Sometimes it is useful to group users according to other criteria
+(@pxref{Group Database}). E.g., it is useful to associate a certain
+group of users with a certain machine. On the other hand grouping of
+host names is not supported so far.
In Sun Microsystems SunOS appeared a new kind of database, the netgroup
database. It allows to group hosts, users, and domain freely, giving
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
- fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
+ /* Don't use __strerror_r's return value because on some systems
+ (at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
+ __strerror_r (errnum, errbuf, sizeof errbuf);
+ fprintf (stderr, ": %s", errbuf);
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
#ifndef __USE_FILE_OFFSET64
extern __ptr_t mmap __P ((__ptr_t __addr, size_t __len, int __prot,
- int __flags, int __fd, __off_t __offset));
+ int __flags, int __fd, __off_t __offset));
#else
extern __ptr_t mmap __P ((__ptr_t __addr, size_t __len, int __prot,
- int __flags, int __fd, __off_t __offset))
+ int __flags, int __fd, __off_t __offset))
__asm__ ("mmap64");
#endif
#ifdef __USE_LARGEFILE64
extern __ptr_t mmap64 __P ((__ptr_t __addr, size_t __len, int __prot,
- int __flags, int __fd, __off64_t __offset));
+ int __flags, int __fd, __off64_t __offset));
#endif
/* Deallocate any mapping for the region starting at ADDR and extending LEN
NEW_LEN. If MAY_MOVE is MREMAP_MAYMOVE the returned address may
differ from ADDR. */
extern __ptr_t mremap __P ((__ptr_t __addr, size_t __old_len,
- size_t __new_len, int __may_move));
+ size_t __new_len, int __may_move));
#endif
__END_DECLS
fprintf (fout, "\n\t/*\n\t * insert server code here\n\t */\n\n");
if (!mtflag)
- if(!streq(proc->res_type, "void"))
- f_print(fout, "\treturn &result;\n}\n");
- else /* cast back to void * */
- f_print(fout, "\treturn (void *) &result;\n}\n");
+ {
+ if (!streq(proc->res_type, "void"))
+ f_print(fout, "\treturn &result;\n}\n");
+ else /* cast back to void * */
+ f_print(fout, "\treturn (void *) &result;\n}\n");
+ }
else
f_print(fout, "\treturn retval;\n}\n");
}
f_print (fout, "\t}\n");
if (!mtflag)
- if (Cflag)
- f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n",
- RESULT, ROUTINE, ARG, RQSTP);
- else
- f_print (fout, "\t%s = (*%s)(&%s, %s);\n",
- RESULT, ROUTINE, ARG, RQSTP);
+ {
+ if (Cflag)
+ f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n",
+ RESULT, ROUTINE, ARG, RQSTP);
+ else
+ f_print (fout, "\t%s = (*%s)(&%s, %s);\n",
+ RESULT, ROUTINE, ARG, RQSTP);
+ }
else
if (Cflag)
f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
#include <dirstream.h>
-/* opendir() must not accidentally open something other than a directory.
- Some OS's have kernel support for that, some don't. In the worst
- case we have to stat() before the open() AND fstat() after.
-
- We have to test at runtime for kernel support since libc may have
- been compiled with different headers to the kernel it's running on.
- This test can't be done reliably in the general case. We'll use
- /dev/null, which if it's not a device lots of stuff will break, as
- a guinea pig. It may be missing in chroot environments, so we
- make sure to fail safe. */
+/* opendir() must not accidentally open something other than a directory.
+ Some OS's have kernel support for that, some don't. In the worst
+ case we have to stat() before the open() AND fstat() after.
+
+ We have to test at runtime for kernel support since libc may have
+ been compiled with different headers to the kernel it's running on.
+ This test can't be done reliably in the general case. We'll use
+ /dev/null, which if it's not a device lots of stuff will break, as
+ a guinea pig. It may be missing in chroot environments, so we
+ make sure to fail safe. */
#ifdef O_DIRECTORY
-static int o_directory_works = -1;
+static int o_directory_works;
static void
-tryopen_o_directory (void)
-{
- int serrno = errno;
- int x = __open ("/dev/null", O_RDONLY|O_NDELAY|O_DIRECTORY);
-
- if (x >= 0)
- {
- __close (x);
- o_directory_works = 0;
- }
- else if (errno != ENOTDIR)
- o_directory_works = 0;
- else
- o_directory_works = 1;
-
- __set_errno (serrno);
-}
+tryopen_o_directory (void)
+{
+ int serrno = errno;
+ int x = __open ("/dev/null", O_RDONLY|O_NDELAY|O_DIRECTORY);
+
+ if (x >= 0)
+ {
+ __close (x);
+ o_directory_works = -1;
+ }
+ else if (errno != ENOTDIR)
+ o_directory_works = -1;
+ else
+ o_directory_works = 1;
+
+ __set_errno (serrno);
+}
# define EXTRA_FLAGS O_DIRECTORY
#else
# define EXTRA_FLAGS 0
#ifdef O_DIRECTORY
/* Test whether O_DIRECTORY works. */
- if (o_directory_works == -1)
+ if (o_directory_works == 0)
tryopen_o_directory ();
/* We can skip the expensive `stat' call if O_DIRECTORY works. */
- if (o_directory_works == 0)
+ if (o_directory_works < 0)
#endif
{
/* We first have to check whether the name is for a directory. We
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
+weak_alias (__mmap, mmap64)
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
+weak_alias (__mmap, mmap64)
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
+weak_alias (__mmap, mmap64)
--- /dev/null
+/* At least for now mmap64 is the same as mmap on all platforms.
+ When/If the 32 bit platforms get a >32 bit VFS we'll have to
+ change it for these platforms. */
lchown - lchown 3 __lchown lchown
mlock EXTRA mlock 2 __mlock mlock
mlockall EXTRA mlockall 1 __mlockall mlockall
+mmap - mmap 6 __mmap mmap mmap64
mount EXTRA mount 5 __mount mount
mremap EXTRA mremap 4 __mremap mremap
munlock EXTRA munlock 2 __munlock munlock
CFLAGS-tzfile.c = $(tz-cflags)
CFLAGS-tzset.c = $(tz-cflags)
+
+# Don't warn about Y2k problem in strftime format string.
+CFLAGS-test_time.c = -Wno-format
|| fread_unlocked (&types[i].isdst, 1, 1, f) != 1
|| fread_unlocked (&types[i].idx, 1, 1, f) != 1)
goto lose;
+ if (types[i].isdst > 1)
+ goto lose;
if (types[i].idx >= chars) /* Bogus index in data file. */
goto lose;
types[i].offset = (long int) decode (x);