mirror of
https://github.com/fluencelabs/redis
synced 2025-06-22 05:21:33 +00:00
Set proctitle: avoid the use of __attribute__((constructor)).
This cased a segfault in some Linux system and was GCC-specific. Commit modified by @antirez: 1) Stripped away the part to set the proc title via config for now. 2) Handle initialization of setproctitle only when the replacement is used. 3) Don't require GCC now that the attribute constructor is no longer used.
This commit is contained in:
@ -2586,16 +2586,23 @@ void redisOutOfMemoryHandler(size_t allocation_size) {
|
||||
}
|
||||
|
||||
void redisSetProcTitle(char *title) {
|
||||
#ifdef USE_SETPROCTITLE
|
||||
setproctitle("%s %s:%d",
|
||||
title,
|
||||
server.bindaddr ? server.bindaddr : "*",
|
||||
server.port);
|
||||
#else
|
||||
REDIS_NOTUSED(title);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct timeval tv;
|
||||
|
||||
/* We need to initialize our libraries, and the server configuration. */
|
||||
#ifdef INIT_SETPROCTITLE_REPLACEMENT
|
||||
spt_init(argc, argv);
|
||||
#endif
|
||||
zmalloc_enable_thread_safeness();
|
||||
zmalloc_set_oom_handler(redisOutOfMemoryHandler);
|
||||
srand(time(NULL)^getpid());
|
||||
|
Reference in New Issue
Block a user