From: srt@zaphod.csci.unt.edu (Steve Tate)
Subject: Strange error in STREAMS code
Date: 13 Nov 1994 18:59:43 GMT [thread overview]
Message-ID: <3a5nmv$4n4@hermes.unt.edu> (raw)
Ok, I admit it.... I'm stumped. I have a weird thing going on in a
STREAMS driver for an Alpha machine running OSF/1, and I don't know what
the problem is. Hopefully someone here can clarify it for me... I fixed
the problem so that the code works, but I'd really like to understand what
was happening. Here's the original code (the code is really just the one
if statement, and the others are for writing to the kernel log).
DLOG("ppp_if: SIOC[GS]ETNPMODE cmd %x\n", i->ioc_cmd);
DLOG("ppp_if: Reference cmd %x\n", SIOCSETNPMODE);
if (i->ioc_cmd == SIOCSETNPMODE) {
DLOG("ppp_if: SETNPMODE really is SETNPMODE!\n", 0);
This produces the following log file entries:
Nov 13 11:40:22 zaphod vmunix: ppp_if: SIOC[GS]ETNPMODE cmd 80087091
Nov 13 11:40:22 zaphod vmunix: ppp_if: Reference cmd 80087091
Nov 13 11:40:22 zaphod vmunix: ppp_if: SETNPMODE about to reply with an M_IOCACK
So it looks like i->ioc_cmd and SIOCSETNPMODE are equal, and yet the
condition in the if is not true (since the next log entry is not made).
Experience tells me that it's some sort of type mismatch or something
(one is getting sign-extended and the other isn't or something), so I
look back at all the definitions. i->ioc_cmd is an int, and SIOCSETNPMODE
is an ioctl code defined with _IOW(..), which is simply a constant
expression that should evaluate to a constant of type int. So it
seems like that can't possibly be the problem. However, since I don't
know what else to do, I decide to try to fix this problem that I shouldn't
be having, and cast the values in the comparison like so:
DLOG("ppp_if: SIOC[GS]ETNPMODE cmd %x\n", i->ioc_cmd);
DLOG("ppp_if: Reference cmd %x\n", SIOCSETNPMODE);
if (((u_int32_t)i->ioc_cmd) == ((u_int32_t)SIOCSETNPMODE)) {
DLOG("ppp_if: SETNPMODE really is SETNPMODE!\n", 0);
Guess what? Now it works! I should be happy, but I'm not --- there's
something fundamental that's going on that I don't understand. Normally
when this happens I look at the assembly code to see what's REALLY going
on. I tried this, but being new to the Alpha, I don't really understand
it enough to see what was happening.
Does anybody have any ideas on what was happening? I'd be most grateful!
--
Steve Tate --- srt@cs.unt.edu | Conservatives: People who think that
Dept. of Computer Sciences | nothing should be done for the first
University of North Texas | time.
Denton, TX 76201 |
next reply other threads:[~1994-11-13 18:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-11-13 18:59 Steve Tate [this message]
1994-11-13 23:24 ` Strange error in STREAMS code Steve Tate
1994-11-13 23:48 ` John Hascall
1994-11-14 16:34 ` Steve Tate
1994-11-14 19:13 ` John Hascall
1994-11-14 22:32 ` Charles M Richmond
1994-11-15 4:00 ` John Hascall
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox