On Wed, Jan 31, 2007 at 10:57:35AM -0800, Eko Prasetya wrote:
> Ini kalo di C:
> 
>        pid = fork();
>        if (pid != 0)
>        {
>            // Exit the parent.
>            exit(0);
>        }
>        else
>        {
>            // Make this guy a process group leader.
>            pid = setsid();
>            if (pid == -1)
>            {
>                printf("Error!\n");
>            }
>        }

Supaya gak jadi zombie (kita mau supaya daemon ini fully detached sama
parentnya) harusnya fork() sekali lagi. Teknik double-fork ini lumayan
umum dipakai.

    if (fork())
        exit(0);
    setsid();
    if (fork())
        exit(0);
    /* your code here */
    
Ronny

Attachment: signature.asc
Description: Digital signature

Kirim email ke