/*
- * Copyright (C) 2006-2013 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
return *result == (void *) -1? -ERRNO_TO_PARA_ERROR(errno) : 1;
}
+/**
+ * Get the size of a shared memory segment.
+ *
+ * \param id The shared memory segment identifier.
+ * \param result Size in bytes is returned here, zero on errors.
+ *
+ * \return Standard.
+ *
+ * \sa shmctl(2).
+ */
+int shm_size(int id, size_t *result)
+{
+ struct shmid_ds ds; /* data structure */
+
+ *result = 0;
+ if (shmctl(id, IPC_STAT, &ds) < 0)
+ return -ERRNO_TO_PARA_ERROR(errno);
+ *result = ds.shm_segsz;
+ return 1;
+}
+
/**
* Detach a shared memory segment.
*