Updated to fedora-glibc-20090424T0747

This commit is contained in:
Jakub Jelinek 2009-04-24 08:00:37 +00:00
parent 335206256c
commit 7dec33c08e
72 changed files with 2332 additions and 827 deletions

146
ChangeLog
View File

@ -1,3 +1,149 @@
2009-04-23 Ulrich Drepper <drepper@redhat.com>
[BZ #9920]
* stdlib/random_r.c (__srandom_r): Change type of word to int32_t
to get consistency between 32 and 64 bit architectures.
[BZ #10052]
* sysdeps/unix/make-syscalls.sh: Add rule to create target
directory for dummy syscall rules.
Patch by Chris Steinbroner <hesh@pobox.com>.
2009-04-23 Aurelien Jarno <aurelien@aurel32.net>
[BZ #10092]
* sysdeps/unix/sysv/linux/sys/mount.h: Define MNT_DETACH and
MNT_EXPIRE.
2009-04-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/preadv.c: The kernel API changed. Adjust.
* sysdeps/unix/sysv/linux/pwritev.c: Likewise.
2009-04-23 Jakub Jelinek <jakub@redhat.com>
* sysdeps/posix/pwritev.c (PWRITEV): Fix up comment. Copy
data from vector to temporary buffer and call PWRITEV after it
instead of vice versa.
* sysdeps/posix/preadv.c: Fix up comment.
* misc/preadv.c: Likewise.
* misc/preadv64.c: Likewise.
* misc/pwritev.c: Likewise.
* misc/pwritev64.c: Likewise.
* misc/sys/uio.h (preadv, pwritev, preadv64, pwritev64): Likewise.
2009-04-23 Ulrich Drepper <drepper@redhat.com>
* shadow/sgetspent_r.c (__sgetspent_r): Recognize too small buffers.
* shadow/Makefile (tests): Add tst-shadow.
* shadow/tst-shadow.c: New file.
[BZ #9955]
* gshadow/Makefile: New file.
* gshadow/Versions: New file.
* gshadow/fgetsgent.c: New file.
* gshadow/fgetsgent_r.c: New file.
* gshadow/getsgent.c: New file.
* gshadow/getsgent_r.c: New file.
* gshadow/getsgnam.c: New file.
* gshadow/getsgnam_r.c: New file.
* gshadow/gshadow.h: New file.
* gshadow/putsgent.c: New file.
* gshadow/sgetsgent.c: New file.
* gshadow/sgetsgent_r.c: New file.
* gshadow/tst-gshadow.c: New file.
* include/gshadow.h: New file.
* Makeconfig (all-subdirs): Add gshadow.
* Makefile (installed-headers): Add gshadow/gshadow.h.
* nss/Makefile (databases): Add sgrp.
* nss/Versions: Add gshadow functions as private exports.
* nss/nsswitch.conf: Add gshadow entry.
* nss/sgrp-lookup.c: New file.
* nss/nss_files/files-parse.c: Add STRING_LIST macro. Rewrite
parse_list to handle STRING_LIST and TRAILING_LIST_PARSER.
* nss/nss_files/files-sgrp.c: New file.
* sysdeps/generic/paths.h: Add _PATH_GSHADOW.
* sysdeps/unix/sysv/linux/paths.h: Likewise.
2009-04-22 Ulrich Drepper <drepper@redhat.com>
* stdio-common/printf.h: Add missing const to register_printf_modifier.
* stdio-common/reg-modifier.c: Likewise.
2009-04-22 Andrew Stubbs <ams@codesourcery.com>
* sysdeps/sh/sh4/setjmp.S (__sigsetjmp): Adjust JB_SIZE when there
is no FPU.
2009-04-20 Ulrich Drepper <drepper@redhat.com>
[BZ #10086]
* sysdeps/unix/sysv/linux/sys/timex.h: Add definitions from kernel
headers up to 2.6.30.
* po/ca.po: Update from translation team.
2009-04-19 Ulrich Drepper <drepper@redhat.com>
[BZ #10069]
* elf/dl-open.c (dl_open_worker): We cannot guarantee that we can load
an object that uses static TLS if the TLS modid is higher than the
reserve we always allocate. At least for multi-threaded code.
2009-04-18 Ulrich Drepper <drepper@redhat.com>
* stdlib/strfmon_l.c (__vstrfmon_l): Don't wrap when computing width.
Numerically stable check for valid width.
* locale/programs/locarchive.c (open_archive): Map the entire file
and not just the administrative data.
(add_locale): When we find a hash sum match compare the content
to be sure.
* malloc/malloc.c (malloc_info): Output address space information.
2009-04-17 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (malloc_info): Also output system memory information.
* sysdeps/unix/sysv/linux/kernel-features.h: All supported
architectures have preadv/pwritev in 2.6.30.
* sysdeps/posix/preadv.c: Reading of zero bytes is no error.
* sysdeps/posix/readv.c: Likewise.
Reported by Markus Armbruster <armbru@redhat.com>.
* malloc/hooks.c (top_check): Force hook value into register.
2009-04-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
* elf/rtld.c (dl_main): Really call _dl_sysdep_start_cleanup after all
calls to _dl_relocate_object.
2009-04-16 Ulrich Drepper <drepper@redhat.com>
[BZ #9957]
* malloc/malloc.c (force_reg): Define.
(sYSMALLOc): Load hook variable into variable
before test and force into register.
(sYSTRIm): Likewise.
(public_mALLOc): Force hook value into register.
(public_fREe): Likewise.
(public_rEALLOc): Likewise.
(public_mEMALIGn): Likewise.
(public_vALLOc): Likewise.
(public_pVALLOc): Likewise.
(public_cALLOc): Likewise.
(__posix_memalign): Likewise.
* malloc/arena.c (ptmalloc_init): Load hook variable into variable
before test and force into register.
* malloc/hooks.c (top_check): Likewise.
(public_sET_STATe): Pretty printing.
* resolv/res_send.c (send_dg): Don't just ignore the result we got
in case we only receive one reply in single-request mode.
2009-04-16 Jakub Jelinek <jakub@redhat.com>
* elf/dl-open.c (_dl_open): Bump GL(dl_nns) to 1 if no libraries

View File

@ -918,7 +918,7 @@ endif
all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
stdlib stdio-common libio malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow po argp \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
crypt nss localedata timezone rt conform debug \
$(add-on-subdirs) $(dlfcn) $(binfmt-subdir)

View File

@ -271,7 +271,7 @@ installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
crypt/crypt.h ctype/ctype.h debug/execinfo.h \
dirent/dirent.h dlfcn/dlfcn.h elf/elf.h elf/link.h \
gmon/sys/gmon.h gmon/sys/gmon_out.h gmon/sys/profil.h \
grp/grp.h iconv/iconv.h iconv/gconv.h \
grp/grp.h gshadow/gshadow.h iconv/iconv.h iconv/gconv.h \
$(wildcard inet/netinet/*.h) \
$(wildcard inet/arpa/*.h inet/protocols/*.h) \
inet/aliases.h inet/ifaddrs.h inet/netinet/ip6.h \

5
NEWS
View File

@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2009-4-13
GNU C Library NEWS -- history of user-visible changes. 2009-4-23
Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
See the end for copying conditions.
@ -44,6 +44,9 @@ Version 2.10
and extend existing format specifiers.
Implemented by Ulrich Drepper.
* Handling for group shadow files has been added.
Implemented by Ulrich Drepper.
Version 2.9

View File

@ -490,6 +490,18 @@ dl_open_worker (void *a)
if (imap->l_need_tls_init)
{
/* For static TLS we have to allocate the memory here
and now. This includes allocating memory in the DTV.
But we cannot change any DTV other than our own. So,
if we cannot guarantee that there is room in the DTV
we don't even try it and fail the load.
XXX We could track the minimum DTV slots allocated in
all threads. */
if (! RTLD_SINGLE_THREAD_P && imap->l_tls_modid > DTV_SURPLUS)
_dl_signal_error (0, "dlopen", NULL, N_("\
cannot load any more object with static TLS"));
imap->l_need_tls_init = 0;
#ifdef SHARED
/* Update the slot information data for at least the

View File

@ -2181,8 +2181,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
}
_dl_sysdep_start_cleanup ();
}
else
{
@ -2237,13 +2235,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
HP_TIMING_DIFF (relocate_time, start, stop);
/* Do any necessary cleanups for the startup OS interface code.
We do these now so that no calls are made after rtld re-relocation
which might be resolved to different functions than we expect.
We cannot do this before relocating the other objects because
_dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
_dl_sysdep_start_cleanup ();
/* Now enable profiling if needed. Like the previous call,
this has to go here because the calls it makes should use the
rtld versions of the functions (particularly calloc()), but it
@ -2299,6 +2290,13 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
HP_TIMING_ACCUM_NT (relocate_time, add);
}
/* Do any necessary cleanups for the startup OS interface code.
We do these now so that no calls are made after rtld re-relocation
which might be resolved to different functions than we expect.
We cannot do this before relocating the other objects because
_dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
_dl_sysdep_start_cleanup ();
#ifdef SHARED
/* Auditing checkpoint: we have added all objects. */
if (__builtin_expect (GLRO(dl_naudit) > 0, 0))

View File

@ -3,5 +3,5 @@ glibc-branch := fedora
glibc-base := HEAD
DIST_BRANCH := devel
COLLECTION := dist-f8
fedora-sync-date := 2009-04-16 16:10 UTC
fedora-sync-tag := fedora-glibc-20090416T1610
fedora-sync-date := 2009-04-24 07:47 UTC
fedora-sync-tag := fedora-glibc-20090424T0747

View File

@ -19,7 +19,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: @glibcversion@
Release: 19
Release: 20
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs
# and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@ -1009,6 +1009,11 @@ rm -f *.filelist*
%endif
%changelog
* Fri Apr 24 2009 Jakub Jelinek <jakub@redhat.com> 2.9.90-20
- update from trunk
- fix p{read,write}v{,64} (#497429, #497434)
- fix strfmon (#496386)
* Thu Apr 16 2009 Jakub Jelinek <jakub@redhat.com> 2.9.90-19
- update from trunk
- fix dlopen from statically linked binaries (#495830)

38
gshadow/Makefile Normal file
View File

@ -0,0 +1,38 @@
# Copyright (C) 2009 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 Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 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
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
#
# Makefile for gshadow.
#
subdir := gshadow
headers = gshadow.h
routines = getsgent getsgnam sgetsgent fgetsgent putsgent \
getsgent_r getsgnam_r sgetsgent_r fgetsgent_r
tests = tst-gshadow
CFLAGS-getsgent_r.c = -fexceptions
CFLAGS-getsgent.c = -fexceptions
CFLAGS-fgetsgent.c = -fexceptions
CFLAGS-fgetsgent_r.c = -fexceptions -D_IO_MTSAFE_IO
CFLAGS-putsgent.c = -fexceptions -D_IO_MTSAFE_IO
CFLAGS-getsgnam.c = -fexceptions
CFLAGS-getsgnam_r.c = -fexceptions
include ../Rules

21
gshadow/Versions Normal file
View File

@ -0,0 +1,21 @@
libc {
GLIBC_2.10 {
# e*
endsgent;
# f*
fgetsgent; fgetsgent_r;
# g*
getsgent; getsgent_r; getsgnam; getsgnam_r; getsgent_r; getsgnam_r;
# p*
putsgent;
# s*
setsgent;
# s*
sgetsgent; sgetsgent_r;
}
}

88
gshadow/fgetsgent.c Normal file
View File

@ -0,0 +1,88 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <bits/libc-lock.h>
#include <gshadow.h>
#include <stdio.h>
#include <stdlib.h>
/* A reasonable size for a buffer to start with. */
#define BUFLEN_SPWD 1024
/* We need to protect the dynamic buffer handling. */
__libc_lock_define_initialized (static, lock);
libc_freeres_ptr (static char *buffer);
/* Read one shadow entry from the given stream. */
struct sgrp *
fgetsgent (FILE *stream)
{
static size_t buffer_size;
static struct sgrp resbuf;
fpos_t pos;
struct sgrp *result;
int save;
if (fgetpos (stream, &pos) != 0)
return NULL;
/* Get lock. */
__libc_lock_lock (lock);
/* Allocate buffer if not yet available. */
if (buffer == NULL)
{
buffer_size = BUFLEN_SPWD;
buffer = malloc (buffer_size);
}
while (buffer != NULL
&& (__fgetsgent_r (stream, &resbuf, buffer, buffer_size, &result)
== ERANGE))
{
char *new_buf;
buffer_size += BUFLEN_SPWD;
new_buf = realloc (buffer, buffer_size);
if (new_buf == NULL)
{
/* We are out of memory. Free the current buffer so that the
process gets a chance for a normal termination. */
save = errno;
free (buffer);
__set_errno (save);
}
buffer = new_buf;
/* Reset the stream. */
if (fsetpos (stream, &pos) != 0)
buffer = NULL;
}
if (buffer == NULL)
result = NULL;
/* Release lock. Preserve error value. */
save = errno;
__libc_lock_unlock (lock);
__set_errno (save);
return result;
}

76
gshadow/fgetsgent_r.c Normal file
View File

@ -0,0 +1,76 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <ctype.h>
#include <errno.h>
#include <gshadow.h>
#include <stdio.h>
/* Define a line parsing function using the common code
used in the nss_files module. */
#define STRUCTURE sgrp
#define ENTNAME sgent
#define EXTERN_PARSER 1
struct sgent_data {};
#include <nss/nss_files/files-parse.c>
/* Read one shadow entry from the given stream. */
int
__fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen,
struct sgrp **result)
{
char *p;
_IO_flockfile (stream);
do
{
buffer[buflen - 1] = '\xff';
p = fgets_unlocked (buffer, buflen, stream);
if (p == NULL && feof_unlocked (stream))
{
_IO_funlockfile (stream);
*result = NULL;
__set_errno (ENOENT);
return errno;
}
if (p == NULL || buffer[buflen - 1] != '\xff')
{
_IO_funlockfile (stream);
*result = NULL;
__set_errno (ERANGE);
return errno;
}
/* Skip leading blanks. */
while (isspace (*p))
++p;
} while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */
/* Parse the line. If it is invalid, loop to
get the next line of the file to parse. */
! parse_line (buffer, (void *) resbuf, (void *) buffer, buflen,
&errno));
_IO_funlockfile (stream);
*result = resbuf;
return 0;
}
weak_alias (__fgetsgent_r, fgetsgent_r)

30
gshadow/getsgent.c Normal file
View File

@ -0,0 +1,30 @@
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <gshadow.h>
#define LOOKUP_TYPE struct sgrp
#define SETFUNC_NAME setsgent
#define GETFUNC_NAME getsgent
#define ENDFUNC_NAME endsgent
#define DATABASE_NAME gshadow
#define BUFLEN 1024
#include "../nss/getXXent.c"

30
gshadow/getsgent_r.c Normal file
View File

@ -0,0 +1,30 @@
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <gshadow.h>
#define LOOKUP_TYPE struct sgrp
#define SETFUNC_NAME setsgent
#define GETFUNC_NAME getsgent
#define ENDFUNC_NAME endsgent
#define DATABASE_NAME gshadow
#define BUFLEN 1024
#include "../nss/getXXent_r.c"

30
gshadow/getsgnam.c Normal file
View File

@ -0,0 +1,30 @@
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <gshadow.h>
#define LOOKUP_TYPE struct sgrp
#define FUNCTION_NAME getsgnam
#define DATABASE_NAME gshadow
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
#define BUFLEN 1024
#include "../nss/getXXbyYY.c"

30
gshadow/getsgnam_r.c Normal file
View File

@ -0,0 +1,30 @@
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <gshadow.h>
#define LOOKUP_TYPE struct sgrp
#define FUNCTION_NAME getsgnam
#define DATABASE_NAME gshadow
#define ADD_PARAMS const char *name
#define ADD_VARIABLES name
#define BUFLEN 1024
#include "../nss/getXXbyYY_r.c"

131
gshadow/gshadow.h Normal file
View File

@ -0,0 +1,131 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Declaration of types and functions for shadow group suite. */
#ifndef _GSHADOW_H
#define _GSHADOW_H 1
#include <features.h>
#include <paths.h>
#define __need_FILE
#include <stdio.h>
#define __need_size_t
#include <stddef.h>
/* Path to the user database files. */
#define GSHADOW _PATH_GSHADOW
__BEGIN_DECLS
/* Structure of the group file. */
struct sgrp
{
char *sg_namp; /* Group name. */
char *sg_passwd; /* Encrypted password. */
char **sg_adm; /* Group administrator list. */
char **sg_mem; /* Group member list. */
};
/* Open database for reading.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void setsgent (void);
/* Close database.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern void endsgent (void);
/* Get next entry from database, perhaps after opening the file.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct sgrp *getsgent (void);
/* Get shadow entry matching NAME.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct sgrp *getsgnam (__const char *__name);
/* Read shadow entry from STRING.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct sgrp *sgetsgent (__const char *__string);
/* Read next shadow entry from STREAM.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern struct sgrp *fgetsgent (FILE *__stream);
/* Write line containing shadow password entry to stream.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int putsgent (__const struct sgrp *__g, FILE *__stream);
#ifdef __USE_MISC
/* Reentrant versions of some of the functions above.
These functions are not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation they are cancellation points and
therefore not marked with __THROW. */
extern int getsgent_r (struct sgrp *__result_buf, char *__buffer,
size_t __buflen, struct sgrp **__result);
extern int getsgnam_r (__const char *__name, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
struct sgrp **__result);
extern int sgetsgent_r (__const char *__string, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
struct sgrp **__result);
extern int fgetsgent_r (FILE *__stream, struct sgrp *__result_buf,
char *__buffer, size_t __buflen,
struct sgrp **__result);
#endif /* misc */
__END_DECLS
#endif /* gshadow.h */

71
gshadow/putsgent.c Normal file
View File

@ -0,0 +1,71 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <stdbool.h>
#include <stdio.h>
#include <gshadow.h>
#define _S(x) x ? x : ""
/* Write an entry to the given stream.
This must know the format of the group file. */
int
putsgent (const struct sgrp *g, FILE *stream)
{
int errors = 0;
_IO_flockfile (stream);
if (fprintf (stream, "%s:%s:", g->sg_namp, _S (g->sg_passwd)) < 0)
++errors;
bool first = true;
char **sp = g->sg_adm;
if (sp != NULL)
while (*sp != NULL)
{
if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
}
first = false;
}
if (putc_unlocked (':', stream) == EOF)
++errors;
first = true;
sp = g->sg_mem;
if (sp != NULL)
while (*sp != NULL)
{
if (fprintf (stream, "%s%s", first ? "" : ",", *sp++) < 0)
{
++errors;
break;
}
first = false;
}
if (putc_unlocked ('\n', stream) == EOF)
++errors;
_IO_funlockfile (stream);
return errors ? -1 : 0;
}

78
gshadow/sgetsgent.c Normal file
View File

@ -0,0 +1,78 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <errno.h>
#include <bits/libc-lock.h>
#include <gshadow.h>
#include <stdlib.h>
/* A reasonable size for a buffer to start with. */
#define BUFLEN_SPWD 1024
/* We need to protect the dynamic buffer handling. */
__libc_lock_define_initialized (static, lock);
/* Read one shadow entry from the given stream. */
struct sgrp *
sgetsgent (const char *string)
{
static char *buffer;
static size_t buffer_size;
static struct sgrp resbuf;
struct sgrp *result;
int save;
/* Get lock. */
__libc_lock_lock (lock);
/* Allocate buffer if not yet available. */
if (buffer == NULL)
{
buffer_size = BUFLEN_SPWD;
buffer = malloc (buffer_size);
}
while (buffer != NULL
&& __sgetsgent_r (string, &resbuf, buffer, buffer_size, &result) != 0
&& errno == ERANGE)
{
char *new_buf;
buffer_size += BUFLEN_SPWD;
new_buf = realloc (buffer, buffer_size);
if (new_buf == NULL)
{
/* We are out of memory. Free the current buffer so that the
process gets a chance for a normal termination. */
save = errno;
free (buffer);
__set_errno (save);
}
buffer = new_buf;
}
if (buffer == NULL)
result = NULL;
/* Release lock. Preserve error value. */
save = errno;
__libc_lock_unlock (lock);
__set_errno (save);
return result;
}

75
gshadow/sgetsgent_r.c Normal file
View File

@ -0,0 +1,75 @@
/* Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <ctype.h>
#include <errno.h>
#include <gshadow.h>
#include <stdio.h>
#include <string.h>
/* Define a line parsing function using the common code
used in the nss_files module. */
#define STRUCTURE sgrp
#define ENTNAME sgent
struct sgent_data {};
#define TRAILING_LIST_MEMBER sg_mem
#define TRAILING_LIST_SEPARATOR_P(c) ((c) == ',')
#include <nss/nss_files/files-parse.c>
LINE_PARSER
(,
STRING_FIELD (result->sg_namp, ISCOLON, 0);
if (line[0] == '\0'
&& (result->sg_namp[0] == '+' || result->sg_namp[0] == '-'))
{
result->sg_passwd = NULL;
result->sg_adm = NULL;
result->sg_mem = NULL;
}
else
{
STRING_FIELD (result->sg_passwd, ISCOLON, 0);
STRING_LIST (result->sg_adm, ':');
}
)
/* Read one shadow entry from the given stream. */
int
__sgetsgent_r (const char *string, struct sgrp *resbuf, char *buffer,
size_t buflen, struct sgrp **result)
{
char *sp;
if (string < buffer || string >= buffer + buflen)
{
buffer[buflen - 1] = '\0';
sp = strncpy (buffer, string, buflen);
if (buffer[buflen - 1] != '\0')
return ERANGE;
}
else
sp = (char *) string;
int parse_result = parse_line (sp, resbuf, (void *) buffer, buflen, &errno);
*result = parse_result > 0 ? resbuf : NULL;
return *result == NULL ? errno : 0;
}
weak_alias (__sgetsgent_r, sgetsgent_r)

141
gshadow/tst-gshadow.c Normal file
View File

@ -0,0 +1,141 @@
#include <gshadow.h>
#include <stdio.h>
#include <string.h>
static const struct sgrp data[] =
{
{ (char *) "one", (char *) "pwdone",
(char *[]) { (char *) "admoneone", (char *) "admonetwo",
(char *) "admonethree", NULL },
(char *[]) { (char *) "memoneone", (char *) "memonetwo",
(char *) "memonethree", NULL } },
{ (char *) "two", (char *) "pwdtwo",
(char *[]) { (char *) "admtwoone", (char *) "admtwotwo", NULL },
(char *[]) { (char *) "memtwoone", (char *) "memtwotwo",
(char *) "memtwothree", NULL } },
{ (char *) "three", (char *) "pwdthree",
(char *[]) { (char *) "admthreeone", (char *) "admthreetwo", NULL },
(char *[]) { (char *) "memthreeone", (char *) "memthreetwo", NULL } },
{ (char *) "four", (char *) "pwdfour",
(char *[]) { (char *) "admfourone", (char *) "admfourtwo", NULL },
(char *[]) { NULL } },
{ (char *) "five", (char *) "pwdfive",
(char *[]) { NULL },
(char *[]) { (char *) "memfiveone", (char *) "memfivetwo", NULL } },
};
#define ndata (sizeof (data) / sizeof (data[0]))
static int
do_test (void)
{
FILE *fp = tmpfile ();
if (fp == NULL)
{
puts ("cannot open temporary file");
return 1;
}
for (size_t i = 0; i < ndata; ++i)
if (putsgent (&data[i], fp) != 0)
{
printf ("putsgent call %zu failed\n", i + 1);
return 1;
}
rewind (fp);
int result = 0;
int seen = -1;
struct sgrp *g;
while ((g = fgetsgent (fp)) != NULL)
{
++seen;
if (strcmp (g->sg_namp, data[seen].sg_namp) != 0)
{
printf ("sg_namp of entry %d does not match: %s vs %s\n",
seen + 1, g->sg_namp, data[seen].sg_namp);
result = 1;
}
if (strcmp (g->sg_passwd, data[seen].sg_passwd) != 0)
{
printf ("sg_passwd of entry %d does not match: %s vs %s\n",
seen + 1, g->sg_passwd, data[seen].sg_passwd);
result = 1;
}
if (g->sg_adm == NULL)
{
printf ("sg_adm of entry %d is NULL\n", seen + 1);
result = 1;
}
else
{
int i = 1;
char **sp1 = g->sg_adm;
char **sp2 = data[seen].sg_adm;
while (*sp1 != NULL && *sp2 != NULL)
{
if (strcmp (*sp1, *sp2) != 0)
{
printf ("sg_adm[%d] of entry %d does not match: %s vs %s\n",
i, seen + 1, *sp1, *sp2);
result = 1;
}
++sp1;
++sp2;
++i;
}
if (*sp1 == NULL && *sp2 != NULL)
{
printf ("sg_adm of entry %d has too few entries\n", seen + 1);
result = 1;
}
else if (*sp1 != NULL && *sp2 == NULL)
{
printf ("sg_adm of entry %d has too many entries\n", seen + 1);
result = 1;
}
}
if (g->sg_mem == NULL)
{
printf ("sg_mem of entry %d is NULL\n", seen + 1);
result = 1;
}
else
{
int i = 1;
char **sp1 = g->sg_mem;
char **sp2 = data[seen].sg_mem;
while (*sp1 != NULL && *sp2 != NULL)
{
if (strcmp (*sp1, *sp2) != 0)
{
printf ("sg_mem[%d] of entry %d does not match: %s vs %s\n",
i, seen + 1, *sp1, *sp2);
result = 1;
}
++sp1;
++sp2;
++i;
}
if (*sp1 == NULL && *sp2 != NULL)
{
printf ("sg_mem of entry %d has too few entries\n", seen + 1);
result = 1;
}
else if (*sp1 != NULL && *sp2 == NULL)
{
printf ("sg_mem of entry %d has too many entries\n", seen + 1);
result = 1;
}
}
}
fclose (fp);
return result;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

15
include/gshadow.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef _GSHADOW_H
#include <gshadow/gshadow.h>
extern int __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer,
size_t buflen, struct sgrp **result);
extern int __sgetsgent_r (const char *string, struct sgrp *resbuf,
char *buffer, size_t buflen, struct sgrp **result);
struct parser_data;
extern int _nss_files_parse_sgent (char *line, struct sgrp *result,
struct parser_data *data,
size_t datalen, int *errnop);
libc_hidden_proto (_nss_files_parse_sgent)
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -380,7 +380,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
= ((char *) ah->addr
+ oldnamehashtab[oldlocrecarray[cnt - 1].cnt].name_offset);
add_alias (&new_ah,
add_alias (&new_ah,
((char *) ah->addr
+ oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset),
0, oldname, &last_locrec_offset);
@ -517,9 +517,9 @@ open_archive (struct locarhandle *ah, bool readonly)
ah->len = (head.sumhash_offset
+ head.sumhash_size * sizeof (struct sumhashent));
/* Now we know how large the administrative information part is.
Map all of it. */
ah->addr = mmap64 (NULL, ah->len, PROT_READ | (readonly ? 0 : PROT_WRITE),
/* Map the entire file. We might need to compare the category data
in the file with the newly added data. */
ah->addr = mmap64 (NULL, st.st_size, PROT_READ | (readonly ? 0 : PROT_WRITE),
MAP_SHARED, fd, 0);
if (ah->addr == MAP_FAILED)
{
@ -760,10 +760,32 @@ add_locale (struct locarhandle *ah,
{
if (memcmp (data[cnt].sum, sumhashtab[idx].sum, 16) == 0)
{
/* Found it. */
file_offsets[cnt] = sumhashtab[idx].file_offset;
--num_new_offsets;
break;
/* Check the content, there could be a collision of
the hash sum.
Unfortunately the sumhashent record does not include
the size of the stored data. So we have to search for
it. */
locrecent = (struct locrecent *) ((char *) ah->addr
+ head->locrectab_offset);
size_t iloc;
for (iloc = 0; iloc < head->locrectab_used; ++iloc)
if (locrecent[iloc].refs != 0
&& (locrecent[iloc].record[cnt].offset
== sumhashtab[idx].file_offset))
break;
if (iloc != head->locrectab_used
&& data[cnt].size == locrecent[iloc].record[cnt].len
&& memcmp (data[cnt].addr,
(char *) ah->addr + sumhashtab[idx].file_offset,
data[cnt].size) == 0)
{
/* Found it. */
file_offsets[cnt] = sumhashtab[idx].file_offset;
--num_new_offsets;
break;
}
}
idx += incr;

View File

@ -1,3 +1,21 @@
2009-04-22 Ulrich Drepper <drepper@redhat.com>
[BZ #9963]
* locales/en_PH: Fix LC_PAPER.
* locales/es_CL: Likewise.
* locales/es_CO: Likewise.
* locales/es_MX: Likewise.
* locales/es_US: Likewise.
* locales/es_VE: Likewise.
* locales/fil_PH: Likewise.
* locales/ik_CA: Likewise.
* locales/iu_CA: Likewise.
* locales/tl_PH: Likewise.
2009-04-18 Ulrich Drepper <drepper@redhat.com>
* SUPPORTED: Add ks_IN.
2009-04-07 Ulrich Drepper <drepper@redhat.com>
* locales/ks_IN@devanagari: Replace duplicated information with copy.

View File

@ -261,6 +261,7 @@ km_KH/UTF-8 \
kn_IN/UTF-8 \
ko_KR.EUC-KR/EUC-KR \
ko_KR.UTF-8/UTF-8 \
ks_IN/UTF-8 \
ks_IN@devanagari/UTF-8 \
ku_TR.UTF-8/UTF-8 \
ku_TR/ISO-8859-9 \

View File

@ -166,11 +166,7 @@ END LC_MESSAGES
LC_PAPER
% This is the ISO_IEC TR14652 Locale definition for the LC_PAPER category
% generated by IBM Basic CountryPack Transformer.
height 297
width 210
copy "tl_PH"
END LC_PAPER

View File

@ -125,10 +125,8 @@ date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
END LC_TIME
LC_PAPER
% FIXME
height 297
% FIXME
width 210
height 279
width 216
END LC_PAPER
LC_TELEPHONE

View File

@ -125,10 +125,8 @@ date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
END LC_TIME
LC_PAPER
% FIXME
height 297
% FIXME
width 210
height 279
width 216
END LC_PAPER
LC_TELEPHONE

View File

@ -125,10 +125,8 @@ date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
END LC_TIME
LC_PAPER
% FIXME
height 297
% FIXME
width 210
height 279
width 216
END LC_PAPER
LC_TELEPHONE

View File

@ -177,8 +177,7 @@ date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
END LC_TIME
LC_PAPER
height 279
width 216
copy "en_US"
END LC_PAPER
LC_TELEPHONE

View File

@ -126,10 +126,8 @@ date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
END LC_TIME
LC_PAPER
% FIXME
height 297
% FIXME
width 210
height 279
width 216
END LC_PAPER
LC_TELEPHONE

View File

@ -150,8 +150,7 @@ noexpr "<U005B><U0068><U0048><U006E><U004E><U005D><U002E><U002A>"
END LC_MESSAGES
LC_PAPER
height 297
width 210
copy "tl_PH"
END LC_PAPER
LC_MEASUREMENT

View File

@ -207,10 +207,8 @@ yesexpr "<U005B><U0079><U0059><U0069><U0049><U0061><U0041><U005D><U002E><U00
noexpr "<U005B><U006E><U004E><U0071><U0051><U005D><U002E><U002A>"
END LC_MESSAGES
% Default paper: A4
LC_PAPER
height 297
width 210
copy "en_CA"
END LC_PAPER
% Metric System (ISO 1000)

View File

@ -119,10 +119,8 @@ yesexpr "<U005B><U0079><U0059><U0073><U0053><U005D><U002E><U002A>"
noexpr "<U005B><U006E><U004E><U005D><U002E><U002A>"
END LC_MESSAGES
% Default paper: A4
LC_PAPER
height 297
width 210
copy "en_CA"
END LC_PAPER
% FIXME

View File

@ -144,8 +144,8 @@ copy "en_US"
END LC_MESSAGES
LC_PAPER
height 297
width 210
height 279
width 216
END LC_PAPER
LC_MEASUREMENT

View File

@ -624,8 +624,9 @@ ptmalloc_init (void)
if (check_action != 0)
__malloc_check_init();
}
if(__malloc_initialize_hook != NULL)
(*__malloc_initialize_hook)();
void (*hook) (void) = force_reg (__malloc_initialize_hook);
if (hook != NULL)
(*hook)();
__malloc_initialized = 1;
}

View File

@ -235,8 +235,9 @@ top_check()
return -1;
}
/* Call the `morecore' hook if necessary. */
if (__after_morecore_hook)
(*__after_morecore_hook) ();
void (*hook) (void) = force_reg (__after_morecore_hook);
if (hook)
(*hook) ();
main_arena.system_mem = (new_brk - mp_.sbrk_base) + sbrk_size;
top(&main_arena) = (mchunkptr)(brk + front_misalign);
@ -669,10 +670,10 @@ public_sET_STATe(Void_t* msptr)
!disallow_malloc_check)
__malloc_check_init ();
else if (!ms->using_malloc_checking && using_malloc_checking) {
__malloc_hook = 0;
__free_hook = 0;
__realloc_hook = 0;
__memalign_hook = 0;
__malloc_hook = NULL;
__free_hook = NULL;
__realloc_hook = NULL;
__memalign_hook = NULL;
using_malloc_checking = 0;
}
}

View File

@ -23,6 +23,10 @@
This is a version (aka ptmalloc2) of malloc/free/realloc written by
Doug Lea and adapted to multiple threads/arenas by Wolfram Gloger.
There have been substantial changesmade after the integration into
glibc in all parts of the code. Do not look for much commonality
with the ptmalloc2 version.
* Version ptmalloc2-20011215
based on:
VERSION 2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee)
@ -564,6 +568,13 @@ Void_t* memcpy();
#endif
#endif
/* Force a value to be in a register and stop the compiler referring
to the source (mostly memory location) again. */
#define force_reg(val) \
({ __typeof (val) _v; asm ("" : "=r" (_v) : "0" (val)); _v; })
/*
MALLOC_FAILURE_ACTION is the action to take before "return 0" when
malloc fails to be able to return memory, either because memory is
@ -3165,8 +3176,9 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
if (__builtin_expect (__after_morecore_hook != NULL, 0))
(*__after_morecore_hook) ();
void (*hook) (void) = force_reg (__after_morecore_hook);
if (__builtin_expect (hook != NULL, 0))
(*hook) ();
} else {
/*
If have mmap, try using it as a backup when MORECORE fails or
@ -3302,10 +3314,12 @@ static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
if (snd_brk == (char*)(MORECORE_FAILURE)) {
correction = 0;
snd_brk = (char*)(MORECORE(0));
} else
} else {
/* Call the `morecore' hook if necessary. */
if (__builtin_expect (__after_morecore_hook != NULL, 0))
(*__after_morecore_hook) ();
void (*hook) (void) = force_reg (__after_morecore_hook);
if (__builtin_expect (hook != NULL, 0))
(*hook) ();
}
}
/* handle non-contiguous cases */
@ -3453,8 +3467,9 @@ static int sYSTRIm(pad, av) size_t pad; mstate av;
MORECORE(-extra);
/* Call the `morecore' hook if necessary. */
if (__builtin_expect (__after_morecore_hook != NULL, 0))
(*__after_morecore_hook) ();
void (*hook) (void) = force_reg (__after_morecore_hook);
if (__builtin_expect (hook != NULL, 0))
(*hook) ();
new_brk = (char*)(MORECORE(0));
if (new_brk != (char*)MORECORE_FAILURE) {
@ -3579,7 +3594,8 @@ public_mALLOc(size_t bytes)
mstate ar_ptr;
Void_t *victim;
__malloc_ptr_t (*hook) (size_t, __const __malloc_ptr_t) = __malloc_hook;
__malloc_ptr_t (*hook) (size_t, __const __malloc_ptr_t)
= force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(bytes, RETURN_ADDRESS (0));
@ -3655,7 +3671,8 @@ public_fREe(Void_t* mem)
mstate ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
void (*hook) (__malloc_ptr_t, __const __malloc_ptr_t) = __free_hook;
void (*hook) (__malloc_ptr_t, __const __malloc_ptr_t)
= force_reg (__free_hook);
if (__builtin_expect (hook != NULL, 0)) {
(*hook)(mem, RETURN_ADDRESS (0));
return;
@ -3713,7 +3730,7 @@ public_rEALLOc(Void_t* oldmem, size_t bytes)
Void_t* newp; /* chunk to return */
__malloc_ptr_t (*hook) (__malloc_ptr_t, size_t, __const __malloc_ptr_t) =
__realloc_hook;
force_reg (__realloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(oldmem, bytes, RETURN_ADDRESS (0));
@ -3825,7 +3842,7 @@ public_mEMALIGn(size_t alignment, size_t bytes)
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
__memalign_hook;
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(alignment, bytes, RETURN_ADDRESS (0));
@ -3882,7 +3899,7 @@ public_vALLOc(size_t bytes)
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
__memalign_hook;
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, bytes, RETURN_ADDRESS (0));
@ -3929,7 +3946,7 @@ public_pVALLOc(size_t bytes)
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
__memalign_hook;
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, rounded_bytes, RETURN_ADDRESS (0));
@ -3970,8 +3987,6 @@ public_cALLOc(size_t n, size_t elem_size)
unsigned long clearsize;
unsigned long nclears;
INTERNAL_SIZE_T* d;
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) =
__malloc_hook;
/* size_t is unsigned so the behavior on overflow is defined. */
bytes = n * elem_size;
@ -3984,6 +3999,8 @@ public_cALLOc(size_t n, size_t elem_size)
}
}
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) =
force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0)) {
sz = bytes;
mem = (*hook)(sz, RETURN_ADDRESS (0));
@ -6192,9 +6209,6 @@ int
__posix_memalign (void **memptr, size_t alignment, size_t size)
{
void *mem;
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
__memalign_hook;
/* Test whether the SIZE argument is valid. It must be a power of
two multiple of sizeof (void *). */
@ -6205,6 +6219,9 @@ __posix_memalign (void **memptr, size_t alignment, size_t size)
/* Call the hook here, so that caller is posix_memalign's caller
and not posix_memalign itself. */
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
mem = (*hook)(alignment, size, RETURN_ADDRESS (0));
else
@ -6232,6 +6249,10 @@ malloc_info (int options, FILE *fp)
size_t total_nfastblocks = 0;
size_t total_avail = 0;
size_t total_fastavail = 0;
size_t total_system = 0;
size_t total_max_system = 0;
size_t total_aspace = 0;
size_t total_aspace_mprotect = 0;
void mi_arena (mstate ar_ptr)
{
@ -6337,11 +6358,38 @@ malloc_info (int options, FILE *fp)
sizes[NFASTBINS].from, sizes[NFASTBINS].to,
sizes[NFASTBINS].total, sizes[NFASTBINS].count);
total_system += ar_ptr->system_mem;
total_max_system += ar_ptr->max_system_mem;
fprintf (fp,
"</sizes>\n<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"</heap>\n",
nfastblocks, fastavail, nblocks, avail);
"<system type=\"current\" size=\"%zu\"/>\n"
"<system type=\"max\" size=\"%zu\"/>\n",
nfastblocks, fastavail, nblocks, avail,
ar_ptr->system_mem, ar_ptr->max_system_mem);
if (ar_ptr != &main_arena)
{
heap_info *heap = heap_for_ptr(top(ar_ptr));
fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
heap->size, heap->mprotect_size);
total_aspace += heap->size;
total_aspace_mprotect += heap->mprotect_size;
}
else
{
fprintf (fp,
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n",
ar_ptr->system_mem, ar_ptr->system_mem);
total_aspace += ar_ptr->system_mem;
total_aspace_mprotect += ar_ptr->system_mem;
}
fputs ("</heap>\n", fp);
}
fputs ("<malloc version=\"1\">\n", fp);
@ -6358,8 +6406,14 @@ malloc_info (int options, FILE *fp)
fprintf (fp,
"<total type=\"fast\" count=\"%zu\" size=\"%zu\"/>\n"
"<total type=\"rest\" count=\"%zu\" size=\"%zu\"/>\n"
"<system type=\"current\" size=\"%zu\n/>\n"
"<system type=\"max\" size=\"%zu\n/>\n"
"<aspace type=\"total\" size=\"%zu\"/>\n"
"<aspace type=\"mprotect\" size=\"%zu\"/>\n"
"</malloc>\n",
total_nfastblocks, total_fastavail, total_nblocks, total_avail);
total_nfastblocks, total_fastavail, total_nblocks, total_avail,
total_system, total_max_system,
total_aspace, total_aspace_mprotect);
return 0;
}

