Netriplex Patches
Merge request reports
Activity
28 28 $ knotc -c knot.conf reload 29 29 @end example 30 30 31 The tool @code{knotc} is designed as a front-end for user, making it easier 32 to do everything from server startup to state checking of a running server daemon. 31 The tool @code{knotc} is designed as a front-end for user, making it easier to control running server daemon. 317 321 cwd[0] = '\0'; 318 322 } 319 323 } 320 if (chdir("/") != 0) { 321 log_server_warning("Server can't change working directory.\n"); 324 if (!daemon_root) { I'm not sure what's required for proper daemonization, but the working directory was always '/', nothing about rundir (from conf, I assume) there. I think that '/' is the safest dir you can use and it's more convenient when writing init scrips - the original code was by @jvcelak, maybe he can elaborate a bit.
801 802 /* EBUSY on incremental transfer has a special meaning and 802 803 * is caused by a journal not able to free up space for incoming 803 804 * transfer, thus forcing to start a new full zone transfer. */ 805 806 /* Some bad incremental transfer packets seem to get further 807 * than they should. This has been seen when the master has 808 * logged the fact that it is falling back to AXFR. 809 * In this case, chs->count == 0, so we end up here with 810 * EINVAL. To work around this problem, force a new full 811 * zone transfer in this case. */ 812 804 813 if (ret == KNOT_EBUSY && rq->type == XFR_TYPE_IIN) { 805 814 return xfr_start_axfr(w, rq, diff_nospace_msg); 815 } else if (ret == KNOT_EINVAL && rq->type == XFR_TYPE_IIN) { I agree, #183 (closed)
252 252 /* Schedule EXPIRE timer on first attempt. */ 253 253 if (!zd->xfr_in.expire) { 254 254 uint32_t expire_tmr = zones_jitter(zones_soa_expire(zone)); 255 // Allow for timeouts. Otherwise zones with very short 256 // expiry may expire before the timeout is reached. 257 expire_tmr += 2 * (conf()->max_conn_idle * 1000); I think that
chdir("/")
is required during daemonization by some SysV Unix standard. I cannot find a documentation on that issue, but I think that it might introduce some side effects. Does anyone know?The core dump directory can be set both on Linux and BSD (man core): Linux:
sysctl -w kernel.core_pattern=/some/core/pattern
BSD:sysctl kern.corefile=/some/core/pattern
W. R. Stevens, S. A. Rago, Advanced Programming in the UNIX Environment, 2nd edition.
Change the current working directory to the root directory. The current working directory inherited from the parent could be on a mounted file system. Since daemons normally exist until the system is rebooted, if the daemon stays on a mounted file system, that file system cannot be unmounted. Alternatively, some daemons might change the current working directory to some specific location, where they will do all their work. For example, line printer spooling daemons often change to their spool directory.
D. Lennert, How To Write a UNIX Daemon.
Each process has a current working directory. The kernel holds this directory file open during the life of the process. If a process has a current directory on a mounted file system, the file system is "in use" and cannot be dismounted by the administrator without finding and killing this process. (The hard part is finding the process!) Unless a process explicitly alters this via chdir(2), it inherits the current directory of its parent. When launched from an interactive shell, the current directory will be whatever the user has most recently selected via the cd command. Because of this, daemons should adopt a current directory which is not located on a mounted file system (assuming that the daemon’s purpose allows this). The root file system, "/", is the most reliable choice.