MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / shm_exclusive

Function shm_exclusive

src/utilities/drop.cpp:263–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261
262#ifndef HAVE_MMAP
263static int shm_exclusive( SLONG key, SLONG length)
264{
265/**************************************
266 *
267 * s h m _ e x c l u s i v e
268 *
269 **************************************
270 *
271 * Functional description
272 * Check to see if we are the only ones accessing
273 * shared memory. Return a shared memory id
274 * if so, -1 otherwise.
275 *
276 **************************************/
277 struct shmid_ds buf;
278
279 const int id = shmget(key, (int) length, IPC_ALLOC);
280 if (id == -1 || shmctl(id, IPC_STAT, &buf) == -1 || buf.shm_nattch != 1)
281 {
282 return -1;
283 }
284
285 return id;
286}
287#endif

Callers 1

remove_resourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected