Beispiel #1
0
            public static ServerObject LoadServer(string name)
            {
                Process p = GetProcessByName(name);

                if (p == null)
                {
                    if (Program.Vfs == null)
                    {
                        return(null);
                    }
                    lib.MonoIOError err;
                    Formatter.WriteLine("LoadServer: opening /modules/" + name, Program.arch.DebugOutput);
                    lib.File f = lib.MonoIO.Open("/modules/" + name,
                                                 System.IO.FileMode.Open, System.IO.FileAccess.Read,
                                                 System.IO.FileShare.Read, System.IO.FileOptions.None,
                                                 out err);
                    if (f == null || f.Error != lib.MonoIOError.ERROR_SUCCESS)
                    {
                        throw new Exception("failed to open /modules/" + name + ": " +
                                            f.Error.ToString());
                    }

                    Formatter.WriteLine("LoadServer: creating process", Program.arch.DebugOutput);
                    p = Process.CreateProcess(f, name, new object[] { });
                    p.Start();
                }
                Formatter.WriteLine("LoadServer: waiting on message loop to start", Program.arch.DebugOutput);
                while (p.MessageServer == null)
                {
                    ;
                }
                return(p.MessageServer);
            }
Beispiel #2
0
        public static Process CreateProcess(lib.File file, string name, object [] parameters)
        {
            /* Create a process from an ELF module in a file object */

            ulong epoint = elf.ElfFileReader.LoadObject(Program.arch.VirtualRegions,
                                                        Program.arch.VirtMem, Program.stab, file, name, out var tls_size);

            return(Create(name, epoint, 0x8000, Program.arch.VirtualRegions, Program.stab,
                          parameters, tls_size));
        }
Beispiel #3
0
            public static Interfaces.IFileSystem LoadServerInstance(string protocol, lib.File f)
            {
                Formatter.WriteLine("LoadServerInstance: loading server " + protocol, Program.arch.DebugOutput);

                var factory = LoadServer(protocol) as Interfaces.IFactory;

                Formatter.WriteLine("LoadServer: Invoking CreateFSHandler", Program.arch.DebugOutput);
                var ret = factory.CreateFSHandler(f).Sync();

                if (ret == null)
                {
                    throw new Exception("CreateFSHandler failed");
                }

                return(ret);
            }
Beispiel #4
0
 public RPCResult <int> Write(tysos.lib.File f, long pos, byte[] dest, int dest_offset, int count)
 {
     f.Error = lib.MonoIOError.ERROR_WRITE_FAULT;
     return(0);
 }
Beispiel #5
0
 public RPCResult <bool> Close(lib.File handle)
 {
     return(true);
 }
Beispiel #6
0
 public RPCResult <tysos.lib.File.Property> GetPropertyByName(lib.File f, string name)
 {
     return(((lib.VirtualPropertyFile)f).GetPropertyByName(name));
 }
Beispiel #7
0
 public RPCResult <int> IntProperties(tysos.lib.File f)
 {
     return(((lib.VirtualPropertyFile)f).intProperties);
 }