summaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/aix.c
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2018-01-19 15:33:43 -0500
committercjihrig <cjihrig@gmail.com>2018-01-23 20:34:39 -0500
commita083786c7733b5828102661a04a86884c934950a (patch)
treea45536a61b50e7b5fa68a77d6f594de730c4a346 /deps/uv/src/unix/aix.c
parent63f78f5ddc8ac50ea19839827682c51ff3363ac2 (diff)
downloadandroid-node-v8-a083786c7733b5828102661a04a86884c934950a.tar.gz
android-node-v8-a083786c7733b5828102661a04a86884c934950a.tar.bz2
android-node-v8-a083786c7733b5828102661a04a86884c934950a.zip
deps: upgrade libuv to 1.19.1
PR-URL: https://github.com/nodejs/node/pull/18260 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uv/src/unix/aix.c')
-rw-r--r--deps/uv/src/unix/aix.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/deps/uv/src/unix/aix.c b/deps/uv/src/unix/aix.c
index 06f19a4fc9..fd413090fe 100644
--- a/deps/uv/src/unix/aix.c
+++ b/deps/uv/src/unix/aix.c
@@ -65,11 +65,18 @@
#define RDWR_BUF_SIZE 4096
#define EQ(a,b) (strcmp(a,b) == 0)
+static uv_mutex_t process_title_mutex;
+static uv_once_t process_title_mutex_once = UV_ONCE_INIT;
static void* args_mem = NULL;
static char** process_argv = NULL;
static int process_argc = 0;
static char* process_title_ptr = NULL;
+static void init_process_title_mutex_once(void) {
+ uv_mutex_init(&process_title_mutex);
+}
+
+
int uv__platform_loop_init(uv_loop_t* loop) {
loop->fs_fd = -1;
@@ -856,6 +863,9 @@ int uv_set_process_title(const char* title) {
if (new_title == NULL)
return -ENOMEM;
+ uv_once(&process_title_mutex_once, init_process_title_mutex_once);
+ uv_mutex_lock(&process_title_mutex);
+
/* If this is the first time this is set,
* don't free and set argv[1] to NULL.
*/
@@ -868,6 +878,8 @@ int uv_set_process_title(const char* title) {
if (process_argc > 1)
process_argv[1] = NULL;
+ uv_mutex_unlock(&process_title_mutex);
+
return 0;
}
@@ -880,8 +892,13 @@ int uv_get_process_title(char* buffer, size_t size) {
else if (size <= len)
return -ENOBUFS;
+ uv_once(&process_title_mutex_once, init_process_title_mutex_once);
+ uv_mutex_lock(&process_title_mutex);
+
memcpy(buffer, process_argv[0], len + 1);
+ uv_mutex_unlock(&process_title_mutex);
+
return 0;
}