Annotation of fam/fam/IMon.h, Revision 1.1
1.1 ! trev 1: // Copyright (C) 1999 Silicon Graphics, Inc. All Rights Reserved.
! 2: //
! 3: // This program is free software; you can redistribute it and/or modify it
! 4: // under the terms of version 2 of the GNU General Public License as
! 5: // published by the Free Software Foundation.
! 6: //
! 7: // This program is distributed in the hope that it would be useful, but
! 8: // WITHOUT ANY WARRANTY; without even the implied warranty of
! 9: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any
! 10: // license provided herein, whether implied or otherwise, is limited to
! 11: // this program in accordance with the express provisions of the GNU
! 12: // General Public License. Patent licenses, if any, provided herein do not
! 13: // apply to combinations of this program with other product or programs, or
! 14: // any other product whatsoever. This program is distributed without any
! 15: // warranty that the program is delivered free of the rightful claim of any
! 16: // third person by way of infringement or the like. See the GNU General
! 17: // Public License for more details.
! 18: //
! 19: // You should have received a copy of the GNU General Public License along
! 20: // with this program; if not, write the Free Software Foundation, Inc., 59
! 21: // Temple Place - Suite 330, Boston MA 02111-1307, USA.
! 22:
! 23: #ifndef IMon_included
! 24: #define IMon_included
! 25:
! 26: #include "config.h"
! 27: #include <sys/stat.h>
! 28: #include <sys/types.h>
! 29:
! 30: #include "Boolean.h"
! 31:
! 32: struct stat;
! 33:
! 34: // IMon is an object encapsulating the interface to /dev/imon.
! 35: // There can only be one instantiation of the IMon object.
! 36: //
! 37: // The user of this object uses express() and revoke() to
! 38: // express/revoke interest in a file to imon. There is also
! 39: // a callback, the EventHandler. When an imon event comes in,
! 40: // the EventHandler is called.
! 41: //
! 42: // The user of the IMon object is the Interest class.
! 43:
! 44: class IMon {
! 45:
! 46: public:
! 47:
! 48: enum Status { OK = 0, BAD = -1 };
! 49: enum Event { EXEC, EXIT, CHANGE };
! 50:
! 51: typedef void (*EventHandler)(dev_t, ino_t, int event);
! 52:
! 53: IMon(EventHandler h);
! 54: ~IMon();
! 55:
! 56: static bool is_active();
! 57:
! 58: Status express(const char *name, struct stat *stat_return);
! 59: Status revoke(const char *name, dev_t dev, ino_t ino);
! 60:
! 61: private:
! 62:
! 63: // Class Variables
! 64:
! 65: static int imonfd;
! 66: static EventHandler ehandler;
! 67:
! 68: static void read_handler(int fd, void *closure);
! 69:
! 70:
! 71: //
! 72: // Low-level imon routines.
! 73: //
! 74: static int imon_open();
! 75: Status imon_express(const char *name, struct stat *stat_return);
! 76: Status imon_revoke(const char *name, dev_t dev, ino_t ino);
! 77:
! 78: IMon(const IMon&); // Do not copy
! 79: IMon & operator = (const IMon&); // or assign.
! 80:
! 81: };
! 82:
! 83: #endif /* !IMon_included */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>