Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-04-05 02:41:11 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-04-05 02:41:11 +0400
commit6e6cd5bde6164914615f5e82a1b49ed5b2c25eb9 (patch)
tree04c16a09dc72fc5f5379865a9916b2ec8c8f4616 /newlib/libc
parent244a8fae426a68ad51cd610cebd1361a834d676a (diff)
2002-04-04 Jeff Johnston <jjohnstn@redhat.com>
* Makefile.am: Add support for installing crt1.o if one exists. * configure.host: Specify crt1.o for linux. * configure.in: Expose CRT1 and CRT1_DIR for Makefile.am to use. * Makefile.in: Regenerated. * configure: Ditto. * libc/include/sys/unistd.h (_SC_STREAM_MAX, _SC_PRIORITY_SCHEDULING): Added for non-Cygwin, non-RTEMS configurations. * libc/sys/linux/Makefile.am: Add support for crt1 and sysconf. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/crt1.c: New empty file to override one defaulted by gcc. This fixes problem with reconfiguring linux newlib build. * libc/sys/linux/sysconf.c: New file.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/sys/unistd.h5
-rw-r--r--newlib/libc/sys/linux/Makefile.am6
-rw-r--r--newlib/libc/sys/linux/Makefile.in13
-rw-r--r--newlib/libc/sys/linux/crt1.c3
-rw-r--r--newlib/libc/sys/linux/sysconf.c383
5 files changed, 401 insertions, 9 deletions
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index d7e46a7ec..70682b2e0 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -234,6 +234,11 @@ int _EXFUN(symlink, (const char *__name1, const char *__name2));
#define _SC_GETPW_R_SIZE_MAX 51
#define _SC_LOGIN_NAME_MAX 52
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 53
+
+#if !defined(__CYGWIN__) && !defined(__rtems__)
+#define _SC_STREAM_MAX 100
+#define _SC_PRIORITY_SCHEDULING 101
+#endif
# define _PC_LINK_MAX 0
# define _PC_MAX_CANON 1
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am
index 7c936a9a4..a3a0bbe89 100644
--- a/newlib/libc/sys/linux/Makefile.am
+++ b/newlib/libc/sys/linux/Makefile.am
@@ -9,7 +9,7 @@ SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
- select.c signal.c socket.c sleep.c stack.c systat.c termios.c time.c \
+ select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \
usleep.c wait.c
# This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1)
@@ -37,7 +37,7 @@ lib.a: $(LINUX_MACH_LIB) $(lib_a_OBJECTS)
cd tmp; \
for i in $(SUBLIBS); do \
$(AR) x ../$$i; \
- done; \
+ done; \
$(AR) $(AR_FLAGS) ../$@ *.o
$(RANLIB) $@
rm -rf tmp
@@ -47,7 +47,7 @@ endif # USE_LIBTOOL
include $(srcdir)/../../../Makefile.shared
-all: crt0.o
+all: crt0.o crt1.o
crt0.o: machine/crt0.o
rm -f $@
diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in
index 4b59346e9..56efb7cd2 100644
--- a/newlib/libc/sys/linux/Makefile.in
+++ b/newlib/libc/sys/linux/Makefile.in
@@ -94,7 +94,7 @@ SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
- select.c signal.c socket.c sleep.c stack.c systat.c termios.c time.c \
+ select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \
usleep.c wait.c
@@ -127,15 +127,16 @@ CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = brk.o getoptlong.o ids.o inode.o \
@USE_LIBTOOL_FALSE@io.o linux.o process.o realpath.o select.o signal.o \
-@USE_LIBTOOL_FALSE@socket.o sleep.o stack.o systat.o termios.o time.o \
-@USE_LIBTOOL_FALSE@usleep.o wait.o
+@USE_LIBTOOL_FALSE@socket.o sleep.o stack.o sysconf.o systat.o \
+@USE_LIBTOOL_FALSE@termios.o time.o usleep.o wait.o
LTLIBRARIES = $(noinst_LTLIBRARIES)
@USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES =
@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = brk.lo getoptlong.lo ids.lo \
@USE_LIBTOOL_TRUE@inode.lo io.lo linux.lo process.lo realpath.lo \
@USE_LIBTOOL_TRUE@select.lo signal.lo socket.lo sleep.lo stack.lo \
-@USE_LIBTOOL_TRUE@systat.lo termios.lo time.lo usleep.lo wait.lo
+@USE_LIBTOOL_TRUE@sysconf.lo systat.lo termios.lo time.lo usleep.lo \
+@USE_LIBTOOL_TRUE@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)
@@ -475,7 +476,7 @@ maintainer-clean
@USE_LIBTOOL_FALSE@ cd tmp; \
@USE_LIBTOOL_FALSE@ for i in $(SUBLIBS); do \
@USE_LIBTOOL_FALSE@ $(AR) x ../$$i; \
-@USE_LIBTOOL_FALSE@ done; \
+@USE_LIBTOOL_FALSE@ done; \
@USE_LIBTOOL_FALSE@ $(AR) $(AR_FLAGS) ../$@ *.o
@USE_LIBTOOL_FALSE@ $(RANLIB) $@
@USE_LIBTOOL_FALSE@ rm -rf tmp
@@ -487,7 +488,7 @@ objectlist.awk.in: $(noinst_LTLIBRARIES)
echo $$i `pwd`/$$i >> objectlist.awk.in ; \
done
-all: crt0.o
+all: crt0.o crt1.o
crt0.o: machine/crt0.o
rm -f $@
diff --git a/newlib/libc/sys/linux/crt1.c b/newlib/libc/sys/linux/crt1.c
new file mode 100644
index 000000000..018e9a2d4
--- /dev/null
+++ b/newlib/libc/sys/linux/crt1.c
@@ -0,0 +1,3 @@
+/* dummy crt1.c file to override the one normally used by
+ gcc which refers to glibc variables that don't exist in
+ newlib. */
diff --git a/newlib/libc/sys/linux/sysconf.c b/newlib/libc/sys/linux/sysconf.c
new file mode 100644
index 000000000..f953efe5d
--- /dev/null
+++ b/newlib/libc/sys/linux/sysconf.c
@@ -0,0 +1,383 @@
+/* libc/sys/linux/sysconf.c - The sysconf function */
+
+/* Copyright 2002, Red Hat Inc. */
+
+
+#include <unistd.h>
+#include <limits.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/types.h>
+
+long int
+sysconf (int name)
+{
+ switch (name)
+ {
+ case _SC_AIO_LISTIO_MAX:
+#ifdef AIO_LISTIO_MAX
+ return AIO_LISTIO_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_AIO_MAX:
+#ifdef AIO_MAX
+ return AIO_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_AIO_PRIO_DELTA_MAX:
+#ifdef AIO_PRIO_DELTA_MAX
+ return AIO_PRIO_DELTA_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_ARG_MAX:
+#ifdef ARG_MAX
+ return ARG_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_CHILD_MAX:
+#ifdef CHILD_MAX
+ return CHILD_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_CLK_TCK:
+ return CLK_TCK;
+
+ case _SC_DELAYTIMER_MAX:
+#ifdef DELAYTIMER_MAX
+ return DELAYTIMER_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_GETGR_R_SIZE_MAX:
+#ifdef _GETGR_R_SIZE_MAX
+ return _GETGR_R_SIZE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_GETPW_R_SIZE_MAX:
+#ifdef _GETPW_R_SIZE_MAX
+ return _GETPW_R_SIZE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_LOGIN_NAME_MAX:
+#ifdef LOGIN_NAME_MAX
+ return LOGIN_NAME_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_MQ_OPEN_MAX:
+#ifdef MQ_OPEN_MAX
+ return MQ_OPEN_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_MQ_PRIO_MAX:
+#ifdef MQ_PRIO_MAX
+ return MQ_PRIO_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_NGROUPS_MAX:
+#ifdef NGROUPS_MAX
+ return NGROUPS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_OPEN_MAX:
+#ifdef OPEN_MAX
+ return OPEN_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_PAGESIZE:
+#ifdef PAGESIZE
+ return PAGESIZE;
+#else
+ return -1;
+#endif
+
+ case _SC_RTSIG_MAX:
+#ifdef RTSIG_MAX
+ return RTSIG_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_SEM_NSEMS_MAX:
+#ifdef SEM_NSEMS_MAX
+ return SEM_NSEMS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_SEM_VALUE_MAX:
+#ifdef SEM_VALUE_MAX
+ return SEM_VALUE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_SIGQUEUE_MAX:
+#ifdef SIGQUEUE_MAX
+ return SIGQUEUE_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_STREAM_MAX:
+#ifdef STREAM_MAX
+ return STREAM_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_DESTRUCTOR_ITERATIONS:
+#ifdef PTHREAD_DESTRUCTOR_ITERATIONS
+ return PTHREAD_DESTRUCTOR_ITERATIONS;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_KEYS_MAX:
+#ifdef PTHREAD_KEYS_MAX
+ return PTHREAD_KEYS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_STACK_MIN:
+#ifdef PTHREAD_STACK_MIN
+ return PTHREAD_STACK_MIN;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_THREADS_MAX:
+#ifdef PTHREAD_THREADS_MAX
+ return PTHREAD_THREADS_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_TIMER_MAX:
+#ifdef TIMER_MAX
+ return TIMER_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_TTY_NAME_MAX:
+#ifdef TTY_NAME_MAX
+ return TTY_NAME_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_TZNAME_MAX:
+#ifdef TZNAME_MAX
+ return TZNAME_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_ASYNCHRONOUS_IO:
+#ifdef _POSIX_ASYNCHRONOUS_IO
+ return 1;TZNAME_MAX;
+#else
+ return -1;
+#endif
+
+ case _SC_FSYNC:
+#ifdef _POSIX_FSYNC
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_JOB_CONTROL:
+#ifdef _POSIX_JOB_CONTROL
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_MAPPED_FILES:
+#ifdef _POSIX_MAPPED_FILES
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_MEMLOCK:
+#ifdef _POSIX_MEMLOCK
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_MEMLOCK_RANGE:
+#ifdef _POSIX_MEMLOCK_RANGE
+ return _POSIX_MEMLOCK_RANGE;
+#else
+ return -1;
+#endif
+
+ case _SC_MEMORY_PROTECTION:
+#ifdef _POSIX_MEMORY_PROTECTION
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_MESSAGE_PASSING:
+#ifdef _POSIX_MESSAGE_PASSING
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_PRIORITIZED_IO:
+#ifdef _POSIX_PRIORITIZED_IO
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_PRIORITY_SCHEDULING:
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_REALTIME_SIGNALS:
+#ifdef _POSIX_REALTIME_SIGNALS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_SAVED_IDS:
+#ifdef _POSIX_SAVED_IDS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_SEMAPHORES:
+#ifdef _POSIX_SEMAPHORES
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_SHARED_MEMORY_OBJECTS:
+#ifdef _POSIX_SHARED_MEMORY_OBJECTS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_SYNCHRONIZED_IO:
+#ifdef _POSIX_SYNCHRONIZED_IO
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_TIMERS:
+#ifdef _POSIX_TIMERS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREADS:
+#ifdef _POSIX_THREADS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_ATTR_STACKADDR:
+#ifdef _POSIX_THREAD_ATTR_STACKADDR
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_ATTR_STACKSIZE:
+#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_PRIORITY_SCHEDULING:
+#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_PRIO_INHERIT:
+#ifdef _POSIX_THREAD_PRIO_INHERIT
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_PRIO_PROTECT:
+#ifdef _POSIX_THREAD_PRIO_PROTECT
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_PROCESS_SHARED:
+#ifdef _POSIX_THREAD_PROCESS_SHARED
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_THREAD_SAFE_FUNCTIONS:
+#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
+ return 1;
+#else
+ return -1;
+#endif
+
+ case _SC_VERSION:
+#ifdef _POSIX_VERSION
+ return _POSIX_VERSION;
+#else
+ return -1;
+#endif
+
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+
+ return -1; /* can't get here */
+}