diff options
author | Dwight <dmerriman@gmail.com> | 2008-08-11 15:16:54 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-08-11 15:16:54 -0400 |
commit | 776387ea1bf641d43a22f17e2e23e7d0e8780f87 (patch) | |
tree | 466061cfc73afa1cc514fee7ca08903862719fa2 /util | |
parent | 236575ca95fb7bddcd9ff142618fdd4db261530e (diff) | |
parent | 39030722e571658111c3583b61736d1e22524913 (diff) | |
download | mongo-776387ea1bf641d43a22f17e2e23e7d0e8780f87.tar.gz |
Merge branch 'master' of ssh://git.10gen.com/data/gitroot/p
Conflicts:
db/repl.h
Diffstat (limited to 'util')
-rw-r--r-- | util/goodies.h | 12 | ||||
-rw-r--r-- | util/mmap.cpp | 14 | ||||
-rw-r--r-- | util/sock.h | 16 |
3 files changed, 16 insertions, 26 deletions
diff --git a/util/goodies.h b/util/goodies.h index 282f96694d0..631ed12b9f6 100644 --- a/util/goodies.h +++ b/util/goodies.h @@ -189,15 +189,5 @@ public: }; */ -/* -struct lock { -boostlock bl; - DebugMutex& m; - lock(DebugMutex& _m) : m(_m) { - do_lock(); - } - ~lock() { do_unlock(); } -} -*/ -typedef boostlock lock; +//typedef boostlock lock; diff --git a/util/mmap.cpp b/util/mmap.cpp index 94f96d6fa59..a3296cd2412 100644 --- a/util/mmap.cpp +++ b/util/mmap.cpp @@ -148,14 +148,14 @@ void* MemoryMappedFile::map(const char *filename, int length) { /* make sure the file is the full desired length */ off_t filelen = lseek(fd, 0, SEEK_END); if( filelen < length ) { - cout << "map: file length=" << (unsigned) filelen << " want:"; - cout << length; - cout << endl; + log() << "map: file length=" << (unsigned) filelen << " want:" + << length + << endl; if( filelen != 0 ) { - cout << " failing mapping" << endl; + log() << " failing mapping" << endl; return 0; } - cout << " writing file to full length with zeroes..." << endl; + log() << " writing file to full length with zeroes..." << endl; int z = 8192; char buf[z]; memset(buf, 0, z); @@ -168,7 +168,7 @@ void* MemoryMappedFile::map(const char *filename, int length) { write(fd, buf, z); left -= z; } - cout << " done" << endl; + log() << " done" << endl; } lseek(fd, length, SEEK_SET); @@ -184,7 +184,7 @@ void* MemoryMappedFile::map(const char *filename, int length) { void MemoryMappedFile::flush(bool sync) { if( msync(view, len, sync ? MS_SYNC : MS_ASYNC) ) - cout << "msync error " << errno << endl; + problem() << "msync error " << errno << endl; } #endif diff --git a/util/sock.h b/util/sock.h index 1e101b619ac..58913027fcd 100644 --- a/util/sock.h +++ b/util/sock.h @@ -58,11 +58,11 @@ inline void disableNagle(int sock) { #endif if( setsockopt(sock, level, TCP_NODELAY, (char *) &x, sizeof(x)) ) - cout << "ERROR: disableNagle failed" << endl; + log() << "ERROR: disableNagle failed" << endl; } inline void prebindOptions( int sock ){ - cout << "doing prebind option" << endl; + DEV log() << "doing prebind option" << endl; int x = 1; if ( setsockopt( sock , SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x)) < 0 ) cout << "Failed to set socket opt, SO_REUSEADDR" << endl; @@ -71,12 +71,12 @@ inline void prebindOptions( int sock ){ #endif -// .empty() if err
-inline string hostbyname_nonreentrant(const char *hostname) {
- struct hostent *h;
- h = gethostbyname(hostname);
- if( h == 0 ) return "";
- return inet_ntoa( *((struct in_addr *)(h->h_addr)) );
+// .empty() if err +inline string hostbyname_nonreentrant(const char *hostname) { + struct hostent *h; + h = gethostbyname(hostname); + if( h == 0 ) return ""; + return inet_ntoa( *((struct in_addr *)(h->h_addr)) ); } struct SockAddr { |