Daemon Daemon function

Source: Internet
Author: User
#include <unistd.h>

int daemon (int nochdir,int noclose)

When creating sprite processes, it is often necessary to modify the working directory of the sprite process to the "/" root directory
and redirect the standard input, output, and error output to/dev/null

The daemon function is to modify the root directory to the working directory when the parameter nochdir is 0 o'clock.
Noclose for 0 o'clock, do input, output and error output redirect to/dev/null

Execution successful return 0
Error returned-1

/dev/null is a character device, always filled with dissatisfaction, there will be no data generated. is a black hole.

Daemon Daemon function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.