Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
1999-07-06  Ulrich Drepper  <[email protected]>

	* sysdeps/unix/sysv/linux/alpha/ioperm.c: Update for some more
	motherboards.
	Patch by Jay Estabrook.

	* sysdeps/unix/sysv/linux/configure.in: Don't test for libc4 in
	ldd for SPARC.
	* /sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed: New file.
	Patch by Cristian Gafton.

1999-07-02  Cristian Gafton  <[email protected]>

	* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): "return 0"
	instead of "return NULL" to make C++ happy.

1999-07-04  Mark Kettenis  <[email protected]>

	* libio/iofdopen.c (_IO_new_fdopen): Set EINVAL if MODE is not
	allowed by the file access mode of the open file.

1999-07-06  Ulrich Drepper  <[email protected]>

	* sysdeps/generic/setfpucw.c: Include math.h to get all needed
	macros defined.

1999-07-03  Jakub Jelinek   <[email protected]>

	* sysdeps/sparc/sparc64/submul_1.S: Fix carry handling. Optimize.
	* sysdeps/sparc/sparc64/lshift.S: Make a leaf subroutine. Optimize.
	* sysdeps/sparc/sparc64/rshift.S: Likewise.
	* sysdeps/sparc/sparc64/mul_1.S: Optimize.

1999-07-04  Wolfram Gloger  <[email protected]>

	* malloc/malloc.c (request2size): Check for overflow and return
	NULL whenever it is encountered.

1999-07-04  Zack Weinberg  <[email protected]>

	* sysdeps/posix/tempname.c (__gen_tempname):   Add
	ability to create directories.  Replace OPENIT and LARGEFILE
	args with a single flags parameter.
	* sysdeps/generic/tempname.c: Likewise.
	* include/stdio.h: Adjust prototype of __gen_tempname to
	match.  Define symbolic constants for second argument.

	* misc/mkdtemp.c: New file, provides new function mkdtemp().
	* stdlib/stdlib.h: Prototype it.
	* misc/Versions: Export it.
	* misc/Makefile (routines): Add mktemp.
	* manual/filesys.texi: Document it.

	* misc/mktemp.c: Adjust call of __gen_tempname to match new
	convention.
	* misc/mkstemp.c: Likewise.
	* stdio-common/tempnam.c: Likewise.
	* stdio-common/tmpfile.c: Likewise.
	* stdio-common/tmpfile64.c: Likewise.
	* stdio-common/tmpnam.c: Likewise.
	* stdio-common/tmpnam_r.c: Likewise.

1999-07-05  Jakub Jelinek   <[email protected]>

	* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Support
	R_SPARC_OLO10 relocations.
	* elf/elf.h (R_SPARC_OLO10): Fix comment.
  • Loading branch information
Ulrich Drepper committed Jul 6, 1999
1 parent 4708015 commit 2e65ca2
Show file tree
Hide file tree
Showing 30 changed files with 656 additions and 385 deletions.
10 changes: 5 additions & 5 deletions BUGS
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
List of known bugs (certainly very incomplete)
----------------------------------------------

Time-stamp: <1999-04-19T17:58:10-0700 drepper>
Time-stamp: <1999-07-06T15:37:11-0700 drepper>

