Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
	* posix/Makefile (install-others): Add $(inst_libexecdir)/getconf.
	(CFLAGS-sysconf.c): Add -D_GETCONF_DIR.
	(CFLAGS-getconf.c): New.
	($(inst_libexecdir)/getconf): New.
	* posix/confstr.c (confstr): Use __sysconf to query specifications
	that don't have _POSIX_V6_* macros defined.  Use __*_{C,LD}FLAGS
	macros defined in bits/environments.h.
	* sysdeps/posix/sysconf.c: Include stdlib.h, string.h and
	sys/stat.h.
	(__sysconf_check_spec): New routine.
	(__sysconf): Use it.
	* posix/getconf.c (specs): Change into structure array.
	(main): If -v is not given, try to get default from
	$(libexecdir)/getconf/default.  If specification is not
	supported by this getconf, try to execute
	$(libexecdir)/getconf/$(specification).
	* sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h: New file.
	* sysdeps/unix/sysv/linux/s390/bits/environments.h: New file.
	* sysdeps/unix/sysv/linux/powerpc/bits/environments.h: New file.
	* sysdeps/unix/sysv/linux/sparc/bits/environments.h: New file.
	* sysdeps/unix/sysv/linux/i386/bits/environments.h: New file.
	* sysdeps/unix/sysv/linux/x86_64/bits/environments.h: New file.
	* sysdeps/generic/bits/environments.h (__ILP32_OFFBIG_CFLAGS):
	Define.

2004-11-26  Jakub Jelinek  <jakub@redhat.com>
  • Loading branch information
Ulrich Drepper committed Nov 26, 2004

Unverified

No user is associated with the committer email.
1 parent 9069253 commit 28f367c
Showing 13 changed files with 763 additions and 71 deletions.
27 changes: 27 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
2004-11-26 Jakub Jelinek <jakub@redhat.com>

* posix/Makefile (install-others): Add $(inst_libexecdir)/getconf.
(CFLAGS-sysconf.c): Add -D_GETCONF_DIR.
(CFLAGS-getconf.c): New.
($(inst_libexecdir)/getconf): New.
* posix/confstr.c (confstr): Use __sysconf to query specifications
that don't have _POSIX_V6_* macros defined. Use __*_{C,LD}FLAGS
macros defined in bits/environments.h.
* sysdeps/posix/sysconf.c: Include stdlib.h, string.h and
sys/stat.h.
(__sysconf_check_spec): New routine.
(__sysconf): Use it.
* posix/getconf.c (specs): Change into structure array.
(main): If -v is not given, try to get default from
$(libexecdir)/getconf/default. If specification is not
supported by this getconf, try to execute
$(libexecdir)/getconf/$(specification).
* sysdeps/unix/bsd/bsd4.4/freebsd/bits/environments.h: New file.
* sysdeps/unix/sysv/linux/s390/bits/environments.h: New file.
* sysdeps/unix/sysv/linux/powerpc/bits/environments.h: New file.
* sysdeps/unix/sysv/linux/sparc/bits/environments.h: New file.
* sysdeps/unix/sysv/linux/i386/bits/environments.h: New file.
* sysdeps/unix/sysv/linux/x86_64/bits/environments.h: New file.
* sysdeps/generic/bits/environments.h (__ILP32_OFFBIG_CFLAGS):
Define.

2004-11-26 Jakub Jelinek <jakub@redhat.com>

* stdlib/stdlib.h (setenv): Use nonnull only for second argument.
5 changes: 4 additions & 1 deletion bits/environments.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1999, 2001, 2004 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
@@ -72,4 +72,7 @@
# define _XBS5_LP64_OFF64 -1
# define _XBS5_LPBIG_OFFBIG -1

/* CFLAGS. */
#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

#endif /* __WORDSIZE == 32 */
14 changes: 13 additions & 1 deletion posix/Makefile
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@ tests += wordexp-test tst-exec tst-spawn
endif
others := getconf
install-bin := getconf
install-others := $(inst_libexecdir)/getconf

before-compile := testcases.h ptestcases.h

@@ -138,7 +139,7 @@ CFLAGS-waitid.c = -fexceptions
CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-getopt.c = -fexceptions
CFLAGS-wordexp.c = -fexceptions
CFLAGS-sysconf.c = -fexceptions
CFLAGS-sysconf.c = -fexceptions -DGETCONF_DIR='"$(libexecdir)/getconf"'
CFLAGS-pathconf.c = -fexceptions
CFLAGS-fpathconf.c = -fexceptions
CFLAGS-spawn.c = -fexceptions
@@ -147,6 +148,7 @@ CFLAGS-spawni.c = -fexceptions
CFLAGS-pause.c = -fexceptions
CFLAGS-glob.c = $(uses-callbacks) -fexceptions
CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'

tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
@@ -260,3 +262,13 @@ bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace

