[FreeVMS] Re: New release 0.0.54


Subject: [FreeVMS] Re: New release 0.0.54
From: Roger Tucker (roger.tucker@mci.com)
Date: Sat Sep 11 2004 - 01:16:47 CEST


You have to learn to walk before you can run...
So I decided to start slow and learn, by just looking at insque().
I don't think I understand what mycli() was trying to do.

So what is wrong with this:

#include <queue.h> /* My public
header file */
#include <asm/system.h> /* Needed
for __save_flags, etc. */

/* Hmm C is too strongly typed at times */
struct queue_t /* Needed to
avoid type casts */
    {
    struct queue_t *fp;
    struct queue_t *bp;
    };

/*
** insque() - insert entry in queue.
**
** The entry specified by entry is inserted into the queue following
the entry specified by predecessor.
** The insertion is a non-interruptible operation.
** This routine is similar to the VAX INSQUE instruction or the alpha
** __PAL_INSQUEL, __PAL_INSQUEQ routines except that:
** No validation or probing of of arguments occurs.
** The routine can leave the queue in an inconsistent state if a
memory management exception occurs.
** This routine doesn't return the values:
** 0 if the entry was not the only entry in the queue
** 1 if the entry was the only entry in the queue
** VMS required all queues to be aligned on quadword boundaries.
** Theses restrictions seem acceptable since this is a very low level
routine used in kernel mode.
** Other routines should be written to remove the above restrictions if
needed.
**
*/

void insque(void *entryp, void *predp) {
  struct queue_t *entry = entryp;
  struct queue_t *pred = predp;
  unsigned long flags;
  __save_flags(flags); /* Save the interrupt state */
  __cli(); /* Turn off interrupts */
  entry->fp = pred->fp;
  entry->bp = pred;
  pred->fp->bp = entry;
  pred->fp = entry;
  __restore_flags(flags); /* Turn on interrupts if I turned
them off */
}

Roger

-- 
Liste de diffusion FreeVMS
Pour se désinscrire : mailto:freevms-request@ml.free.fr?subject=unsubscribe



This archive was generated by hypermail 2b25 : Sat Sep 11 2004 - 01:14:34 CEST