about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/Makefile29
-rw-r--r--sysdeps/unix/sysv/linux/alpha/brk.S17
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in_systm.h42
-rw-r--r--sysdeps/unix/sysv/linux/poll.c52
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/sysv4/solaris2/Makefile2
6 files changed, 120 insertions, 23 deletions
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
index 3cef7e735b..c9c5ed8fdc 100644
--- a/sysdeps/unix/Makefile
+++ b/sysdeps/unix/Makefile
@@ -23,20 +23,20 @@ ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
 	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/local_lim.h))))))
 
 ifneq (,$(wildcard $(sysincludedir)/sys/param.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_PARAM_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_PARAM_H
 endif
 ifneq (,$(wildcard $(sysincludedir)/sys/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_SYS_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_SYS_LIMITS_H
 endif
 ifneq (,$(wildcard $(sysincludedir)/limits.h))
-local_lim-CFLAGS := $(local_lim-CFLAGS) -DHAVE_LIMITS_H
+mk-local_lim-CFLAGS += -DHAVE_LIMITS_H
 endif
 
 $(common-objpfx)local_lim.h: $(common-objpfx)mk-local_lim
-	if $(dir $<)$(notdir $<) > $@-t; then mv $@-t $@; else XXX; fi
+	$(dir $<)$(notdir $<) > $@-t
+	mv -f $@-t $@
 $(common-objpfx)mk-local_lim: $(sysdep_dir)/unix/mk-local_lim.c
-	cwd=`pwd`; cd $(@D); \
-	$(BUILD_CC) $(BUILD_CFLAGS) $(local_lim-CFLAGS) $$cwd/$< -o $(@F)
+	$(common-objdir-compile)
 
 before-compile := $(before-compile) $(common-objpfx)local_lim.h
 common-generated := $(common-generated) local_lim.h mk-local_lim
@@ -50,7 +50,7 @@ ifeq (,$(filter-out $(sysdep_dir)/stub/ $(common-objpfx),\
 before-compile := $(before-compile) $(common-objpfx)sys/param.h
 
 $(common-objpfx)sys/param.h: $(sysincludedir)/sys/param.h
-	-mkdir $(@D:%/=%)
+	$(make-target-directory)
 	(echo '#ifndef _GNU_SYS_PARAM_H';	\
 	 echo '#define _GNU_SYS_PARAM_H 1';	\
 	 echo '#include <endian.h>';		\
@@ -73,16 +73,17 @@ $(common-objpfx)param.h.c: $(sysincludedir)/sys/param.h
 $(common-objpfx)param.h.dep: $(common-objpfx)param.h.c \
 			     $(sysdep_dir)/unix/Makefile
 	$(+mkdep) -I$(sysincludedir) $<		\
-	| sed > $@				\
+	| sed > $@-t				\
 	      -e 's@^.*:@@'			\
 	      -e 's@$<@@g'			\
 	      -e 's@$(sysincludedir)/*@@g'	\
 	      -e 's@\\$$@@'			\
 	      -e 's@^@sys/param.h-includes := $$(sys/param.h-includes) @'
+	mv $@-t $@
 
 # Get the generated definition of sys/param.h-includes.
 ifndef no_deps
-include $(common-objpfx)param.h.dep
+-include $(common-objpfx)param.h.dep
 endif
 
 # Don't preempt our own headers.
@@ -100,7 +101,7 @@ ifdef sys/param.h-includes
 # Copy the system files to $(common-objdir).
 $(addprefix $(common-objpfx),$(sys/param.h-includes)): $(common-objpfx)%: \
 						       $(sysincludedir)/%
-	-mkdir $(@D:%/=%)
+	$(make-target-directory)
 # Some of these files sometimes contain conflicting declarations for htons,
 # ntohs, etc.  They also often contain definitions of *_ENDIAN and
 # BYTE_ORDER, which we define ourselves in <endian.h>.
@@ -146,7 +147,8 @@ $(common-objpfx)make-errnos.c: $(sysdep_dir)/unix/errnos-tmpl.c \
 
 $(common-objpfx)errnos: $(wildcard $(sysincludedir)/errno.h	\
 				   $(sysincludedir)/sys/errno.h)
-	cat $^ | sed -n 's/^#define[ 	]*\(E[A-Z0-9][A-Z0-9]*\)[ 	].*$$/\1/p' > $@-tmp
+	sed -n 's/^#define[ 	]*\(E[A-Z0-9][A-Z0-9]*\)[ 	].*$$/\1/p' \
+	    $^ > $@-tmp
 	mv $@-tmp $@
 
 common-generated := $(common-generated) \
@@ -169,8 +171,7 @@ make-ioctls-CFLAGS := $(subst /,_,$(subst .,_,\
 				   $(ioctl-includes))))
 
 $(common-objpfx)make-ioctls: $(common-objpfx)make-ioctls.c
-	cd $(@D); $(BUILD_CC) $(BUILD_CFLAGS) $(make-ioctls-CFLAGS) \
-			$(<:$(common-objpfx)%=%) -o $(@F)
+	$(common-objdir-compile)
 
 $(common-objpfx)make-ioctls.c: $(sysdep_dir)/unix/ioctls-tmpl.c \
 			       $(sysdep_dir)/unix/ioctls.awk \
@@ -247,7 +248,7 @@ ifdef syscall.h
 
 # Transmogrify any of several formats of the file into the one we want.
 $(common-objpfx)sys/syscall.h: $(syscall.h)
-	-mkdir $(common-objpfx)sys
+	$(make-target-directory)
 	tr '[A-Z]' '[a-z]' < $< | \
 	sed -e 's/[ 	]sys_/ /' \
 	    -e 's/^#define[ 	]*\([a-z0-9_]*\)[ 	]*/#define SYS_\1 /' \
diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S
index 3d9f6dca5f..f44686b9a4 100644
--- a/sysdeps/unix/sysv/linux/alpha/brk.S
+++ b/sysdeps/unix/sysv/linux/alpha/brk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Brendan Kehoe <brendan@zen.org>, 1993.
 
@@ -50,20 +50,23 @@ LEAF(__brk, 0)
 	ldiq	v0, __NR_brk
 	call_pal PAL_callsys
 
+	/* Be prepared for an OSF-style brk.  */
+	bne	a3, $err1
+	beq	v0, $ok
+
 	/* Correctly handle the brk(0) query case.  */
 	cmoveq	a0, v0, a0
-
-	subq	a0, v0, t0
-	bne	t0, error
+	xor	a0, v0, t0
+	bne	t0, $err0
 
 	/* Update __curbrk and return cleanly.  */
-	stq	a0, __curbrk
 	mov	zero, v0
+$ok:	stq	a0, __curbrk
 	ret
 
 	/* What a horrible way to die.  */
-error:	ldi	v0, ENOMEM
-	jmp	zero, __syscall_error
+$err0:	ldi	v0, ENOMEM
+$err1:	jmp	zero, __syscall_error
 
 	END(__brk)
 
diff --git a/sysdeps/unix/sysv/linux/netinet/in_systm.h b/sysdeps/unix/sysv/linux/netinet/in_systm.h
index f481c5511a..902fe6ea0e 100644
--- a/sysdeps/unix/sysv/linux/netinet/in_systm.h
+++ b/sysdeps/unix/sysv/linux/netinet/in_systm.h
@@ -1 +1,41 @@
-#include <linux/in_systm.h>
+/* System specific type definitions for networking code.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef _NETINET_IN_SYSTM_H
+#define _NETINET_IN_SYSTM_H 1
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+/*
+ * Network order versions of various data types. Unfortunately, BSD
+ * assumes specific sizes for shorts (16 bit) and longs (32 bit) which
+ * don't hold in general. As a consequence, the network order versions
+ * may not reflect the actual size of the native data types.
+ */
+
+typedef u_int16_t n_short;      /* short as received from the net */
+typedef u_int32_t n_long;       /* long as received from the net  */
+typedef u_int32_t n_time;       /* ms since 00:00 GMT, byte rev   */
+
+__END_DECLS
+
+#endif /* netinet/in_systm.h */
diff --git a/sysdeps/unix/sysv/linux/poll.c b/sysdeps/unix/sysv/linux/poll.c
index 198819970a..337b85005f 100644
--- a/sysdeps/unix/sysv/linux/poll.c
+++ b/sysdeps/unix/sysv/linux/poll.c
@@ -1 +1,53 @@
+/* Poll system call, with emulation if it is not available.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <errno.h>
+#include <sys/poll.h>
+
+extern int __syscall_poll __P ((struct pollfd *fds, unsigned int nfds,
+				int timeout));
+extern int __emulate_poll __P ((struct pollfd *fds, unsigned long int nfds,
+				int timeout));
+
+/* The real implementation.  */
+int
+poll (fds, nfds, timeout)
+     struct pollfd *fds;
+     unsigned long int nfds;
+     int timeout;
+{
+  static int must_emulate = 0;
+
+  if (!must_emulate)
+    {
+      int retval = __syscall_poll (fds, nfds, timeout);
+
+      if (retval >= 0 || errno != ENOSYS)
+	return retval;
+
+      must_emulate = 1;
+    }
+
+  return __emulate_poll (fds, nfds, timeout);
+}
+
+
+/* Get the emulation code.  */
+#define poll(fds, nfds, timeout) __emulate_poll (fds, nfds, timeout)
 #include <sysdeps/unix/bsd/poll.c>
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 20ac94ae26..867e3bce3e 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -30,6 +30,7 @@ nanosleep	-	nanosleep	2	__libc_nanosleep	__nanosleep nanosleep
 pause		-	pause		0	__libc_pause	pause
 personality	init-first personality	1	__personality	personality
 pipe		-	pipe		1	__pipe		pipe
+s_poll		EXTRA	poll		3	__syscall_poll
 query_module	EXTRA	query_module	5	query_module
 s_getdents	EXTRA	getdents	3	__getdents
 s_getpriority	getpriority getpriority	2	__syscall_getpriority
diff --git a/sysdeps/unix/sysv/sysv4/solaris2/Makefile b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
index 3f86c46cc8..3ad90f748a 100644
--- a/sysdeps/unix/sysv/sysv4/solaris2/Makefile
+++ b/sysdeps/unix/sysv/sysv4/solaris2/Makefile
@@ -3,4 +3,4 @@
 # along the way (e.g., glue-ctype) will fail because it'll try to link
 # with the libc.a being *constructed* in $(objdir).  As a work-around,
 # we add this to each native-compile.
-BUILD_CFLAGS := $(BUILD_CFLAGS) -L/lib
+ALL_BUILD_CFLAGS += -L/lib