]> xenbits.xensource.com Git - unikraft/libs/newlib.git/log
unikraft/libs/newlib.git
5 years agoAdd device related stubs
Vlad-Andrei BĂDOIU (78692) [Sun, 2 Jun 2019 16:13:14 +0000 (16:13 +0000)]
Add device related stubs

This patch adds a new file dev.c which contains stubs related to devices.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
5 years agoAdd sysexits.h
Vlad-Andrei BĂDOIU (78692) [Sun, 2 Jun 2019 16:13:14 +0000 (16:13 +0000)]
Add sysexits.h

The header was taken from newlibc, release version 2.5.0.20170922.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
5 years agoImplement usleep
Vlad-Andrei BĂDOIU (78692) [Thu, 30 May 2019 11:38:50 +0000 (11:38 +0000)]
Implement usleep

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agopatches: Fix setgroups declaration in origin
Costin Lupu [Wed, 29 May 2019 16:37:25 +0000 (19:37 +0300)]
patches: Fix setgroups declaration in origin

It seems that the setgroups() declaration is not POSIX. The patch fixes
that.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoRemove functions provided by internal Unikraft libs
Costin Lupu [Wed, 29 May 2019 16:37:24 +0000 (19:37 +0300)]
Remove functions provided by internal Unikraft libs

* User functions, such as getpwnam(), are provided by ukunistd
* pathconf() and sysconf() are provided by uksysinfo

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agopoll.h: Include lwip/sockets.h if lwIP is available
Florian Schmidt [Tue, 28 May 2019 07:55:32 +0000 (09:55 +0200)]
poll.h: Include lwip/sockets.h if lwIP is available

for POLLIN and friends.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoSilence unused parameter warnings
Florian Schmidt [Tue, 28 May 2019 07:55:31 +0000 (09:55 +0200)]
Silence unused parameter warnings

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoYet another try to fix the __rtems__ shenanigans
Florian Schmidt [Tue, 28 May 2019 07:55:30 +0000 (09:55 +0200)]
Yet another try to fix the __rtems__ shenanigans

Originally, we defined __rtems__ in sys/stat.h because we wanted it to
provide st_{a,c,m}tim in struct stat. That lead to some unintended side
effects, so we reduced the scope to only that header file by
conditional-defining-and-undefining. It turns out even that has
unintended side effects regarding the definition of sigaddset etc.

Considering that we're not really the RTEMS OS, let's try this the other
way round and provide a patch instead that unconditionally gives us
st_{a,c,m}tim, and to not touch __rtems__ definitions.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoAdd poll() and select() support via lwIP if available
Florian Schmidt [Tue, 28 May 2019 07:55:29 +0000 (09:55 +0200)]
Add poll() and select() support via lwIP if available

Otherwise, provide dummy stubs.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoGlue code for getpwnam()
Florian Schmidt [Tue, 28 May 2019 07:55:28 +0000 (09:55 +0200)]
Glue code for getpwnam()

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agoAlign POLL* values in glue code with musl.
Florian Schmidt [Tue, 28 May 2019 07:55:27 +0000 (09:55 +0200)]
Align POLL* values in glue code with musl.

In turn, this helps lwip with its own definitions to not conflict with
either of these libc implementations.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
5 years agobuild: export -D__DYNAMIC_REENT__ to global C[XX]FLAGS if used
Florian Schmidt [Fri, 10 May 2019 08:49:38 +0000 (10:49 +0200)]
build: export -D__DYNAMIC_REENT__ to global C[XX]FLAGS if used

__DYNAMIC_REENT__ is used as a preprocessor flag in several public
header files (most importantly, stdio.h). This means that if newlib is
compiled with one set of flags and the rest of the build with another,
the header file and the implementation don't match. This leads to
problems such as stdin/stdoud/stderr not working because they always use
the (non-functional) versions inside _impure_data instead instead of the
current environment's private _reent struct.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoRemove functions provided by libvfscore
Vlad-Andrei BĂDOIU (78692) [Thu, 18 Apr 2019 11:09:54 +0000 (11:09 +0000)]
Remove functions provided by libvfscore

