Previously I wrote something like this: > I've been having a problem related to epoll_ctl() lately. > I have a 3-tier system: > > 1. back tier (tcp server) > 2. middle tier (udp server) > 3. front tier > > The problem is happening in the back tier. > If I kill the middle tier with a control-C and then restart it > (before making any requests via the front tier), the socket > descriptor (associated with the middle tier) in the back tier > is 7. But If I first make some requests via the front tier, > then kill the middle tier and restart it, the socket descriptor > is 1. > > When the socket descriptor is 1, I get an EBADF on > an epoll_ctl with an op of EPOLL_CTL_MOD. > It's not on the first call to epoll_ctl that it fails, but the third > call. My debugging shows that the epfd and fd are the same > for all three of these calls. > > I've tried many things to get the back tier to not give me > the socket descriptor of 1. I've tried calling daemon(), > freopen'ing stdin, stdout, and stderr, and a few other > things. I've tried doing these things only in the parent, > only in the child and in both. Nothing has worked. > Any ideas? > > This problem makes me think more about BSD. Even if > I figure this out, I'm still left with epoll. If you could have > any operating system for running an on line service, what > would you pick? Thanks. I ported my back tier to BSD now and the problem I described above has vanished. Also the back tier is significantly smaller than it was under Linux. After 15 years of using Linux, I was reluctant to take this step and even thought about trying a distro based on 3.15 (I was having the problem on 3.13). So far I'm happy with BSD. Its kqueue api is quite a bit better than Linux' epoll api. One difference in working with BSD is that I have to use ::1 in order to tell the middle tier that the back tier is running on the same machine. On Linux I have to use 127.0.0.1. Are there any conditional compilation macros for BSD so I could write #ifdef platform_name connect_wrapper("::1",56789); #else connect_wrapper("127.0.0.1",56789); #endif ? Is the ip command available on BSD? I've heard it's better than ifconfig, but I've only found ifconfig on BSD. I've installed PCBSD successfully on two machines, but I'm having trouble installing it on a third machine. My boot menu lists my flash drive under both UEFI and Legacy Boot Sources. I've tried both. When I try UEFI. it comes back with: Welcome to GRUB! error: disk `' not found. Entering rescue mode... grub rescue> When I try the legacy one it tries to get a dhcp lease. That seems to time out and then it starts booting up Linux from the hard drive. IIrc, in the past I've had to use the legacy option, but now acts like one of the other options and not like what it says it is. Any ideas on this? Thanks. -- Brian Ebenezer Enterprises - In G-d we trust. http://webEbenezer.net -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20140721/dec20065/attachment.html>