From b9f9f699372fae9f3b7926fa165d07fe68a949fb Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 23 Apr 2002 21:33:41 +0000 Subject: 2002-04-23 Jeff Johnston * 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. --- newlib/libc/sys/linux/Makefile.am | 3 ++- newlib/libc/sys/linux/Makefile.in | 17 +++++++++-------- newlib/libc/sys/linux/machine/i386/syscall.h | 14 ++++++++++++++ newlib/libc/sys/linux/mmap.c | 16 ++++++++++++++++ newlib/libc/sys/linux/sys/types.h | 6 +++++- 5 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 newlib/libc/sys/linux/mmap.c (limited to 'newlib/libc/sys') diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index aa020f0e2..9248f33c1 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 22600b64b..8735f6d41 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 08802e52e..c8f265f68 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 000000000..d7dbeb842 --- /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 +#include + +_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 385ca16cc..1954af9c8 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 -- cgit v1.2.3