2010-03-30 16:11:28 +02:00
|
|
|
// mmap_mm.cpp - in memory (no file) version
|
2009-01-30 04:31:13 +01:00
|
|
|
|
2009-10-27 20:58:27 +01:00
|
|
|
/* Copyright 2009 10gen Inc.
|
2009-01-30 04:31:13 +01:00
|
|
|
*
|
2009-10-27 20:58:27 +01:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2009-01-30 04:31:13 +01:00
|
|
|
*
|
2009-10-27 20:58:27 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2009-01-30 04:31:13 +01:00
|
|
|
*
|
2009-10-27 20:58:27 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2009-01-30 04:31:13 +01:00
|
|
|
*/
|
|
|
|
|
2010-04-27 21:33:27 +02:00
|
|
|
#include "pch.h"
|
2009-01-30 04:31:13 +01:00
|
|
|
#include "mmap.h"
|
|
|
|
|
2009-02-06 19:29:57 +01:00
|
|
|
/* in memory (no file) version */
|
|
|
|
|
2009-01-30 04:31:13 +01:00
|
|
|
namespace mongo {
|
|
|
|
|
|
|
|
MemoryMappedFile::MemoryMappedFile() {
|
|
|
|
fd = 0;
|
|
|
|
maphandle = 0;
|
|
|
|
view = 0;
|
|
|
|
len = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MemoryMappedFile::close() {
|
|
|
|
if ( view )
|
2010-03-03 23:23:37 +01:00
|
|
|
free( view );
|
2009-01-30 04:31:13 +01:00
|
|
|
view = 0;
|
|
|
|
len = 0;
|
|
|
|
}
|
|
|
|
|
2010-03-03 23:23:37 +01:00
|
|
|
void* MemoryMappedFile::map(const char *filename, long& length , int options ) {
|
|
|
|
assert( length );
|
2009-01-30 04:31:13 +01:00
|
|
|
view = malloc( length );
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MemoryMappedFile::flush(bool sync) {
|
|
|
|
}
|
2011-01-04 06:40:41 +01:00
|
|
|
|
2010-06-24 17:03:57 +02:00
|
|
|
void MemoryMappedFile::_lock() {}
|
|
|
|
void MemoryMappedFile::_unlock() {}
|
2009-01-30 04:31:13 +01:00
|
|
|
|
2011-01-04 06:40:41 +01:00
|
|
|
}
|
2009-01-30 04:31:13 +01:00
|
|
|
|