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-7.2/src/fdlist.c (file contents):
Revision 992 by michael, Mon Aug 17 19:19:16 2009 UTC vs.
Revision 1001 by michael, Sat Aug 29 22:44:44 2009 UTC

# Line 74 | Line 74 | fdlist_init(void)
74   void
75   recalc_fdlimit(void *unused)
76   {
77 #ifdef _WIN32
78  /* this is what WSAStartup() usually returns. Even though they say
79   * the value is for compatibility reasons and should be ignored,
80   * we actually can create even more sockets... */
81  hard_fdlimit = 32767;
82 #else
77    int fdmax;
78    struct rlimit limit;
79  
# Line 101 | Line 95 | recalc_fdlimit(void *unused)
95  
96    if (fdmax != hard_fdlimit)
97      execute_callback(fdlimit_cb, fdmax);
104 #endif
98   }
99  
100   static inline unsigned int
101   hash_fd(int fd)
102   {
110 #ifdef _WIN32
111  return ((((unsigned) fd) >> 2) % FD_HASH_SIZE);
112 #else
103    return (((unsigned) fd) % FD_HASH_SIZE);
114 #endif
104   }
105  
106   fde_t *
# Line 181 | Line 170 | fd_close(fde_t *F)
170    }
171  
172    /* Unlike squid, we're actually closing the FD here! -- adrian */
184 #ifdef _WIN32
185  if (F->flags.is_socket)
186    closesocket(F->fd);
187  else
188    CloseHandle((HANDLE)F->fd);
189 #else
173    close(F->fd);
191 #endif
174    number_fd--;
175  
176    memset(F, 0, sizeof(fde_t));
# Line 234 | Line 216 | fd_note(fde_t *F, const char *format, ..
216   /* Make sure stdio descriptors (0-2) and profiler descriptor (3)
217   * always go somewhere harmless.  Use -foreground for profiling
218   * or executing from gdb */
237 #ifndef _WIN32
219   void
220   close_standard_fds(void)
221   {
# Line 247 | Line 228 | close_standard_fds(void)
228        exit(-1); /* we're hosed if we can't even open /dev/null */
229    }
230   }
250 #endif
231  
232   void
233   close_fds(fde_t *one)
# Line 258 | Line 238 | close_fds(fde_t *one)
238    for (i = 0; i < FD_HASH_SIZE; i++)
239      for (F = fd_hash[i]; F != NULL; F = F->hnext)
240        if (F != one)
261      {
262 #ifdef _WIN32
263        if (F->flags.is_socket)
264          closesocket(F->fd);
265        else
266          CloseHandle((HANDLE)F->fd);
267 #else
241          close(F->fd);
269 #endif  
270      }
242   }

Diff Legend

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