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-8/src/fdlist.c (file contents), Revision 1312 by michael, Mon Mar 26 16:07:20 2012 UTC vs.
ircd-hybrid/trunk/src/fdlist.c (file contents), Revision 1736 by michael, Sun Jan 13 09:31:46 2013 UTC

# Line 40 | Line 40 | fde_t *fd_hash[FD_HASH_SIZE];
40   fde_t *fd_next_in_loop = NULL;
41   int number_fd = LEAKED_FDS;
42   int hard_fdlimit = 0;
43 struct Callback *fdlimit_cb = NULL;
43  
45 static void *
46 changing_fdlimit(va_list args)
47 {
48  int old_fdlimit = hard_fdlimit;
49
50  hard_fdlimit = va_arg(args, int);
51
52  if (ServerInfo.max_clients > MAXCLIENTS_MAX)
53  {
54    if (old_fdlimit != 0)
55      sendto_realops_flags(UMODE_ALL, L_ALL,
56        "HARD_FDLIMIT changed to %d, adjusting MAXCLIENTS to %d",
57        hard_fdlimit, MAXCLIENTS_MAX);
58
59    ServerInfo.max_clients = MAXCLIENTS_MAX;
60  }
61
62  return NULL;
63 }
64
65 void
66 fdlist_init(void)
67 {
68  memset(&fd_hash, 0, sizeof(fd_hash));
44  
45 <  fdlimit_cb = register_callback("changing_fdlimit", changing_fdlimit);
46 <  eventAddIsh("recalc_fdlimit", recalc_fdlimit, NULL, 58);
72 <  recalc_fdlimit(NULL);
73 < }
74 <
75 < void
76 < recalc_fdlimit(void *unused)
45 > static int
46 > set_fdlimit(void)
47   {
48    int fdmax;
49    struct rlimit limit;
# Line 92 | Line 62 | recalc_fdlimit(void *unused)
62  
63    /* under no condition shall this raise over 65536
64     * for example user ip heap is sized 2*hard_fdlimit */
65 <  fdmax = IRCD_MIN(fdmax, 65536);
65 >  hard_fdlimit = IRCD_MIN(fdmax, 65536);
66  
67 <  if (fdmax != hard_fdlimit)
68 <    execute_callback(fdlimit_cb, fdmax);
67 >  return -1;
68 > }
69 >
70 > void
71 > fdlist_init(void)
72 > {
73 >  set_fdlimit();
74   }
75  
76   static inline unsigned int
# Line 225 | Line 200 | close_standard_fds(void)
200    for (i = 0; i < LOWEST_SAFE_FD; i++)
201    {
202      close(i);
203 <    if (open(PATH_DEVNULL, O_RDWR) < 0)
203 >    if (open("/dev/null", O_RDWR) < 0)
204        exit(-1); /* we're hosed if we can't even open /dev/null */
205    }
206   }

Diff Legend

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