The core patch 'lib/vfs: expose remaining vfs functions'
provides additional functions which are currently stubs
in newlib's gluecode. This patch removes the stubs.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoFix fwrite's return value for newline ended strings
Vlad-Andrei BĂDOIU (78692) [Wed, 10 Apr 2019 11:22:05 +0000 (11:22 +0000)]
Fix fwrite's return value for newline ended strings

Fwrite does not return the correct number of items
written. If we pass a string that ends in '\n' we
get n - 1(the '\n') for a string of length n.
That is because __sputc_r returns EOF for the
the newline character. This patch solves the problem
by increasing the variable i if  __sputc_r returned
EOF when p[i] is '\n'.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoRemove readdir stub function
Florian Schmidt [Fri, 12 Apr 2019 07:09:00 +0000 (09:09 +0200)]
Remove readdir stub function

This is provided by vfscore, on which newlib has a dependency.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoSuppress code style warnings when using GCC 6, 7 or 8
Simon Kuenzer [Wed, 10 Apr 2019 09:27:39 +0000 (11:27 +0200)]
Suppress code style warnings when using GCC 6, 7 or 8

Supress code style warnings for external libnewlib sources when using
GCC 6, GCC 7, or GCC 8. The new warning suppression flags are
introduced depending on the GCC version that is in use.
Additionally, this patch name spaces `SUPPRESS_FLAGS` to
`LIBNEWLIB_SUPPRESS_FLAGS-y` and we remove the double definition of
`-Wno-implicit-function-declaration`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoAdd libvfscore as dependency
Simon Kuenzer [Wed, 10 Apr 2019 08:32:37 +0000 (10:32 +0200)]
Add libvfscore as dependency

The current implementation requires libvfscore to be selected. Without
libvfscore `read`, `write`, `close`, and `fstat` are undefined and
linking fails. With this commit we also fix a typo in the dependency
definition to libukalloc.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoRemove stub for opendir
Felipe Huici [Fri, 5 Apr 2019 18:25:04 +0000 (20:25 +0200)]
Remove stub for opendir

The opendir function is now provided by Unikraft's vfs library,
remove the stub from newlib to prevent multiple definition errors.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoImplement gettimeofday, clock_gettime, sleep
Florian Schmidt [Wed, 3 Apr 2019 12:16:39 +0000 (14:16 +0200)]
Implement gettimeofday, clock_gettime, sleep

The implementations are taken from nolibc.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoFix selectively included type definitions
Florian Schmidt [Tue, 26 Mar 2019 13:51:36 +0000 (14:51 +0100)]
Fix selectively included type definitions

The newlib glue code uses code originally taken from musl. In musl, the
way to selectively include certain data types from those defined in
types.h is through the use of __NEED_* macros. Newlib uses a different
approach: it provides all definitions as underscored variants via
sys/_types.h, and the header files then typedef them over to the normal
variants as needed, with preprocessor guards around each of them to
provent duplications.

Replace the __NEED macros (which are effectively noops, so none of those
data types ever got properly defined in those headers) with the newlib
_types solution.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoUse Unikraft __getreent() when scheduling is enabled
Costin Lupu [Fri, 22 Mar 2019 14:11:07 +0000 (16:11 +0200)]
Use Unikraft __getreent() when scheduling is enabled

When scheduling is enabled, Unikraft provides the __getreent() function.

The current patch also fixes the compilation warnings that occur
because of __DYNAMIC_REENT__ redefinition when __rtems__ is defined.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
6 years agoAdd stubs for C++ libraries
Vlad-Andrei BĂDOIU (78692) [Thu, 21 Mar 2019 15:34:56 +0000 (15:34 +0000)]
Add stubs for C++ libraries

This patch adds the missing stubs needed by the
C++ llvm libraries. It creates a new locale.c
file for the stubs related to the locales.
This patch adds the missing include
to stddef inside mman.h.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoFix __rtems__ usage in glue code headers
Costin Lupu [Thu, 14 Mar 2019 09:41:00 +0000 (11:41 +0200)]
Fix __rtems__ usage in glue code headers

