To enable -O2 compilation we have to disable some optimizations:
- strict-aliasing (TODO: introduce required unions to enable this)
- aggressive-loop-optimizations
- array-bounds
Affected builds are
- sys/src/cmd/dossrv/build.json
- sys/src/cmd/ip/build.json
- sys/src/lib/authsrv/build.json
- sys/src/lib/memdraw/build.json
This way sleep() knows that it should not interrupt the process
to serve awake().
Also rename Proc.insyscall to Proc.inkernel since that's the meaning
of the flag, which is only read to serve awake()'s mechanics and
to accounttime(). Indeed faultAmd64 was setting insyscall to 1.
The "write on closed pipe" note should be posted only
if the write occurred on a closed pipe.
Before this fix, on any interrupt caused the note to be sent,
despite the pipe being open and fully working.
Awake can now interrupt several blocking syscalls (even
during note handling).
Among others, it can interrupt await, pread and pwrite.
It cannot interrupt several others for different reasons:
- awake cannot be interrupted by awake;
- syscalls like remove and create can be used for kernel comunication
and it would be hard to know if the effect occurred in the
receiving fs if they were interrupted;
- other syscalls do not need awake since they just provide access
to kernel infos (eg seek or fd2path)
NOTE: awakes registered before a note cannot occur during the note
handling and will be deferred till the next call to noted.
With this commit all functions declared in libc.h have been renamed
with the "jehanne_" prefix. This is done for several reason:
- it removes conflicts during symbol resolution when linking
standard C libraries like newlib or musl
- it allows programs depending on a standard C library to directly
link to a library depending on our non standard libc (eg libsec).
To ease transiction two files are provided:
- sys/include/lib9.h that can be included instead of <libc.h> to use
the old names (via a simple set of macros)
- sys/src/lib/c/lib9.c that can be compiled with a program where the
macro provided by lib9.h are too dumb (see for example rc or grep).
In the kernel port/lib.h has been modified accordingly and some of
the functions it directly provides has been renamed too (eg malloc
in qmalloc.c and print in devcons.c).