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
1=== modified file 'configure.ac'
2--- configure.ac 2017-01-28 03:54:15 +0000
3+++ configure.ac 2017-03-17 08:02:27 +0000
4@@ -311,6 +311,15 @@
5 ])
6 AC_SUBST(DEFAULT_SWAP_DIR)
7
8+DEFAULT_IPC_PREFIX=""
9+AC_ARG_WITH(ipcprefix,
10+ AS_HELP_STRING([--with-ipcprefix=NAME],
11+ [Default namespace prefix for shared memory object for ipc communication.
12+ Default is empty string and the share memory object name will be specified by squid. ]), [
13+ DEFAULT_IPC_PREFIX="$withval"
14+])
15+AC_SUBST(DEFAULT_IPC_PREFIX)
16+
17 if test "$squid_cv_compiler" = "gcc"; then
18 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
19 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
20
21=== modified file 'src/ipc/Makefile.am'
22--- src/ipc/Makefile.am 2017-01-01 00:16:45 +0000
23+++ src/ipc/Makefile.am 2017-03-17 08:02:27 +0000
24@@ -68,7 +68,7 @@
25 mem/Segment.cc \
26 mem/Segment.h
27
28-DEFS += -DDEFAULT_STATEDIR=\"$(localstatedir)/run/squid\"
29+DEFS += -DDEFAULT_STATEDIR=\"$(localstatedir)/run/squid\" -DDEFAULT_IPC_PREFIX=\"$(DEFAULT_IPC_PREFIX)\"
30
31 install-data-local:
32 $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/squid;
33
34=== modified file 'src/ipc/Port.cc'
35--- src/ipc/Port.cc 2017-01-01 00:16:45 +0000
36+++ src/ipc/Port.cc 2017-03-17 08:02:27 +0000
37@@ -51,6 +51,7 @@
38 {
39 assert(id >= 0);
40 String addr = channelPathPfx;
41+ addr.append(DEFAULT_IPC_PREFIX);
42 addr.append(service_name.c_str());
43 addr.append(processLabel);
44 addr.append('-');
45@@ -65,6 +66,7 @@
46 static String coordinatorAddr;
47 if (!coordinatorAddr.size()) {
48 coordinatorAddr= channelPathPfx;
49+ coordinatorAddr.append(DEFAULT_IPC_PREFIX);
50 coordinatorAddr.append(service_name.c_str());
51 coordinatorAddr.append(coordinatorAddrLabel);
52 coordinatorAddr.append(".ipc");
53
54=== modified file 'src/ipc/mem/Segment.cc'
55--- src/ipc/mem/Segment.cc 2017-01-01 00:16:45 +0000
56+++ src/ipc/mem/Segment.cc 2017-03-17 08:02:27 +0000
57@@ -30,6 +30,8 @@
58 #include <unistd.h>
59 #endif
60
61+#define DEFAULT_SQUID_IPC_PREFIX "/" DEFAULT_IPC_PREFIX
62+
63 // test cases change this
64 const char *Ipc::Mem::Segment::BasePath = DEFAULT_STATEDIR;
65
66@@ -229,9 +231,9 @@
67 if (nameIsPath) {
68 name.append(BasePath);
69 if (name[name.size()-1] != '/')
70- name.append('/');
71+ name.append(DEFAULT_SQUID_IPC_PREFIX);
72 } else {
73- name.append('/');
74+ name.append(DEFAULT_SQUID_IPC_PREFIX);
75 name.append(service_name.c_str());
76 name.append('-');
77 }

Subscribers

People subscribed via source and target branches

to all changes: