libc: add header for ffsl and ffsll

We have an implementation of those functions that external users can call at
will.  But because they are not anywhere in our headers, OSv users will not
find the correct function signature. Man page says:

       #include <string.h>

       int ffsl(long int i);

       int ffsll(long long int i);

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
poll: fix problem with events

I have noticed a bug while testing poll today. While we are constructing the
pfd array, we correctly emplace the fd of the ith element, but events and
revents always comes from the first. That causes problems if the fds in the set
are waiting for different events.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
mgmt: update

Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build: Use -O0 for debug build instead of -Og

One of the reasons for using the debug build is to be able to debug
symbols which can't be read in the release build because they are
optimized out:

 (gdb) p var
   $1 = <optimized out>

Unfortunatelly -Og does not prevent this, only -O0 does.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
libc: add function of pgid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add getpgrp for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add getppid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add getpwnam_r to porting CRuby

getpwnam_r and getpwuid_r is almost same function.
So, implement getpw_r for commonly function and
To change the two function to call getpw_r

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add setegid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add seteuid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add setregid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add setreuid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add sid function for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add waitpid for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
stub __libc_start_main

We may have to implement it in the future if we support static PIEs, but for
sure not at the moment, where we handle all the initialization ourselves.
Still, objects without lazy linking will abort if the symbol is not present.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
dhcp: Fix MTU logging

When OSv started, using dmesg command we will see a message such as:

  Configuring eth0: ip 192.168.122.15 subnet mask 255.255.255.0 gateway 192.168.122.1 MTU 0

We found that the dhcp packet doesn't carry a positive interface MTU. In
order to avoid misunderstanding, change the MTU value of displaying
message to ETHERMTU(1500) when dhcp packet's MTU is zero.

Signed-off-by: wangbicheng <wangbicheng@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
linux compat: define macros for syscalls

There is a lot of boilerplate we need to write whenever we want a syscall to be
reachable through the syscall function. This patch reduces that by only having
the implementer to specify the name and its arguments.

We can probably do slightly better than this, but I believe this is simple enough
already.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: add pthread_attr_getguardsize() for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: fix namei() and friends

Add 'const' to function prototype of namei() and friends
to allow passing of a C++ converted string using c_str() which
return a const char*

Signed-off-by: Jaspal Singh Dhillon <jaspal.iiith@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mempool: add malloc_usable_size() to C linkage for porting CRuby

Signed-off-by: KANATSU Minoru <icc.pot.tyew272@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>