This patch was introduced to modify the prototype of the
`ioctl()` function when it was exported directly from vfscore.
Now, since we want to keep the wrapper in musl, we leave the
function prototype unchanged. The patch is no longer needed.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
Musl wrappers use a binary system call, e.g. for x86_64 the `syscall`
instruction is used which is a trap. In a single-address-space OS as an Unikraft
unikernel this is just overhead. Hence, we changed the way musl deals with
syscall handling by using some syscall shim layer macros.
Those will replace binary system calls with function calls.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
In the previous version, wrappers over system calls (e.g. `read ()`)
were defined in syscall shim layer. Since we want to maintain musl as
vanilla as possible, we have re-introduced these wrappers.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
We need to set the LIBSYSCALL_SHIM_NOWRAPPER field in the configuration
file to prevent syscall shim layer from creating system call wrappers.
These wrappers are already defined in musl.
Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #5
Robert Kuban [Tue, 25 Oct 2022 16:41:24 +0000 (18:41 +0200)]
Remove include directory from clean list
The current clean rule in the Unikraft build system can not remove
directories and terminates with an error if there is a directory in
the list of files to clean.
This commit removes the include directory inside the lib-musl build
directory from the clean list.
Since each sublibrary has a separate subdirectories in the include
directory, this change will not make headers accessible which would have
been deleted by the clean rule.
Alternatives considered:
1. Enable the build rule to remove directories.
This would lead to the uk_clean_list not containing a complete
lists of files to remove anymore and makes the potential damage
of errors in the clean list much higher.
2. Add every header file into the `LIBMUSL_CLEAN` variable.
This could be done in `_libmusl_import_lib` and would remove the
linked headers, but would still leave the directory tree.
3. Do not create the links, but include from the origin directory.
This would remove the ability to filter header files in the
sublibrary makefile.
The VDSO is responsible for the virtual system calls in a basic
linux application and makes so that some system calls will be faster
because the transition between kernel mode and user mode is eliminated.
Therefore, it shouldn't be used in Unikraft. At the moment, in musl
this feature is enabled and functions like __clock_gettime will generate
a segfault.
Signed-off-by: Florin Postolache <florin.postolache80@gmail.com> Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com> Approved-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #10
The musl libc provides its own wrappers around syscalls, which we prefer
to the shim-layer-generated ones as they often do additional
bookkeeping. And we can't have both as it would lead to conflicts.
Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3
Simon Kuenzer [Tue, 13 Jul 2021 19:24:08 +0000 (21:24 +0200)]
Correct license headers introduced by NEC Laboratories Europe GmbH
This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
with the following commits: 60a1108 - Initial port (Felipe Huici)
On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.
The original author(s) or an authorized representative from
the author's affiliation consents to the change with a
`Reviewed-by` tag to this commit.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu> Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #2
gaulthier gain [Tue, 3 Mar 2020 10:23:24 +0000 (10:23 +0000)]
Update __stdout_write to allow flushing on stdout
This patch fixes the issue where printing on stdout does nothing
since stdout was not flushed. In that case, we found that the problem
was related to __stdout_write. Indeed f->lbf must be set to '\n' for
line-buffered mode nevertheless, the condition "(!(f->flags & F_SVB)
&& __syscall(SYS_ioctl, f->fd, TIOCGWINSZ, &wsz))" fails on Unikraft.
The variable f->lbf is thus reset to -1 which prevents a correct
display on stdout. With this patch, we "force" f->lbf to be set in
line-buffered mode.
Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
gaulthier gain [Tue, 3 Mar 2020 10:23:23 +0000 (10:23 +0000)]
Add patch to update mount.h to avoid conflicts with vfscore
This patch updates "mount.h" in order to avoid ioctl redefinition
error with vfscore. Basically, the musl "mount.h" file includes
<sys/ioctl.h> only if _VFSCORE_SYS_MOUNT_H_ was not defined.
Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Gaulthier Gain [Wed, 29 Jan 2020 21:18:34 +0000 (22:18 +0100)]
Use syscall_shim layer instead of musl internal syscalls
This commit updates include/syscall.h by including uk_syscall
from the syscall_shim layer. In addition, it redirects syscall,
__syscall, syscall_cp and __syscall_ret to the syscall_shim layer.
Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Gaulthier Gain [Wed, 29 Jan 2020 21:18:28 +0000 (22:18 +0100)]
Remove files related to syscalls management
In this patch, we remove patches, source and header files that are
obsolete with the syscall shim layer. These old files were added at
the time where the syscall shim layer was not implemented.
Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be> Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>