/*
- * $Id$
- *
- * DEBUG: section 54 Interprocess Communication
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
*
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+/* DEBUG: section 54 Interprocess Communication */
+
#include "squid.h"
#include "base/TextException.h"
#include "compat/shm.h"
+#include "Debug.h"
+#include "fatal.h"
#include "ipc/mem/Segment.h"
-#include "protos.h"
+#include "SBuf.h"
+#include "tools.h"
+#if HAVE_FCNTL_H
#include <fcntl.h>
+#endif
+#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
+#endif
+#if HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+#if HAVE_UNISTD_H
#include <unistd.h>
-
+#endif
// test cases change this
const char *Ipc::Mem::Segment::BasePath = DEFAULT_STATEDIR;
return result;
}
+SBuf
+Ipc::Mem::Segment::Name(const SBuf &prefix, const char *suffix)
+{
+ SBuf result = prefix;
+ result.append("_");
+ result.append(suffix);
+ return result;
+}
+
#if HAVE_SHM
Ipc::Mem::Segment::Segment(const char *const id):
- theFD(-1), theName(GenerateName(id)), theMem(NULL),
- theSize(0), theReserved(0), doUnlink(false)
+ theFD(-1), theName(GenerateName(id)), theMem(NULL),
+ theSize(0), theReserved(0), doUnlink(false)
{
}
static SegmentMap Segments;
Ipc::Mem::Segment::Segment(const char *const id):
- theName(id), theMem(NULL), theSize(0), theReserved(0), doUnlink(false)
+ theName(id), theMem(NULL), theSize(0), theReserved(0), doUnlink(false)
{
}
#endif // HAVE_SHM
void
-Ipc::Mem::RegisteredRunner::run(const RunnerRegistry &r)
+Ipc::Mem::RegisteredRunner::useConfig()
{
// If Squid is built with real segments, we create() real segments
// in the master process only. Otherwise, we create() fake
#else
if (IamWorkerProcess())
#endif
- create(r);
+ create();
// we assume that master process does not need shared segments
// unless it is also a worker
if (!InDaemonMode() || !IamMasterProcess())
- open(r);
+ open();
}
+