On TV product, kdbus connecting was failed because saved size of command
line in kernel and actual size were different. So we need to increase
buffer size of command line when zygote process is executed by execvp().
This patch appends dummy argument once calling execvp().
Reference:
- https://review.tizen.org/gerrit/#/c/291592/
Change-Id: I9da3f12b2a464c2598012541f720fa0ff15a043b
Signed-off-by: jie <jie137.zhang@samsung.com>
(cherry picked from commit
d33bf9d2b81e6040f60f7789c40fa41cdc660531)
+#if BUILDFLAG(IS_TIZEN_TV)
+static const size_t kDummyArgLength = 2048;
+#endif
+
// Get the process's "environment" (i.e. the thing that setenv/getenv
// work with).
char** GetEnvironment() {
// Get the process's "environment" (i.e. the thing that setenv/getenv
// work with).
char** GetEnvironment() {
fd_shuffle2.reserve(options.fds_to_remap.size());
std::vector<char*> argv_cstr;
fd_shuffle2.reserve(options.fds_to_remap.size());
std::vector<char*> argv_cstr;
+#if BUILDFLAG(IS_TIZEN_TV)
+ argv_cstr.reserve(argv.size() + 2);
+#else
argv_cstr.reserve(argv.size() + 1);
argv_cstr.reserve(argv.size() + 1);
for (const auto& arg : argv)
argv_cstr.push_back(const_cast<char*>(arg.c_str()));
for (const auto& arg : argv)
argv_cstr.push_back(const_cast<char*>(arg.c_str()));
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Append dummy argument in order to increase buffer size of command line
+ // for forked process from launched process.
+ char dummy_arg[kDummyArgLength];
+ memset(dummy_arg, ' ', kDummyArgLength);
+ dummy_arg[kDummyArgLength - 1] = '\0';
+ argv_cstr.push_back(dummy_arg);
argv_cstr.push_back(nullptr);
argv_cstr.push_back(nullptr);
+#else
+ argv_cstr.push_back(nullptr);
+#endif
std::unique_ptr<char* []> new_environ;
char* const empty_environ = nullptr;
std::unique_ptr<char* []> new_environ;
char* const empty_environ = nullptr;