Plugin Writing Guide


Introduction

In order to make ESM the easiest possible program to use I'd like all plugin writers to please follow these conventions when writing your plugins.

Install Directory

All plugins should be install in esmdir/plugins esmdir should default to /usr/local/esm and should be user changable in the Makefile.

Signals

Please honor SIGHUP! And please cleanup after yourself. This includes stopping all proccesses created and deleteing all temp files. esmd can't do this for you. But you can. :)

Security

For security reasons all temp files should be created with the permissions 600.

Stdin & Stdout

Any plugin should work perfect when both stdin and stdout are FIFOs. To test for this make two FIFO's with mkfifo. Then redirect stdin and stdout to the FIFOs. For instance someplugin < stdin_fifo > stdout_fifo You may need to do some fflush(NULL)'s in a C program to make things work right.

Code Defensivly!

ESM is designed to warn you if anything goes wrong. But if your plugins fail in the face of errors what's the use?

You should write your plugins to that if anything isn't right, such as a failure to create a temp file, the user is warned. One good example would be the included ESMSysLog dmonitor. In older versions if it couldn't open the FIFO's it used to communicate with syslogd it would just ignore the error and continue. In this version it will loudly complain.

To be continued... :)

Index


© 1999, 2000 Peter Todd
Last update - $Id: plugin.html,v 5.2 2000/05/02 00:38:44 pete Exp $