Deleted Added
sdiff udiff text old ( 265509 ) new ( 265511 )
full compact
1/*-
2 * Copyright (c) 2012 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Edward Tomasz Napierala under sponsorship
6 * from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/10/usr.sbin/ctld/ctld.c 265511 2014-05-07 07:35:21Z trasz $
30 */
31
32#include <sys/types.h>
33#include <sys/time.h>
34#include <sys/socket.h>
35#include <sys/wait.h>
36#include <netinet/in.h>
37#include <assert.h>

--- 1166 unchanged lines hidden (view full) ---

1204 if (errno == EEXIST)
1205 log_errx(1, "daemon already running, pid: %jd.",
1206 (intmax_t)otherpid);
1207 log_err(1, "cannot open or create pidfile \"%s\"",
1208 newconf->conf_pidfile_path);
1209 }
1210 }
1211
1212 if (oldconf->conf_kernel_port_on != newconf->conf_kernel_port_on) {
1213 if (newconf->conf_kernel_port_on == true) {
1214 log_debugx("enabling CTL iSCSI port");
1215 error = kernel_port_on();
1216 if (error != 0)
1217 log_errx(1, "failed to enable CTL iSCSI port, exiting");
1218 } else {
1219 error = kernel_port_off();
1220 if (error != 0)
1221 log_warnx("failed to disable CTL iSCSI port");
1222 }
1223 }
1224
1225 TAILQ_FOREACH_SAFE(oldtarg, &oldconf->conf_targets, t_next, tmptarg) {
1226 /*
1227 * First, remove any targets present in the old configuration
1228 * and missing in the new one.
1229 */
1230 newtarg = target_find(newconf, oldtarg->t_name);
1231 if (newtarg == NULL) {
1232 TAILQ_FOREACH_SAFE(oldlun, &oldtarg->t_luns, l_next,

--- 612 unchanged lines hidden (view full) ---

1845 newconf = conf_new_from_file(config_path);
1846 if (newconf == NULL)
1847 log_errx(1, "configuration error, exiting");
1848 if (debug > 0) {
1849 oldconf->conf_debug = debug;
1850 newconf->conf_debug = debug;
1851 }
1852
1853 error = conf_apply(oldconf, newconf);
1854 if (error != 0)
1855 log_errx(1, "failed to apply configuration, exiting");
1856 conf_delete(oldconf);
1857 oldconf = NULL;
1858
1859 register_signals();
1860

--- 28 unchanged lines hidden (view full) ---

1889 oldconf = NULL;
1890 }
1891 } else if (sigterm_received) {
1892 log_debugx("exiting on signal; "
1893 "reloading empty configuration");
1894
1895 log_debugx("disabling CTL iSCSI port "
1896 "and terminating all connections");
1897
1898 oldconf = newconf;
1899 newconf = conf_new();
1900 if (debug > 0)
1901 newconf->conf_debug = debug;
1902 error = conf_apply(oldconf, newconf);
1903 if (error != 0)
1904 log_warnx("failed to apply configuration");
1905
1906 log_warnx("exiting on signal");
1907 exit(0);
1908 } else {
1909 nchildren -= wait_for_children(false);
1910 assert(nchildren >= 0);
1911 }
1912 }
1913 /* NOTREACHED */
1914}