From: DINH V. Ho? <ho...@us...> - 2002-03-12 23:24:35
|
Update of /cvsroot/libetpan/libetpan/tools In directory usw-pr-cvs1:/tmp/cvs-serv9693/tools Modified Files: Makefile Added Files: mapping.c mapping.h Log Message: generic interfaces - bug fixes --- NEW FILE: mapping.c --- #include "mapping.h" #include <unistd.h> #include <sys/mman.h> int get_mapping(size_t length, int prot, int flags, int fd, off_t offset, void ** presult, void ** pmapping, size_t * pmapping_size) { void * mapping; size_t * mapping_size; void * result; size_t page_size; off_t delta; page_size = getpagesize(); delta = offset % page_size; mapping = mmap(NULL, length + offset, prot, flags, fd, offset - delta); if (mapping == MAP_FAILED) return -1; result = ((char *) mapping) + delta; mapping_size = length + offset; * pmapping = mapping; * pmapping_size = mapping_size; * presult = result; return 0; } --- NEW FILE: mapping.h --- #ifndef MAPPING_H #define MAPPING_H #include <sys/types.h> int get_mapping(size_t length, int prot, int flags, int fd, off_t offset, void ** presult, void ** pmapping, size_t * pmapping_size); #endif Index: Makefile =================================================================== RCS file: /cvsroot/libetpan/libetpan/tools/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile 13 Dec 2001 02:01:31 -0000 1.4 +++ Makefile 12 Mar 2002 23:24:30 -0000 1.5 @@ -1,9 +1,11 @@ TARGET = libtools HEADERS = mailstream.h mailstream_helper.h mail.h \ mmapstring.h mailstream_low.h \ - mailstream_socket.h mailstream_ssl.h + mailstream_socket.h mailstream_ssl.h \ + mapping.h SOURCES = connect.c md5.c mmapstring.c \ mailstream_helper.c mailstream_low.c \ - mailstream.c mailstream_socket.c mailstream_ssl.c + mailstream.c mailstream_socket.c mailstream_ssl.c \ + mapping.c include ../Rules |