Skip to content
Snippets Groups Projects
  1. Oct 16, 2013
  2. Oct 15, 2013
  3. Oct 14, 2013
    • Nadav Har'El's avatar
      Add osv::run function · e15b3322
      Nadav Har'El authored
      
      Add a convenience function, osv::run(), to run an ELF executable.
      
      The patch includes extensive Doxygen documentation for the new function,
      also detailing the how osv::run() differs from the familiar Linux
      functions like exec(2).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      e15b3322
    • Pekka Enberg's avatar
      mmu: Fix mincore() for non-resident mmaps · 7d532448
      Pekka Enberg authored
      
      Fix mincore() to follow Linux ABI and return ENOMEM only if (part of
      the) memory range is unmapped even if it's not resident.  This is needed
      for mincore() to work with demand paged mmaps.
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      7d532448
    • Pekka Enberg's avatar
      libzpool: Fix ->rw_count type in struct krwlock · bdc4a282
      Pekka Enberg authored
      
      Fixes the following compilation error:
      
        ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c: In function ‘rw_enter’:
        ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c:205:3: error: pointer targets in passing argument 1 of ‘atomic_add_int’ differ in signedness [-Werror=pointer-sign]
           atomic_add_int(&rwlp->rw_count, 1);
           ^
        In file included from ../../bsd/sys/cddl/compat/opensolaris/sys/atomic.h:33:0,
                         from ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h:66,
                         from ../../bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h:31,
                         from ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c:32:
        ../../bsd/machine/atomic.h:285:1: note: expected ‘volatile u_int *’ but argument is of type ‘int *’
         ATOMIC_ASM(add,      int,   "addl %1,%0",  "ir",  v);
         ^
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      bdc4a282
    • Pekka Enberg's avatar
      libzpool: Fix gettimeofday() include · 4fd23254
      Pekka Enberg authored
      
      Fixes the following build breakage:
      
          CC bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.o
        ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c: In function ‘cv_timedwait’:
        ../../bsd/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c:322:2: error: implicit declaration of function ‘gettimeofday’ [-Werror=implicit-function-declaration]
          if (gettimeofday(&tv, NULL) != 0)
        ^
        cc1: all warnings being treated as errors
      
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      4fd23254
    • Nadav Har'El's avatar
      Add forgotten dlfcn.cc · d2397b7e
      Nadav Har'El authored
      
      I forgot to commit the change to dlfcn.cc in the previous patch. Sorry...
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      d2397b7e
    • Nadav Har'El's avatar
      Rework elf::program's API · ba3e3efa
      Nadav Har'El authored
      
      This is patch v2, incorporating most of the comments from the previous round.
      
      Solves issue #47:
      
      elf::program's API - add_object() and remove_object() was problematic in
      two respects:
      
      1. It did not do reference-counting on the loaded object, so if add_object()
         was done 5 times, a single remove_object() would unmap the object and
        its 4 other users will crash.
      
      2. It is un-C++-like.
      
      This patch replaces these two functions by a single function get_library():
      
        std::shared_ptr<elf::object>
         get_library(std::string lib, std::vector<std::string> extra_path = {});
      
      get_library() returns a shared_ptr, which is reference counting and does
      proper C++-style RAII. For example in the code:
      
      	auto lib = elf::get_program()->get_library(path);
      	auto main = lib->lookup<int (int, char**)>("main");
      	int rc = main(argc, argv);
      
      once lib out of scope, the reference count of the elf::object automatically
      goes down, and if nobody else holds another shared-pointer to the same
      library, the object is destroyed (causing the shared library to be unloaded).
      
      This patch also documents, with Doxygen, all the functions it touches.
      
      IMPORTANT NOTE: This reference count is completely unrelated to the issue
      of concurrent use of dlopen()/dlclose()/dl_iterate_phdr(), which is still
      buggy and we need to fix (I have a patch for that, but it's too long to fit
      in the margin).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      ba3e3efa
Loading