]> xenbits.xensource.com Git - unikraft/libs/musl.git/log
unikraft/libs/musl.git
2 years agoMakefile: Make Makefile.uk.musl.network compatible with LWIP
Razvan Deaconescu [Sat, 29 Oct 2022 09:27:25 +0000 (12:27 +0300)]
Makefile: Make Makefile.uk.musl.network compatible with LWIP

Remove the lack of presence of `posix-driver`. `posix-driver` needs to
be enabled for Musl to work with networking support.

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #19

2 years agoMakefile.uk.musl.complex: Include tgmath.h header 12/head
Florin Postolache [Fri, 11 Nov 2022 10:37:17 +0000 (12:37 +0200)]
Makefile.uk.musl.complex: Include tgmath.h header

Add tgmath.h header when both complex and math sublibs are enabled.
This header unites all types of math trigonometric functions for all
types(float, double, long double and complex) under one definition.
The header is not needed by musl source files but could be required
by applications.

Signed-off-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #24

2 years agoSet tid to 0 for the main thread
Dragos Iulian Argint [Wed, 26 Oct 2022 21:05:59 +0000 (00:05 +0300)]
Set tid to 0 for the main thread

This commit ads in the Config.uk the following default selection:
`LIBPOSIX_PROCESS_INIT_PIDS`, which allows pid,tid assignation
However, there is a bug in the assignment of tids that
makes the tid of the main thread not available when the
LIBC TCB (i.e. pthread structure) is initialized. The
currently adopted solution is to hardcode the tid to 0.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoRemove obsolete patches
Dragos Iulian Argint [Sun, 14 Aug 2022 22:39:58 +0000 (01:39 +0300)]
Remove obsolete patches

This commit reorders the patch numbers used for
musl and deletes those that are not needed as a
result of the changes made in this PR.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agopthread_create: TLS alignment and cleanup
Dragos Iulian Argint [Sun, 14 Aug 2022 22:13:29 +0000 (01:13 +0300)]
pthread_create: TLS alignment and cleanup

This patch replaces 2 function calls from musl with
2 custom ones and introduces an additional size
when allocating the map for a thread, `libc.tls_align`.
It is needed because Unikraft demands that the tls be aligned.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoAdd patch for the `clone()` wrapper for x86_64
Dragos Iulian Argint [Sun, 14 Aug 2022 22:12:03 +0000 (01:12 +0300)]
Add patch for the `clone()` wrapper for x86_64

The clone wrapper is an assembly source file which will
invoke a `syscall` instruction. Since we want just a
function call, we need to change it accordingly.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoAdd custom TLS related functions as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 22:07:58 +0000 (01:07 +0300)]
Add custom TLS related functions as glue code

The functions related to the TLS layout (like copying content)
are implemented in the unikraft core libraries.
To use them, we need to add glue source code.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoAdd custom `unmapself` function as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 22:01:17 +0000 (01:01 +0300)]
Add custom `unmapself` function as glue code

