phc2sys: Add option to set path to ptp4l UDS.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2014-07-08 16:14:18 +02:00 committed by Richard Cochran
parent bdb6a35883
commit 28865f91df
2 changed files with 15 additions and 1 deletions

View File

@ -194,6 +194,10 @@ clock frequency (unless the
.B \-S .B \-S
option is used). option is used).
.TP .TP
.BI \-z " uds-address"
Specifies the address of the server's UNIX domain socket.
The default is /var/run/ptp4l.
.TP
.BI \-l " print-level" .BI \-l " print-level"
Set the maximum syslog level of messages which should be printed or sent to Set the maximum syslog level of messages which should be printed or sent to
the system logger. The default is 6 (LOG_INFO). the system logger. The default is 6 (LOG_INFO).

View File

@ -53,6 +53,7 @@
#include "stats.h" #include "stats.h"
#include "sysoff.h" #include "sysoff.h"
#include "tlv.h" #include "tlv.h"
#include "uds.h"
#include "util.h" #include "util.h"
#include "version.h" #include "version.h"
@ -1158,6 +1159,7 @@ static void usage(char *progname)
" -u [num] number of clock updates in summary stats (0)\n" " -u [num] number of clock updates in summary stats (0)\n"
" -n [num] domain number (0)\n" " -n [num] domain number (0)\n"
" -x apply leap seconds by servo instead of kernel\n" " -x apply leap seconds by servo instead of kernel\n"
" -z [path] server address for UDS (/var/run/ptp4l)\n"
" -l [num] set the logging level to 'num' (6)\n" " -l [num] set the logging level to 'num' (6)\n"
" -m print messages to stdout\n" " -m print messages to stdout\n"
" -q do not print messages to the syslog\n" " -q do not print messages to the syslog\n"
@ -1192,7 +1194,7 @@ int main(int argc, char *argv[])
progname = strrchr(argv[0], '/'); progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0]; progname = progname ? 1+progname : argv[0];
while (EOF != (c = getopt(argc, argv, while (EOF != (c = getopt(argc, argv,
"arc:d:s:E:P:I:S:F:R:N:O:L:i:u:wn:xl:mqvh"))) { "arc:d:s:E:P:I:S:F:R:N:O:L:i:u:wn:xz:l:mqvh"))) {
switch (c) { switch (c) {
case 'a': case 'a':
autocfg = 1; autocfg = 1;
@ -1285,6 +1287,14 @@ int main(int argc, char *argv[])
case 'x': case 'x':
node.kernel_leap = 0; node.kernel_leap = 0;
break; break;
case 'z':
if (strlen(optarg) > MAX_IFNAME_SIZE) {
fprintf(stderr, "path %s too long, max is %d\n",
optarg, MAX_IFNAME_SIZE);
return -1;
}
strncpy(uds_path, optarg, MAX_IFNAME_SIZE);
break;
case 'l': case 'l':
if (get_arg_val_i(c, optarg, &print_level, if (get_arg_val_i(c, optarg, &print_level,
PRINT_LEVEL_MIN, PRINT_LEVEL_MAX)) PRINT_LEVEL_MIN, PRINT_LEVEL_MAX))