View File

@ -24,7 +24,7 @@
without change the file pointer, and put the result in the buffers
described by VECTOR, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in VECTOR instead
'pread' (see <unistd.h>) except that data are put in VECTOR instead
of a contiguous buffer. */
ssize_t
preadv (fd, vector, count, offset)

View File

@ -24,7 +24,7 @@
without change the file pointer, and put the result in the buffers
described by VECTOR, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in VECTOR instead
'pread' (see <unistd.h>) except that data are put in VECTOR instead
of a contiguous buffer. */
ssize_t
preadv64 (fd, vector, count, offset)

View File

@ -23,7 +23,7 @@
/* Write data pointed by the buffers described by VECTOR, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
position OFFSET without change the file pointer. The data is
written in the order specified. Operates just like 'write' (see
written in the order specified. Operates just like 'pwrite' (see
<unistd.h>) except that the data are taken from VECTOR instead of a
contiguous buffer. */
ssize_t

View File

@ -23,7 +23,7 @@
/* Write data pointed by the buffers described by VECTOR, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
position OFFSET without change the file pointer. The data is
written in the order specified. Operates just like 'write' (see
written in the order specified. Operates just like 'pwrite' (see
<unistd.h>) except that the data are taken from VECTOR instead of a
contiguous buffer. */
ssize_t

