~ubuntu-branches/ubuntu/vivid/juju-mongodb/vivid-proposed

« back to all changes in this revision

Viewing changes to src/mongo/util/logfile.cpp

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2014-03-27 00:47:53 UTC
  • Revision ID: package-import@ubuntu.com-20140327004753-gfflsyu804txqh33
Tags: 2.4.9-0ubuntu3
d/p/0099-Pagesize-hacks.patch: Apply some hacks for non-4k pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "mongo/util/startup_test.h"
27
27
#include "mongo/util/text.h"
28
28
 
 
29
#define PAGESIZE sysconf(_SC_PAGESIZE)
29
30
 
30
31
using namespace mongoutils;
31
32
 
36
37
            if( 0 && debug ) {
37
38
                try {
38
39
                    LogFile f("logfile_test");
39
 
                    void *p = malloc(16384);
 
40
                    void *p = malloc(4*PAGESIZE);
40
41
                    char *buf = (char*) p;
41
 
                    buf += 4095;
 
42
                    buf += PAGESIZE - 1;
42
43
                    buf = (char*) (((size_t)buf)&(~0xfff));
43
44
                    memset(buf, 'z', 8192);
44
 
                    buf[8190] = '\n';
45
 
                    buf[8191] = 'B';
 
45
                    buf[2 * PAGESIZE - 2] = '\n';
 
46
                    buf[2 * PAGESIZE - 1] = 'B';
46
47
                    buf[0] = 'A';
47
 
                    f.synchronousAppend(buf, 8192);
48
 
                    f.synchronousAppend(buf, 8192);
 
48
                    f.synchronousAppend(buf, 2 * PAGESIZE);
 
49
                    f.synchronousAppend(buf, 2 * PAGESIZE);
49
50
                    free(p);
50
51
                }
51
52
                catch(DBException& e ) {
226
227
 
227
228
        fassert( 16144, charsToWrite >= 0 );
228
229
        fassert( 16142, _fd >= 0 );
 
230
 
 
231
// Disabling alignment test on PPC64 due to a 64kB page size on PPC64 instead of 4kB on x86
 
232
#ifndef __PPC64__
229
233
        fassert( 16143, reinterpret_cast<ssize_t>( buf ) % g_minOSPageSizeBytes == 0 );  // aligned
 
234
#endif
230
235
 
231
236
#ifdef POSIX_FADV_DONTNEED
232
237
        const off_t pos = lseek(_fd, 0, SEEK_CUR); // doesn't actually seek, just get current position