- fprintf(stderr, "option %s", optname);
- if (arg) {
- fprintf(stderr, " with arg %s\n", arg);
+ if (!strcmp(optname, "fd-cap")) {
+ unsigned long v;
+
+ errno = 0;
+ v = strtoul(arg, NULL, 0);
+ if (errno != 0 || !isdigit(arg[0])) {
+ ERR("Wrong value in --fd-cap parameter: %s", arg);
+ ret = -1;
+ goto end;
+ }
+ if (v < DEFAULT_RELAYD_MINIMAL_FD_CAP) {
+ ERR("File descriptor cap must be set to at least %d",
+ DEFAULT_RELAYD_MINIMAL_FD_CAP);
+ }
+ if (v >= UINT_MAX) {
+ ERR("File descriptor cap overflow in --fd-cap parameter: %s", arg);
+ ret = -1;
+ goto end;
+ }
+ lttng_opt_fd_cap = (unsigned int) v;
+ DBG3("File descriptor cap set to %u", lttng_opt_fd_cap);
+
+ } else {
+ fprintf(stderr, "unknown option %s", optname);
+ if (arg) {
+ fprintf(stderr, " with arg %s\n", arg);
+ }