Changeset: 45303902bb42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=45303902bb42
Modified Files:
monetdb5/modules/mal/mal_mapi.c
testing/process.py
tools/mserver/mserver5.1.in
Branch: mtest
Log Message:
Add a possibility to use IP port in UNIX domain socket file name.
diffs (54 lines):
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -761,7 +761,12 @@ SERVERlisten(int port, const char *usock
#endif
userver.sun_family = AF_UNIX;
- memcpy(userver.sun_path, usockfile, ulen + 1);
+ const char *p;
+ if ((p = strstr(usockfile, "${PORT}")) != NULL)
+ snprintf(userver.sun_path, sizeof(userver.sun_path),
+ "%.*s%d%s", (int) (p - usockfile),
usockfile, port<0?0:port, p + 7);
+ else
+ memcpy(userver.sun_path, usockfile, ulen + 1);
length = (SOCKLEN) sizeof(userver);
if (remove(usockfile) == -1 && errno != ENOENT) {
char *e = createException(IO, "mal_mapi.listen",
OPERATION_FAILED ": remove UNIX socket file: %s",
diff --git a/testing/process.py b/testing/process.py
--- a/testing/process.py
+++ b/testing/process.py
@@ -363,7 +363,10 @@ class server(Popen):
cmd.append('mapi_port=%s' % mapiport)
if usock is not None:
cmd.append('--set')
- cmd.append('mapi_usock=%s.%s' % (usock, mapiport))
+ if mapiport == '0':
+ cmd.append('mapi_usock=%s.${PORT}' % usock)
+ else:
+ cmd.append('mapi_usock=%s.%s' % (usock, mapiport))
for i in range(len(cmd)):
if cmd[i].startswith('--dbpath='):
dbpath = cmd[i][9:]
diff --git a/tools/mserver/mserver5.1.in b/tools/mserver/mserver5.1.in
--- a/tools/mserver/mserver5.1.in
+++ b/tools/mserver/mserver5.1.in
@@ -268,8 +268,16 @@ Default
.TP
.B mapi_usock
The name of the UNIX domain socket file on which the server will
-listen for connections. Note, there is usually a severe
-system-imposed length limitation on the name of the file.
+listen for connections.
+If the name contains the substring
+.BR ${PORT} ,
+that part will be replaced by the decimal representation of the TCP/IP
+port (option
+.BR mapi_port ).
+This is especially useful if the port was specified as
+.BR 0 .
+Note, there is usually a severe system-imposed length limitation on
+the name of the file.
.TP
.B mapi_port
The TCP/IP port number on which the server will listen for
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list