Back at the Eagle's Nest, in late 1993, the decision was made to switch its host machine (a 1990 vintage 25 MHz Cheetah Gold 486 PC) from ESIX to Linux, because Linux simply had more to offer. So, I was called upon to do another port. This was the kick in the pants I needed to finally buy a new hard disk and put a real operating system on my own PC. Armed with the 0.99.12 kernel and SLS 1.03 distribution, I tackled the task before me, and found it to be quite easy to go from my System V Release 4 ported code to Linux. Here is a list of the issues I ran up against, which should make an initial “gotcha” list for anyone porting a network application to Linux. You'll notice many of the same things mentioned in Michael K. Johnson's excellent “Porting To Linux” article in Linux Journal, Vol. 1 Edition 1.
Signal handling. BSD, and SVR4 via the signal(2) call, have restartable signals. In Linux you must explicitly ask for BSD signal handling or use the somewhat different sigaction interface. [Editor's Note: See the last section of Linux Programming Hints on page 33.] For me, it was just easier to change the code to assume signal handlers need to be reset.
select(2) and the timeout parameter. Like so many apps, EBBS assumed that select(2) leaves the contents of the timeval struct alone. You've got to reset the timeout if you're calling select in a loop.
the FD_SET macro and its kin live in <sys/time.h>. Not that this should bog down anyone's porting, but it's worth mentioning since most Unixes put these macros in <sys/types.h> or <sys/select.h>.
Terminal I/O. A lot of BSD source relies on gtty(2) and stty(2) and obscure ioctl flags. When I realized they weren't in the base C library, I changed it all over to termio. Probably a good idea anyway, even if I did have to put the BSD source from PBBS back for the NeXT port.
The Eagle's Nest went online with Linux in October 1993 and we've been faithfully keeping step with the latest revisions ever since. Compared to our experience running on ESIX, Linux has been both good and bad.
The good: the ext2 filesystem and kernel proper. Some BBS operations requiring lots of file access, notably the scan for new messages and the “visit” function (to mark all messages as read) were excruciatingly slow under ESIX, but lightning fast under Linux - with the exact same hardware, of course. A new message scan that might take ten seconds before will get done in one or two now. All the buffering Linux does really made a difference for us.
The bad: the TCP/IP networking. The Eagle's Nest sometimes gets a couple of hundred logins a day, and it shares bandwidth with anonymous ftp service and a WWW server. Hence, the kernel gets battered pretty badly network-wise. Through the releases from 0.99 pl13 to the present 1.1.8, we've seen lots of strange things like dying inetds, frequent reboots to revive the network, and connections hanging both on connect and close. Luckily, it keeps getting better, and as of 1.1.8 the only annoying problem left is occasional hanging at connect time, and only when it has to deal with long delays or lost packets. Unfortunately such conditions are not at all uncommon on Internet.
That aside, we at the Eagle's Nest are pretty happy with Linux, and I now use it almost exclusively myself. I have another operating system on my disk, but it's just a faint memory. Its name starts with D I think. Doom! Yeah, that's it!
As I mentioned already, no port of EBBS has generated anywhere close to the interest the Linux port has received. The worldwide scope of Linux is especially evident. Interest in EBBS for Linux has sprouted on every continent except Antarctica, all with very little promotion on my part! See sidebar for a partial list of Linux EBBS systems available on Internet.
Not too long after the Linux port was done, I decided that the current code was getting too messy for any more nontrivial additions or enhancements. Here are a few of the things holding advancement of the present incarnation of EBBS back:
The chroot. It's a security feature but also a portability nightmare. Every flavor of Unix requires a different set of system files under ~bbs to allow the system to work, and indeed some haven't been figured out yet. It also makes the install script a big mess. Consider shared libraries. On some systems they're in /lib, some in /usr/lib, some in /usr/shlib. On some systems all you need is libc.so.*, on others (like Solaris) you need a half dozen or more shared libraries. It's a huge mess. In the latest version (2.2) I have added a compile time option to turn off the chroot if desired. To get rid of it safely would be even better.
Because of the chroot, it's nearly impossible to add hooks to the outside system into the BBS. Many BBS operators have expressed the need for two-way Internet mail and Usenet, and with the chroot this is impractical if not impossible to do with EBBS. A few hooks outside the BBS proper have been successfully done, for example the outgoing mail/post forwarding, and IRC, 4m, and Gopher clients.
Keeping track of read posts, and the .DIR files. The Pirates BBS way of keeping track of which user has read which post involves each post having a record in a .DIR file associated with each board. These records have things like the owner and title of the post, and one byte for each possible account on the system. When the user reads the post, their byte in the post's record in the .DIR is marked as such. The race conditions involved with simultaneous updates of these files are rampant and tricky to guard against. Also, since each .DIR record must be a known size, the numbers of BBS accounts is fixed at compile time, not a desirable feature.
So last November, I embarked on a complete rewrite, with the goal of keeping all or most of the existing EBBS features but a completely new foundation. Five months later I'm almost done with the first cut. The fact that this is a spare-time venture, plus a couple of rewrites from scratch when I got frustrated, have made it slow going.
The development of the new version is being done 100% on Linux, and I'm making a point to stay as POSIX-compliant as possible so ports can be done without too much hassle. These are some of the features under development:
No more chroot. See above. I am going to get rid of the Shell Escape menu function for this reason, as it's risky, and disallow the system(3) C library call anywhere in my code, since it spawns a shell as well. In short, I'm trying to make it impossible to break out.
Run time configuration, to allow binary distribution (the Linux way!). Right now, all EBBS optional features and access permissions must be configured at compile time. A set of initialization files that the BBS reads at run time will be a major improvement. In particular I am trying to make configurable anything that may vary between distributions, such as the mail program to use for forwarding. In addition, I plan to make all files used by the BBS ASCII rather than binary, so they may be easily patched with an editor if something goes awry. This includes the passwds file and boards file.
No more .DIR files. I will be storing the bits showing which posts/mail a user has read in a per-user config file, eliminating the need for the .DIR files. And, it eliminates the restriction on the number of accounts.
Separation of the user interface and BBS core, only interacting via a carefully defined API set. This will allow anyone who wants to build their own user interface, for example an X-Windows GUI, to do so easily, with only knowledge of the APIs for accessing the BBS core functions. I plan to write a network API set which will allow clients to connect to remote BBS servers via a yet-undefined TCP/IP-based protocol. This way, things like menu movements and editing may be done on the client, with none of the lag that has become all too common on the increasingly crowded “information highway”.
And a few more features which aren't present now: group mailing, replies by mail to post authors, per-board managers, added chat features like private rooms, and more.
At the time of this writing, this rewrite is very nearly ready for initial testing, with only a few features yet to be added. If all goes well, something will be publicly available by the time you read this. I'm tentatively calling it Eagles BBS 3.0 and plan to distribute under the GNU copyleft or something similar; everything is subject to change at this point of course.
I hope this work culminates in a useful addition to the already-impressive array of software for Linux. The demand for Linux bulletin board software is there, it seems. It's been an enlightening and educational experience for me, however time consuming. The development environment offered by gcc, gdb, and the myriad of other tools is as good as any, I think. At first the documentation left a bit to be desired but that has improved markedly. I'd like to encourage other programmers to do the same with their favorite spare-time projects-the Linux community is very responsive and helpful with everything from suggestions to development to distribution. I'm proud to be involved with it.
Ray Rocker (email@example.com) (firstname.lastname@example.org) currently lives in Huntsville, Alabama, USA, where he is employed as a software analyst. On those rare occasions when he isn't in front of an SVGA monitor, he enjoys good beer, weightlifting, jogging, college football and basketball, and can usually be found on the amateur radio bands during contest weekends as WQ5L.
- High-Availability Storage with HA-LVM
- March 2015 Issue of Linux Journal: System Administration
- DNSMasq, the Pint-Sized Super Dæmon!
- Localhost DNS Cache
- Real-Time Rogue Wireless Access Point Detection with the Raspberry Pi
- Days Between Dates: the Counting
- The Usability of GNOME
- PostgreSQL, the NoSQL Database
- Linux for Astronomers
- Multitenant Sites