Merge lp:~gary-wzl77/squid/ipc_prefix into lp:squid/3.5

Proposed by Gary.Wang
Status: Needs review
Proposed branch: lp:~gary-wzl77/squid/ipc_prefix
Merge into: lp:squid/3.5
Diff against target: 77 lines (+16/-3)
4 files modified
configure.ac (+9/-0)
src/ipc/Makefile.am (+1/-1)
src/ipc/Port.cc (+2/-0)
src/ipc/mem/Segment.cc (+4/-2)
To merge this branch: bzr merge lp:~gary-wzl77/squid/ipc_prefix
Reviewer Review Type Date Requested Status
Alex Rousskov Needs Information
Amos Jeffries Needs Information
Review via email: mp+318714@code.launchpad.net

Commit message

Added new configure option --with-ipcprefix to enable to customize
share memory object namespace prefix in compile time.
This's the minimal change to squid to make it work in strict confinement of snap world.

Description of the change

Added new configure option --with-ipcprefix to enable to customize
share memory object namespace prefix in compile time.
This's the minimal change to squid to make it work in strict confinement of snap world.

To post a comment you must log in.
Revision history for this message
Amos Jeffries (yadi) wrote :

As mentioned earlier, merge requests should be sent to squid-dev mailing list. We need to discuss why the configurable service_name is not being used for this. Particularly since this patch is altering the behaviour of that feature.

review: Needs Information
Revision history for this message
Alex Rousskov (rousskov) wrote :

Please explain why the existing DEFAULT_STATEDIR cannot be used to customize the
shared memory segment prefix at compile time.

I agree with Amos that it is best to discuss this on squid-dev.

review: Needs Information
lp:~gary-wzl77/squid/ipc_prefix updated
14150. By Gary.Wang

To keep it consistent, change src/ipc/Port.cc to honor the new DEFAULT_IPC_PREFIX.

Unmerged revisions

14150. By Gary.Wang

To keep it consistent, change src/ipc/Port.cc to honor the new DEFAULT_IPC_PREFIX.

14149. By Gary.Wang

Added new configure option --with-ipcprefix to enable to customize
share memory object namespace prefix in compile time.
This's the minimal change to squid to make it work in strict confinement of snap world.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2017-01-28 03:54:15 +0000
+++ configure.ac 2017-03-17 08:02:27 +0000
@@ -311,6 +311,15 @@
311])311])
312AC_SUBST(DEFAULT_SWAP_DIR)312AC_SUBST(DEFAULT_SWAP_DIR)
313313
314DEFAULT_IPC_PREFIX=""
315AC_ARG_WITH(ipcprefix,
316 AS_HELP_STRING([--with-ipcprefix=NAME],
317 [Default namespace prefix for shared memory object for ipc communication.
318 Default is empty string and the share memory object name will be specified by squid. ]), [
319 DEFAULT_IPC_PREFIX="$withval"
320])
321AC_SUBST(DEFAULT_IPC_PREFIX)
322
314if test "$squid_cv_compiler" = "gcc"; then323if test "$squid_cv_compiler" = "gcc"; then
315 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`324 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
316 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`325 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
317326
=== modified file 'src/ipc/Makefile.am'
--- src/ipc/Makefile.am 2017-01-01 00:16:45 +0000
+++ src/ipc/Makefile.am 2017-03-17 08:02:27 +0000
@@ -68,7 +68,7 @@
68 mem/Segment.cc \68 mem/Segment.cc \
69 mem/Segment.h69 mem/Segment.h
7070
71DEFS += -DDEFAULT_STATEDIR=\"$(localstatedir)/run/squid\"71DEFS += -DDEFAULT_STATEDIR=\"$(localstatedir)/run/squid\" -DDEFAULT_IPC_PREFIX=\"$(DEFAULT_IPC_PREFIX)\"
7272
73install-data-local:73install-data-local:
74 $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/squid;74 $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/squid;
7575
=== modified file 'src/ipc/Port.cc'
--- src/ipc/Port.cc 2017-01-01 00:16:45 +0000
+++ src/ipc/Port.cc 2017-03-17 08:02:27 +0000
@@ -51,6 +51,7 @@
51{51{
52 assert(id >= 0);52 assert(id >= 0);
53 String addr = channelPathPfx;53 String addr = channelPathPfx;
54 addr.append(DEFAULT_IPC_PREFIX);
54 addr.append(service_name.c_str());55 addr.append(service_name.c_str());
55 addr.append(processLabel);56 addr.append(processLabel);
56 addr.append('-');57 addr.append('-');
@@ -65,6 +66,7 @@
65 static String coordinatorAddr;66 static String coordinatorAddr;
66 if (!coordinatorAddr.size()) {67 if (!coordinatorAddr.size()) {
67 coordinatorAddr= channelPathPfx;68 coordinatorAddr= channelPathPfx;
69 coordinatorAddr.append(DEFAULT_IPC_PREFIX);
68 coordinatorAddr.append(service_name.c_str());70 coordinatorAddr.append(service_name.c_str());
69 coordinatorAddr.append(coordinatorAddrLabel);71 coordinatorAddr.append(coordinatorAddrLabel);
70 coordinatorAddr.append(".ipc");72 coordinatorAddr.append(".ipc");
7173
=== modified file 'src/ipc/mem/Segment.cc'
--- src/ipc/mem/Segment.cc 2017-01-01 00:16:45 +0000
+++ src/ipc/mem/Segment.cc 2017-03-17 08:02:27 +0000
@@ -30,6 +30,8 @@
30#include <unistd.h>30#include <unistd.h>
31#endif31#endif
3232
33#define DEFAULT_SQUID_IPC_PREFIX "/" DEFAULT_IPC_PREFIX
34
33// test cases change this35// test cases change this
34const char *Ipc::Mem::Segment::BasePath = DEFAULT_STATEDIR;36const char *Ipc::Mem::Segment::BasePath = DEFAULT_STATEDIR;
3537
@@ -229,9 +231,9 @@
229 if (nameIsPath) {231 if (nameIsPath) {
230 name.append(BasePath);232 name.append(BasePath);
231 if (name[name.size()-1] != '/')233 if (name[name.size()-1] != '/')
232 name.append('/');234 name.append(DEFAULT_SQUID_IPC_PREFIX);
233 } else {235 } else {
234 name.append('/');236 name.append(DEFAULT_SQUID_IPC_PREFIX);
235 name.append(service_name.c_str());237 name.append(service_name.c_str());
236 name.append('-');238 name.append('-');
237 }239 }

Subscribers

People subscribed via source and target branches

to all changes: