Re: [osv-dev] [PATCH] libc: implement posix_madvise

2021-12-21 Thread Nadav Har'El
On Wed, Dec 22, 2021 at 12:42 AM Waldek Kozaczuk 
wrote:

> The OSV_LIBC_API macro makes sure that during the compilation phase the
> posix_madvise symbol is left as GLOBAL DEFAULT in the libc/mman.o where all
> other symbols are left hidden. The presence of posix_madvise in those 4
> symbols files is used to feed the version script that is used by the linker
> to eliminate all other symbols but the ones listed in the sum of the
> symbols files for given architecture - aarch64 or x64. The reason we have
> given symbol occur almost always in 4 of those files [(x64 + aarch64) times
> 2] is because most symbols are also present in ld-musl-x86_64.so.1 and our
> dynamic linker advertises this library as well. And each of the symbol
> files was originally generated using scripts/extract_symbols.sh which
> identifies symbols to be exported against a version of kernel.elf built
> with all symbols exported and given Linux library file from the host. At
> the end of the day, it does not matter which file the given symbol is part
> of as we collapse them all into a single version script.
>
> The OSV_LIBC_API used during the compilation phase and the symbol files
> used by the linker may be seen as a duplicate mechanism and frankly, the
> version script would have been enough to export (keep) symbols we want to.
> However OSV_LIBC_API + -fvisibility-hidden "*lets the optimizer produce
> better code*" (see https://gcc.gnu.org/wiki/Visibility) and this
> mechanism but itself is also not enough because there are still some
> symbols left (C++ typeinfo and other symbols, possibly originating from
> libstdc++.a) what we need to eliminate using the version script and linker.
>

Thanks for the explanation.

So, my next question would be if we can automatically produce the linker
scripts, in one of two ways:
1. Recreate them every time on the user's build machine like you said you
build them for the first time, or
2. Create at least parts of it from automatic grepping of OSV_LIBC_API et
al. in the source files.

The goal is that you won't need to remember to add a symbols in 6 different
places for it to work.
Keep in mind that we'll note really ave comprehensive tests for all symbols
in all cases, so if I forget to add new_function() to libdl, or to aarch64,
I might not notice this in my tests.

If the answer is no, then my question would be if we could at least not
duplicate the linker scripts. Can't x86 and aarch have the same list of
exported functions? And if two libraries contain the same symbols, could we
somehow automatically copy symbols between them?


> On Tuesday, December 21, 2021 at 4:45:42 PM UTC-5 Nadav Har'El wrote:
>
>> Can you please remind me why we need both OSV_LIBC_API and putting the
>> function name in 5 different files?
>> Isn't there a big risk that later when all this export stuff is less
>> fresh in our mind, we forget one of these 6 places and create a mess?
>>
>> --
>> Nadav Har'El
>> n...@scylladb.com
>>
>>
>> On Tue, Dec 21, 2021 at 8:26 PM Waldemar Kozaczuk 
>> wrote:
>>
>>> Some apps/runtimes like dotnet call posix_madvise
>>> which we do not implement. This patch adds a simple
>>> implementation of it based on madvise with a difference
>>> that only POSIX_MADV_DONTNEED is supported. On top of
>>> this as required posix_madvise() returns an error without
>>> setting errno.
>>>
>>> Signed-off-by: Waldemar Kozaczuk 
>>> ---
>>>  .../aarch64/osv_ld-musl-aarch64.so.1.symbols   |  1 +
>>>  exported_symbols/aarch64/osv_libc.so.6.symbols |  1 +
>>>  .../x64/osv_ld-musl-x86_64.so.1.symbols|  1 +
>>>  exported_symbols/x64/osv_libc.so.6.symbols |  1 +
>>>  libc/mman.cc   | 14 ++
>>>  5 files changed, 18 insertions(+)
>>>
>>> diff --git a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>>> b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>>> index c463131a..4c284fba 100644
>>> --- a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>>> +++ b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>>> @@ -739,6 +739,7 @@ posix_fadvise
>>>  posix_fadvise64
>>>  posix_fallocate
>>>  posix_fallocate64
>>> +posix_madvise
>>>  posix_memalign
>>>  pow
>>>  pow10
>>> diff --git a/exported_symbols/aarch64/osv_libc.so.6.symbols
>>> b/exported_symbols/aarch64/osv_libc.so.6.symbols
>>> index 000191b7..ea0bfcdc 100644
>>> --- a/exported_symbols/aarch64/osv_libc.so.6.symbols
>>> +++ b/exported_symbols/aarch64/osv_libc.so.6.symbols
>>> @@ -667,6 +667,7 @@ posix_fadvise
>>>  posix_fadvise64
>>>  posix_fallocate
>>>  posix_fallocate64
>>> +posix_madvise
>>>  posix_memalign
>>>  ppoll
>>>  prctl
>>> diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>>> b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>>> index b3f87859..d88e98ed 100644
>>> --- a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>>> +++ b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>>> @@ -721,6 +721,7 @@ posix_fadvi

