Uploaded: 03 Sep, 2006
Previous uploads by this submitter: 0

Author: Darien

Downloads: 83

First off, this snippet is directly out of my code, so just be warned that it is not compatable with stock-rom, you WILL have to modify it to make it work..

Now, have you ever been working in your mud, and wanted to check the /proc/<pid>/fd to see what all is there, but not want to log into the shell.. Then this is the thing for you.

This system allows you to check the file-descriptors opened by the mud, via use of the desc_check command.

You can also info a file-descriptor, to grab pertinant information, through the info_desc command.

And if you want to be alittle ball-sy.. You can also clean the descriptor (ie close it) through the clean_desc command.

Along with this system is a wonderful little automated clean_desc updater for your handler.

What the cleaner will do is look through your muds opened sockets. (descriptors) and any other list that holds a FD.. so your muds control opened by init_socket. internal-webserver, IMC if you have it. ANd it will leave those that you set up alone, ie, so they don't get closed.

However, if you have a hanging-socket, (something not protected, and not in the lists) It will attempt to 'close' it, and sure enough, once closed, your mud will be happier.

I say this because i've ran across afew muds that had major problem, run for a day, and have, 400 hanging file-descriptors sitting in the /proc/<pid>/fd, with this, it elminates that problem all together. Add all that with the cool info_desc command and the desc_check command, and you've got a powerful debugging tool on your hands.

Problems caused by Hanging file-descriptors:

1: In-ability to open file-data for reading/writing, most muds exit(1); when they fail
to open a file, so right there, it stops crashing.

2: hanging file-descriptors, if you get enough of them, will eat up all availability for
a new socket to connect to your mud. We want players don't we?

3: memory corruption, the worst of them all, but the hanging file-descriptors can
influence memory, and infact, lead to corruption, especialy if the mud is trying
to use a hanging-socket (and doesn't know that its hanging)

All in All, this is a 2 hour code-job, its usage is simple, its purpose is cool, and its
design is far from legendary. But this can help a mud if it has problems.

Notably, because of the neato-ness of this code, there will be future updates, bug-patches, fixes, maybe a stock-rom port, who knows, but this is a system recommended for all, even if you don't have problems, the info_desc and desc_check, can give the imp of any mud, the feeling of power :)