diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-07-25 22:41:15 +0400 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-07-25 22:41:15 +0400 |
commit | 61921945b6c1d269b64c708070dba4afa85f1556 (patch) | |
tree | 2a2c76e8d7fe252454d4507ce2c05b0fa8619e20 /newlib/libc | |
parent | 3d966a92d36173a2d852f72199705a811e9cb17b (diff) |
2002-07-25 Jeff Johnston <jjohnstn@redhat.com>
* libc/sys/linux/Makefile.am: Add confstr.c.
* libc/sys/linux/Makefile.in: Regenerated.
* libc/sys/linux/confstr.c: New file.
* libc/sys/linux/confstr.h: Ditto.
* libc/sys/linux/sys/unistd.h: Include <features.h> and
<bits/environments.h>.
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/sys/linux/Makefile.am | 1 | ||||
-rw-r--r-- | newlib/libc/sys/linux/Makefile.in | 74 | ||||
-rw-r--r-- | newlib/libc/sys/linux/confstr.c | 161 | ||||
-rw-r--r-- | newlib/libc/sys/linux/confstr.h | 1 | ||||
-rw-r--r-- | newlib/libc/sys/linux/sys/unistd.h | 3 |
5 files changed, 204 insertions, 36 deletions
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index d48e5da04..944a1ee0e 100644 --- a/newlib/libc/sys/linux/Makefile.am +++ b/newlib/libc/sys/linux/Makefile.am @@ -19,6 +19,7 @@ LIB_SOURCES = \ clock_getres.c \ clock_gettime.c \ clock_settime.c \ + confstr.c \ ctermid.c \ flockfile.c \ fpathconf.c \ diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in index a3e484534..486c5b903 100644 --- a/newlib/libc/sys/linux/Makefile.in +++ b/newlib/libc/sys/linux/Makefile.in @@ -1,6 +1,6 @@ -# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am +# Makefile.in generated automatically by automake 1.4 from Makefile.am -# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -116,6 +116,7 @@ LIB_SOURCES = \ clock_getres.c \ clock_gettime.c \ clock_settime.c \ + confstr.c \ ctermid.c \ flockfile.c \ fpathconf.c \ @@ -252,16 +253,17 @@ LIBS = @LIBS@ @USE_LIBTOOL_FALSE@calloc.$(OBJEXT) callocr.$(OBJEXT) cfreer.$(OBJEXT) \ @USE_LIBTOOL_FALSE@cfspeed.$(OBJEXT) clock_getres.$(OBJEXT) \ @USE_LIBTOOL_FALSE@clock_gettime.$(OBJEXT) clock_settime.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@ctermid.$(OBJEXT) flockfile.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@fpathconf.$(OBJEXT) free.$(OBJEXT) freer.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@fstab.$(OBJEXT) fstatvfs.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@fstatvfs64.$(OBJEXT) ftok.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@funlockfile.$(OBJEXT) getdate.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getdate_err.$(OBJEXT) gethostname.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getoptlong.$(OBJEXT) getreent.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@getrlimit64.$(OBJEXT) ids.$(OBJEXT) inode.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@io.$(OBJEXT) io64.$(OBJEXT) ipc.$(OBJEXT) \ -@USE_LIBTOOL_FALSE@linux.$(OBJEXT) malign.$(OBJEXT) malignr.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@confstr.$(OBJEXT) ctermid.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@flockfile.$(OBJEXT) fpathconf.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@free.$(OBJEXT) freer.$(OBJEXT) fstab.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@fstatvfs.$(OBJEXT) fstatvfs64.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ftok.$(OBJEXT) funlockfile.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getdate.$(OBJEXT) getdate_err.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@gethostname.$(OBJEXT) getoptlong.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@getreent.$(OBJEXT) getrlimit64.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@ids.$(OBJEXT) inode.$(OBJEXT) io.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@io64.$(OBJEXT) ipc.$(OBJEXT) linux.$(OBJEXT) \ +@USE_LIBTOOL_FALSE@malign.$(OBJEXT) malignr.$(OBJEXT) \ @USE_LIBTOOL_FALSE@mallinfor.$(OBJEXT) mallocr.$(OBJEXT) \ @USE_LIBTOOL_FALSE@malloptr.$(OBJEXT) mallstatsr.$(OBJEXT) \ @USE_LIBTOOL_FALSE@mmap.$(OBJEXT) mntent.$(OBJEXT) mntent_r.$(OBJEXT) \ @@ -295,29 +297,29 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) @USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = aio.lo brk.lo calloc.lo \ @USE_LIBTOOL_TRUE@callocr.lo cfreer.lo cfspeed.lo clock_getres.lo \ -@USE_LIBTOOL_TRUE@clock_gettime.lo clock_settime.lo ctermid.lo \ -@USE_LIBTOOL_TRUE@flockfile.lo fpathconf.lo free.lo freer.lo fstab.lo \ -@USE_LIBTOOL_TRUE@fstatvfs.lo fstatvfs64.lo ftok.lo funlockfile.lo \ -@USE_LIBTOOL_TRUE@getdate.lo getdate_err.lo gethostname.lo \ -@USE_LIBTOOL_TRUE@getoptlong.lo getreent.lo getrlimit64.lo ids.lo \ -@USE_LIBTOOL_TRUE@inode.lo io.lo io64.lo ipc.lo linux.lo malign.lo \ -@USE_LIBTOOL_TRUE@malignr.lo mallinfor.lo mallocr.lo malloptr.lo \ -@USE_LIBTOOL_TRUE@mallstatsr.lo mmap.lo mntent.lo mntent_r.lo \ -@USE_LIBTOOL_TRUE@mq_close.lo mq_getattr.lo mq_notify.lo mq_open.lo \ -@USE_LIBTOOL_TRUE@mq_receive.lo mq_send.lo mq_setattr.lo mq_unlink.lo \ -@USE_LIBTOOL_TRUE@msize.lo msizer.lo mstats.lo mtrim.lo mtrimr.lo \ -@USE_LIBTOOL_TRUE@ntp_gettime.lo pathconf.lo pread.lo pread64.lo \ -@USE_LIBTOOL_TRUE@process.lo psignal.lo pvallocr.lo pwrite.lo \ -@USE_LIBTOOL_TRUE@pwrite64.lo raise.lo readdir64.lo realloc.lo \ -@USE_LIBTOOL_TRUE@reallocr.lo realpath.lo rename.lo resource.lo \ -@USE_LIBTOOL_TRUE@sched.lo select.lo seteuid.lo sethostname.lo \ -@USE_LIBTOOL_TRUE@setrlimit64.lo shm_open.lo shm_unlink.lo sig.lo \ -@USE_LIBTOOL_TRUE@sigaction.lo sigqueue.lo signal.lo siglongjmp.lo \ -@USE_LIBTOOL_TRUE@sigset.lo sigwait.lo socket.lo sleep.lo stack.lo \ -@USE_LIBTOOL_TRUE@statvfs.lo statvfs64.lo strsignal.lo sysconf.lo \ -@USE_LIBTOOL_TRUE@sysctl.lo systat.lo system.lo tcdrain.lo tcsendbrk.lo \ -@USE_LIBTOOL_TRUE@termios.lo time.lo ttyname_r.lo usleep.lo utimes.lo \ -@USE_LIBTOOL_TRUE@vallocr.lo wait.lo +@USE_LIBTOOL_TRUE@clock_gettime.lo clock_settime.lo confstr.lo \ +@USE_LIBTOOL_TRUE@ctermid.lo flockfile.lo fpathconf.lo free.lo freer.lo \ +@USE_LIBTOOL_TRUE@fstab.lo fstatvfs.lo fstatvfs64.lo ftok.lo \ +@USE_LIBTOOL_TRUE@funlockfile.lo getdate.lo getdate_err.lo \ +@USE_LIBTOOL_TRUE@gethostname.lo getoptlong.lo getreent.lo \ +@USE_LIBTOOL_TRUE@getrlimit64.lo ids.lo inode.lo io.lo io64.lo ipc.lo \ +@USE_LIBTOOL_TRUE@linux.lo malign.lo malignr.lo mallinfor.lo mallocr.lo \ +@USE_LIBTOOL_TRUE@malloptr.lo mallstatsr.lo mmap.lo mntent.lo \ +@USE_LIBTOOL_TRUE@mntent_r.lo mq_close.lo mq_getattr.lo mq_notify.lo \ +@USE_LIBTOOL_TRUE@mq_open.lo mq_receive.lo mq_send.lo mq_setattr.lo \ +@USE_LIBTOOL_TRUE@mq_unlink.lo msize.lo msizer.lo mstats.lo mtrim.lo \ +@USE_LIBTOOL_TRUE@mtrimr.lo ntp_gettime.lo pathconf.lo pread.lo \ +@USE_LIBTOOL_TRUE@pread64.lo process.lo psignal.lo pvallocr.lo \ +@USE_LIBTOOL_TRUE@pwrite.lo pwrite64.lo raise.lo readdir64.lo \ +@USE_LIBTOOL_TRUE@realloc.lo reallocr.lo realpath.lo rename.lo \ +@USE_LIBTOOL_TRUE@resource.lo sched.lo select.lo seteuid.lo \ +@USE_LIBTOOL_TRUE@sethostname.lo setrlimit64.lo shm_open.lo \ +@USE_LIBTOOL_TRUE@shm_unlink.lo sig.lo sigaction.lo sigqueue.lo \ +@USE_LIBTOOL_TRUE@signal.lo siglongjmp.lo sigset.lo sigwait.lo \ +@USE_LIBTOOL_TRUE@socket.lo sleep.lo stack.lo statvfs.lo statvfs64.lo \ +@USE_LIBTOOL_TRUE@strsignal.lo sysconf.lo sysctl.lo systat.lo system.lo \ +@USE_LIBTOOL_TRUE@tcdrain.lo tcsendbrk.lo termios.lo time.lo \ +@USE_LIBTOOL_TRUE@ttyname_r.lo usleep.lo utimes.lo vallocr.lo wait.lo CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -456,7 +458,7 @@ maintainer-clean-recursive: dot_seen=no; \ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ rev="$$subdir $$rev"; \ - test "$$subdir" != "." || dot_seen=yes; \ + test "$$subdir" = "." && dot_seen=yes; \ done; \ test "$$dot_seen" = "no" && rev=". $$rev"; \ target=`echo $@ | sed s/-recursive//`; \ diff --git a/newlib/libc/sys/linux/confstr.c b/newlib/libc/sys/linux/confstr.c new file mode 100644 index 000000000..6b566b308 --- /dev/null +++ b/newlib/libc/sys/linux/confstr.c @@ -0,0 +1,161 @@ +/* Copyright (C) 1991, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + 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 _GNU_SOURCE 1 + +#include <stddef.h> +#include <errno.h> +#include <unistd.h> +#include <string.h> +#include <confstr.h> + +/* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes + of BUF with the value corresponding to NAME and zero-terminate BUF. + Return the number of bytes required to hold NAME's entire value. */ +size_t +confstr (name, buf, len) + int name; + char *buf; + size_t len; +{ + const char *string; + size_t string_len; + + switch (name) + { + case _CS_PATH: + { + static const char cs_path[] = CS_PATH; + string = cs_path; + string_len = sizeof (cs_path); + } + break; + + case _CS_V6_WIDTH_RESTRICTED_ENVS: + /* We have to return a newline-separated list of named of + programming environements in which the widths of blksize_t, + cc_t, mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t, + ssize_t, suseconds_t, tcflag_t, useconds_t, wchar_t, and + wint_t types are no greater than the width of type long. + + Currently this means all environment which the system allows. */ + { + static const char restenvs[] = +#if _POSIX_V6_ILP32_OFF32 > 0 + "_POSIX_V6_ILP32_OFF32" +#endif +#if _POSIX_V6_ILP32_OFFBIG > 0 +# if _POSIX_V6_ILP32_OFF32 > 0 + "\n" +# endif + "_POSIX_V6_ILP32_OFFBIG" +#endif +#if _POSIX_V6_LP64_OFF64 > 0 +# if _POSIX_V6_ILP32_OFF32 > 0 || _POSIX_V6_ILP32_OFFBIG > 0 + "\n" +# endif + "_POSIX_V6_LP64_OFF64" +#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" +#endif + ; + string = restenvs; + string_len = sizeof (restenvs); + } + break; + + case _CS_XBS5_ILP32_OFFBIG_CFLAGS: + case _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: + case _CS_LFS_CFLAGS: +#if _XBS5_LP64_OFF64 == -1 && _XBS5_LPBIG_OFFBIG == -1 && _XBS5_ILP32_OFFBIG == 1 + /* Signal that we want the new ABI. */ + { + static const char file_offset[] = "-D_FILE_OFFSET_BITS=64"; + string = file_offset; + string_len = sizeof (file_offset); + } + break; +#endif + /* FALLTHROUGH */ + + case _CS_LFS_LINTFLAGS: + case _CS_LFS_LDFLAGS: + case _CS_LFS_LIBS: + case _CS_LFS64_CFLAGS: + case _CS_LFS64_LINTFLAGS: + case _CS_LFS64_LDFLAGS: + case _CS_LFS64_LIBS: + + 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: + case _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: + case _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: + case _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: + /* GNU libc does not require special actions to use LFS functions. */ + string = ""; + string_len = 1; + break; + + default: + __set_errno (EINVAL); + return 0; + } + + if (len > 0 && buf != NULL) + { + if (string_len <= len) + memcpy (buf, string, string_len); + else + { + memcpy (buf, string, len - 1); + buf[len - 1] = '\0'; + } + } + return string_len; +} diff --git a/newlib/libc/sys/linux/confstr.h b/newlib/libc/sys/linux/confstr.h new file mode 100644 index 000000000..15859c3b2 --- /dev/null +++ b/newlib/libc/sys/linux/confstr.h @@ -0,0 +1 @@ +#define CS_PATH "/bin:/usr/bin" diff --git a/newlib/libc/sys/linux/sys/unistd.h b/newlib/libc/sys/linux/sys/unistd.h index 52c380118..062a16282 100644 --- a/newlib/libc/sys/linux/sys/unistd.h +++ b/newlib/libc/sys/linux/sys/unistd.h @@ -1,6 +1,8 @@ #ifndef _UNISTD_H #define _UNISTD_H +#include <features.h> + #ifdef __cplusplus extern "C" { #endif @@ -159,6 +161,7 @@ int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ +#include <bits/environments.h> #include <bits/confname.h> # define MAXPATHLEN 1024 |