Re: [osv-dev] [PATCH] libc: implement posix_madvise

2021-12-21 Thread Waldek Kozaczuk
The OSV_LIBC_API macro makes sure that during the compilation phase the 
posix_madvise symbol is left as GLOBAL DEFAULT in the libc/mman.o where all 
other symbols are left hidden. The presence of posix_madvise in those 4 
symbols files is used to feed the version script that is used by the linker 
to eliminate all other symbols but the ones listed in the sum of the 
symbols files for given architecture - aarch64 or x64. The reason we have 
given symbol occur almost always in 4 of those files [(x64 + aarch64) times 
2] is because most symbols are also present in ld-musl-x86_64.so.1 and our 
dynamic linker advertises this library as well. And each of the symbol 
files was originally generated using scripts/extract_symbols.sh which 
identifies symbols to be exported against a version of kernel.elf built 
with all symbols exported and given Linux library file from the host. At 
the end of the day, it does not matter which file the given symbol is part 
of as we collapse them all into a single version script. 

The OSV_LIBC_API used during the compilation phase and the symbol files 
used by the linker may be seen as a duplicate mechanism and frankly, the 
version script would have been enough to export (keep) symbols we want to. 
However OSV_LIBC_API + -fvisibility-hidden "*lets the optimizer produce 
better code*" (see https://gcc.gnu.org/wiki/Visibility) and this mechanism 
but itself is also not enough because there are still some symbols left 
(C++ typeinfo and other symbols, possibly originating from libstdc++.a) 
what we need to eliminate using the version script and linker.

On Tuesday, December 21, 2021 at 4:45:42 PM UTC-5 Nadav Har'El wrote:

