Class: Mach::Task

Inherits:
Port
  • Object
show all
Includes:
Functions
Defined in:
lib/mach/task.rb

Instance Attribute Summary

Attributes inherited from Port

#ipc_space, #port

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Functions

attach_mach_function, error_check, error_check_bootstrap, new_memory_pointer, #new_memory_pointer

Methods included from Types

#enum, #find_type, typedefs

Methods inherited from Port

#==, #copy_send, #deallocate, #destroy, #insert_right, #receive_right, #send_right, #to_s

Constructor Details

#initialize(task) ⇒ Task

Returns a new instance of Task.



13
14
15
# File 'lib/mach/task.rb', line 13

def initialize(task)
  super(:port => task)
end

Class Method Details

.selfTask

Returns:



9
10
11
# File 'lib/mach/task.rb', line 9

def self.self
  new(Functions.mach_task_self)
end

Instance Method Details

#get_bootstrap_portObject



33
34
35
# File 'lib/mach/task.rb', line 33

def get_bootstrap_port
  get_special_port(:bootstrap)
end

#get_special_port(which_port) ⇒ Object

Parameters:

  • which_port (MachSpecialPort)


20
21
22
23
24
# File 'lib/mach/task.rb', line 20

def get_special_port(which_port)
  mem = new_memory_pointer(:mach_port_t)
  task_get_special_port(task, which_port, mem)
  Port.new(:port => mem.get_uint(0))
end

#set_bootstrap_port(port) ⇒ Object



37
38
39
# File 'lib/mach/task.rb', line 37

def set_bootstrap_port(port)
  set_special_port(:bootstrap, port)
end

#set_special_port(which_port, newport) ⇒ Object

Parameters:

  • which_port (MachSpecialPort)
  • newport (Port, Integer)


29
30
31
# File 'lib/mach/task.rb', line 29

def set_special_port(which_port, newport)
  task_set_special_port(task, which_port, newport.to_i)
end