Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Dec 1998 22:06:52 -0800 (PST)
From:      Archie Cobbs <archie@whistle.com>
To:        jkh@zippy.cdrom.com (Jordan K. Hubbard)
Cc:        eivind@yes.no, vallo@matti.ee, current@FreeBSD.ORG, dg@FreeBSD.ORG
Subject:   Re: mformat in free(): warning: junk pointer, too high to make sense.
Message-ID:  <199812110606.WAA22141@bubba.whistle.com>
In-Reply-To: <2923.913355388@zippy.cdrom.com> from "Jordan K. Hubbard" at "Dec 10, 98 09:49:48 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Jordan K. Hubbard writes:
> > > As for the inetd problem:   We know what it is, we have a fix, and David
> > > Greenman seems to be vetoing committing it due to its "inelegance".
> > 
> > So let's see his version.
> 
> Why doesn't someone just commit it?  David's already in hot water over
> his filesystem destroying fragmentation changes and I don't think
> anyone will side with him if you just bring the inetd change into
> -current at this point. :-) :-)

Well, this brings up an unrelated question. I've written a little
library that comes in very handy in situations like this (I have
heard there are similar things out there but this was a custom job).

Basically, it allows you to write an event driven program, where
each event is handled atomically from all others, without resorting
to threads and libc_r. An event is a file descriptor read/write
condition, a timer timeout, or a signal receipt.

The header file looks like this..

  /* Types of events */
  enum
  {
    EVENT_READ,		/* value = file descriptor */
    EVENT_WRITE,	/* value = file descriptor */
    EVENT_EXCEPTION,	/* value = file descriptor */
    EVENT_TIMEOUT,	/* value = time in miliseconds */
    EVENT_SIGNAL,	/* value = signal number */
    EVENT_USER,		/* value = user defined */
  };

  typedef u_int	EventRef;
  typedef void	(*EventHdlr)(int type, void *cookie);

  /* Register a new event */
  extern int	EventRegister(EventRef *ref, int type, int value,
		  int prio, EventHdlr action, void *cookie);
  /* Unregister a pending event */
  extern int	EventUnRegister(EventRef *ref);
  /* Check if an event is pending */
  extern int	EventIsRegistered(EventRef ref);
  /* Check time remaining on a timeout event */
  extern int	EventTimerRemain(EventRef ref);
  /* Trigger a user defined event */
  extern int	EventUserEvent(int value);
  /* Begin servicing events */
  extern int	EventStart(void);
  /* Stop servicing events */
  extern void	EventStop(void);

Is this something possibly worth it's own little library? I'd be
willing to refine it and write a man page.  Then maybe the inetd
problem could be solved more 'elegantly'.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812110606.WAA22141>