> Can you please remind me why we need both OSV_LIBC_API and putting the 
> function name in 5 different files?
> Isn't there a big risk that later when all this export stuff is less fresh 
> in our mind, we forget one of these 6 places and create a mess?
>
> --
> Nadav Har'El
> n...@scylladb.com
>
>
> On Tue, Dec 21, 2021 at 8:26 PM Waldemar Kozaczuk  
> wrote:
>
>> Some apps/runtimes like dotnet call posix_madvise
>> which we do not implement. This patch adds a simple
>> implementation of it based on madvise with a difference
>> that only POSIX_MADV_DONTNEED is supported. On top of
>> this as required posix_madvise() returns an error without
>> setting errno.
>>
>> Signed-off-by: Waldemar Kozaczuk 
>> ---
>>  .../aarch64/osv_ld-musl-aarch64.so.1.symbols   |  1 +
>>  exported_symbols/aarch64/osv_libc.so.6.symbols |  1 +
>>  .../x64/osv_ld-musl-x86_64.so.1.symbols|  1 +
>>  exported_symbols/x64/osv_libc.so.6.symbols |  1 +
>>  libc/mman.cc   | 14 ++
>>  5 files changed, 18 insertions(+)
>>
>> diff --git a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols 
>> b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>> index c463131a..4c284fba 100644
>> --- a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>> +++ b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
>> @@ -739,6 +739,7 @@ posix_fadvise
>>  posix_fadvise64
>>  posix_fallocate
>>  posix_fallocate64
>> +posix_madvise
>>  posix_memalign
>>  pow
>>  pow10
>> diff --git a/exported_symbols/aarch64/osv_libc.so.6.symbols 
>> b/exported_symbols/aarch64/osv_libc.so.6.symbols
>> index 000191b7..ea0bfcdc 100644
>> --- a/exported_symbols/aarch64/osv_libc.so.6.symbols
>> +++ b/exported_symbols/aarch64/osv_libc.so.6.symbols
>> @@ -667,6 +667,7 @@ posix_fadvise
>>  posix_fadvise64
>>  posix_fallocate
>>  posix_fallocate64
>> +posix_madvise
>>  posix_memalign
>>  ppoll
>>  prctl
>> diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols 
>> b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>> index b3f87859..d88e98ed 100644
>> --- a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>> +++ b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
>> @@ -721,6 +721,7 @@ posix_fadvise
>>  posix_fadvise64
>>  posix_fallocate
>>  posix_fallocate64
>> +posix_madvise
>>  __posix_getopt
>>  posix_memalign
>>  pow
>> diff --git a/exported_symbols/x64/osv_libc.so.6.symbols 
>> b/exported_symbols/x64/osv_libc.so.6.symbols
>> index 6635cabb..07b5368b 100644
>> --- a/exported_symbols/x64/osv_libc.so.6.symbols
>> +++ b/exported_symbols/x64/osv_libc.so.6.symbols
>> @@ -596,6 +596,7 @@ posix_fadvise
>>  posix_fadvise64
>>  posix_fallocate
>>  posix_fallocate64
>> +posix_madvise
>>  __posix_getopt
>>  posix_memalign
>>  ppoll
>> diff --git a/libc/mman.cc b/libc/mman.cc
>> index 9dd6429a..75a94eb0 100644
>> --- a/libc/mman.cc
>> +++ b/libc/mman.cc
>> @@ -257,3 +257,17 @@ void *sbrk(intptr_t increment)
>>  errno = ENOMEM;
>>  return (void *)-1;
>>  }
>> +
>> +static unsigned posix_madvise_to_advise(int advice)
>> +{
>> +if (advice == POSIX_MADV_DONTNEED) {
>> +return mmu::advise_dontneed;
>> +}
>> +return 0;
>> +}
>> +
>> +OSV_LIBC_API
>> +int posix_madvise(void *addr, size_t len, int advice

Re: [osv-dev] [PATCH] libc: implement posix_madvise

2021-12-21 Thread Nadav Har'El
Can you please remind me why we need both OSV_LIBC_API and putting the
function name in 5 different files?
Isn't there a big risk that later when all this export stuff is less fresh
in our mind, we forget one of these 6 places and create a mess?

--
Nadav Har'El
n...@scylladb.com


On Tue, Dec 21, 2021 at 8:26 PM Waldemar Kozaczuk 
wrote:

> Some apps/runtimes like dotnet call posix_madvise
> which we do not implement. This patch adds a simple
> implementation of it based on madvise with a difference
> that only POSIX_MADV_DONTNEED is supported. On top of
> this as required posix_madvise() returns an error without
> setting errno.
>
> Signed-off-by: Waldemar Kozaczuk 
> ---
>  .../aarch64/osv_ld-musl-aarch64.so.1.symbols   |  1 +
>  exported_symbols/aarch64/osv_libc.so.6.symbols |  1 +
>  .../x64/osv_ld-musl-x86_64.so.1.symbols|  1 +
>  exported_symbols/x64/osv_libc.so.6.symbols |  1 +
>  libc/mman.cc   | 14 ++
>  5 files changed, 18 insertions(+)
>
> diff --git a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
> b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
> index c463131a..4c284fba 100644
> --- a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
> +++ b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
> @@ -739,6 +739,7 @@ posix_fadvise
>  posix_fadvise64
>  posix_fallocate
>  posix_fallocate64
> +posix_madvise
>  posix_memalign
>  pow
>  pow10
> diff --git a/exported_symbols/aarch64/osv_libc.so.6.symbols
> b/exported_symbols/aarch64/osv_libc.so.6.symbols
> index 000191b7..ea0bfcdc 100644
> --- a/exported_symbols/aarch64/osv_libc.so.6.symbols
> +++ b/exported_symbols/aarch64/osv_libc.so.6.symbols
> @@ -667,6 +667,7 @@ posix_fadvise
>  posix_fadvise64
>  posix_fallocate
>  posix_fallocate64
> +posix_madvise
>  posix_memalign
>  ppoll
>  prctl
> diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
> b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
> index b3f87859..d88e98ed 100644
> --- a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
> +++ b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
> @@ -721,6 +721,7 @@ posix_fadvise
>  posix_fadvise64
>  posix_fallocate
>  posix_fallocate64
> +posix_madvise
>  __posix_getopt
>  posix_memalign
>  pow
> diff --git a/exported_symbols/x64/osv_libc.so.6.symbols
> b/exported_symbols/x64/osv_libc.so.6.symbols
> index 6635cabb..07b5368b 100644
> --- a/exported_symbols/x64/osv_libc.so.6.symbols
> +++ b/exported_symbols/x64/osv_libc.so.6.symbols
> @@ -596,6 +596,7 @@ posix_fadvise
>  posix_fadvise64
>  posix_fallocate
>  posix_fallocate64
> +posix_madvise
>  __posix_getopt
>  posix_memalign
>  ppoll
> diff --git a/libc/mman.cc b/libc/mman.cc
> index 9dd6429a..75a94eb0 100644
> --- a/libc/mman.cc
> +++ b/libc/mman.cc
> @@ -257,3 +257,17 @@ void *sbrk(intptr_t increment)
>  errno = ENOMEM;
>  return (void *)-1;
>  }
> +
> +static unsigned posix_madvise_to_advise(int advice)
> +{
> +if (advice == POSIX_MADV_DONTNEED) {
> +return mmu::advise_dontneed;
> +}
> +return 0;
> +}
> +
> +OSV_LIBC_API
> +int posix_madvise(void *addr, size_t len, int advice) {
> +auto err = mmu::advise(addr, len, posix_madvise_to_advise(advice));
> +return err.get();
> +}
> --
> 2.31.1
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to osv-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/osv-dev/20211221182614.242226-1-jwkozaczuk%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/CANEVyjsy2qaz-LRX4ZjMuRFa848e2rjAbsTs239HObzYiF5Ueg%40mail.gmail.com.


[osv-dev] [PATCH] libc: implement posix_madvise

2021-12-21 Thread Waldemar Kozaczuk
Some apps/runtimes like dotnet call posix_madvise
which we do not implement. This patch adds a simple
implementation of it based on madvise with a difference
that only POSIX_MADV_DONTNEED is supported. On top of
this as required posix_madvise() returns an error without
setting errno.

