Skip to content

Commit 6cbc619

Browse files
committed
gh-475: Fix issues in third_party/proctitle.c
* add proctitle.h; * add config-time detection of setproctitle() syscall; * fixing program_invocation_(short)?_name globals (glibc); * fixing progname (getprogname(), initialized with argv[0]); * this module now works on osx; * fix osx ps displaying garbage (argc-1 extra \0 necessary); * general refactoring; * fix linux proctitle truncation (init_set_proctitle was called with argv+1, this is wrong); * CAVEAT: 'progname: ' prefix no longer present, will fix later
1 parent 7729c69 commit 6cbc619

File tree

5 files changed

+239
-147
lines changed

5 files changed

+239
-147
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ check_struct_has_member("struct stat" "st_mtimensec" "sys/stat.h"
113113
# stack. Find whether or not it's present.
114114
check_library_exists("" __libc_stack_end "" HAVE_LIBC_STACK_END)
115115

116+
check_function_exists(setproctitle HAVE_SETPROCTITLE)
117+
check_function_exists(setprogname HAVE_SETPROGNAME)
118+
check_function_exists(getprogname HAVE_GETPROGNAME)
119+
116120
#
117121
# Enable 'make tags' target.
118122
#

src/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ main(int argc, char **argv)
592592
#ifdef HAVE_BFD
593593
symbols_load(argv[0]);
594594
#endif
595+
argv = init_set_proc_title(argc, argv);
595596
/*
596597
* Support only #!/usr/bin/tarantol but not
597598
* #!/usr/bin/tarantool -a -b because:
@@ -625,7 +626,6 @@ main(int argc, char **argv)
625626
crc32_init();
626627
memory_init();
627628

628-
argv = init_set_proc_title(argc, argv);
629629
main_argc = argc;
630630
main_argv = argv;
631631

src/trivia/config.h.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@
192192
/** pthread_set_name_np(pthread_self(), "") - *BSD */
193193
#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1
194194

195+
#cmakedefine HAVE_SETPROCTITLE 1
196+
#cmakedefine HAVE_SETPROGNAME 1
197+
#cmakedefine HAVE_GETPROGNAME 1
198+
195199
/** \cond public */
196200

197201
/** System configuration dir (e.g /etc) */

0 commit comments

Comments
 (0)