$(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
$(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@

$(inst_libexecdir)/getconf: $(objpfx)getconf FORCE
$(addprefix $(..)./scripts/mkinstalldirs ,\
$(filter-out $(wildcard $@),$@))
for spec in `LC_ALL=C GETCONF_DIR=/dev/null \
$(run-program-prefix) $< \
_POSIX_V6_WIDTH_RESTRICTED_ENVS`; do \
$(INSTALL_PROGRAM) $< $@/$$spec.new; \
mv -f $@/$$spec.new $@/$$spec; \
done
185 changes: 138 additions & 47 deletions posix/confstr.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Copyright (C) 1991,96,97,2000-2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1996, 1997, 2000-2002, 2003, 2004
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
@@ -54,50 +55,153 @@ confstr (name, buf, len)
Currently this means all environment which the system allows. */
{
static const char restenvs[] =
#if _POSIX_V6_ILP32_OFF32 > 0
"_POSIX_V6_ILP32_OFF32"
char restenvs[4 * sizeof "_POSIX_V6_LPBIG_OFFBIG"];

string_len = 0;
#ifndef _POSIX_V6_ILP32_OFF32
if (__sysconf (_SC_V6_ILP32_OFF32) > 0)
#endif
#if _POSIX_V6_ILP32_OFFBIG > 0
# if _POSIX_V6_ILP32_OFF32 > 0
"\n"
# endif
"_POSIX_V6_ILP32_OFFBIG"
#if !defined _POSIX_V6_ILP32_OFF32 || _POSIX_V6_ILP32_OFF32 > 0
{
memcpy (restenvs + string_len, "_POSIX_V6_ILP32_OFF32",
sizeof "_POSIX_V6_ILP32_OFF32" - 1);
string_len += sizeof "_POSIX_V6_ILP32_OFF32" - 1;
}
#endif
#if _POSIX_V6_LP64_OFF64 > 0
# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0
"\n"
# endif
"_POSIX_V6_LP64_OFF64"
#ifndef _POSIX_V6_ILP32_OFFBIG
if (__sysconf (_SC_V6_ILP32_OFFBIG) > 0)
#endif
#if _POSIX_V6_LPBIG_OFFBIG > 0
# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0 \
|| _POSIX_V6_LP64_OFF64 > 0
"\n"
# endif
"_POSIX_V6_LPBIG_OFFBIG"
#if !defined _POSIX_V6_ILP32_OFFBIG || _POSIX_V6_ILP32_OFFBIG > 0
{
if (string_len)
restenvs[string_len++] = '\n';
memcpy (restenvs + string_len, "_POSIX_V6_ILP32_OFFBIG",
sizeof "_POSIX_V6_ILP32_OFFBIG" - 1);
string_len += sizeof "_POSIX_V6_ILP32_OFFBIG" - 1;
}
#endif
#ifndef _POSIX_V6_LP64_OFF64
if (__sysconf (_SC_V6_LP64_OFF64) > 0)
#endif
#if !defined _POSIX_V6_LP64_OFF64 || _POSIX_V6_LP64_OFF64 > 0
{
if (string_len)
restenvs[string_len++] = '\n';
memcpy (restenvs + string_len, "_POSIX_V6_LP64_OFF64",
sizeof "_POSIX_V6_LP64_OFF64" - 1);
string_len += sizeof "_POSIX_V6_LP64_OFF64" - 1;
}
#endif
#ifndef _POSIX_V6_LPBIG_OFFBIG
if (__sysconf (_SC_V6_LPBIG_OFFBIG) > 0)
#endif
#if !defined _POSIX_V6_LPBIG_OFFBIG || _POSIX_V6_LPBIG_OFFBIG > 0
{
if (string_len)
restenvs[string_len++] = '\n';
memcpy (restenvs + string_len, "_POSIX_V6_LPBIG_OFFBIG",
sizeof "_POSIX_V6_LPBIG_OFFBIG" - 1);
string_len += sizeof "_POSIX_V6_LPBIG_OFFBIG" - 1;
}
#endif
;
restenvs[string_len++] = '\0';
string = restenvs;
string_len = sizeof (restenvs);
}
break;

case _CS_XBS5_ILP32_OFF32_CFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
#ifdef __ILP32_OFF32_CFLAGS
# if _POSIX_V6_ILP32_OFF32 == -1
# error __ILP32_OFF32_CFLAGS shouldn't be defined
# elif !defined _POSIX_V6_ILP32_OFF32
if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
break;
# endif
string = __ILP32_OFF32_CFLAGS;
string_len = sizeof (__ILP32_OFF32_CFLAGS);
#endif
break;

case _CS_XBS5_ILP32_OFFBIG_CFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS:
#ifdef __ILP32_OFFBIG_CFLAGS
# if _POSIX_V6_ILP32_OFFBIG == -1
# error __ILP32_OFFBIG_CFLAGS shouldn't be defined
# elif !defined _POSIX_V6_ILP32_OFFBIG
if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
break;
# endif
string = __ILP32_OFFBIG_CFLAGS;
string_len = sizeof (__ILP32_OFFBIG_CFLAGS);
#endif
break;

case _CS_XBS5_LP64_OFF64_CFLAGS:
case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
#ifdef __LP64_OFF64_CFLAGS
# if _POSIX_V6_LP64_OFF64 == -1
# error __LP64_OFF64_CFLAGS shouldn't be defined
# elif !defined _POSIX_V6_LP64_OFF64
if (__sysconf (_SC_V6_LP64_OFF64) < 0)
break;
# endif
string = __LP64_OFF64_CFLAGS;
string_len = sizeof (__LP64_OFF64_CFLAGS);
#endif
break;

case _CS_XBS5_ILP32_OFF32_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
#ifdef __ILP32_OFF32_LDFLAGS
# if _POSIX_V6_ILP32_OFF32 == -1
# error __ILP32_OFF32_LDFLAGS shouldn't be defined
# elif !defined _POSIX_V6_ILP32_OFF32
if (__sysconf (_SC_V6_ILP32_OFF32) < 0)
break;
# endif
string = __ILP32_OFF32_LDFLAGS;
string_len = sizeof (__ILP32_OFF32_LDFLAGS);
#endif
break;

case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
#ifdef __ILP32_OFFBIG_LDFLAGS
# if _POSIX_V6_ILP32_OFFBIG == -1
# error __ILP32_OFFBIG_LDFLAGS shouldn't be defined
# elif !defined _POSIX_V6_ILP32_OFFBIG
if (__sysconf (_SC_V6_ILP32_OFFBIG) < 0)
break;
# endif
string = __ILP32_OFFBIG_LDFLAGS;
string_len = sizeof (__ILP32_OFFBIG_LDFLAGS);
#endif
break;

case _CS_XBS5_LP64_OFF64_LDFLAGS:
case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
#ifdef __LP64_OFF64_LDFLAGS
# if _POSIX_V6_LP64_OFF64 == -1
# error __LP64_OFF64_LDFLAGS shouldn't be defined
# elif !defined _POSIX_V6_LP64_OFF64
if (__sysconf (_SC_V6_LP64_OFF64) < 0)
break;
# endif
string = __LP64_OFF64_LDFLAGS;
string_len = sizeof (__LP64_OFF64_LDFLAGS);
#endif
break;

case _CS_LFS_CFLAGS:
case _CS_LFS_LINTFLAGS:
#if _XBS5_LP64_OFF64 == -1 && _XBS5_LPBIG_OFFBIG == -1 && _XBS5_ILP32_OFFBIG == 1
#if _POSIX_V6_ILP32_OFF32 == 1 && _POSIX_V6_ILP32_OFFBIG == 1
# define __LFS_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
/* Signal that we want the new ABI. */
{
static const char file_offset[]
= "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64";
string = file_offset;
string_len = sizeof (file_offset);
}
break;
string = __LFS_CFLAGS;
string_len = sizeof (__LFS_CFLAGS);
#endif
/* FALLTHROUGH */
break;

case _CS_LFS_LDFLAGS:
case _CS_LFS_LIBS:
@@ -106,44 +210,31 @@ confstr (name, buf, len)

case _CS_LFS64_CFLAGS:
case _CS_LFS64_LINTFLAGS:
if (sizeof (off_t) != sizeof (off64_t))
{
static const char lf64_source[] = "-D_LARGEFILE64_SOURCE";
string = lf64_source;
string_len = sizeof (lf64_source);
}
#define __LFS64_CFLAGS "-D_LARGEFILE64_SOURCE"
string = __LFS64_CFLAGS;
string_len = sizeof (__LFS64_CFLAGS);
break;

case _CS_LFS64_LDFLAGS:
case _CS_LFS64_LIBS:
/* No special libraries or linker flags needed. */
break;

case _CS_XBS5_ILP32_OFF32_CFLAGS:
case _CS_XBS5_ILP32_OFF32_LDFLAGS:
case _CS_XBS5_ILP32_OFF32_LIBS:
case _CS_XBS5_ILP32_OFF32_LINTFLAGS:
case _CS_XBS5_ILP32_OFFBIG_LDFLAGS:
case _CS_XBS5_ILP32_OFFBIG_LIBS:
case _CS_XBS5_ILP32_OFFBIG_LINTFLAGS:
case _CS_XBS5_LP64_OFF64_CFLAGS:
case _CS_XBS5_LP64_OFF64_LDFLAGS:
case _CS_XBS5_LP64_OFF64_LIBS:
case _CS_XBS5_LP64_OFF64_LINTFLAGS:
case _CS_XBS5_LPBIG_OFFBIG_CFLAGS:
case _CS_XBS5_LPBIG_OFFBIG_LDFLAGS:
case _CS_XBS5_LPBIG_OFFBIG_LIBS:
case _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS:

case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFF32_LIBS:
case _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS:
case _CS_POSIX_V6_ILP32_OFFBIG_LIBS:
case _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS:
case _CS_POSIX_V6_LP64_OFF64_CFLAGS:
case _CS_POSIX_V6_LP64_OFF64_LDFLAGS:
case _CS_POSIX_V6_LP64_OFF64_LIBS:
case _CS_POSIX_V6_LP64_OFF64_LINTFLAGS:
case _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS:
Loading

0 comments on commit 28f367c

Please sign in to comment.