Signed-off-by: Waldemar Kozaczuk 
---
 .../aarch64/osv_ld-musl-aarch64.so.1.symbols   |  1 +
 exported_symbols/aarch64/osv_libc.so.6.symbols |  1 +
 .../x64/osv_ld-musl-x86_64.so.1.symbols|  1 +
 exported_symbols/x64/osv_libc.so.6.symbols |  1 +
 libc/mman.cc   | 14 ++
 5 files changed, 18 insertions(+)

diff --git a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols 
b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
index c463131a..4c284fba 100644
--- a/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
+++ b/exported_symbols/aarch64/osv_ld-musl-aarch64.so.1.symbols
@@ -739,6 +739,7 @@ posix_fadvise
 posix_fadvise64
 posix_fallocate
 posix_fallocate64
+posix_madvise
 posix_memalign
 pow
 pow10
diff --git a/exported_symbols/aarch64/osv_libc.so.6.symbols 
b/exported_symbols/aarch64/osv_libc.so.6.symbols
index 000191b7..ea0bfcdc 100644
--- a/exported_symbols/aarch64/osv_libc.so.6.symbols
+++ b/exported_symbols/aarch64/osv_libc.so.6.symbols
@@ -667,6 +667,7 @@ posix_fadvise
 posix_fadvise64
 posix_fallocate
 posix_fallocate64
+posix_madvise
 posix_memalign
 ppoll
 prctl
diff --git a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols 
b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
index b3f87859..d88e98ed 100644
--- a/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
+++ b/exported_symbols/x64/osv_ld-musl-x86_64.so.1.symbols
@@ -721,6 +721,7 @@ posix_fadvise
 posix_fadvise64
 posix_fallocate
 posix_fallocate64
+posix_madvise
 __posix_getopt
 posix_memalign
 pow
diff --git a/exported_symbols/x64/osv_libc.so.6.symbols 
b/exported_symbols/x64/osv_libc.so.6.symbols
index 6635cabb..07b5368b 100644
--- a/exported_symbols/x64/osv_libc.so.6.symbols
+++ b/exported_symbols/x64/osv_libc.so.6.symbols
@@ -596,6 +596,7 @@ posix_fadvise
 posix_fadvise64
 posix_fallocate
 posix_fallocate64
+posix_madvise
 __posix_getopt
 posix_memalign
 ppoll
diff --git a/libc/mman.cc b/libc/mman.cc
index 9dd6429a..75a94eb0 100644
--- a/libc/mman.cc
+++ b/libc/mman.cc
@@ -257,3 +257,17 @@ void *sbrk(intptr_t increment)
 errno = ENOMEM;
 return (void *)-1;
 }
+
+static unsigned posix_madvise_to_advise(int advice)
+{
+if (advice == POSIX_MADV_DONTNEED) {
+return mmu::advise_dontneed;
+}
+return 0;
+}
+
+OSV_LIBC_API
+int posix_madvise(void *addr, size_t len, int advice) {
+auto err = mmu::advise(addr, len, posix_madvise_to_advise(advice));
+return err.get();
+}
-- 
2.31.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20211221182614.242226-1-jwkozaczuk%40gmail.com.


[osv-dev] [COMMIT osv master] zfs: extract zfs code as optional libsolaris.so

2021-12-21 Thread Commit Bot
From: Waldemar Kozaczuk 
Committer: Waldemar Kozaczuk 
Branch: master

zfs: extract zfs code as optional libsolaris.so

Originally I thought that extracting ZFS out of the kernel
as a shared library would not be as easy as it it has turned out to
be. Obviously after figuring couple of important gotchas which I
describe below and in the code comments.

The advantages of moving ZFS to a separate library are following:
- kernel becomes ~900K smaller
- there are at least 10 less threads needed to run non-ZFS image
  (running ROFS image on 1 cpu requires only 25 threads)

I also hope this patch provides a blueprint of how we could implement
another ext2/3/4 filesystem driver (see #1179) or other true kernel modules.

The essence of this patch are changes to the main makefile to build
new libsolaris.so and various ZFS-related parts of the kernel like
pagecache, arc_shrinker and ZFS dev driver to make them call into
libsolaris.so upon dynamically registering handful of callbacks.

The new libsolaris.so is mainly composed of the solaris and zfs sets
as defined in the makefile (and not part of the kernel anymore)
plus bsd RPC code (xdr*), kobj and finally new fs/zfs/zfs_initialize.c
which provides main INIT function - zfs_initialize(). The
zfs_initialize() initializes various ZFS resources like threads and
memory and registers various callback functions into the main kernel
(see comments in zfs_initialize.c).

Two important gotchas I have discovered are:
1) The libsolaris.so needs to build with BIND_NOW to make all symbols
   resolved eagerly to avoid page faults to resolve those symbols later
   if the ZFS code in libsolaris.so is called to resolve other faults.
   This would cause deadlocks.