This following list contains those bugs which I'm aware of. Please
make sure that bugs you report are not listed here. If you can fix one
Expand Down Expand Up @@ -56,13 +56,13 @@ Severity: [ *] to [***]
[ *] The libm-ieee `scalb' function gives wrong results for
non-integral second parameters.

[ *] The *scanf() functions currently do not handle %l[ and %ls parameters
correctly since the parsing of the multi-byte characters does not
yet use mbsrtowcs().

[ *] The strftime() implementation cannot handle multibyte locales really
good since the TOLOWER and TOUPPER are not prepared.

[ *] The putenv() function copies it's argument which means that the
string (and possible later changes to it) are not automatically
reflected in the environment.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ulrich Drepper
[email protected]
68 changes: 68 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
1999-07-06 Ulrich Drepper <[email protected]>

* sysdeps/unix/sysv/linux/alpha/ioperm.c: Update for some more
motherboards.
Patch by Jay Estabrook.

* sysdeps/unix/sysv/linux/configure.in: Don't test for libc4 in
ldd for SPARC.
* /sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed: New file.
Patch by Cristian Gafton.

1999-07-02 Cristian Gafton <[email protected]>

* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): "return 0"
instead of "return NULL" to make C++ happy.

1999-07-04 Mark Kettenis <[email protected]>

* libio/iofdopen.c (_IO_new_fdopen): Set EINVAL if MODE is not
allowed by the file access mode of the open file.

1999-07-06 Ulrich Drepper <[email protected]>

* sysdeps/generic/setfpucw.c: Include math.h to get all needed
macros defined.

1999-07-03 Jakub Jelinek <[email protected]>

* sysdeps/sparc/sparc64/submul_1.S: Fix carry handling. Optimize.
* sysdeps/sparc/sparc64/lshift.S: Make a leaf subroutine. Optimize.
* sysdeps/sparc/sparc64/rshift.S: Likewise.
* sysdeps/sparc/sparc64/mul_1.S: Optimize.

1999-07-04 Wolfram Gloger <[email protected]>

* malloc/malloc.c (request2size): Check for overflow and return
NULL whenever it is encountered.

1999-07-04 Zack Weinberg <[email protected]>

* sysdeps/posix/tempname.c (__gen_tempname): Add
ability to create directories. Replace OPENIT and LARGEFILE
args with a single flags parameter.
* sysdeps/generic/tempname.c: Likewise.
* include/stdio.h: Adjust prototype of __gen_tempname to
match. Define symbolic constants for second argument.

* misc/mkdtemp.c: New file, provides new function mkdtemp().
* stdlib/stdlib.h: Prototype it.
* misc/Versions: Export it.
* misc/Makefile (routines): Add mktemp.
* manual/filesys.texi: Document it.

* misc/mktemp.c: Adjust call of __gen_tempname to match new
convention.
* misc/mkstemp.c: Likewise.
* stdio-common/tempnam.c: Likewise.
* stdio-common/tmpfile.c: Likewise.
* stdio-common/tmpfile64.c: Likewise.
* stdio-common/tmpnam.c: Likewise.
* stdio-common/tmpnam_r.c: Likewise.

1999-07-05 Jakub Jelinek <[email protected]>

* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_rela): Support
R_SPARC_OLO10 relocations.
* elf/elf.h (R_SPARC_OLO10): Fix comment.

1999-07-02 Tim Waugh <[email protected]>

* posix/wordexp-test.c: Revert bogus 'unset IFS' change. It
Expand Down
2 changes: 1 addition & 1 deletion elf/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ typedef struct
#define R_SPARC_10 30 /* Direct 10 bit */
#define R_SPARC_11 31 /* Direct 11 bit */
#define R_SPARC_64 32 /* Direct 64 bit */
#define R_SPARC_OLO10 33 /* ?? */
#define R_SPARC_OLO10 33 /* 10bit with secondary 13bit addend */
#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
Expand Down
7 changes: 6 additions & 1 deletion include/stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ extern int __path_search __P ((char *__tmpl, size_t __tmpl_len,
__const char *__dir, __const char *__pfx,
int __try_tempdir));

extern int __gen_tempname __P ((char *__tmpl, int __openit, int __large_file));
extern int __gen_tempname __P ((char *__tmpl, int __kind));
/* The __kind argument to __gen_tempname may be one of: */
#define __GT_FILE 0 /* create a file */
#define __GT_BIGFILE 1 /* create a file, using open64 */
#define __GT_DIR 2 /* create a directory */
#define __GT_NOCREATE 3 /* just find a name not currently in use */

/* Print out MESSAGE on the error output and abort. */
extern void __libc_fatal __P ((__const char *__message))
Expand Down
11 changes: 8 additions & 3 deletions libio/iofdopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ _IO_new_fdopen (fd, mode)
#ifndef O_ACCMODE
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
if (fd_flags == -1
|| ((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
|| ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
if (fd_flags == -1)
return NULL;

if (((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
|| ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
{
MAYBE_SET_EINVAL;
return NULL;
}

/* The May 93 draft of P1003.4/D14.1 (redesignated as 1003.1b)
[System Application Program Interface (API) Amendment 1:
Expand Down
51 changes: 35 additions & 16 deletions malloc/malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1259,12 +1259,12 @@ static void free_atfork();
#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ))
#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))

/* pad request bytes into a usable size */
/* pad request bytes into a usable size, return non-zero on overflow */

#define request2size(req) \
(((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
(long)(MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \
(((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK)))
#define request2size(req, nb) \
((nb = (req) + (SIZE_SZ + MALLOC_ALIGN_MASK)),\
((long)nb <= 0 ? 1 : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) ? (nb = MINSIZE) :\
(nb &= ~MALLOC_ALIGN_MASK)), 0)))

/* Check if m has acceptable alignment */

Expand Down Expand Up @@ -2622,7 +2622,8 @@ Void_t* mALLOc(bytes) size_t bytes;
}
#endif

nb = request2size(bytes);
if(request2size(bytes, nb))
return 0;
arena_get(ar_ptr, nb);
if(!ar_ptr)
return 0;
Expand Down Expand Up @@ -3133,7 +3134,8 @@ Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
oldp = mem2chunk(oldmem);
oldsize = chunksize(oldp);

nb = request2size(bytes);
if(request2size(bytes, nb))
return 0;

#if HAVE_MMAP
if (chunk_is_mmapped(oldp))
Expand Down Expand Up @@ -3399,7 +3401,8 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;

if (alignment < MINSIZE) alignment = MINSIZE;

nb = request2size(bytes);
if(request2size(bytes, nb))
return 0;
arena_get(ar_ptr, nb + alignment + MINSIZE);
if(!ar_ptr)
return 0;
Expand Down Expand Up @@ -3574,7 +3577,8 @@ Void_t* cALLOc(n, elem_size) size_t n; size_t elem_size;
}
#endif

sz = request2size(n * elem_size);
if(request2size(n * elem_size, sz))
return 0;
arena_get(ar_ptr, sz);
if(!ar_ptr)
return 0;
Expand Down Expand Up @@ -4364,8 +4368,10 @@ malloc_check(sz, caller) size_t sz; const Void_t *caller;
#endif
{
mchunkptr victim;
INTERNAL_SIZE_T nb = request2size(sz + 1);
INTERNAL_SIZE_T nb;

if(request2size(sz+1, nb))
return 0;
(void)mutex_lock(&main_arena.mutex);
victim = (top_check() >= 0) ? chunk_alloc(&main_arena, nb) : NULL;
(void)mutex_unlock(&main_arena.mutex);
Expand Down Expand Up @@ -4434,7 +4440,10 @@ realloc_check(oldmem, bytes, caller)
}
oldsize = chunksize(oldp);

nb = request2size(bytes+1);
if(request2size(bytes+1, nb)) {
(void)mutex_unlock(&main_arena.mutex);
return 0;
}

#if HAVE_MMAP
if (chunk_is_mmapped(oldp)) {
Expand Down Expand Up @@ -4491,7 +4500,8 @@ memalign_check(alignment, bytes, caller)
if (alignment <= MALLOC_ALIGNMENT) return malloc_check(bytes, NULL);
if (alignment < MINSIZE) alignment = MINSIZE;

nb = request2size(bytes+1);
if(request2size(bytes+1, nb))
return 0;
(void)mutex_lock(&main_arena.mutex);
p = (top_check() >= 0) ? chunk_align(&main_arena, nb, alignment) : NULL;
(void)mutex_unlock(&main_arena.mutex);
Expand All @@ -4511,7 +4521,12 @@ malloc_starter(size_t sz, const Void_t *caller)
malloc_starter(sz, caller) size_t sz; const Void_t *caller;
#endif
{
mchunkptr victim = chunk_alloc(&main_arena, request2size(sz));
INTERNAL_SIZE_T nb;
mchunkptr victim;

if(request2size(sz, nb))
return 0;
victim = chunk_alloc(&main_arena, nb);

return victim ? chunk2mem(victim) : 0;
}
Expand Down Expand Up @@ -4547,16 +4562,20 @@ malloc_atfork(sz, caller) size_t sz; const Void_t *caller;
#endif
{
Void_t *vptr = NULL;
INTERNAL_SIZE_T nb;
mchunkptr victim;

tsd_getspecific(arena_key, vptr);
if(!vptr) {
if(save_malloc_hook != malloc_check) {
victim = chunk_alloc(&main_arena, request2size(sz));
if(request2size(sz, nb))
return 0;
victim = chunk_alloc(&main_arena, nb);
return victim ? chunk2mem(victim) : 0;
} else {
if(top_check() < 0) return 0;
victim = chunk_alloc(&main_arena, request2size(sz+1));
if(top_check()<0 || request2size(sz+1, nb))
return 0;
victim = chunk_alloc(&main_arena, nb);
return victim ? chunk2mem_check(victim, sz) : 0;
}
} else {
Expand Down
27 changes: 26 additions & 1 deletion manual/filesys.texi
Original file line number Diff line number Diff line change
Expand Up @@ -2935,11 +2935,36 @@ end with @samp{XXXXXX}, @code{mkstemp} returns @code{-1} and does not
modify @var{template}.

The file is opened using mode @code{0600}. If the file is meant to be
used by other users the mode must explicitly changed.
used by other users the mode must be changed explicitly.
@end deftypefun

Unlike @code{mktemp}, @code{mkstemp} is actually guaranteed to create a
unique file that cannot possibly clash with any other program trying to
create a temporary file. This is because it works by calling
@code{open} with the @code{O_EXCL} flag bit, which says you want to
always create a new file, and get an error if the file already exists.

@comment stdlib.h
@comment BSD
@deftypefun {char *} mkdtemp (char *@var{template})
The @code{mkdtemp} function creates a directory with a unique name. If
it succeeds, it overwrites @var{template} with the name of the
directory, and returns @var{template}. As with @code{mktemp} and
@code{mkstemp}, @var{template} should be a string ending with
@samp{XXXXXX}.

If @code{mkdtemp} cannot create an uniquely named directory, it returns
@code{NULL} and sets @var{errno} appropriately. If @var{template} does
not end with @samp{XXXXXX}, @code{mkdtemp} returns @code{NULL} and does
not modify @var{template}. @var{errno} will be set to @code{EINVAL} in
this case.

The directory is created using mode @code{0700}.
@end deftypefun

The directory created by @code{mkdtemp} cannot clash with temporary
files or directories created by other users. This is because directory
creation always works like @code{open} with @code{O_EXCL}.
@xref{Creating Directories}.

The @code{mkdtemp} function comes from OpenBSD.
2 changes: 1 addition & 1 deletion misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ routines := brk sbrk sstk ioctl \
acct chroot fsync sync fdatasync reboot \
gethostid sethostid \
revoke vhangup \
swapon swapoff mktemp mkstemp \
swapon swapoff mktemp mkstemp mkdtemp \
ualarm usleep \
gtty stty \
ptrace \
Expand Down
4 changes: 4 additions & 0 deletions misc/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@ libc {
# t*
tdestroy; truncate64;
}
GLIBC_2.2 {
# m*
mkdtemp;
}
}
35 changes: 35 additions & 0 deletions misc/mkdtemp.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* Copyright (C) 1999 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
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */

#include <stdio.h>
#include <stdlib.h>

/* Generate a unique temporary directory from TEMPLATE.
The last six characters of TEMPLATE must be "XXXXXX";
they are replaced with a string that makes the filename unique.
The directory is created, mode 700, and its name is returned.
(This function comes from OpenBSD.) */
char *
mkdtemp (template)
char *template;
{
if (__gen_tempname (template, __GT_DIR))
return NULL;
else
return template;
}
4 changes: 2 additions & 2 deletions misc/mkstemp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 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
Expand Down Expand Up @@ -27,5 +27,5 @@ int
mkstemp (template)
char *template;
{
return __gen_tempname (template, 1, 0);
return __gen_tempname (template, __GT_FILE);
}
4 changes: 2 additions & 2 deletions misc/mktemp.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1998 Free Software Foundation, Inc.
/* Copyright (C) 1998, 1999 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
Expand Down Expand Up @@ -26,7 +26,7 @@ char *
mktemp (template)
char *template;
{
if (__gen_tempname (template, 0, 0) < 0)
if (__gen_tempname (template, __GT_NOCREATE) < 0)
/* We return the null string if we can't find a unique file name. */
template[0] = '\0';

Expand Down
Loading

0 comments on commit 2e65ca2

Please sign in to comment.