Re: Message buffer and printf reentrancy patch

From: Bruce Evans (bde_at_zeta.org.au)
Date: 06/16/03

  • Next message: John-Mark Gurney: "Re: make /dev/pci really readable"
    Date: Mon, 16 Jun 2003 21:13:13 +1000 (EST)
    To: Don Lewis <truckman@FreeBSD.org>
    
    

    On Mon, 16 Jun 2003, Don Lewis wrote:

    > On 16 Jun, Bruce Evans wrote:
    > > On Sun, 15 Jun 2003, Ian Dowse wrote:
    > >> >> ...
    > >> >> +#define MSGBUF_SEQSUB(mbp, seq1, seq2) (MSGBUF_SEQNORM(mbp, (seq1) - (seq2)
    > > ...
    > > This problem and many casts could be avoided by using unsigned types
    > > for most of the msgbuf fields. I forget the details of why we changed
    > > them back to signed. The log message for msgbuf.h 1.19 says that this
    > > is because we perform signed arithmetic on them. The details for this,
    > > can probably be handled by the macros now.
    >
    > Using unsigned types was the first thing that I thought of. I was
    > wondering if the reason that this wasn't done was some sort of
    > portability problem with the atomic operations.

    MSG_SEQSUB() takes differences of sequence numbers now. The differences
    can be negative. Though the macro could convert to a signed type, the
    range of sequence numbers must be limited for their differences to fit
    in a signed type, so the type for sequence numbers may as well be signed
    too.

    > It looks like MSGBUF_SEQNORM() could avoid the conditional code and any
    > questions about signed remainders if it was defined like this:
    >
    > #define MSGBUF_SEQNORM(mbp, seq) (((seq) + (mbp)->msg_seqmod) % \
    > (mbp)->msg_seqmod)
    >
    > as long as msg_seqmod < INT_MAX/2. MSGBUF_SEQNORM() could be simplified
    > further if msg_seqmod was added by the caller (such as MSGBUF_SEQSUB())
    > if the argument could be negative.

    Yes. The negative numbers of interest seem to be limited to at most
    differences of sequence numbers (or maybe differeces of indexes, which
    are smaller), so they are larger than -msg_seqmod. MSGBUF_SEQSUB()
    shouldn't add the bias, however, since it is used in contexts where
    we really want to see the negative values.

    Bruce
    _______________________________________________
    freebsd-arch@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-arch
    To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"


  • Next message: John-Mark Gurney: "Re: make /dev/pci really readable"

    Relevant Pages

    • Re: Efficiency re: Module Sequence in a Project feb08
      ... documentation tool for my addin. ... When Documentor listed the module names, they were NOT in alpha sequence. ... " Excel knows where to go to start MacName up. ... accesses the modules and the macros within them. ...
      (microsoft.public.excel.programming)
    • Re: Macros calling other macros?
      ... -1) Avoid binding a key and a sequence beginning by that key (S1 or ... intend to call by hand any of the inner macros, ... A sequence beginning by ",@" and following by ... not mandated by Mutt in any way. ...
      (comp.mail.mutt)
    • Re: About a macro
      ... > but I'm still not very at ease with macros. ... Most lisp programmers ... #<STANDARD-METHOD MY-MAP NIL (T T SEQUENCE SEQUENCE) 206F4864> ...
      (comp.lang.lisp)
    • RE: Help Pleeeeeeeeeeeeeeeeease :-(
      ... Record macros to copy and paste. ... Write macros in VBA using conditions and Excel VBA constants to find the ... Write macros that can sequence the macros you've created previously into ... > a-level ict project basically. ...
      (microsoft.public.excel.misc)