2) The libsolaris.so needs the osv-mlock note so that dynamic linker
   would populate the mappings. This is similar to above to avoid page
   faults later that would lead to deadlocks.

Please note the libsolaris.so is built with most symbols hidden
and code garbage collection on to help minimize its size (804K)
and expose minimum number of symbols (< 100) needed by libzfs.so.
The latter also helps avoid possible symbol collision with other apps.

We also make changes to loader.cc to dlopen("/libsolaris.so") before
we mount ZFS filesystem (for that reason libsolaris.so needs to be part
of the bootfs for ZFS images). Because ZFS is root filesystem, we cannot
use the same approach we used for nfs which is also implemented as a
shared library but loaded in pivot_rootfs() which happens much later.

In theory we could build mixed disk with two partitions - 1st ROFS
one with libsolaris.so on it and the 2nd ZFS one which would be mounted
after we mount ROFS and load and initialize libsolaris.so from it.

I have tested this patch by running unit tests (all pass) and also using
tests/misc-zfs-io.cc as well as running stress test of MySQL on ZFS
image.

Fixes #1009

Signed-off-by: Waldemar Kozaczuk 

---
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -568,7 +568,6 @@ bsd += bsd/porting/kthread.o
 bsd += bsd/porting/mmu.o
 bsd += bsd/porting/pcpu.o
 bsd += bsd/porting/bus_dma.o
-bsd += bsd/porting/kobj.o
 bsd += bsd/sys/netinet/if_ether.o
 bsd += bsd/sys/compat/linux/linux_socket.o
 bsd += bsd/sys/compat/linux/linux_ioctl.o
@@ -618,9 +617,6 @@ bsd += bsd/sys/netinet/cc/cc_cubic.o
 bsd += bsd/sys/netinet/cc/cc_htcp.o
 bsd += bsd/sys/netinet/cc/cc_newreno.o
 bsd += bsd/sys/netinet/arpcache.o
-bsd += bsd/sys/xdr/xdr.o
-bsd += bsd/sys/xdr/xdr_array.o
-bsd += bsd/sys/xdr/xdr_mem.o
 bsd += bsd/sys/xen/evtchn.o
 
 ifeq ($(arch),x64)
@@ -644,6 +640,11 @@ bsd += bsd/sys/dev/random/live_entropy_sources.o
 
 $(out)/bsd/sys/%.o: COMMON += -Wno-sign-compare -Wno-narrowing 
-Wno-write-strings -Wno-parentheses -Wno-unused-but-set-variable
 
+xdr :=
+xdr += bsd/sys/xdr/xdr.o
+xdr += bsd/sys/xdr/xdr_array.o
+xdr += bsd/sys/xdr/xdr_mem.o
+
 solaris :=
 solaris += bsd/sys/cddl/compat/opensolaris/kern/opensolaris.o
 solaris += bsd/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.o
@@ -799,7 +800,7 @@ libtsm += drivers/libtsm/tsm_screen.o
 libtsm += drivers/libtsm/tsm_vte.o
 libtsm += drivers/libtsm/tsm_vte_charsets.o
 
-drivers := $(bsd) $(solaris)
+drivers := $(bsd)
 drivers += core/mmu.o
 drivers += arch/$(arch)/early-console.o
 drivers += drivers/console.o
@@ -1849,6 +1850,7 @@ fs_objs += virtiofs/virtiofs_vfsops.o \
 fs_objs += pseudofs/pseudofs.o
 fs_objs += procfs/procfs_vnops.o
 fs_objs += sysfs/sysfs_vnops.o
+fs_objs += zfs/zfs_null_vfsops.o
 
 objects += $(addprefix fs/, $(fs_objs))
 objects += $(addprefix libc/, $(libc))
@@ -2035,11 +2037,11 @@ $(out)/empty_bootfs.o: ASFLAGS += -I$(out)
 
 $(out)/tools/mkfs/mkfs.so: $(out)/tools/mkfs/mkfs.o $(out)/libzfs.so
$(makedir)
-   $(call quiet, $(CC) $(CFLAGS) -o $@ $(out)/tools/mkfs/mkfs.o -L$(out) 
-lzfs, LINK mkfs.so)
+   $(call quiet, $(CC) $(CFLAGS) -o $@ $(out)/tools/mkfs/mkfs.o -L$(out) 
-lzfs -lstdc++, LINK mkfs.so)
 
 $(out)/tools/cpiod/cpiod.so: $(out)/tool

[osv-dev] [COMMIT osv master] zfs: expose some symbols in solaris part of bsd code

2021-12-21 Thread Commit Bot
From: Waldemar Kozaczuk 
Committer: Waldemar Kozaczuk 
Branch: master

zfs: expose some symbols in solaris part of bsd code

This patch annotates ~90 symbols with explicit public visibility
across various parts of ZFS or related code in the bsd/ subtree. This is
in preparation of the next patch that extracts ZFS code into a separate
libsolaris.so library where all symbols but the ones marked here as public.
These symbols need to be exposed for the main user of libsolaris.so - libzfs.so.

