Class: SysVIPC::SharedMemory

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

Instance Method Summary collapse

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).



335
336
337
338
339
# File 'lib/SysVIPC.rb', line 335

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).



343
344
345
# File 'lib/SysVIPC.rb', line 343

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

#ipc_rmidObject Also known as: rm

Remove. See shmctl(2).



325
326
327
# File 'lib/SysVIPC.rb', line 325

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).



314
315
316
317
318
319
320
# File 'lib/SysVIPC.rb', line 314

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).



305
306
307
308
309
# File 'lib/SysVIPC.rb', line 305

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