aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/sys
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-04-23 21:33:41 +0000
committerJeff Johnston <jjohnstn@redhat.com>2002-04-23 21:33:41 +0000
commitb9f9f699372fae9f3b7926fa165d07fe68a949fb (patch)
treec6212ab5fc51c520cfa62e5d66b1e08776fcd151 /newlib/libc/sys
parent54492ef5c66430812b1e4188d19f33799273be93 (diff)
downloadnewlib-b9f9f699372fae9f3b7926fa165d07fe68a949fb.zip
newlib-b9f9f699372fae9f3b7926fa165d07fe68a949fb.tar.gz
newlib-b9f9f699372fae9f3b7926fa165d07fe68a949fb.tar.bz2
2002-04-23 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/machine/types.h (__pid_t, __off_t, __loff_t): Added. * libc/sys/linux/Makefile.am: Add support for mmap.c. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/mmap.c: New file. * libc/sys/linux/machine/i386/syscall.h: Add _syscall6 macro. * libc/sys/linux/sys/types.h (pid_t, off_t, loff_t): Added.
Diffstat (limited to 'newlib/libc/sys')
-rw-r--r--newlib/libc/sys/linux/Makefile.am3
-rw-r--r--newlib/libc/sys/linux/Makefile.in17
-rw-r--r--newlib/libc/sys/linux/machine/i386/syscall.h14
-rw-r--r--newlib/libc/sys/linux/mmap.c16
-rw-r--r--newlib/libc/sys/linux/sys/types.h6
5 files changed, 46 insertions, 10 deletions
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am
index aa020f0..9248f33 100644
--- a/newlib/libc/sys/linux/Makefile.am
+++ b/newlib/libc/sys/linux/Makefile.am
@@ -8,7 +8,8 @@ SUBDIRS = machine .
SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
- brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
+ brk.c getoptlong.c ids.c inode.c io.c linux.c mmap.c \
+ process.c realpath.c \
select.c signal.c siglongjmp.c socket.c sleep.c stack.c \
sysconf.c systat.c termios.c time.c \
usleep.c wait.c
diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in
index 22600b6..8735f6d 100644
--- a/newlib/libc/sys/linux/Makefile.in
+++ b/newlib/libc/sys/linux/Makefile.in
@@ -93,7 +93,8 @@ SUBDIRS = machine .
SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
- brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
+ brk.c getoptlong.c ids.c inode.c io.c linux.c mmap.c \
+ process.c realpath.c \
select.c signal.c siglongjmp.c socket.c sleep.c stack.c \
sysconf.c systat.c termios.c time.c \
usleep.c wait.c
@@ -127,17 +128,17 @@ DEFS = @DEFS@ -I. -I$(srcdir)
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@siglongjmp.o socket.o sleep.o stack.o sysconf.o \
-@USE_LIBTOOL_FALSE@systat.o termios.o time.o usleep.o wait.o
+@USE_LIBTOOL_FALSE@io.o linux.o mmap.o process.o realpath.o select.o \
+@USE_LIBTOOL_FALSE@signal.o siglongjmp.o socket.o sleep.o stack.o \
+@USE_LIBTOOL_FALSE@sysconf.o systat.o 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 siglongjmp.lo socket.lo sleep.lo \
-@USE_LIBTOOL_TRUE@stack.lo sysconf.lo systat.lo termios.lo time.lo \
-@USE_LIBTOOL_TRUE@usleep.lo wait.lo
+@USE_LIBTOOL_TRUE@inode.lo io.lo linux.lo mmap.lo process.lo \
+@USE_LIBTOOL_TRUE@realpath.lo select.lo signal.lo siglongjmp.lo \
+@USE_LIBTOOL_TRUE@socket.lo sleep.lo stack.lo sysconf.lo systat.lo \
+@USE_LIBTOOL_TRUE@termios.lo time.lo usleep.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)
diff --git a/newlib/libc/sys/linux/machine/i386/syscall.h b/newlib/libc/sys/linux/machine/i386/syscall.h
index 08802e5..c8f265f 100644
--- a/newlib/libc/sys/linux/machine/i386/syscall.h
+++ b/newlib/libc/sys/linux/machine/i386/syscall.h
@@ -55,6 +55,12 @@ __asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
: "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \
"d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)));
+#undef __inline_syscall6
+#define __inline_syscall6(name,ret,arg1,arg2,arg3,arg4,arg5,arg6) \
+__asm__ volatile ("push %%ebx; lea 8(%%ebp),%%ebx; int $0x80; pop %%ebx" \
+ : "=a" (ret) \
+ : "0" (__NR_##name));
+
#undef _syscall1
#define _syscall1(type,name,type1,arg1) \
type name(type1 arg1) \
@@ -102,6 +108,14 @@ __syscall_return(type,__res); \
}
#undef _syscall6
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
+ type5,arg5,type6,arg6) \
+type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
+{ \
+long __res; \
+__inline_syscall6(name,__res,arg1,arg2,arg3,arg4,arg5,arg6) \
+__syscall_return(type,__res); \
+}
#endif /* __PIC__ && __i386__ */
diff --git a/newlib/libc/sys/linux/mmap.c b/newlib/libc/sys/linux/mmap.c
new file mode 100644
index 0000000..d7dbeb8
--- /dev/null
+++ b/newlib/libc/sys/linux/mmap.c
@@ -0,0 +1,16 @@
+/* libc/sys/linux/mmap.c - Memory mapping functions */
+
+/* Copyright 2002, Red Hat Inc. */
+
+#include <sys/mman.h>
+#include <machine/syscall.h>
+
+_syscall6(void *,mmap,void *,addr,size_t,len,int,prot,int,flags,int,fd,off_t,off);
+_syscall2(int,munmap,void *,addr,size_t,len);
+_syscall1(int,mlockall,int,flags);
+_syscall0(int,munlockall);
+_syscall2(int,mlock,const void *,addr,size_t,len);
+_syscall2(int,munlock,const void *,addr,size_t,len);
+_syscall3(int,mprotect,void *,addr,size_t,len,int,prot);
+_syscall3(int,msync,void *,addr,size_t,len,int,flags);
+_syscall4(void *,mremap,void *,addr,size_t,oldlen,size_t,newlen,int,maymove);
diff --git a/newlib/libc/sys/linux/sys/types.h b/newlib/libc/sys/linux/sys/types.h
index 385ca16..1954af9 100644
--- a/newlib/libc/sys/linux/sys/types.h
+++ b/newlib/libc/sys/linux/sys/types.h
@@ -25,7 +25,11 @@ typedef _CLOCK_T_ clock_t;
#endif
typedef unsigned int __socklen_t;
-typedef long int __useconds_t;
+typedef unsigned int __useconds_t;
+
+typedef __pid_t pid_t;
+typedef __off_t off_t;
+typedef __loff_t loff_t;
#include <linux/types.h>