1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "mozilla/ipc/SetProcessTitle.h"
12 # include "base/set_process_title_linux.h"
13 # define HAVE_SETPROCTITLE
14 # define HAVE_SETPROCTITLE_INIT
16 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
17 defined(__DragonFly__)
19 # include <sys/types.h>
21 # define HAVE_SETPROCTITLE
27 void SetProcessTitle(const std::vector
<std::string
>& aNewArgv
) {
28 #ifdef HAVE_SETPROCTITLE
29 nsAutoCStringN
<1024> buf
;
32 for (const std::string
& arg
: aNewArgv
) {
38 buf
.Append(arg
.c_str());
41 setproctitle("-%s", buf
.get());
45 void SetProcessTitleInit(char** aOrigArgv
) {
46 #ifdef HAVE_SETPROCTITLE_INIT
47 setproctitle_init(aOrigArgv
);
51 } // namespace mozilla