Skip to content
Snippets Groups Projects
  1. Jul 08, 2013
    • Nadav Har'El's avatar
      Improve error messages in "java.so -jar" · c714e257
      Nadav Har'El authored
      Print useful error messages, instead of cryptic exception traces,
      in three cases of "java.so -jar something.jar":
      
       1. When something.jar doesn't exist
       2. When something.jar exists, but can't be read as a jar (zip) file
       3. When something.jar exists, but doesn't have a "Main-Class" field
          in its manifest.
      c714e257
  2. Jun 24, 2013
    • Guy Zana's avatar
      run.js: fix argv handling, use String[] as in the java command · 0e21676c
      Guy Zana authored
      Starting the CLI and using the run command by specifying it as a run.py argument
      didn't work due to a cast problem (run expected NativeArray).
      
      previousely this didn't work:
      
      $ sudo ./scripts/run.py -n -e "java.so -jar /java/cli.jar run tools/netserver-osv -D -4 -f -N" -c2 -m1G
      0e21676c
  3. Jun 18, 2013
    • Nadav Har'El's avatar
      CLI: add tiny HTTP server · 948bea47
      Nadav Har'El authored
      This single Java source file is a full-fledged HTTP 0.9 server.
      I wanted to add it to expose the console lock bug (fixed in a separate
      patch), and to verify that bind() works correctly (it does).
      
      But additionally, this tiny HTTP server (about 6KB of compressed bytecode)
      can be very useful for our CLI - it can be run in the background and let
      you view files in the OSV system in your browser, even while another
      program is running.
      
      To run Shrew from the CLI, just run
      
      	java com.cloudius.cli.util.Shrew
      
      Which runs the HTTP server in the background (in a separate thread),
      letting the user continue to use the CLI. If you add an argument "fg" to
      this command, it runs the server in the current thread, never returning.
      
      Currently, the HTTP server is written to browse OSV's root directory
      hierarchy: accessing http://192.168.122.100:8080/ from the host shows
      you the OSV guest's root directory, and you can decend into more
      directories and download individual files.
      948bea47
  4. Jun 17, 2013
  5. Jun 04, 2013
    • Nadav Har'El's avatar
      Fix argv handling in RunJava · b4d67a4a
      Nadav Har'El authored
      The recent change, to add the program name as argv[0] for C code's
      main(), make sense for C code, but less for Java code, where main()
      normally expects args[0] to be the first argument, not the program name.
      
      So the change to RunJava.java was un-Java-like; It also broke the "java"
      CLI command which didn't put "java" in argv[0] for the arguments to
      RunJava.main(), so the "java" command no longer worked after the previous
      patch.
      
      Instead, we change java.cc (which compiles to java.so). This is what
      calls RunJava.class, and it should remove the new argv[0] before calling its
      main() - instead of expecting that RunJava.class to do this.
      b4d67a4a
    • Guy Zana's avatar
      loader: don't consume one element of argv before running main() · 1e7452c8
      Guy Zana authored
      the convention in linux is that argv[0] holds the program executable.
      I had an attempt to run netserver not from the CLI and it didn't work because
      its argument parsing got broken.
      1e7452c8
    • Nadav Har'El's avatar
      CLI: Allow running a single command non-interactively · 496d27f8
      Nadav Har'El authored
      Added the possibility to pass to cli.jar a command, which it runs instead
      of taking commands interactively. Note that the initialization script is
      run before the given command.
      
      After this patch,
      
              scripts/run.py -e "java.so -jar /java/cli.jar"
      
      Continues to run the interactive command line editor loop, as before.
      But additionally, one can do:
      
              scripts/run.py -e "java.so -jar /java/cli.jar ls"
      
      To run just the command "ls" and exit - exactly as if the user would type
      this command on the command line and exit the VM.
      
      The given command can be, of course, much longer. For example to run Jetty
      after the CLI's normal initialization script, the following monster can
      be used:
      
      scripts/run.py -n -e "java.so -jar /java/cli.jar java -classpath /jetty/* org.eclipse.jetty.xml.XmlConfiguration /jetty/jetty.xml"
      
      (Funny how a single command should say "java" 3 times and "jetty" 4 times :-))
      496d27f8
  6. Jun 03, 2013
    • Nadav Har'El's avatar
      java.so: wait for other threads to finish · 5384f24f
      Nadav Har'El authored
      java.cc would exit right after the main() method finished. But in Java,
      this is not the correct behavior. Rather, even if main() returns, we
      need to wait for all other threads to end (or more accurately, wait
      for all threads not marked with setDaemon(true)).
      
      Calling jvm->DestroyJavaVM() does this for us, and it's probably the
      Right Thing(TM) to do anyway.
      
      Before this patch, the Jetty benchmark exited immediately after
      startup.  After this patch, its worker threads keep the whole VM running.
      5384f24f
  7. May 28, 2013
    • Nadav Har'El's avatar
      Overhaul java.so command line · 31681180
      Nadav Har'El authored
      Java.so used to correctly support the "-jar" option, but did not fully
      allow the other "mode" of running Java: specifying a class name which is
      supposed to be searched in the class path. The biggest problem was that
      it only know to find class files, but not a class inside a jar in the class
      path - even if the classpath was correctly set.
      
      Unfortunately, fixing this C code was impossible, as JNI's FindClass()
      simply doesn't know to look in Jars.
      
      So this patch overhauls java.so: Java.so now only runs a fixed class,
      /java/RunJava.class. This class, in turn, is the one that parses the
      command line arguments, sets the class path, finds the jar or class to
      run, etc.. The code is now much easier to understand, and actually works
      as expected :-) It also fixes the bug we had with SpecJVM2008's "compiler.*"
      benchmarks, which forced us to tweak the class path manually.
      
      The new code supports running a class from the classpath, and also the
      "-classpath" option to set the class path. Like the "java" command line
      tool in Linux, this one also recognizes wildcard classpaths. For example,
      to run Jetty, whose code is in a dozen jars in /jetty, one can do:
      
              run.py -e "java.so -classpath /jetty/* org.eclipse.jetty.xml.XmlConfiguration jetty.xml"
      31681180
    • Guy Zana's avatar
      788b0a8d
  8. May 27, 2013
  9. May 26, 2013
  10. May 21, 2013
  11. May 19, 2013
  12. May 18, 2013
  13. May 16, 2013
    • Nadav Har'El's avatar
      Default console to cooked mode, not raw mode. · cf74861e
      Nadav Har'El authored
      Until now, OSV's console defaulted to raw mode, to make the CLI
      happy. The problem is that on Linux, applications expect to be
      run in cooked mode, so if we ever run a simple application that
      tries to read user input, it can be confused.
      
      This patch makes OSV console default to cooked mode, and the
      CLI switch to raw mode before reading an input line - and reset
      to the default mode just before running the user's command.
      
      Unfortunately, we had to resort to adding a JNI class "Stty",
      since Java has no builtin support for the ioctls required for
      changing the tty settings.
      cf74861e
  14. May 14, 2013
  15. May 12, 2013
    • Nadav Har'El's avatar
      Some badly-written Java code - including the "serial" benchmark of · 271ede99
      Nadav Har'El authored
      SPECjvm2008, uses the Thread.getContextClassLoader() class loader
      to load classes - instead of using the current class-loader as any
      decent code does when using reflection.
      
      To allow this ugly, but officially supported, usage, we need to
      set the context class loader in RunJar.java.
      271ede99
  16. May 09, 2013
  17. May 08, 2013
Loading