summaryrefslogtreecommitdiff
path: root/db/instance.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-07-26 14:25:55 -0400
committerEliot Horowitz <eliot@10gen.com>2010-07-26 14:25:55 -0400
commitc7a38e409d48440c824ad5a5d6f450ba3adc875e (patch)
tree3155c1a6aa1340b3df0b8feed4db9bbd082b7346 /db/instance.cpp
parent401d3ab6b9f3b7f6a2a949074dd05945297f4152 (diff)
downloadmongo-c7a38e409d48440c824ad5a5d6f450ba3adc875e.tar.gz
cleaning pidfilepath code - adding to mongos SERVER-1488
Diffstat (limited to 'db/instance.cpp')
-rw-r--r--db/instance.cpp33
1 files changed, 11 insertions, 22 deletions
diff --git a/db/instance.cpp b/db/instance.cpp
index ee99f56da26..89b994219d6 100644
--- a/db/instance.cpp
+++ b/db/instance.cpp
@@ -752,17 +752,16 @@ namespace mongo {
#endif
}
- void writePid(int fd) {
#if !defined(_WIN32) && !defined(__sunos__)
- stringstream ss;
- ss << getpid() << endl;
- string s = ss.str();
- const char * data = s.c_str();
- assert ( write( fd, data, strlen( data ) ) );
-#endif
+ void writePid(int fd) {
+ stringstream ss;
+ ss << getpid() << endl;
+ string s = ss.str();
+ const char * data = s.c_str();
+ assert ( write( fd, data, strlen( data ) ) );
}
+
void acquirePathLock() {
-#if !defined(_WIN32) && !defined(__sunos__)
string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string();
bool oldFile = false;
@@ -795,21 +794,11 @@ namespace mongo {
uassert( 13342, "Unable to truncate lock file", ftruncate(lockFile, 0) == 0);
writePid( lockFile );
fsync( lockFile );
-#endif
}
-
- void maybeCreatePidFile() {
-#if !defined(_WIN32) && !defined(__sunos__)
- if (!(pidfilepath.empty())) {
- int pidfd;
- int oflags = O_CREAT|O_TRUNC|O_WRONLY;
- int omode = S_IRWXU|S_IRWXG|S_IRWXO;
- string name = boost::filesystem::path( pidfilepath ).native_file_string();
- assert( ( (pidfd=(open(name.c_str(), oflags, omode))) > -1 ) );
- writePid(pidfd);
- assert( close( pidfd ) == 0 );
- }
-#endif
+#else
+ void acquirePathLock() {
+ // TODO - this is very bad
}
+#endif
} // namespace mongo