View File

@ -58,7 +58,7 @@ extern ssize_t writev (int __fd, __const struct iovec *__iovec, int __count)
without change the file pointer, and put the result in the buffers
described by IOVEC, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in IOVEC instead
'pread' (see <unistd.h>) except that data are put in IOVEC instead
of a contiguous buffer.
This function is a cancellation point and therefore not marked with
@ -69,7 +69,7 @@ extern ssize_t preadv (int __fd, __const struct iovec *__iovec, int __count,
/* Write data pointed by the buffers described by IOVEC, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
position OFFSET without change the file pointer. The data is
written in the order specified. Operates just like 'write' (see
written in the order specified. Operates just like 'pwrite' (see
<unistd.h>) except that the data are taken from IOVEC instead of a
contiguous buffer.
@ -96,7 +96,7 @@ extern ssize_t __REDIRECT (pwritev, (int __fd, __const struct iovec *__iovec,
without change the file pointer, and put the result in the buffers
described by IOVEC, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in IOVEC instead
'pread' (see <unistd.h>) except that data are put in IOVEC instead
of a contiguous buffer.
This function is a cancellation point and therefore not marked with
@ -107,7 +107,7 @@ extern ssize_t preadv64 (int __fd, __const struct iovec *__iovec, int __count,
/* Write data pointed by the buffers described by IOVEC, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
position OFFSET without change the file pointer. The data is
written in the order specified. Operates just like 'write' (see
written in the order specified. Operates just like 'pwrite' (see
<unistd.h>) except that the data are taken from IOVEC instead of a
contiguous buffer.

View File

@ -1,3 +1,10 @@
2009-04-22 Ulrich Drepper <drepper@redhat.com>
[BZ #10090]
* pthread_attr_setschedparam.c (__pthread_attr_setschedparam):
Check policy and priority for validity.
Patch mostly by Zhang Xiliang <zhangxiliang@cn.fujitsu.com>.
2009-03-15 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -31,6 +31,12 @@ __pthread_attr_setschedparam (attr, param)
assert (sizeof (*attr) >= sizeof (struct pthread_attr));
struct pthread_attr *iattr = (struct pthread_attr *) attr;
int min = sched_get_priority_min (iattr->schedpolicy);
int max = sched_get_priority_max (iattr->schedpolicy);
if (min == -1 || max == -1
|| param->sched_priority > max || param->sched_priority < min)
return EINVAL;
/* Copy the new values. */
memcpy (&iattr->schedparam, param, sizeof (struct sched_param));

View File

@ -1,4 +1,4 @@
# Copyright (C) 1996-1998,2000,2001,2002,2007 Free Software Foundation, Inc.
# Copyright (C) 1996-1998,2000-2002,2007,2009 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
@ -34,7 +34,7 @@ routines = nsswitch getnssent getnssent_r digits_dots \
# Caution: if you add a database here, you must add its real name
# in databases.def, too.
databases = proto service hosts network grp pwd rpc ethers \
spwd netgrp key alias
spwd netgrp key alias sgrp
others := getent
install-bin := getent

View File

@ -9,7 +9,7 @@ libc {
}
GLIBC_PRIVATE {
_nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
__nss_disable_nscd; __nss_lookup_function;
__nss_disable_nscd; __nss_lookup_function; _nss_files_parse_sgent;
__nss_passwd_lookup2; __nss_group_lookup2; __nss_hosts_lookup2;
__nss_services_lookup2; __nss_next2;
@ -87,6 +87,11 @@ libnss_files {
_nss_files_getspent_r;
_nss_files_getspnam_r;
_nss_files_setsgent;
_nss_files_endsgent;
_nss_files_getsgent_r;
_nss_files_getsgnam_r;
_nss_netgroup_parseline;
_nss_files_getpublickey;
_nss_files_getsecretkey;

View File

@ -103,6 +103,7 @@ parse_line (char *line, struct STRUCTURE *result, \
EXTRA_ARGS_DECL) \
{ \
ENTDATA_DECL (data) \
BUFFER_PREPARE \
char *p = strpbrk (line, EOLSET "\n"); \
if (p != NULL) \
*p = '\0'; \
@ -127,6 +128,21 @@ nss_files_parse_hidden_def (parse_line)
} \
}
# define STRING_LIST(variable, terminator_c) \
{ \
char **list = parse_list (&line, buf_start, buf_end, terminator_c, \
errnop); \
if (list) \
variable = list; \
else \
return -1; /* -1 indicates we ran out of space. */ \
\
/* Determine the new end of the buffer. */ \
while (*list != NULL) \
++list; \
buf_start = (char *) (list + 1); \
}
/* Helper function. */
static inline uint32_t
__attribute__ ((always_inline))
@ -178,12 +194,39 @@ strtou32 (const char *nptr, char **endptr, int base)
# ifndef TRAILING_LIST_MEMBER
# define BUFFER_PREPARE /* Nothing to do. */
# define TRAILING_LIST_PARSER /* Nothing to do. */
# else
# define TRAILING_LIST_PARSER \
# define BUFFER_PREPARE \
char *buf_start = NULL; \
char *buf_end = (char *) data + datalen; \
if (line >= data->linebuffer && line < buf_end) \
/* Find the end of the line buffer, we will use the space in \
DATA after it for storing the vector of pointers. */ \
buf_start = strchr (line, '\0') + 1; \
else \
/* LINE does not point within DATA->linebuffer, so that space is \
not being used for scratch space right now. We can use all of \
it for the pointer vector storage. */ \
buf_start = data->linebuffer; \
# define TRAILING_LIST_PARSER \
{ \
char **list = parse_list (line, data, datalen, errnop); \
if (buf_start == NULL) \
{ \
if (line >= data->linebuffer && line < buf_end) \
/* Find the end of the line buffer, we will use the space in \
DATA after it for storing the vector of pointers. */ \
buf_start = strchr (line, '\0') + 1; \
else \
/* LINE does not point within DATA->linebuffer, so that space is \
not being used for scratch space right now. We can use all of \
it for the pointer vector storage. */ \
buf_start = data->linebuffer; \
} \
\
char **list = parse_list (&line, buf_start, buf_end, '\0', errnop); \
if (list) \
result->TRAILING_LIST_MEMBER = list; \
else \
@ -192,19 +235,12 @@ strtou32 (const char *nptr, char **endptr, int base)
static inline char **
__attribute ((always_inline))
parse_list (char *line, struct parser_data *data, size_t datalen, int *errnop)
parse_list (char **linep, char *eol, char *buf_end, int terminator_c,
int *errnop)
{
char *eol, **list, **p;
char *line = *linep;
char **list, **p;
if (line >= data->linebuffer && line < (char *) data + datalen)
/* Find the end of the line buffer, we will use the space in DATA after
it for storing the vector of pointers. */
eol = strchr (line, '\0') + 1;
else
/* LINE does not point within DATA->linebuffer, so that space is
not being used for scratch space right now. We can use all of
it for the pointer vector storage. */
eol = data->linebuffer;
/* Adjust the pointer so it is aligned for storing pointers. */
eol += __alignof__ (char *) - 1;
eol -= (eol - (char *) 0) % __alignof__ (char *);
@ -214,25 +250,30 @@ parse_list (char *line, struct parser_data *data, size_t datalen, int *errnop)
p = list;
while (1)
{
char *elt;
if ((size_t) ((char *) &p[1] - (char *) data) > datalen)
if ((char *) (p + 2) > buf_end)
{
/* We cannot fit another pointer in the buffer. */
*errnop = ERANGE;
return NULL;
}
if (*line == '\0')
break;
if (*line == terminator_c)
{
++line;
break;
}
/* Skip leading white space. This might not be portable but useful. */
while (isspace (*line))
++line;
elt = line;
char *elt = line;
while (1)
{
if (*line == '\0' || TRAILING_LIST_SEPARATOR_P (*line))
if (*line == '\0' || *line == terminator_c
|| TRAILING_LIST_SEPARATOR_P (*line))
{
/* End of the next entry. */
if (line > elt)
@ -241,13 +282,20 @@ parse_list (char *line, struct parser_data *data, size_t datalen, int *errnop)
/* Terminate string if necessary. */
if (*line != '\0')
*line++ = '\0';
{
char endc = *line;
*line++ = '\0';
if (endc == terminator_c)
goto out;
}
break;
}
++line;
}
}
out:
*p = NULL;
*linep = line;
return list;
}

View File

@ -0,0 +1,38 @@
/* User file parser in nss_files module.
Copyright (C) 2009 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <gshadow.h>
#define STRUCTURE sgrp
#define ENTNAME sgent
#define DATABASE "gshadow"
struct sgent_data {};
/* Our parser function is already defined in sgetspent_r.c, so use that
to parse lines from the database file. */
#define EXTERN_PARSER
#include "files-parse.c"
#include GENERIC
DB_LOOKUP (sgnam, 1 + strlen (name), (".%s", name),
{
if (name[0] != '+' && name[0] != '-'
&& ! strcmp (name, result->sg_namp))
break;
}, const char *name)

View File

@ -6,6 +6,7 @@
passwd: db files
group: db files
shadow: db files
gshadow: files
hosts: files dns
networks: files dns

24
nss/sgrp-lookup.c Normal file
View File

@ -0,0 +1,24 @@
/* Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2009.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define DATABASE_NAME gshadow
#define ALTERNATE_NAME group
#define DEFAULT_CONFIG "files"
#include "XXX-lookup.c"

1459
po/ca.po

File diff suppressed because it is too large Load Diff

View File

@ -1048,9 +1048,7 @@ send_dg(res_state statp,
}
if (n == 0) {
Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
if (!single_request
&& resplen > 1
&& (recvresp1 || (buf2 != NULL && recvresp2)))
if (resplen > 1 && (recvresp1 || (buf2 != NULL && recvresp2)))
{
/* There are quite a few broken name servers out
there which don't handle two outstanding
@ -1059,9 +1057,15 @@ send_dg(res_state statp,
having received one answer switch to the mode
where we send the second request only once we
have received the first answer. */
single_request = true;
*gotsomewhere = save_gotsomewhere;
goto retry;
if (!single_request)
{
single_request = true;
*gotsomewhere = save_gotsomewhere;
goto retry;
}
*resplen2 = 1;
return resplen;
}
*gotsomewhere = 1;

View File

@ -1,4 +1,4 @@
# Copyright (C) 1996, 2003, 2004 Free Software Foundation, Inc.
# Copyright (C) 1996, 2003, 2004, 2009 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
@ -26,6 +26,8 @@ routines = getspent getspnam sgetspent fgetspent putspent \
getspent_r getspnam_r sgetspent_r fgetspent_r \
lckpwdf
tests = tst-shadow
CFLAGS-getspent_r.c = -fexceptions
CFLAGS-getspent.c = -fexceptions
CFLAGS-fgetspent.c = -fexceptions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2005 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998, 2005, 2009 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
@ -91,8 +91,12 @@ int
__sgetspent_r (const char *string, struct spwd *resbuf, char *buffer,
size_t buflen, struct spwd **result)
{
int parse_result = parse_line (strncpy (buffer, string, buflen),
resbuf, NULL, 0, &errno);
buffer[buflen - 1] = '\0';
char *sp = strncpy (buffer, string, buflen);
if (buffer[buflen - 1] != '\0')
return ERANGE;
int parse_result = parse_line (sp, resbuf, NULL, 0, &errno);
*result = parse_result > 0 ? resbuf : NULL;
return *result == NULL ? errno : 0;

84
shadow/tst-shadow.c Normal file
View File

@ -0,0 +1,84 @@
#include <shadow.h>
#include <stdio.h>
#include <string.h>
static const struct spwd data[] =
{
{ (char *) "one", (char *) "pwdone", 1, 2, 3, 4, 5, 6, 7 },
{ (char *) "two", (char *) "pwdtwo", 11, 12, 13, 14, 15, 16, 17 },
{ (char *) "three", (char *) "pwdthree", -1, 22, 23, 24, 25, 26, 27 },
{ (char *) "four", (char *) "pwdfour", 31, -1, 33, 34, 35, 36, 37 },
{ (char *) "five", (char *) "pwdfive", 41, 42, -1, 44, 45, 46, 47 },
{ (char *) "six", (char *) "pwdsix", 51, 52, 53, -1, 55, 56, 57 },
{ (char *) "seven", (char *) "pwdseven", 61, 62, 63, 64, -1, 66, 67 },
{ (char *) "eight", (char *) "pwdeigth", 71, 72, 73, 74, 75, -1, 77 },
{ (char *) "nine", (char *) "pwdnine", 81, 82, 83, 84, 85, 86, ~0ul },
};
#define ndata (sizeof (data) / sizeof (data[0]))
static int
do_test (void)
{
FILE *fp = tmpfile ();
if (fp == NULL)
{
puts ("cannot open temporary file");
return 1;
}
for (size_t i = 0; i < ndata; ++i)
if (putspent (&data[i], fp) != 0)
{
printf ("putspent call %zu failed\n", i + 1);
return 1;
}
rewind (fp);
int result = 0;
int seen = -1;
struct spwd *p;
while ((p = fgetspent (fp)) != NULL)
{
++seen;
if (strcmp (p->sp_namp, data[seen].sp_namp) != 0)
{
printf ("sp_namp of entry %d does not match: %s vs %s\n",
seen + 1, p->sp_namp, data[seen].sp_namp);
result = 1;
}
if (strcmp (p->sp_pwdp, data[seen].sp_pwdp) != 0)
{
printf ("sp_pwdp of entry %d does not match: %s vs %s\n",
seen + 1, p->sp_pwdp, data[seen].sp_pwdp);
result = 1;
}
#define T(f) \
if (p->f != data[seen].f) \
{ \
printf ("%s of entry %d wrong: %ld vs %ld\n", \
#f, seen + 1, p->f, data[seen].f); \
result = 1; \
}
T (sp_lstchg);
T (sp_min);
T (sp_max);
T (sp_warn);
T (sp_expire);
if (p->sp_flag != data[seen].sp_flag)
{
printf ("sp_flag of entry %d wrong: %lu vs %lu\n",
seen + 1, p->sp_flag, data[seen].sp_flag);
result = 1;
}
}
fclose (fp);
return result;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"

View File

@ -113,7 +113,7 @@ extern int register_printf_function (int __spec, printf_function __func,
it returns a positive value representing the bit set in the USER
field in 'struct printf_info'. */
extern int register_printf_modifier (wchar_t *__str) __wur __THROW;
extern int register_printf_modifier (__const wchar_t *__str) __wur __THROW;
/* Register variable argument handler for user type. The return value

View File

@ -39,7 +39,7 @@ static int next_bit;
int
__register_printf_modifier (wchar_t *str)
__register_printf_modifier (const wchar_t *str)
{
if (str[0] == L'\0')
{
@ -48,7 +48,7 @@ __register_printf_modifier (wchar_t *str)
return -1;
}
wchar_t *wc = str;
const wchar_t *wc = str;
while (*wc != L'\0')
if (*wc < 0 || *wc > (wchar_t) UCHAR_MAX)
goto einval;

View File

@ -1,5 +1,5 @@
/*
Copyright (C) 1995, 2005 Free Software Foundation
Copyright (C) 1995, 2005, 2009 Free Software Foundation
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -166,7 +166,7 @@ __srandom_r (seed, buf)
int type;
int32_t *state;
long int i;
long int word;
int32_t word;
int32_t *dst;
int kc;

View File

@ -1,5 +1,5 @@
/* Formatting a monetary value according to the given locale.
Copyright (C) 1996, 1997, 2002, 2004, 2006 Free Software Foundation, Inc.
Copyright (C) 1996,1997,2002,2004,2006,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -133,7 +133,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
int done;
const char *currency_symbol;
size_t currency_symbol_len;
int width;
long int width;
char *startp;
const void *ptr;
char space_char;
@ -221,13 +221,21 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
while (isdigit (*++fmt))
{
width *= 10;
width += to_digit (*fmt);
int val = to_digit (*fmt);
if (width > LONG_MAX / 10
|| (width == LONG_MAX && val > LONG_MAX % 10))
{
__set_errno (E2BIG);
return -1;
}
width = width * 10 + val;
}
/* If we don't have enough room for the demanded width we
can stop now and return an error. */
if (dest + width >= s + maxsize)
if (width >= maxsize - (dest - s))
{
__set_errno (E2BIG);
return -1;
@ -560,7 +568,7 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
out_char (space_char);
out_nstring (currency_symbol, currency_symbol_len);
}
if (sign_posn == 4)
{
if (sep_by_space == 2)
@ -589,9 +597,8 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format,
while (dest - startp < width);
else
{
int dist = width - (dest - startp);
char *cp;
for (cp = dest - 1; cp >= startp; --cp)
long int dist = width - (dest - startp);
for (char *cp = dest - 1; cp >= startp; --cp)
cp[dist] = cp[0];
dest += dist;

View File

@ -44,6 +44,7 @@
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DRUM "/dev/drum"
#define _PATH_GSHADOW "/etc/gshadow"
#define _PATH_KMEM "/dev/kmem"
#define _PATH_MAILDIR "/var/mail"
#define _PATH_LASTLOG "/var/log/lastlog"

View File

@ -48,7 +48,7 @@ ifree (char **ptrp)
without change the file pointer, and put the result in the buffers
described by VECTOR, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in VECTOR instead
'pread' (see <unistd.h>) except that data are put in VECTOR instead
of a contiguous buffer. */
ssize_t
PREADV (int fd, const struct iovec *vector, int count, OFF_T offset)
@ -83,7 +83,7 @@ PREADV (int fd, const struct iovec *vector, int count, OFF_T offset)
/* Read the data. */
ssize_t bytes_read = PREAD (fd, buffer, bytes, offset);
if (bytes_read <= 0)
if (bytes_read < 0)
return -1;
/* Copy the data from BUFFER into the memory specified by VECTOR. */

View File

@ -44,12 +44,12 @@ ifree (char **ptrp)
}
/* Read data from file descriptor FD at the given position OFFSET
without change the file pointer, and put the result in the buffers
described by VECTOR, which is a vector of COUNT 'struct iovec's.
The buffers are filled in the order specified. Operates just like
'read' (see <unistd.h>) except that data are put in VECTOR instead
of a contiguous buffer. */
/* Write data pointed by the buffers described by IOVEC, which is a
vector of COUNT 'struct iovec's, to file descriptor FD at the given
position OFFSET without change the file pointer. The data is
written in the order specified. Operates just like 'write' (see
<unistd.h>) except that the data are taken from IOVEC instead of a
contiguous buffer. */
ssize_t
PWRITEV (int fd, const struct iovec *vector, int count, OFF_T offset)
{
@ -81,26 +81,14 @@ PWRITEV (int fd, const struct iovec *vector, int count, OFF_T offset)
return -1;
}
/* Read the data. */
ssize_t bytes_read = PWRITE (fd, buffer, bytes, offset);
if (bytes_read <= 0)
return -1;
/* Copy the data from BUFFER into the memory specified by VECTOR. */
bytes = bytes_read;
char *ptr = buffer;
for (int i = 0; i < count; ++i)
{
size_t copy = MIN (vector[i].iov_len, bytes);
ptr = __mempcpy ((void *) ptr, (void *) vector[i].iov_base,
vector[i].iov_len);
(void) memcpy ((void *) vector[i].iov_base, (void *) buffer, copy);
buffer += copy;
bytes -= copy;
if (bytes == 0)
break;
}
return bytes_read;
/* Write the data. */
return PWRITE (fd, buffer, bytes, offset);
}
#if __WORDSIZE == 64 && defined pwritev64
# undef pwritev64

View File

@ -70,7 +70,7 @@ __libc_readv (int fd, const struct iovec *vector, int count)
/* Read the data. */
ssize_t bytes_read = __read (fd, buffer, bytes);
if (bytes_read <= 0)
if (bytes_read < 0)
return -1;
/* Copy the data from BUFFER into the memory specified by VECTOR. */

View File

@ -22,13 +22,15 @@
ENTRY (__sigsetjmp)
/* Save registers */
add #JB_SIZE, r4
#ifdef __SH_FPU_ANY__
add #JB_SIZE, r4
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
sts.l fpscr, @-r4
#else
add #(JB_SIZE - 4 * 5), r4
#endif /* __SH_FPU_ANY__ */
stc.l gbr, @-r4
#ifdef PTR_MANGLE

View File

@ -155,6 +155,7 @@ shared-only-routines += $file
case x"$callnum" in
x_)
echo "\
\$(make-target-directory)
(echo '/* Dummy module requested by syscalls.list */'; \\"
;;
x*)

View File

@ -531,9 +531,7 @@
#endif
/* Support for preadv and pwritev was added in 2.6.30. */
#if __LINUX_KERNEL_VERSION >= 0x02061e \
&& (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
|| defined __ia64__ || defined __sparc__ && defined __sh__)
#if __LINUX_KERNEL_VERSION >= 0x02061e
# define __ASSUME_PREADV 1
# define __ASSUME_PWRITEV 1
#endif

View File

@ -44,6 +44,7 @@
#define _PATH_DEVDB "/var/run/dev.db"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_DRUM "/dev/drum"
#define _PATH_GSHADOW "/etc/gshadow"
#define _PATH_KLOG "/proc/kmsg"
#define _PATH_KMEM "/dev/kmem"
#define _PATH_LASTLOG "/var/log/lastlog"

View File

@ -37,6 +37,10 @@
# define OFF_T off_t
#endif
#define LO_HI_LONG(val) \
(off_t) val, \
(off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
#ifndef __ASSUME_PREADV
static ssize_t PREADV_REPLACEMENT (int, __const struct iovec *,
int, OFF_T) internal_function;
@ -55,15 +59,13 @@ PREADV (fd, vector, count, offset)
if (SINGLE_THREAD_P)
result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
(off_t) ((off64_t) offset >> 32),
(off_t) (offset & 0xffffffff));
LO_HI_LONG (offset));
else
{
int oldtype = LIBC_CANCEL_ASYNC ();
result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
(off_t) ((off64_t) offset >> 32),
(off_t) (offset & 0xffffffff));
LO_HI_LONG (offset));
LIBC_CANCEL_RESET (oldtype);
}

View File

@ -37,6 +37,10 @@
# define OFF_T off_t
#endif
#define LO_HI_LONG(val) \
(off_t) val, \
(off_t) ((((uint64_t) (val)) >> (sizeof (long) * 4)) >> (sizeof (long) * 4))
#ifndef __ASSUME_PWRITEV
static ssize_t PWRITEV_REPLACEMENT (int, __const struct iovec *,
int, OFF_T) internal_function;
@ -55,15 +59,13 @@ PWRITEV (fd, vector, count, offset)
if (SINGLE_THREAD_P)
result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
(off_t) ((off64_t) offset >> 32),
(off_t) (offset & 0xffffffff));
LO_HI_LONG (offset));
else
{
int oldtype = LIBC_CANCEL_ASYNC ();
result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
(off_t) ((off64_t) offset >> 32),
(off_t) (offset & 0xffffffff));
LO_HI_LONG (offset));
LIBC_CANCEL_RESET (oldtype);
}

