Commit 9f237eac authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

env_dpdk: save and restore optind in spdk_env_init



DPDK's use of getopt() needs special handling of the optind global
variable since we are passing it a separate array of arguments (not the
typical argv and argc).  Set optind to 1 internally to env_dpdk so that
the apps don't need to know about it, and restore optind in case the
calling app is also using getopt().

Change-Id: Icbf07002c99fa9f94c866e8eff707124b0ef679b
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365062


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 1f5bbe02
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -175,8 +175,6 @@ main(int argc, char **argv)
		sleep(10);
	}

	optind = 1; /* reset the optind */

	opts.shutdown_cb = spdk_iscsi_shutdown;
	opts.usr1_handler = spdk_sigusr1;
	spdk_app_init(&opts);
+1 −1
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ parse_args(int argc, char **argv)
		usage(argv[0]);
		return 1;
	}
	optind = 1;

	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ parse_args(int argc, char **argv)
		usage(argv[0]);
		return 1;
	}
	optind = 1;

	return 0;
}

+0 −1
Original line number Diff line number Diff line
@@ -409,7 +409,6 @@ parse_args(int argc, char **argv)
		return 1;
	}

	optind = 1;
	return 0;
}

+0 −2
Original line number Diff line number Diff line
@@ -960,8 +960,6 @@ parse_args(int argc, char **argv)
		}
	}

	optind = 1;

	return 0;
}

Loading