Skip to content
Snippets Groups Projects
  1. Dec 03, 2013
  2. Nov 25, 2013
  3. Nov 18, 2013
  4. Nov 08, 2013
  5. Nov 04, 2013
  6. Oct 29, 2013
  7. Oct 24, 2013
  8. Oct 15, 2013
  9. Oct 14, 2013
    • 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
    • Tomasz Grabiec's avatar
      RunJava: handle directories in classpath properly · 9325f833
      Tomasz Grabiec authored
      
      URLClassLoader determines whether URL denotes a jar or directory
      by checking the last character of the path.
      
      Before:
      
         [/]% java -cp java Hello
         Uncaught Java exception:
         java.lang.ClassNotFoundException: Hello
             at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
             at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
             at java.security.AccessController.doPrivileged(Native Method)
             at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
             at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
             at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
             at io.osv.RunJava.loadClass(RunJava.java:175)
             at io.osv.RunJava.runClass(RunJava.java:115)
             at io.osv.RunJava.parseArgs(RunJava.java:81)
             at io.osv.RunJava.main(RunJava.java:27)
      
      After:
      
         [/]% java -cp java Hello
         Hello, world.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      9325f833
    • Tomasz Grabiec's avatar
      java.cc: return on error rather than abort · e0b8739c
      Tomasz Grabiec authored
      
      Currently we call abort() if something is wrong whith
      java.so command. Now that we allow to run processes from
      the command line this may not be the best behavior because
      a problem with starting a less import program will abort
      the system:
      
        [/]% run java.so -cp java Hello
        run_elf(): running main() in the context of thread 0xffffc0000c30b010
        java.so: Can't create VM.
        Aborted
      
      Instead of that we could just return and the system can
      be still usable:
      
        [/]% run java.so -cp java Hello
        run_elf(): running main() in the context of thread 0xffffc0000c30b010
        java.so: Can't create VM.
        run: finished with exitcode 1
      
        [/]%
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      e0b8739c
  10. Oct 07, 2013
  11. Oct 06, 2013
    • Nadav Har'El's avatar
      Put RunJava.class in a jar, runjava.jar · a8af5dde
      Nadav Har'El authored
      
      We use the RunJava Java class to run Java applications (both java.so
      and the "java" CLI command use it). We used to have RunJava.class
      uncompressed, in the /java directory, but this caused two problems:
      
      1. Or noticed that having a directory (/java) on the classpath causes
         thousands of stat() calls when Java tries to look for all classes
         in this directory. With a jar, its contents are read only once.
      
      2. The "java" CLI command (java.groovy) didn't work because apparently
         Groovy cannot deal with classes being in the top-level package.
      
         So this patch moves RunJava into the io.osv package, and put it into a jar
         /java/runjava.jar.
      
         Note that java.groovy is changed in a separate patch (because it's in
         a different sub-repository....)
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      a8af5dde
  12. Sep 29, 2013
    • Nadav Har'El's avatar
      Add "-version" option to RunJava · 0ec190c0
      Nadav Har'El authored
      
      Add "-version" option to RunJava, and therefore to java.so and the "java"
      CLI command.
      
      java -version now shows:
      
        java version "1.7.0_25"
        OpenJDK Runtime Environment (1.7.0_25-mockbuild_2013_07_27_13_36-b00)
        OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
      
      I can't explain why the version on the second line is different than what
      "java -version" on Fedora 18 shows for the same libjvm.so:
      
        java version "1.7.0_25"
        OpenJDK Runtime Environment (fedora-2.3.10.4.fc18-x86_64)
        OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
      0ec190c0
  13. Sep 24, 2013
  14. Sep 15, 2013
  15. Sep 11, 2013
    • Pekka Enberg's avatar
      java.so: Pass "-D" command line options to JVM · 337eda3b
      Pekka Enberg authored
      Pass the "-D" command line options that are used to configure JMX, for
      example, to the JVM.
      337eda3b
    • Nadav Har'El's avatar
      Add reboot function · 542c319b
      Nadav Har'El authored
      Added a new function, osv::reboot() (declared in <osv/power.hh>)
      for rebooting the VM.
      
      Also added a Java interface - com.cloudius.util.Power.reboot().
      
      NOTE: Power.java and/or jni/power.cc also need to be copied into
      the mgmt submodule.
      542c319b
  16. Sep 10, 2013
  17. Sep 08, 2013
  18. Sep 03, 2013
  19. Aug 29, 2013
    • Nadav Har'El's avatar
      java.so: Allow both -classpath and -jar · d96bb41a
      Nadav Har'El authored
      In the existing code, each -classpath or -jar paramter replaced the
      classpath. This is inconvenient (and unlike the Unix "java" program).
      Better just add to the classpath.
      
      For example, now we can run:
      
        java.so -cp /java/cli.jar -jar /java/web.jar app
      
        Which runs web.jar's main class, but adds both cli.jar and web.jar
        to the classpath.
      d96bb41a
  20. Aug 22, 2013
  21. Aug 21, 2013
  22. Aug 14, 2013
    • Guy Zana's avatar
      cli: fix broken 'test' command · 9502e850
      Guy Zana authored
      Broken by 92b6753b.
      
      The test command of the CLI didn't work because Javascript cannot work
      with a Java String[] array as if it is a JS array, I was surprised to see
      92b6753b and I assumed it works but
      apparently the test command got broken.
      
      This patch properly returning a Scriptable object that Javascript
      code understands, it acquires a thread specific Rhino Context that
      is used to cast the test names to a JS array, and from there the JS
      code picks it up.
      9502e850
  23. Aug 05, 2013
  24. Aug 04, 2013
    • Nadav Har'El's avatar
      CLI: Telnet connection shouldn't mess with console's stty · a8e0b003
      Nadav Har'El authored
      Our CLI changes the console's tty mode to raw when doing its line
      editing, and back to the original (cooked) mode when running a command.
      Obviously, when we're running on a telnet connection we shouldn't touch
      the console's mode like the existing code did.
      
      OSV doesn't (at least for now) have ptys, so we can't handle the
      telnet connection exactly like we handled the console, and the kernel
      can't implement a "cooked" line discipline for us like it implemented on
      the console. But we can do a very similar thing in Java instead:
      
      This patch adds a new Java class, "TTY", which has an input and output
      stream and an "stty" interface. We have one implementation for the console
      (using System.in, System.out and the console's Stty), and a different
      implementation, TelnetTTY, for a telnet connection.
      
      This patch does not currently implement a line discipline ("cooked mode")
      for this TelnetTTY, so it will always stay in raw mode. This is fine for all
      our current uses of the CLI, but if in the future we have commands that read
      user input and expect cooked mode (echo, line editing), we'll need to
      implement this line discipline.
      a8e0b003
  25. Jul 30, 2013
    • Nadav Har'El's avatar
      CLI: Telnet server · 0b2df7d9
      Nadav Har'El authored
      This patch adds a simple telnet server to OSV, implemented in Java.
      One can telnet to the VM's IP address (default port 23) and get a CLI
      shell. Multiple concurrent telnet sessions are supported (and the shells
      are independent, as expected).
      
      To start the telnet server, simply run the com.cloudius.cli.util.TelnetCLI
      class. For example, in the CLI to start a telnet server in the background
      use:
      
      	java com.cloudius.cli.util.TelnetCLI &
      
      To start OSV with only a telnet server, try
      
      	sudo scripts/run.py -c1 -nv -m2G -e "java.so -jar
      		/java/cli.jar java  com.cloudius.cli.util.TelnetCLI"
      
      (The "cli.jar" in the last example is only needed to set the IP address...)
      
      In the future we can turn the telnet server on by default - but let's
      add a password feature first :-) Right now, there's no password requested
      when someone telnets in.
      0b2df7d9
    • Nadav Har'El's avatar
      CLI: Allow setting the CLI's input/output streams · 08ce572f
      Nadav Har'El authored
      The CLI used to assume it was using System.in, System.out (which point
      to the console). Now make these parameters. We need this so we can run the
      CLI on a telnet connection, and it doesn't send output to the console or try
      to read from it.
      08ce572f
  26. Jul 29, 2013
    • Nadav Har'El's avatar
      CLI: Remove global (JVM-wide) variables. · 92b6753b
      Nadav Har'El authored
      RhinoCLI relied on a bunch of global Java variables such as _cx and _args.
      This was not only ugly, it also prevents us from running multiple instances
      of the CLI on the same JVM - e.g., to support multiple telnet connections.
      
      There isn't actually a need for these JVM-wide global variables. At most,
      we need to global use variables in the Javascript interpreter (so each
      instance of the interpreter would have its own copy).
      
      This patch puts main's arguments in a new global-per-javascript-interpreter
      variable "mainargs" instead of the global-for-entire-JVM _args. "_cx" isn't
      needed at all: one of uses was to for Java to convert a String[] into the
      equivalent Javascript alternative - but Java should just return String[]
      and let Javascript worry about handling that (it seems to work just fine
      without change). A second use was for returning an exit code, but a more
      appropriate methods to do the same thing without global variables exist.
      92b6753b
  27. Jul 28, 2013
Loading