ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/fdlist.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/fdlist.c (file contents):
Revision 4479 by michael, Thu Aug 14 16:18:31 2014 UTC vs.
Revision 6553 by michael, Sat Oct 3 16:56:22 2015 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2014 ircd-hybrid development team
4 > *  Copyright (c) 1997-2015 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 44 | Line 44 | int number_fd = LEAKED_FDS;
44   int hard_fdlimit = 0;
45  
46  
47 < static int
48 < set_fdlimit(void)
47 > void
48 > fdlist_init(void)
49   {
50    int fdmax;
51    struct rlimit limit;
# Line 65 | Line 65 | set_fdlimit(void)
65    /* under no condition shall this raise over 65536
66     * for example user ip heap is sized 2*hard_fdlimit */
67    hard_fdlimit = IRCD_MIN(fdmax, 65536);
68
69  return -1;
70 }
71
72 void
73 fdlist_init(void)
74 {
75  set_fdlimit();
68   }
69  
70   static inline unsigned int
# Line 101 | Line 93 | void
93   fd_open(fde_t *F, int fd, int is_socket, const char *desc)
94   {
95    unsigned int hashv = hash_fd(fd);
96 +
97    assert(fd >= 0);
98 +  assert(!F->flags.open);
99  
100    F->fd = fd;
101    F->comm_index = -1;
# Line 125 | Line 119 | fd_close(fde_t *F)
119   {
120    unsigned int hashv = hash_fd(F->fd);
121  
122 +  assert(F->flags.open);
123 +
124    if (F == fd_next_in_loop)
125      fd_next_in_loop = F->hnext;
126  
# Line 165 | Line 161 | fd_dump(struct Client *source_p, int par
161   {
162    for (unsigned int i = 0; i < FD_HASH_SIZE; ++i)
163      for (fde_t *F = fd_hash[i]; F; F = F->hnext)
164 <      sendto_one_numeric(source_p, &me, RPL_STATSDEBUG|SND_EXPLICIT,
164 >      sendto_one_numeric(source_p, &me, RPL_STATSDEBUG | SND_EXPLICIT,
165                           "F :fd %-5d desc '%s'", F->fd, F->desc);
166   }
167  
# Line 201 | Line 197 | close_standard_fds(void)
197      close(i);
198  
199      if (open("/dev/null", O_RDWR) < 0)
200 <      exit(-1); /* we're hosed if we can't even open /dev/null */
200 >      exit(EXIT_FAILURE); /* we're hosed if we can't even open /dev/null */
201    }
202   }
203  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)