[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 4/4] lib/posix-libdl: Add stubs



Hi,

This patch looks good, thanks. I will change minor wording of the commit 
message on upstream.

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

On 14.08.19, 16:56, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:

    Unikraft does not support dynamic loading yet, all libraries are statically
    linked. However, we simply provide stubs for those libraries that load 
dynamic
    libraries explicitly. For debugging purposes, we choose to print the 
"loaded"
    libraries names.
    
    Signed-off-by: Andrei Gogonea <andrei.gogonea09@xxxxxxxxx>
    Signed-off-by: Teodora Serbanescu <teo.serbanescu16@xxxxxxxxx>
    Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
    ---
     lib/posix-libdl/Makefile.uk   |  2 +
     lib/posix-libdl/exportsyms.uk |  7 +++-
     lib/posix-libdl/stubs.c       | 69 +++++++++++++++++++++++++++++++++++
     3 files changed, 77 insertions(+), 1 deletion(-)
     create mode 100644 lib/posix-libdl/stubs.c
    
    diff --git a/lib/posix-libdl/Makefile.uk b/lib/posix-libdl/Makefile.uk
    index 4e5109a5..27020fbd 100644
    --- a/lib/posix-libdl/Makefile.uk
    +++ b/lib/posix-libdl/Makefile.uk
    @@ -2,3 +2,5 @@ $(eval $(call addlib_s,posix_libdl,$(CONFIG_POSIX_LIBDL)))
     
     CINCLUDES-$(CONFIG_POSIX_LIBDL)    += -I$(POSIX_LIBDL_BASE)/include
     CXXINCLUDES-$(CONFIG_POSIX_LIBDL)  += -I$(POSIX_LIBDL_BASE)/include
    +
    +POSIX_LIBDL_SRCS-y += $(POSIX_LIBDL_BASE)/stubs.c
    diff --git a/lib/posix-libdl/exportsyms.uk b/lib/posix-libdl/exportsyms.uk
    index 621e94f0..77c7a542 100644
    --- a/lib/posix-libdl/exportsyms.uk
    +++ b/lib/posix-libdl/exportsyms.uk
    @@ -1 +1,6 @@
    -none
    +dlopen
    +dlclose
    +dlsym
    +dlerror
    +dladdr
    +dlinfo
    \ No newline at end of file
    diff --git a/lib/posix-libdl/stubs.c b/lib/posix-libdl/stubs.c
    new file mode 100644
    index 00000000..dbfac7d1
    --- /dev/null
    +++ b/lib/posix-libdl/stubs.c
    @@ -0,0 +1,69 @@
    +/* SPDX-License-Identifier: BSD-3-Clause */
    +/*
    + * Authors: Andrei Gogonea <andrei.gogonea09@xxxxxxxxx>
    + *
    + * Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
    + *
    + * Redistribution and use in source and binary forms, with or without
    + * modification, are permitted provided that the following conditions
    + * are met:
    + *
    + * 1. Redistributions of source code must retain the above copyright
    + *    notice, this list of conditions and the following disclaimer.
    + * 2. Redistributions in binary form must reproduce the above copyright
    + *    notice, this list of conditions and the following disclaimer in the
    + *    documentation and/or other materials provided with the distribution.
    + * 3. Neither the name of the copyright holder nor the names of its
    + *    contributors may be used to endorse or promote products derived from
    + *    this software without specific prior written permission.
    + *
    + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
IS"
    + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE
    + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE
    + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 
BE
    + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
THE
    + * POSSIBILITY OF SUCH DAMAGE.
    + *
    + * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
    + */
    +
    +#include <uk/essentials.h>
    +#include <uk/print.h>
    +#include <dlfcn.h>
    +
    +
    +void *dlopen(const char *filename, int flags)
    +{
    +   uk_pr_debug("%s(%s, %d)\n", __func__, filename, flags);
    +   return 0;
    +}
    +
    +int dlclose(void *handle __unused)
    +{
    +   return 0;
    +}
    +
    +void *dlsym(void *handle __unused, const char *symbol __unused)
    +{
    +   return 0;
    +}
    +
    +char *dlerror(void)
    +{
    +   return 0;
    +}
    +
    +int dladdr(const void *addr __unused, Dl_info *info __unused)
    +{
    +   return 0;
    +}
    +
    +int dlinfo(void *handle __unused, int request __unused, void *info 
__unused)
    +{
    +   return 0;
    +}
    -- 
    2.20.1
    
    

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.