Class: SysVIPC::SharedMemory

Inherits:
Object
  • Object
show all
Includes:
SysVIPC
Defined in:
lib/SysVIPC.rb

Constant Summary

Constants included from SysVIPC

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SysVIPC

#check_result

Instance Attribute Details

#shmidObject (readonly)

Returns the value of attribute shmid.



315
316
317
# File 'lib/SysVIPC.rb', line 315

def shmid
  @shmid
end

Instance Method Details

#attach(shmaddr = nil, flags = 0) ⇒ Object

Attach to a shared memory address object and return it. See shmat(2). If shmaddr is nil, the shared memory is attached at the first available address as selected by the system. See shmat(2).



349
350
351
352
353
# File 'lib/SysVIPC.rb', line 349

def attach(shmaddr = nil, flags = 0)
  shmaddr = shmat(@shmid, shmaddr, flags)
  check_result(shmaddr)
  shmaddr
end

#detach(shmaddr) ⇒ Object

Detach the Shmaddr object shmaddr. See shmdt(2).



357
358
359
# File 'lib/SysVIPC.rb', line 357

def detach(shmaddr)
  check_result(shmdt(shmaddr))
end

#ipc_rmidObject Also known as: rm

Remove. See shmctl(2).



339
340
341
# File 'lib/SysVIPC.rb', line 339

def ipc_rmid
  check_result(shmctl(@shmid, IPC_RMID, nil))
end

#ipc_set(shmid_ds) ⇒ Object Also known as: shmid_ds=

Set the Shmid_ds object. See shmctl(2).



328
329
330
331
332
333
334
# File 'lib/SysVIPC.rb', line 328

def ipc_set(shmid_ds)
  unless Shmid_ds === shmid_ds
	raise ArgumentError,
	  "argument to ipc_set must be a Shmid_ds"
  end
  check_result(shmctl(@shmid, IPC_SET, shmid_ds))
end

#ipc_statObject Also known as: shmid_ds

Return the Shmid_ds object. See shmctl(2).



319
320
321
322
323
# File 'lib/SysVIPC.rb', line 319

def ipc_stat
  res, shmid_ds = shmctl(@shmid, IPC_STAT)
  check_result(res)
  shmid_ds
end