Re: implementation of daemon process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Preetham" == Preetham D Naik <pdn@sasken.com> writes:
Preetham> i know that but what i wanted is to know how the daemon process is
Preetham> internally implemented. I wanted its source code.I know how to make a
Preetham> process a daemon.

Here's the source of the simplest portable daemon I can think of.

#include <unistd.h>

int
main ()
{
  switch (fork ())
    {
    default:
      return 0;

    case -1:
      return -1;
      
    case 0:
      setsid ();
      pause ();
      return 0;
    }
}

>> > PLEASE VISIT US AT [snip]

No, we'll not visit you.

>> > SASKEN BUSINESS DISCLAIMER
[snip]

  Please, remove the obnoxious gratuitous disclaimer messages when
posting to public mailing lists.

  Responders, please, do not quote the aforementioned bogosity.

~velco

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux