segclock() has to be called from hzclock(), otherwise
only processes running on cpu0 would catche the interrupt
and the time delta would be wrong.
lock the segment when allocating Seg->profile as
profile ctl might be issued from multiple processes.
Proc->debug qlock is not sufficient.
Seg->profile can never be freed or reallocated once
set as the timer interrupt accesses it without any
locking.
cwfs and hjfs create ther /srv command files with
ORCLOSE flag, so they get removed once the fileserver
terminates. we can use this to check that the fileserver
has in fact finished halting without making assumtions
about the time it should maximally take for any fileserver
to write out its buffers to disk.
to read the value of the stack pointer register, snap
used Machdata->szreg to determine the width of the
SP register in the Ureg structure. however, the value
does not match the Ureg.sp type for a number of architectures
(mips2, amd64) and it is unclear if this was an oversight
as it is rarely used (snap is indeed the only user) or
if it was intended for a different purpose.
so we use szaddr instead which matches the stack pointer
width in the Ureg and fixes the truncated stack issue on
amd64.
this can happen when the on the final sync when the mailbox
is being freed:
freembox -> mboxdecref -> syncmbox -> wridxfile -> pridx -> insurecache -> msgincref
syncmbox() used to enter the mailbox into the hash tree to
update the qid.vers. this is wrong when we are doing the final
sync before freeing the mailbox as the hash reference has already
been removed by freemailbox().
also avoid adding hash entries for mails for the about to be
freed mailbox in cachehash().
add function to check the refcounts for Mailbox and Message on a fid
use the full 64 bit of the qid.path, so we can use the full 32 bit for the id
instead of only maintaining refcount for the top message, msgincref() now
adds a reference to all its parent messages including self and top message.
then we can check in recursive delmessage() that all the parts have a zero
refcount.
remove the Fid.mtop field, it was never used.
make sure deletion and flag changes only affect the top message.
cachefree(): only look for top message in lru. sub-parts are never
added to the cache.
use the nparts field when reading sub-part of existing message, so
that we parse the index right in case the number of parts somehow
changed.
messages marked as Deleted but still in inbox should be written
to the index.
instead of having application processors spin in mpshutdown()
with mmu on, and be subject to reboot() overriding kernel text
and modifying page tables, park the application processors in
rebootcode idle loop with the mmu off.
to reproduce:
u8int x, y;
x = 0xff;
y = 0xc0;
if((s8int)(x & y) >= 0)
print("help\n");
compiles correctly but prints a warning
warning: test.c:11 useless or misleading comparison: UINT >= 0
the issue is that compar() unconditionally skipped over
all left casts ignoring the case when a cast would sign
extend the value.
the new code only skips over the cast when the original
type with is smaller than the cast result or when they
are equal width and types have same signedness. so the
effective left hand side type is the last truncation
or sign extension.