From f9484cf5152ce89bba3d52aea661e6f1fff27e54 Mon Sep 17 00:00:00 2001 From: John Barboza Date: Mon, 23 Jan 2017 11:02:23 -0500 Subject: [PATCH] zos: use built-in proctitle implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use built-in proctitle implementation because there is no such thing as a process title on zOS. PR-URL: https://github.com/libuv/libuv/pull/1208 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé --- src/unix/os390.c | 18 ++---------------- src/unix/proctitle.c | 6 ++++++ test/test-process-title.c | 2 +- uv.gyp | 2 +- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/unix/os390.c b/src/unix/os390.c index d3a9abfa6..be325a923 100644 --- a/src/unix/os390.c +++ b/src/unix/os390.c @@ -860,20 +860,6 @@ update_timeout: } } -char** uv_setup_args(int argc, char** argv) { - return argv; -} - - -int uv_set_process_title(const char* title) { - return ENOSYS; -} - - -int uv_get_process_title(char* buffer, size_t size) { - if (buffer == NULL || size == 0) - return -EINVAL; - - buffer[0] = '\0'; - return ENOSYS; +void uv__set_process_title(const char* title) { + /* do nothing */ } diff --git a/src/unix/proctitle.c b/src/unix/proctitle.c index 08d875f7a..9160f7eaf 100644 --- a/src/unix/proctitle.c +++ b/src/unix/proctitle.c @@ -48,9 +48,15 @@ char** uv_setup_args(int argc, char** argv) { for (i = 0; i < argc; i++) size += strlen(argv[i]) + 1; +#if defined(__MVS__) + /* argv is not adjacent. So just use argv[0] */ + process_title.str = argv[0]; + process_title.len = strlen(argv[0]); +#else process_title.str = argv[0]; process_title.len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[0]; assert(process_title.len + 1 == size); /* argv memory should be adjacent. */ +#endif /* Add space for the argv pointers. */ size += (argc + 1) * sizeof(char*); diff --git a/test/test-process-title.c b/test/test-process-title.c index 96fe719b5..5d5ede9d6 100644 --- a/test/test-process-title.c +++ b/test/test-process-title.c @@ -60,7 +60,7 @@ static void uv_get_process_title_edge_cases() { TEST_IMPL(process_title) { -#if defined(__sun) || defined(__MVS__) +#if defined(__sun) RETURN_SKIP("uv_(get|set)_process_title is not implemented."); #else /* Check for format string vulnerabilities. */ diff --git a/uv.gyp b/uv.gyp index 3e9063ecd..60fd5c126 100644 --- a/uv.gyp +++ b/uv.gyp @@ -198,7 +198,7 @@ }], ], }], - [ 'OS in "linux mac ios android"', { + [ 'OS in "linux mac ios android os390"', { 'sources': [ 'src/unix/proctitle.c' ], }], [ 'OS != "os390"', {