joyent/libuv — pull request #590 by hnakamur (2012-10-15 22:58:35+00:00)
Title: Implement uv_set_process_title on darwin. Just copied linux implementati...

...on and add 'extern char **environ'.

I found a library named libnostd impelemnts setproctitle on darwin.
http://www.25thandclement.com/~william/projects/libnostd.html
Its implemetaion is almost same between linux and darwin, so I copied libuv linux implementation of uv_set_process_title to src/unix/darwin.c

I confirmed all tests pass on darwin with this pull request applied.

I also tried a sample program using uv_set_process_title.

libuv_set_process_title_test.c
```
#include
#include
#include

int main(int argc, char **argv) {
char buffer[256];

argv = uv_setup_args(argc, argv);

if (argc > 1)
uv_set_process_title("hello uv_set_process_title");

uv_get_process_title(buffer, sizeof(buffer));
printf("title=%s\n", buffer);

sleep(2);
return 0;
}
```

The results:
```
c -o a.out libuv_set_process_title_test.c -I $(HOME)/src/libuv/include -L $(HOME)/src/libuv -luv -framework CoreServices
bash-3.2$ ./a.out & ps auxww | grep 'hello uv_set_process_title' | grep -v grep
[1] 24982
title=./a.out
bash-3.2$
[1]+ Done ./a.out
bash-3.2$ ./a.out 1 & ps auxww | grep 'hello uv_set_process_title' | grep -v grep
[1] 24986
title=hello uv_set_process_title
hnakamur 24986 0.0 0.0 2433000 1148 s006 R 7:55AM 0:00.01 hello uv_set_process_title
```