View File

@ -96,8 +96,12 @@ enum
/* Possible value for FLAGS parameter of `umount2'. */
enum
{
MNT_FORCE = 1 /* Force unmounting. */
MNT_FORCE = 1, /* Force unmounting. */
#define MNT_FORCE MNT_FORCE
MNT_DETACH = 2, /* Just detach from the tree. */
#define MNT_DETACH MNT_DETACH
MNT_EXPIRE = 4 /* Mark for expiry. */
#define MNT_EXPIRE MNT_EXPIRE
};

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997, 1999, 2007 Free Software Foundation, Inc.
/* Copyright (C) 1995-1997, 1999, 2007, 2009 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
@ -22,7 +22,7 @@
#include <features.h>
#include <sys/time.h>
/* These definitions from linux/timex.h as of 2.2.0. */
/* These definitions from linux/timex.h as of 2.6.30. */
struct ntptimeval
{
@ -54,10 +54,12 @@ struct timex
long int errcnt; /* calibration errors (ro) */
long int stbcnt; /* stability limit exceeded (ro) */
int tai; /* TAI offset (ro) */
/* ??? */
int :32; int :32; int :32; int :32;
int :32; int :32; int :32; int :32;
int :32; int :32; int :32; int :32;
int :32; int :32; int :32;
};
/* Mode codes (timex.mode) */
@ -67,6 +69,9 @@ struct timex
#define ADJ_ESTERROR 0x0008 /* estimated time error */
#define ADJ_STATUS 0x0010 /* clock status */
#define ADJ_TIMECONST 0x0020 /* pll time constant */
#define ADJ_TAI 0x0080 /* set TAI offset */
#define ADJ_MICRO 0x1000 /* select microsecond resolution */
#define ADJ_NANO 0x2000 /* select nanosecond resolution */
#define ADJ_TICK 0x4000 /* tick value */
#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
@ -99,6 +104,9 @@ struct timex
#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
STA_PPSERROR | STA_CLOCKERR) /* read-only bits */