Class: SysVIPC::SharedMemory
- Inherits:
-
Object
- Object
- SysVIPC::SharedMemory
- Defined in:
- lib/sysvipc.rb
Instance Method Summary collapse
-
#attach(shmaddr = nil, flags = 0) ⇒ Object
Attach to a shared memory address object and return it.
-
#detach(shmaddr) ⇒ Object
Detach the
Shmaddr
objectshmaddr
. -
#ipc_rmid ⇒ Object
(also: #rm)
Remove.
-
#ipc_set(shmid_ds) ⇒ Object
(also: #shmid_ds=)
Set the Shmid_ds object.
-
#ipc_stat ⇒ Object
(also: #shmid_ds)
Return the Shmid_ds object.
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).
342 343 344 345 346 |
# File 'lib/sysvipc.rb', line 342 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).
350 351 352 |
# File 'lib/sysvipc.rb', line 350 def detach(shmaddr) check_result(shmdt(shmaddr)) end |
#ipc_rmid ⇒ Object Also known as: rm
Remove. See shmctl(2).
332 333 334 |
# File 'lib/sysvipc.rb', line 332 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).
321 322 323 324 325 326 327 |
# File 'lib/sysvipc.rb', line 321 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_stat ⇒ Object Also known as: shmid_ds
Return the Shmid_ds object. See shmctl(2).
312 313 314 315 316 |
# File 'lib/sysvipc.rb', line 312 def ipc_stat res, shmid_ds = shmctl(@shmid, IPC_STAT) check_result(res) shmid_ds end |