Signed-off-by: Waldemar Kozaczuk 

---
diff --git a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c 
b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
--- a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
+++ b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
@@ -35,6 +35,8 @@
 #include 
 #include 
 
+#include 
+
 void *
 zfs_kmem_alloc(size_t size, int kmflags)
 {
@@ -133,6 +135,7 @@ kmem_debugging(void)
return (0);
 }
 
+OSV_LIB_SOLARIS_API
 uint64_t kmem_size(void)
 {
return physmem * PAGE_SIZE;
diff --git a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c 
b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
--- a/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
+++ b/bsd/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
@@ -35,12 +35,14 @@
 #include 
 #include 
 #include 
+#include 
 
 static uma_zone_t taskq_zone;
 
+OSV_LIB_SOLARIS_API
 taskq_t *system_taskq = NULL;
 
-void
+OSV_LIB_SOLARIS_API void
 system_taskq_init(void *arg)
 {
taskq_zone = uma_zcreate("taskq_zone", sizeof(struct ostask),
@@ -49,7 +51,7 @@ system_taskq_init(void *arg)
 }
 SYSINIT(system_taskq_init, SI_SUB_CONFIGURE, SI_ORDER_ANY, system_taskq_init, 
NULL);
 
-void
+OSV_LIB_SOLARIS_API void
 system_taskq_fini(void *arg)
 {
 
@@ -58,7 +60,7 @@ system_taskq_fini(void *arg)
 }
 SYSUNINIT(system_taskq_fini, SI_SUB_CONFIGURE, SI_ORDER_ANY, 
system_taskq_fini, NULL);
 
-taskq_t *
+OSV_LIB_SOLARIS_API taskq_t *
 taskq_create(const char *name, int nthreads, pri_t pri, int minalloc 
__bsd_unused2,
 int maxalloc __bsd_unused2, uint_t flags)
 {
@@ -83,7 +85,7 @@ taskq_create_proc(const char *name, int nthreads, pri_t pri, 
int minalloc,
return (taskq_create(name, nthreads, pri, minalloc, maxalloc, flags));
 }
 
-void
+OSV_LIB_SOLARIS_API void
 taskq_destroy(taskq_t *tq)
 {
 
@@ -108,7 +110,7 @@ taskq_run(void *arg, int pending __bsd_unused2)
uma_zfree(taskq_zone, task);
 }
 
-taskqid_t
+OSV_LIB_SOLARIS_API taskqid_t
 taskq_dispatch(taskq_t *tq, task_func_t func, void *arg, uint_t flags)
 {
struct ostask *task;
diff --git a/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c 
b/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
--- a/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
+++ b/bsd/sys/cddl/contrib/opensolaris/common/avl/avl.c
@@ -93,6 +93,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Small arrays to translate between balance (or diff) values and child 
indeces.
@@ -121,7 +122,7 @@ static const int  avl_balance2child[]   = {0, 0, 1};
  * NULL - if at the end of the nodes
  * otherwise next node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_walk(avl_tree_t *tree, void*oldnode, int left)
 {
size_t off = tree->avl_offset;
@@ -168,7 +169,7 @@ avl_walk(avl_tree_t *tree, void *oldnode, int left)
  * Return the lowest valued node in a tree or NULL.
  * (leftmost child from root of tree)
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_first(avl_tree_t *tree)
 {
avl_node_t *node;
@@ -187,7 +188,7 @@ avl_first(avl_tree_t *tree)
  * Return the highest valued node in a tree or NULL.
  * (rightmost child from root of tree)
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_last(avl_tree_t *tree)
 {
avl_node_t *node;
@@ -211,7 +212,7 @@ avl_last(avl_tree_t *tree)
  * NULL: no node in the given direction
  * "void *"  of the found tree node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_nearest(avl_tree_t *tree, avl_index_t where, int direction)
 {
int child = AVL_INDEX2CHILD(where);
@@ -240,7 +241,7 @@ avl_nearest(avl_tree_t *tree, avl_index_t where, int 
direction)
  * *where (if not NULL)  is set to indicate the insertion point
  * "void *"  of the found tree node
  */
-void *
+OSV_LIB_SOLARIS_API void *
 avl_find(avl_tree_t *tree, const void *value, avl_index_t *where)
 {
avl_node_t *node;
@@ -467,7 +468,7 @@ avl_rotation(avl_tree_t *tree, avl_node_t *node, int 
balance)
  * After the node is inserted, a single rotation further up the tree may
  * be necessary to maintain an acceptable AVL balance.
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_insert(avl_tree_t *tree, void *new_data, avl_index_t where)
 {
avl_node_t *node;
@@ -617,7 +618,7 @@ avl_insert_here(
 /*
  * Add a new node to an AVL tree.
  */
-void
+OSV_LIB_SOLARIS_API void
 avl_add(avl_tree_t *tree, void *new_node)
 {
avl_index_t where;
@@ -660,7 +661,7 @@ avl_add(avl_tree_t *tree, void *new_node)
 

[osv-dev] É TERRORISTA ASSASSINO #ROBERTOJONGHILAVARINI (OLTRE CHE 卍NAZI卍, PEDOFILO E PARTE DI NDRANGHETA) DI CRIMINALISSIMO #ISTITUTOGANASSINI ISTITUTO GANASSINI DI RICERCHE BIOMEDICHE E CRIMINALISSI

2021-12-21 Thread MAURIZIO PORCARI FIDEURAM INVESTIMENTI SGR
É TERRORISTA ASSASSINO #ROBERTOJONGHILAVARINI (OLTRE CHE 卍NAZI卍, PEDOFILO E 
PARTE DI NDRANGHETA) DI CRIMINALISSIMO #ISTITUTOGANASSINI ISTITUTO 
GANASSINI DI RICERCHE BIOMEDICHE E CRIMINALISSIMO MOVIMENTO #FAREFRONTE 
FARE FRONTE! IL FIGLIO DI PUTTANA..OMICIDA ROBERTO JONGHI LAVARINI SE 
LA FA MOLTO, A LIVELLO DI RICICLAGGIO DI PROVENTI LERCISSIMI, COL NOTO COME 
"RENATO VALLANZASCA DELLA FINANZA MILANESE", IL GIÁ FINITO 3 VOLTE IN 
CARCERE: PAOLO BARRAI DI CRIMINALE #TERRANFT E CRIMINALE #TERRABITCOIN 
(TRATTASI DI UNA DELLE SUE DELINQUENZIALISSIME 4 "LAVATRICI" FINANZIARIE, 
COME DA EROICO SERVIZIO DI FANPAGE.IT 
https://youmedia.fanpage.it/video/al/YVXPpOSwUXALhewA). MA NE SCRIVEREMO 
PRESTO! É TERRORISTA NAZIST卍ASSASSINO, PURE IL NOTO PEDOFILO: 
#GIANFRANCOSTEFANIZZI DI CRIMINALISSIMO STUDIO MOAI #MOAI #STUDIOMOAI 
#MOAISTUDIO! É NAZI卍ASSASSINO #CARLOFIDANZA DI DELINQUENTISSIMO PARTITO 
MASSONICO^HITLERIANO #FRATELLIDITALIA! NE SCRIVE,  A PROPOSITO, L'EROICO 
BANCHIERE SVIZZERO #ANDREASNIGG DI BANK J SAFRA SARASIN ZURICH. A CUI, I 4 
FIGLI DI TROIACCIA GIANFRANCO STEFANIZZI, PAOLO BARRAI, CARLO FIDANZA E 
ROBERTO JONGHI LAVARINI SI SON SPESSO RIVOLTI, PER IMBOSCARE 50 MLN DI EURO 
(RICEVUTI DAL PEDOFILO STRAGISTA #SILVIOBERLUSCONI), PER CREARE NUOVE 
CELLULE TERRORISTICHE NAZI卍FASCISTE, MEGA ASSASSINE! COME 'I NUOVI NUCLEI 
ARMATI NAZISTI E RIVOLUZIONARI', 'LE SQUADRE D'AZIONE KILLER DI SILVIO 
BERLUSCONI' E 'LA ROSA DEI VENTI ASSASSINA'! A VOI IL GRANDISSIMO ANDREAS 
NIGG DI BANK J SAFRA SARASIN, DA ZURIGO.

CIAO A TUTTI. SON SEMPRE IL VOSTRO BANCHIERE SVIZZERO: ANDREAS NIGG DI BANK 
J SAFRA SARASIN.
https://citywireselector.com/manager/andreas-nigg/d2395
https://ch.linkedin.com/in/andreasnigg
https://www.blogger.com/profile/13220677517437640922

HO SERI INTERESSI IN ITALIA. HO TANTI CLIENTI A ZURIGO, DI NAZIONALITÀ 
ITALIANA. I MASSONI #GIOVANNIFERRERO E #FRANCESCOGATANOCALTAGIRONE. IL 
MASSONE GAY CHE AMA TANTO I RAGAZZINI: #GIANPAOLOGAMBA DI 
#BANCAALBERTINISYZ. OLTRE CHE I MASSONI #BENETTON, #RENZOROSSO DI DIESEL, 
#FLAVIOBRIATORE, #VITTORIOSGARBI, #CARLOBONOMI, #GIOELEMAGALDI E PURE QUEL 
DEPRAVATO SESSUALE DI #GUIDOCROSETTO EX "FRATELLI NDRANGHETISTI D'ITALIA". 
ED ARTISTI, COME I MASSONI #MONICABELLUCCI, #CARLOVERDONE ED 
#ENRICOMONTESANO (NON ESISTE PIÙ IL SEGRETO BANCARIO, QUINDI POSSO 
SCRIVERNE). PER QUESTO, VOGLIO SGAMARE IL MALE BASTARDAMENTE 
MASSO卐NAZI卐FASCISTA E BERLUSCONIANO CHE BLOCCA, STUPRA, DIREI PURE UCCIDE 
L'ITALIA, DA 35 ANNI. TANTE VOLTE MI SONO VENUTI A TROVARE A ZURIGO, I 4 
TERRORISTI HITLERIANI ED ASSASSINI GIANFRANCO STEFANIZZI, PAOLO BARRAI, 
CARLO FIDANZA E ROBERTO JONGHI LAVARINI. INSIEME AL BANCHIERE 
CRIMINALISSIMO E MOLTO PEDOFILO #GIOVANNIPIROVANO DI #BANCAMEDIOLANUM (CHE 
IN SVIZZERA, NON PER NIENTE, CHIAMIAMO TUTTI BANCA MAFIOLANUM, CAMORRANUM, 
NDRANGOLANUM, LAVALAVA PER COCALEROS COLOMBIANUM, HITLERANUM, NAZISTANUM, 
MEDIOLANUM). PROPRIO COSÍ, PARTE DEL GRUPPO ERA PURE QUELLO CHE IN FINANZA 
INTERNAZIONALE CHIAMIAMO "IL PEDOFILO NDRANGHETISTA DEL BITCOIN": IL NOTO 
PEDERASTA ASSASSINO E NAZI卍LEGHISTA #PAOLOBARRAI. VI ERA A VOLTE, PURE, IL 
MASSONE SCHIFOSAMENTE PEDOFILO, PINOCHETTIANO E NDRANGHETISTA #CARPEORO 
#GIANFRANCOPECORARO. E TALVOLTA VI ERA PURE L'EX AMANTE OMOSESSUALE DI 
#GIULIOTREMONTI GIULIO TREMONTI, OSSIA IL FROCIO FASCISTA, CHE SEMPRE 
INCULA TANTI BAMBINI: #GIOELEMAGALDI GIOELE MAGALDI (AMANTE PURE DEI FROCI 
NAZI卐LEGHISTI #LUCAMORISI & #ALDOSTORTI). MI DICEVA IL GRUPPONE, CHE I 
STRAGISTI #SILVIOBERLUSCONI ED #GIOVANNIPIROVANO VOLEVANO IMBOSCARE 50 MLN 
DI EURO, DA USARE TUTTI PER FINANZIARE NUOVE CELLULE TERRORISTE 
NAZIFASCISTE ITALIANE. DAI NOMI DI 'I NUOVI NUCLEI ARMATI NAZISTI E 
RIVOLUZIONARI', 'LE SQUADRE D'AZIONE KILLER DI SILVIO BERLUSCONI' E 'LA 
ROSA DEI VENTI ASSASSINA'. OVVIAMENTE, HO SEMPRE DETTO LORO ¨LI È LA PORTA, 
PLEASE GO, THANK YOU¨. UNA VOLTA, VENNE CON LORO PURE UN AVVOCATO ITALIANO 
STRA ASSASSINO, STRA SATANISTA, STRA MASSONE, STRA PEDOFILO, NOTO COME "IL 
JACK LO SQUARTATORE DI BAMBINI", IL BASTARDO SGOZZATORE DI BIMBI: 
#DANIELEMINOTTI DI GENOVA E CRIMINALE STUDIO LEGALE LISI. IL QUALE MI 
MINACCIÒ DICENDO "SE DICI MEZZA PAROLA DEI NOSTRI PROGETTI TERRORISTICI, TI 
AMMAZZIAMO E SQUARTIAMO MASSONICAMENTE'. PROPRIO PER VIA DI QUESTA SUA 
MINACCIA DI MORTE, IN SEGNO DI SFIDA, DICO TRE MILIONI DI PAROLE E NON SOLO 
MEZZA! E NE SCRIVO SU INTERNET, DA ORA IN AVANTI, SU TUTTI I SITI DEL MONDO 
E PER TUTTA LA MIA VITA (PREFERISCO LA MORTE, CHE PIEGARMI ALLA NAZI卍MAFIA 
ASSASSINA DEI PEZZI DI MERDA BERLUSCONICCHI, SCUSATE LO SFOGO, PLEASE). 
DICIAMOCELA TUTTA. IO SCHIFO CON TUTTE LE FORZE I NAZI卍MAFIOSI, PEDOFILI, 
ASSASSINI ANZI STRAGISTI #BERLUSCONI! SON DEI PEZZI DI MERDA #HITLER, 
#PINOCHET, #PUTIN MISTI A STRA PEZZI DI MERDA #ALCAPONE AL CAPONE, 
#TOTORIINA TOTO RINNA E #PASQUALEBARRA PASQUALE BARRA DETTO "O ANIMALE"! SI 
PRENDONO LA NAZIONE INTERA, INTRECCIANDO POTERE ECONOMICO, POTERE DI 
CORROMPERE CHIUNQUE, POTE