`unmapself()` provides a detached thread the ability
to free the memory region allocated for the stack and
TLS. In the original version, this function does
`munmap()', which will deallocate the thread's stack,
after which it executes exit() (NB: SYS_exit). This
works because there is another stack in the Kernel.
Since this does not exist in Unikraft, we implement
our version of unmapself.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoProvide `__set_thread_area()` as glue code
Dragos Iulian Argint [Sun, 14 Aug 2022 21:50:22 +0000 (00:50 +0300)]
Provide `__set_thread_area()` as glue code

`__set_thread_area()` is a function that is usually
architecture dependent, it sets the tls pointer in the
fs register. An `arch_prctl` system call is used. We
are replacing this call with a custom version because
`arch_prctl()` is not implemented in Unikraft at the
moment.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoRemove `__unmapself` and `set_thread_area`
Dragos Iulian Argint [Sun, 14 Aug 2022 21:49:00 +0000 (00:49 +0300)]
Remove `__unmapself` and `set_thread_area`

Comment the sources corresponding to the functions
__unmapself() (for detached threads) and
__set_thread_area() (for setting the fs register
to the tls pointer) because they will be reintroduced
as glue code.

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoInitialize TLS and reserve TCB space
Dragos Iulian Argint [Sun, 14 Aug 2022 21:44:54 +0000 (00:44 +0300)]
Initialize TLS and reserve TCB space

This commit adds a call in Makefile.uk to reserve the space
needed for the LIBC TCB (e.g. `pthread` structure)
and adds 3 glue code files:
`__uk_init_tls.c` - initialize an Unikraft TLS
`__uk_unmapself.c` - allows unmapping for detached threads
`__set_thread_area.c` - bypass for arch_prctl() syscall for
setting the tls pointer

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoAdd library dependencies for thread support
Dragos Iulian Argint [Sun, 14 Aug 2022 21:42:48 +0000 (00:42 +0300)]
Add library dependencies for thread support

Select (by default) the core libraries used by musl:
`LIBUKMMAP` - provides mmap() syscall
`LIBPOSIX_PROCESS_PIDS` - provides pid,tid implementation
`LIBPOSIX_PROCESS_CLONE` - provides the clone() syscall
`LIBPOSIX_FUTEX` - provides futex() syscall
`LIBUKSCHED_TCB_INIT` - allows setting the size for the LIBC TCB

Signed-off-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Reviewed-by: Florin Postolache <florin.postolache80@gmail.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #9

2 years agoAdd script for generating Makefile.uk.musl.* entries
Robert Kuban [Tue, 19 Jul 2022 14:29:41 +0000 (16:29 +0200)]
Add script for generating Makefile.uk.musl.* entries

Adds a script that can find the source files for a given architecture and
sublibrary by emulating the mechanism in the original musl makefile.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #8

2 years agoRemove patch for 'ioctl'
Dragos Iulian Argint [Sat, 7 May 2022 09:05:35 +0000 (12:05 +0300)]
Remove patch for 'ioctl'

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

2 years agoAdd patches for system call handling
Dragos Iulian Argint [Sat, 7 May 2022 08:54:09 +0000 (11:54 +0300)]
Add patches for system call handling

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

2 years agoRe-enable musl-defined wrappers
Dragos Iulian Argint [Sat, 7 May 2022 08:48:18 +0000 (11:48 +0300)]
Re-enable musl-defined wrappers

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

2 years agoSet `LIBSYSCALL_SHIM_NOWRAPPER` for musl
Dragos Iulian Argint [Sat, 7 May 2022 08:45:29 +0000 (11:45 +0300)]
Set `LIBSYSCALL_SHIM_NOWRAPPER` for musl

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

2 years agoMakefile.uk.musl.process: Add wait.c build dependency
Razvan Deaconescu [Wed, 9 Nov 2022 07:11:59 +0000 (09:11 +0200)]
Makefile.uk.musl.process: Add wait.c build dependency

This is required for Python3.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #23

2 years agoRemove include directory from clean list
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.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #17

2 years agoMakefile.uk: Add sysexits.h include dependency
Razvan Deaconescu [Wed, 9 Nov 2022 07:09:59 +0000 (09:09 +0200)]
Makefile.uk: Add sysexits.h include dependency

This is required by Python3.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #22

2 years agoComment macros to stop using VDSO
Florin Postolache [Mon, 15 Aug 2022 09:31:24 +0000 (12:31 +0300)]
Comment macros to stop using VDSO

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

3 years agoMake musl initialization work with unikraft RELEASE-0.10.0 RELEASE-0.6 RELEASE-0.7.0 RELEASE-0.8.0 RELEASE-0.9.0
Cyril Soldani [Thu, 10 Dec 2020 08:31:16 +0000 (09:31 +0100)]
Make musl initialization work with unikraft

Work around some syscalls not being implemented in unikraft.

Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoEnable sendfile, used by other modules
Cyril Soldani [Tue, 10 Nov 2020 10:18:05 +0000 (11:18 +0100)]
Enable sendfile, used by other modules

Signed-off-by: Cyril Soldani <cyril.soldani@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoPrevent syscall shim layer libc wrapper generation
Cyril Soldani [Fri, 9 Oct 2020 16:55:50 +0000 (18:55 +0200)]
Prevent syscall shim layer libc wrapper generation

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

3 years agoAdd patches that fixes stdout
gaulthier gain [Fri, 9 Oct 2020 16:00:23 +0000 (16:00 +0000)]
Add patches that fixes stdout

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoUpdate README.md
gaulthier gain [Tue, 6 Oct 2020 18:24:10 +0000 (18:24 +0000)]
Update README.md

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoSynchronize musl with POSIX-Process internal libs
gaulthier gain [Tue, 6 Oct 2020 18:23:47 +0000 (18:23 +0000)]
Synchronize musl with POSIX-Process internal libs

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoUse sendfile only if lwip is not enabled
gaulthier gain [Tue, 6 Oct 2020 18:09:24 +0000 (18:09 +0000)]
Use sendfile only if lwip is not enabled

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoAdd gmtime
gaulthier gain [Tue, 6 Oct 2020 13:40:29 +0000 (13:40 +0000)]
Add gmtime

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoSynchronize musl with POSIX internal libs
gaulthier gain [Tue, 6 Oct 2020 10:17:23 +0000 (10:17 +0000)]
Synchronize musl with POSIX internal libs

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoAdd SC_LEVEL1_DCACHE_LINESIZ definition
gaulthier gain [Tue, 6 Oct 2020 08:02:38 +0000 (08:02 +0000)]
Add SC_LEVEL1_DCACHE_LINESIZ definition

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoSubcomponize musl (based on Alex work)
gaulthier gain [Tue, 6 Oct 2020 08:00:25 +0000 (08:00 +0000)]
Subcomponize musl (based on Alex work)

Signed-off-by: gaulthier gain <gaulthier.gain@uliege.be>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #3

3 years agoCorrect license headers introduced by NEC Laboratories Europe GmbH
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

4 years agoUpdate __stdout_write to allow flushing on stdout RELEASE-0.5
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>
4 years agoAdd patch to update mount.h to avoid conflicts with vfscore
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>
5 years agoUpdate README.md with current status RELEASE-0.4
Gaulthier Gain [Fri, 31 Jan 2020 22:23:43 +0000 (23:23 +0100)]
Update README.md with current status

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUpdate COPYING.md with musl specifications
Gaulthier Gain [Fri, 31 Jan 2020 22:23:42 +0000 (23:23 +0100)]
Update COPYING.md with musl specifications

We updated the license part by considering musl MIT license.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUpdate MAINTAINERS.md
Gaulthier Gain [Wed, 29 Jan 2020 21:18:50 +0000 (22:18 +0100)]
Update MAINTAINERS.md

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUpdate Config.uk with the required micro-libs
Gaulthier Gain [Wed, 29 Jan 2020 21:18:48 +0000 (22:18 +0100)]
Update Config.uk with the required micro-libs

Add libvfscore, libposix_process and syscall_shim layer as required
micro-libraries.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to unistd
Gaulthier Gain [Wed, 29 Jan 2020 21:18:47 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to unistd

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to time
Gaulthier Gain [Wed, 29 Jan 2020 21:18:46 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to time

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to stdio
Gaulthier Gain [Wed, 29 Jan 2020 21:18:45 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to stdio

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to stat
Gaulthier Gain [Wed, 29 Jan 2020 21:18:44 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to stat

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to signal
Gaulthier Gain [Wed, 29 Jan 2020 21:18:43 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to signal

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to process
Gaulthier Gain [Wed, 29 Jan 2020 21:18:42 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to process

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to misc
Gaulthier Gain [Wed, 29 Jan 2020 21:18:41 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to misc

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to linux
Gaulthier Gain [Wed, 29 Jan 2020 21:18:40 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to linux

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to legacy
Gaulthier Gain [Wed, 29 Jan 2020 21:18:39 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to legacy

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to fcntl
Gaulthier Gain [Wed, 29 Jan 2020 21:18:38 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to fcntl

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAvoid multiple definitions by excluding functions related to dirent
Gaulthier Gain [Wed, 29 Jan 2020 21:18:37 +0000 (22:18 +0100)]
Avoid multiple definitions by excluding functions related to dirent

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUpdate __syscall_cp.c to use syscalls from the syscall_shim layer
Gaulthier Gain [Wed, 29 Jan 2020 21:18:36 +0000 (22:18 +0100)]
Update __syscall_cp.c to use syscalls from the syscall_shim layer

This patch updates __syscall_cp.c to use uk_syscall declaration from
the syscall_shim layer.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUse uk/bits/syscall_nrs.h instead of musl internal bits/syscall.h
Gaulthier Gain [Wed, 29 Jan 2020 21:18:35 +0000 (22:18 +0100)]
Use uk/bits/syscall_nrs.h instead of musl internal bits/syscall.h

This patch updates Makefile.uk and include/sys/syscall.h in order to
avoid generating a clone of syscall_nrs.h which is defined within
Unikraft.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoUse syscall_shim layer instead of musl internal syscalls
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>
5 years agoAdd patch to update time.h to avoid conflicts with uktime
Gaulthier Gain [Wed, 29 Jan 2020 21:18:33 +0000 (22:18 +0100)]
Add patch to update time.h to avoid conflicts with uktime

This patch updates time.h in order to avoid redefinition errors with
musl-imported time.h.

Note that we included '<bits/alltypes>' otherwise 'locale_t' type is
unknown. A next task will be to find a cleaner approach.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAdd patch to rename __unused field to pad
Gaulthier Gain [Wed, 29 Jan 2020 21:18:32 +0000 (22:18 +0100)]
Add patch to rename __unused field to pad

This patch renames __unused in arch/x86_64/bits/stat.h to pad
since __unused is a keyword in Unikraft.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAdd patch to remove syscall prototype in unistd.h
Gaulthier Gain [Wed, 29 Jan 2020 21:18:31 +0000 (22:18 +0100)]
Add patch to remove syscall prototype in unistd.h

This patch removes the long syscall(long, ...) prototype which
conflicts with Unikraft's syscall_shim layer macros.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAdd stub for mprotect in mem.c
Gaulthier Gain [Wed, 29 Jan 2020 21:18:30 +0000 (22:18 +0100)]
Add stub for mprotect in mem.c

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAdd glue code rules for mem.c in Makefile.uk
Gaulthier Gain [Wed, 29 Jan 2020 21:18:29 +0000 (22:18 +0100)]
Add glue code rules for mem.c in Makefile.uk

This commit updates Makefile.uk to support glue code related to
mem.c between musl and Unikraft.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoRemove files related to syscalls management
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>
5 years agoUpdate compilation flags with musl namespace
Gaulthier Gain [Wed, 29 Jan 2020 21:18:27 +0000 (22:18 +0100)]
Update compilation flags with musl namespace

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoReview formatting for files generations in Makefile.uk
Gaulthier Gain [Wed, 29 Jan 2020 21:18:26 +0000 (22:18 +0100)]
Review formatting for files generations in Makefile.uk

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoCall configure after patching
Gaulthier Gain [Wed, 29 Jan 2020 21:18:25 +0000 (22:18 +0100)]
Call configure after patching

Update Makefile.uk to run the configure script after patching.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoAdd support for C++ applications
Gaulthier Gain [Wed, 29 Jan 2020 21:18:24 +0000 (22:18 +0100)]
Add support for C++ applications

Update Makefile.uk to provide support to C++ applications.

Signed-off-by: Gaulthier Gain <gaulthier.gain@uliege.be>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoInitial port
Felipe Huici [Mon, 3 Sep 2018 14:11:59 +0000 (16:11 +0200)]
Initial port

Initial port, enough code to compile and run a hello world application.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
5 years agoInitial commit (empty)
Simon Kuenzer [Thu, 30 Jan 2020 09:12:31 +0000 (10:12 +0100)]
Initial commit (empty)

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>