Beispiel #1
0
        private NvResult GetDeviceFileFromFd(int fd, out NvDeviceFile deviceFile)
        {
            deviceFile = null;

            if (fd < 0)
            {
                return(NvResult.InvalidParameter);
            }

            deviceFile = _deviceFileIdRegistry.GetData <NvDeviceFile>(fd);

            if (deviceFile == null)
            {
                Logger.Warning?.Print(LogClass.ServiceNv, $"Invalid file descriptor {fd}");

                return(NvResult.NotImplemented);
            }

            if (deviceFile.Owner.Pid != _owner.Pid)
            {
                return(NvResult.AccessDenied);
            }

            return(NvResult.Success);
        }
 public NvIoctlNotImplementedException(ServiceCtx context, NvDeviceFile deviceFile, NvIoctl command, string message)
     : base(message)
 {
     Context    = context;
     DeviceFile = deviceFile;
     Command    = command;
 }
Beispiel #3
0
 public NvQueryEventNotImplementedException(ServiceCtx context, NvDeviceFile deviceFile, uint eventId, string message)
     : base(message)
 {
     Context    = context;
     DeviceFile = deviceFile;
     EventId    = eventId;
 }
Beispiel #4
0
        public static void Destroy()
        {
            foreach (object entry in _deviceFileIdRegistry.Values)
            {
                NvDeviceFile deviceFile = (NvDeviceFile)entry;

                deviceFile.Close();
            }

            _deviceFileIdRegistry.Clear();
        }
Beispiel #5
0
        public static void Destroy()
        {
            NvHostChannelDeviceFile.Destroy();

            foreach (object entry in DeviceFileIdRegistry.Values)
            {
                NvDeviceFile deviceFile = (NvDeviceFile)entry;

                deviceFile.Close();
            }

            DeviceFileIdRegistry.Clear();
        }
Beispiel #6
0
        private int Open(ServiceCtx context, string path)
        {
            if (_deviceFileRegistry.TryGetValue(path, out Type deviceFileClass))
            {
                ConstructorInfo constructor = deviceFileClass.GetConstructor(new Type[] { typeof(ServiceCtx), typeof(IVirtualMemoryManager), typeof(ulong) });

                NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke(new object[] { context, _clientMemory, _owner });

                deviceFile.Path = path;

                return(DeviceFileIdRegistry.Add(deviceFile));
            }
            else
            {
                Logger.Warning?.Print(LogClass.ServiceNv, $"Cannot find file device \"{path}\"!");
            }

            return(-1);
        }
Beispiel #7
0
        private int Open(ServiceCtx context, string path)
        {
            if (context.Process == _owner)
            {
                if (_deviceFileRegistry.TryGetValue(path, out Type deviceFileClass))
                {
                    ConstructorInfo constructor = deviceFileClass.GetConstructor(new Type[] { typeof(ServiceCtx) });

                    NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke(new object[] { context });

                    return(_deviceFileIdRegistry.Add(deviceFile));
                }
                else
                {
                    Logger.PrintWarning(LogClass.ServiceNv, $"Cannot find file device \"{path}\"!");
                }
            }

            return(-1);
        }
 public NvIoctlNotImplementedException(ServiceCtx context, NvDeviceFile deviceFile, NvIoctl command)
     : this(context, deviceFile, command, "The ioctl is not implemented.")
 {
 }
Beispiel #9
0
 public NvQueryEventNotImplementedException(ServiceCtx context, NvDeviceFile deviceFile, uint eventId)
     : this(context, deviceFile, eventId, "This query event is not implemented.")
 {
 }