ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/src/restart.c
Revision: 97
Committed: Sun Oct 9 08:42:57 2005 UTC (20 years, 10 months ago) by michael
Content type: text/x-csrc
File size: 2084 byte(s)
Log Message:
- Got rid of restart(), cleaned up m_restart() and make it use server_die()

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * restart.c: Functions to allow the ircd to restart.
4     *
5     * Copyright (C) 2002 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #include "stdinc.h"
26     #include "restart.h"
27     #include "common.h"
28     #include "ircd.h"
29     #include "send.h"
30     #include "client.h" /* for UMODE_ALL */
31    
32    
33     void
34     server_die(const char *mesg, int rboot)
35     {
36     char buffer[IRCD_BUFSIZE];
37     dlink_node *ptr = NULL;
38     struct Client *target_p = NULL;
39 michael 97 static int was_here = 0;
40 adx 30
41 michael 97 if (rboot && was_here++)
42     abort();
43    
44 adx 30 if (EmptyString(mesg))
45     snprintf(buffer, sizeof(buffer), "Server %s",
46     rboot ? "Restarting" : "Terminating");
47     else
48     snprintf(buffer, sizeof(buffer), "Server %s: %s",
49     rboot ? "Restarting" : "Terminating", mesg);
50    
51     DLINK_FOREACH(ptr, local_client_list.head)
52     {
53     target_p = ptr->data;
54    
55     sendto_one(target_p, ":%s NOTICE %s :%s",
56     me.name, target_p->name, buffer);
57     }
58    
59     DLINK_FOREACH(ptr, serv_list.head)
60     {
61     target_p = ptr->data;
62    
63     sendto_one(target_p, ":%s ERROR :%s", me.name, buffer);
64     }
65    
66     ilog(L_NOTICE, buffer);
67    
68     send_queued_all();
69     close_fds(NULL);
70    
71     unlink(pidFileName);
72    
73     if (rboot)
74     {
75     execv(SPATH, myargv);
76     exit(1);
77     }
78     else
79     exit(0);
80     }
81 adx 62
82     void
83     ircd_outofmemory(void)
84     {
85 michael 97 server_die("Out of memory", 1);
86 adx 62 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision