sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Implementation of mmap/munmap/msync. sl@0: * sl@0: */ sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: sl@0: #include sl@0: #include "mmap.h" sl@0: sl@0: extern "C" sl@0: { sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Funcation name: mmap sl@0: // Description: Provides mmap functionality. sl@0: // Returns: valid address : On success sl@0: // -1 : On error sl@0: // In case of error, errno value set sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: sl@0: EXPORT_C void* mmap(void */*addr*/, size_t len, int prot, int flags, int fildes, off_t offset) sl@0: { sl@0: //TODO;To validate addr for page boundry and sharedmemory sl@0: return _mmap_r(_REENT, len, prot, flags, fildes, offset); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Funcation name: munmap sl@0: // Description: Provides munmap functionality. sl@0: // Returns: 0 : On success sl@0: // -1 : On error sl@0: // In case of error, errno value set sl@0: // Remark: support for unmapping part of the mapped pages is not supported sl@0: // Unmap will remove all mappings those were mapped starting from the offset sl@0: // to offset + len (refer to mmap signature) sl@0: // ----------------------------------------------------------------------------- sl@0: sl@0: EXPORT_C int munmap(void *addr, size_t len) sl@0: { sl@0: //TODO;To validate addr for page boundry and sharedmemory sl@0: return _munmap_r(_REENT, addr, len); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Funcation name: msync sl@0: // Description: Provides msync functionality. sl@0: // Returns: 0 : On success sl@0: // -1 : On error sl@0: // In case of error, errno value set sl@0: // sl@0: // ----------------------------------------------------------------------------- sl@0: sl@0: EXPORT_C int msync(void *addr, size_t len, int flags) sl@0: { sl@0: return _msync_r(_REENT, addr, len, flags); sl@0: } sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Funcation name: mprotect sl@0: // Description: Provides msync functionality. sl@0: // Returns: 0 : On success sl@0: // -1 : On error sl@0: // In case of error, errno value set sl@0: // Remark: mprotect is only build enabled and not functional sl@0: // ----------------------------------------------------------------------------- sl@0: sl@0: EXPORT_C int mprotect(const void *addr, size_t len, int prot) sl@0: { sl@0: return _mprotect_r(_REENT, addr, len, prot); sl@0: } sl@0: sl@0: sl@0: } // extern "C" sl@0: sl@0: // End of File