> warning: a.c:9 useless or misleading comparison: UINT < 0
the error can be observed by compiling the following code
with warnings enabled:
#include <u.h>
#include <libc.h>
uint r;
void
main(int argc, char *argv[])
{
int r;
if(r < 0){
exits(0);
}
}
the offending code in the compiler is:
- if(l->op == ONAME && l->sym->type){
- lt = l->sym->type;
- if(lt->etype == TARRAY)
- lt = lt->link;
- }
compiler handles scope by overwritin and reverting
symbols while parsing. in the ccom phase, the nodes symbol
(n->sym) is not in the right scope and we wrongly think r
is uint instead of int.
it is not clear to me what this code tried to accomplish in
the first place nor could anyone answer me this question.
the risk is small as this change doesnt affect the compiled
program, only the warning, so removing the offending code.
the malloc pool allocator is limited in its allocation
size. as almost all data structures in cwfs are never
freed, use brk() in ialloc() instead of mallocalign().
this means memory returned by ialloc() cannot be freed!
to make sure we do not call free by accident, remove
the #define malloc(n) ialloc(n, 0) macro and use ialloc()
directly as in the original code to show the intend
of permanent allocations.
this was a big mistake. we should never attempt to
timeout or retry a scsi command from the controller
driver because theres no way to tell how long a
command would take or if a command has side effects
when being retried.
number of bank slots in Conf.mem[4] was too small
for kenjis machine, set it to maximum 16 (the
size of the RAM map in pc64/memory.c).
also increasing the UPA memory map to 64. the
e820 map on my x200s has 31 entries and many
holes. this gets rid of the "mapfree: ... losing"
messages on boot.
make mntflushfree() return the original rpc and do the
botched clunk check on the original instead of the
current rpc.
so if we get a botched flush of a clunk, we abandon the
fid of the channel as well.
if theres an error transmitting a Tclunk or Tremove request,
we cannot assume the fid to be clunked. in case this was
a transient error, reusing the fid on further requests
will fail.
as a work arround, we zero the channels fid and allocate
a new fid before the chan is reused.
this is not correct as we essentially leak the fid
on the fileserver, but we will still be able to use
the mount.
the shift instructions does not change the zero flag
when the shift count is 0, so we cannot remove the
compare instruction in this case.
this fixes oggdec under 386.
ftrvxmtrx repots devices that use the endpoint number for
input and output of different types like:
nusb/ether: parsedesc endpoint 5[7] 07 05 81 03 08 00 09 # ep1 in intr
nusb/ether: parsedesc endpoint 5[7] 07 05 82 02 00 02 00
nusb/ether: parsedesc endpoint 5[7] 07 05 01 02 00 02 00 # ep1 out bulk
the previous change tried to work arround this but had the
concequence that only the lastly defined endpoint was
usable.
this change addresses the issue by allowing up to 32 endpoints
per device (16 output + 16 input endpoints) in devusb. the
hci driver will ignore the 4th bit and will only use the
lower 4 bits as endpoint address when talking to the usb
device.
when we encounter a conflict, we map the input endpoint
to the upper id range 16..31 and the output endpoint
to id 0..15 so two distinct endpoints are created.
nusb code assumes endpoint numbers are unique. It's true in general
case, but it becomes false once the direction bit is ignored. The
commit adds a check so that two endpoints of different types are not
merged into one with Eboth direction. It does overwrite endpoint
though, so it shouldn't be considered as a full fix.
the 802.11 spec only specifies the msb of the rate for
Beacon, Probe Response, Association Response, Reassociation Response,
Mesh Peering Open, and Mesh Peering Confirm management frames
...
The MSB of each Supported Rate octet in other
management frame types is ignored by receiving STAs.
this should make no difference but on some netgear ap's not
setting this bit seems to ignore these data rates.
driver sets wifi->rates array to tell wifi layer what
rates it supports. when we receive beacon, we determine
the minimum and maximum data rates and set wn->minrate
and wn->maxrate to point to the entries in wifi->rates.
it is the responsibility of the driver to use this
information on transmit.
to run aux/wpa at boot, we need factotum to be running. tho
factotum was started only after the network was configured.
what we do now is start factotum early, not fetching keys
from secstore. once network is available and the auth server
is known, we fetch keys from secstore using auth/secstore in
bootrc.
to pass the authserver for p9 authentication to factotum, we
write it in /net/ndb and the special _authdial() in factotum
will picks it up.
as we are using auth/secstore binary in any case, we remove
the duplicated secstore code from factotum and make it just
exec auth/secstore to fetch the keys on startup (unless -n
or -S is specified).
load x-stretched scanline and use image replication bit to let
devdraw do the y-stretching. this reduces slow RGB15 -> display
conversions as devdraw caches small numbers of converted source
scanlines (one in hour case). setting pixels should also be a
bit faster. (only 3 writes instead of 9 for x3 scaling)
remove unused memsetb() routine.
replace foo ? 1 : 0 with foo != 0
avoid double calculation of rgb components in readbyte()
handle byte aligned color components in writebyte()
which lets us avoid the read-modify-write and the shifting.
surprisingly, the branches in the loop are way less important
than avoiding the memory access.
this change makes ganes/snes playable at -3 scaling.
used to set audio device frequency thru /dev/volume tho
only ac97 driver supports this. as a quick work arround,
upsample the 32000 hz audio signal to 44100 hz (without
any interpolation).
move the sample buffer room check from audiosample() into
dspstep() so that when the buffer is full (shouldnt happen),
we wont advance dspstate so samples will not get dropped.
we allow protocol path to begin with # for dial, so should
allow this for announce as well. this is primarily usefull
when booting the fileserver to listen on alternate ip stack.
according to erik, virtualbox puts the source overrides
before the ioapic entries so the addirq() call fails
as no ioapics have been declared yet. use a second pass
over the table after we processed the apic entries.
the original format for addresses was %8lux which was changed
to %p for amd64. this broke linuxemu which assumes fixed format
in the segment file. as a compromize we change it to %8p and
amd64 port of linuxemu will hopefully use a more robust parser :)
quote handling was broken with 21-bit runes. nextrec()
returned quoted rune as long rune | (Runemax+1) to escape
it.
with 16-bit runes, storing that long into 16-bit Rune
would automatically remove the escaping, but with 21-bit
runes, Rune is uint32 so the escaping would remain. we
now use (Runemask+1) instead, and mask the escaping off
explicitely when storing back to Rune.
add 0xffff to tab1 as range 0xffff-0x10ffff has 4 byte utf-8 sequence.
use Runemax (0x10ffff) instead of Runemask (0x1fffff) to denote
the last valid rune for inverted [^] match as Runemask is out of the
valid rune space.
when the previous instruction sets the zero flag,
we can remove the CMPL/CMPQ instruction.
this removes compares for zero/non zero tests only.
it only looks at the previous non-nop instruction
to see if it sets our compare value register.
we have to wait for the pcmconv process to exit before
exiting yourselfs because otherwise pcmconv could
keep /dev/audio open and prevent further reopens for
a short period of time.
the rule that was used to copy header files from ../pc
accidently overwrote dat.h when ../pc/dat.h was updated
because it matched on all *.h files that was also found
in ../pc directory. change to exact match on $PCHEADERS
to prevent this.
problems that need to be addressed:
- reads in the whole /proc every second for no reason
- breaks when http server doesnt include Content-Length header
- length is wrong for continued download (-o option)
do not store Block* pointer in packet descriptor, assumed
pointer would fit in a long. we use pointer table now to
record the Block* pointer and store index instead.
old ramfs had a limit on the number of files it could serve
and file size was limited to maximum allocaiton size.
the new implementation uses multiple memory chunks to back file data
in a private compactable memory pool to overcome these limits.
files can be sparse. file metadata is maintained by 9pfile data
structures of lib9p.
mischief → ; import -p tcp!9.offblast.org!17007 / /n/9
mischief → -> import: can't mount /: EOF receiving fversion reply
mischief → on the console
mischief → bmo Mar 13 18:55:30 dialing tcp!9.offblast.org!17007
mischief → bmo Mar 13 18:55:30 reconnected to tcp!9.offblast.org!17007
mischief → bmo Mar 13 18:55:30 connected from 199.191.58.44
mischief → bmo Mar 13 18:55:34 exiting...bmo Mar 13 18:55:30 dialing tcp!9.offblast.org!17007
mischief → bmo Mar 13 18:55:30 reconnected to tcp!9.offblast.org!17007
mischief → bmo Mar 13 18:55:30 connected from 199.191.58.44
mischief → bmo Mar 13 18:55:34 exiting...
mischief → aan is dialing the *exportfs* port because i explicitly specified it
netfd is initially zero (stdin), when filter() closes fd0,
fd0 is free to be reused. this causes problems with openmount()
that assumes sfd being >2.
instead, we dup the our pipe end over netfd, and close the pipe.
stringwidth() and string() sometimes failed spuriously due
to the wrong assumption that cachechars() will only fail
when a different subfont is needed. in fact, cachechars()
can fail for other reasons like when it resizes the fontcache
(or fails todo so).
theres also the case when loadchar() is unable to translate
a character and returns 0. this case needs to be differentiated
from such temporary conditions like fontcache resize or subfont
load to stop the retry loop in string() and stringwidth().
now cachechars() returns -1 to indicate that it cannot
proceed and we test this in string() and stringwidth()
to skip over untranslatable characters to make progress
instead of retrying.
when libmach is compiled with 6c, unions in the 32bit Uregs
cause fields to be wronly aligned. use #pragma pack arround
the #include "/$objtype/include/ureg.h" statement.
the comment about Physseg.size being in pages is wrong,
change type to uintptr and correct the comment.
change the length parameter of segattach() and isoverlap()
to uintptr as well. segments can grow over 4GB in pc64 now
and globalsegattach() in devsegment calculates len argument
of isoverlap() by s->top - s->bot. note that the syscall
still takes 32bit ulong argument for the length!
check for integer overflow in segattach(), make sure segment
goes not beyond USTKTOP.
change PTEMAPMEM constant to uvlong as it is used to calculate
SEGMAXSIZE.
previous change had forgot how dithering works... m(
we *really* add a random signal when *reducing* the number
of bits. just make sure we do not overflow like in
mixin().
the check in dither() was inverted. we should only
add noise when the output bit count is greater
than input bit count (samples shifted up) to
fill the lower zero bits produced by the shift.
simplifying paging code by getting rid of duppage(). instead,
fixfault() now always makes a copy of the shared/cached page
and leaves the cache alone. newpage() uncaches pages as
neccesary.
thanks charles forsyth for the suggestion.
from http://9fans.net/archive/2014/03/26:
> It isn't needed at all. When a cached page is written, it's trying hard to
> replace the page in the cache by a new copy,
> to return the previously cached page. Instead, I copy the cached page and
> return the copy, which is what it already
> does in another instance. ...
1) handle errors when loading thumbprint file.
initThumbprints() now returns nil and sets errstr
on error. a syntax error in a thumbprint file
should be reported instead of silently ignored!
(have to check users)
2) fix memory leak in initThumbprints(); we have to use
freeThumbprints() instead of free to release crltab.
3) use the actual head entries for thumbprint
storage in the thumbprints array. most thumbprint
files are rather sparse.
4) remove private emalloc() function. we shouldnt
just exit the calling process on allocation error,
instead handle error properly. this is a library!