]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
deprecate --forks and map()
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 9 Jan 2020 14:53:10 +0000 (15:53 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 17 Jan 2020 14:01:44 +0000 (15:01 +0100)
- reduce visibility in docs
- add deprecation warnings (docs and stderr)

daemon/engine.c
daemon/main.c
doc/kresd.8.in
lib/utils.h

index 04cf74263b7f4dac351b62157c6b2f89f1dc5809..9fa9ac8f799755a761d8684a395b52ed4800f7bc 100644 (file)
@@ -88,7 +88,6 @@ static int l_help(lua_State *L)
                "resolve(name, type[, class, flags, callback])\n    resolve query, callback when it's finished\n"
                "todname(name)\n    convert name to wire format\n"
                "tojson(val)\n    convert value to JSON\n"
-               "map(expr)\n    run expression on all workers\n"
                "net\n    network configuration\n"
                "cache\n    network configuration\n"
                "modules\n    modules configuration\n"
@@ -387,6 +386,9 @@ static int l_fromjson(lua_State *L)
 
 static int l_map(lua_State *L)
 {
+       /* We don't kr_log_deprecate() here for now.  Plan: after --forks gets *removed*,
+        * kill internal uses of map() (e.g. from daf module) and add deprecation here.
+        * Alternatively we might (attempt to) implement map() in another way. */
        if (lua_gettop(L) != 1 || !lua_isstring(L, 1))
                lua_error_p(L, "map('string with a lua expression')");
 
index 126e54ac0bf7eab445aec5002342fd37f7a3fa09..0b62f60512ec2e06b6fdab936fef703fb4524d5c 100644 (file)
@@ -232,7 +232,6 @@ static void help(int argc, char *argv[])
               " -t, --tls=[addr]       Server address for TLS (default: off).\n"
               " -S, --fd=[fd:kind]     Listen on given fd (handed out by supervisor, :kind is optional).\n"
               " -c, --config=[path]    Config file path (relative to [rundir]) (default: config).\n"
-              " -f, --forks=N          Start N forks sharing the configuration (implies -n).\n"
               " -n, --noninteractive   Don't start the read-eval-print loop for stdin+stdout.\n"
               " -q, --quiet            No command prompt in interactive mode.\n"
               " -v, --verbose          Run in verbose mode."
@@ -379,6 +378,11 @@ static int parse_args(int argc, char **argv, struct args *args)
                        break;
                case 'f':
                        args->forks = strtol_10(optarg);
+                       if (args->forks == 1) {
+                               kr_log_deprecate("use --noninteractive instead of --forks=1\n");
+                       } else {
+                               kr_log_deprecate("support for running multiple --forks will be removed\n");
+                       }
                        if (args->forks <= 0) {
                                kr_log_error("[system] error '-f' requires a positive"
                                                " number, not '%s'\n", optarg);
index 2f0f190a4eeb854e5945a3cc950eb2ac6ea2e4a6..77b102f94a6b7b79dbc43796bdcc181f2b06088b 100644 (file)
@@ -22,8 +22,6 @@
 .IR fd ]
 .RB [ \-c | \-\-config
 .IR config ]
-.RB [ \-f | \-\-forks
-.IR N ]
 .RB [ \-n | \-\-noninteractive ]
 .RB [ \-q | \-\-quiet ]
 .RB [ \-v | \-\-verbose ]
@@ -118,6 +116,8 @@ file at the default location (\fIconfig\fR). The syntax is
 described in \fIdaemon/README.md\fR.
 .TP
 .B \-f\fI N\fR, \fB\-\-forks=\fI<N>
+This option is deprecated since 5.0.0!
+
 With this option, the daemon is started in non-interactive mode and instead creates a
 UNIX socket in \fIrundir\fR that the operator can connect to for interactive session.
 A number greater than 1 forks the daemon N times, all forks will bind to same addresses
index baec16c71baa464280980b82f33dded7bd9e4848..c1c7b8be4d9bdc88de0f421435b8e4e5b45a62b1 100644 (file)
@@ -51,6 +51,7 @@ typedef void (*trace_log_f)(const struct kr_query *query, const char *source, co
 
 #define kr_log_info printf
 #define kr_log_error(...) fprintf(stderr, ## __VA_ARGS__)
+#define kr_log_deprecate(...) fprintf(stderr, "deprecation WARNING: " __VA_ARGS__)
 
 /* Always export these, but override direct calls by macros conditionally. */
 /** Whether in --verbose mode.  Only use this for reading. */