In order to use __rtems__ one has to define it in all affected headers.
Besides 'sys/stat.h', we also identified 'time.h'. Moreover, we define
__rtems__ only if it was not previously defined.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoEnable setjmp and longjmp support
Costin Lupu [Sun, 10 Mar 2019 14:33:06 +0000 (16:33 +0200)]
Enable setjmp and longjmp support

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agoadd declarations needed for vfscore in the gluecode RELEASE-0.3.1
Yuri Volchkov [Tue, 5 Mar 2019 18:29:55 +0000 (19:29 +0100)]
add declarations needed for vfscore in the gluecode

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
6 years agoupdate newlib glue for use with vfscore
Yuri Volchkov [Tue, 5 Mar 2019 18:29:54 +0000 (19:29 +0100)]
update newlib glue for use with vfscore

Consists of multiple fixes:
  - remove stubs of the functions provided by vfscore
  - import mount.h, statfs.h, uio.h from nolibc (minimal changes)
  - add stub for sigfillset

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
6 years agoAdd missing include to time.c
Florian Schmidt [Fri, 14 Dec 2018 09:54:53 +0000 (10:54 +0100)]
Add missing include to time.c

time.c uses errno, but doesn't include the correct header.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Felipe Huici <felipe.huici@neclab.eu>
6 years agoFix remaining time in nanosleep
Dafna Hirschfeld [Mon, 17 Sep 2018 19:42:25 +0000 (22:42 +0300)]
Fix remaining time in nanosleep

Add the fix of commit 96f68ab in unikraft to newlib:
Calculate the remaining time to sleep and update
the rem parameter if it is given.
If the remaining time is larger than 0, it means that
the thread was waken up explicitly and nanosleep returns -1
to indicate that. Otherwise nanosleep returns 0.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Reviewed-by: Florian Schmidt <florian.schmidt@neclab.eu>
6 years agoreimplement nanosleep for new api
Yuri Volchkov [Fri, 15 Jun 2018 13:58:48 +0000 (15:58 +0200)]
reimplement nanosleep for new api

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agoremove functions provided by libvfscore
Yuri Volchkov [Fri, 15 Jun 2018 11:51:33 +0000 (13:51 +0200)]
remove functions provided by libvfscore

Which are: close, read and write

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agopatch: set default _READ_WRITE_RETURN_TYPE to _ssize_t
Yuri Volchkov [Fri, 15 Jun 2018 11:51:32 +0000 (13:51 +0200)]
patch: set default _READ_WRITE_RETURN_TYPE to _ssize_t

The vfscore provides the same definitions of functions read/write as
in 'man 2 write'. Newlib used int as a return type of these functions,
which is wrong.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agobuild: add CONFIG_ prefix to all kconfig symbols
Yuri Volchkov [Fri, 15 Jun 2018 11:51:31 +0000 (13:51 +0200)]
build: add CONFIG_ prefix to all kconfig symbols

This is needed to support similar modifications in Unikraft main repo

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
7 years agoInitial public release: documentation RELEASE-0.2
Florian Schmidt [Wed, 29 Nov 2017 10:53:03 +0000 (11:53 +0100)]
Initial public release: documentation

This contains the initial documentation for newlib for Unikraft.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
7 years agoInitial public release: configuration and build files
Florian Schmidt [Wed, 29 Nov 2017 12:43:46 +0000 (13:43 +0100)]
Initial public release: configuration and build files

This contains the configuration and make files required to build
libnewlib for Unikraft.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
7 years agoInitial public release: glue code
Florian Schmidt [Wed, 29 Nov 2017 12:42:29 +0000 (13:42 +0100)]
Initial public release: glue code

This contains the glue/wrapper code required to build libnewlib for
Unikraft.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
7 years agoinitial commit (empty)
Florian Schmidt [Wed, 29 Nov 2017 12:27:59 +0000 (13:27 +0100)]
initial commit (empty)

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>