Gentoo Archives: gentoo-user-de

From: Daniel Frickemeier <Daniel@×××××××.de>
To: gentoo-user-de@l.g.o
Subject: Re: [gentoo-user-de] C programm als daemon laufen lassen.
Date: Fri, 06 Aug 2004 07:35:13
Message-Id: 200408060934.32079.Daniel@zigulle.de
In Reply to: [gentoo-user-de] C programm als daemon laufen lassen. by Christian
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Hi Christian,
5
6 Es gibt ne c-Funktion dafür, man daemon hilft dir weiter:
7
8 NAME
9 daemon - run in the background
10
11 SYNOPSIS
12 #include <unistd.h>
13
14 int daemon(int nochdir, int noclose);
15
16 DESCRIPTION
17 The daemon() function is for programs wishing to detach themselves
18 from the controlling terminal and run in the back-
19 ground as system daemons.
20
21 Unless the argument nochdir is non-zero, daemon() changes the current
22 working directory to the root ("/").
23
24 Unless the argument noclose is non-zero, daemon() will redirect
25 standard input, standard output and standard error to
26 /dev/null.
27
28 RETURN VALUE
29 (This function forks, and if the fork() succeeds, the parent does
30 _exit(0), so that further errors are seen by the child
31 only.) On success zero will be returned. If an error occurs, daemon()
32 returns -1 and sets the global variable errno to
33 any of the errors specified for the library functions fork(2) and
34 setsid(2).
35
36 SEE ALSO
37 fork(2), setsid(2)
38
39
40 Und fürs loggen gibts den syslog. man syslog ist dein Freund!!!
41
42 cu Daniel
43
44 - --
45 "Ich finde es unverantwortlich, daß Sie hier eine Position einnehmen, die ich
46 für unverantwortlich halte."
47 Edmund Stoiber zu Gerhard Schröder
48 -----BEGIN PGP SIGNATURE-----
49 Version: GnuPG v1.2.4 (GNU/Linux)
50
51 iD8DBQFBEzSGO4VpKoZkgJoRAsNVAJ9eWhbkNSMgnQucIaCIydEQaJV5IACfUyHP
52 ezIe/846bxexvMHs9enxztQ=
53 =96o2
54 -----END PGP SIGNATURE-----
55
56
57 --
58 gentoo-user-de@g.o mailing list

Replies

Subject Author
[gentoo-user-de] visas oder anderes server administrations interface auf gentoo? Christian Ruppert <Spooky@×××××××××.org>