Aggiornamento note copyright
[gapil.git] / sources / SharedMem.c
index 35ba20caa2a3c323ea05fbdc7727c9b53ee2a42e..16cae770d9c4dc8afddf2bb4b58a97eaa51f7cc1 100644 (file)
  *
  * Author: S. Piccardi
  *
- * $Id: SharedMem.c,v 1.4 2003/02/03 14:27:58 piccardi Exp $
- *
  ***************************************************************/
-#include <sys/shm.h>                  /* SysV IPC shared memory declarations */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>                                 /* standard I/O functions */
-#include <fcntl.h>
-#include <signal.h>                          /* signal handling declarations */
-#include <unistd.h>
+#include <sys/shm.h>     /* SysV shared memory */
+#include <sys/types.h>   /* primitive system data types */
+#include <sys/stat.h>    /* file characteristics constants and functions */
+#include <stdio.h>       /* standard I/O library */
+#include <fcntl.h>       /* file control functions */
+#include <signal.h>      /* signal constants, types and functions */
+#include <unistd.h>      /* unix standard library */
 #include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
+#include <string.h>      /* C strings library */
+#include <errno.h>       /* error definitions and routines */
 
 #include "macros.h"
 /* *************************************************************************
@@ -64,7 +62,7 @@
  *         the fill value
  * Return: the address of the shared memory segment (NULL on error)
  */
-void * ShmCreate(key_t ipc_key, int shm_size, int perm, char fill) 
+void * ShmCreate(key_t ipc_key, int shm_size, int perm, int fill) 
 {
     void * shm_ptr;
     int shm_id;                       /* ID of the IPC shared memory segment */
@@ -102,7 +100,7 @@ void * ShmFind(key_t ipc_key, int shm_size)
 }
 /*
  * Function ShmRemove:
- * Scheudle removal for a SysV shared memory segment 
+ * Schedule removal for a SysV shared memory segment 
  * Input:  an IPC key value
  *         the shared memory segment size
  * Return: 0 on success, -1 on error
@@ -142,7 +140,7 @@ int ShmRemove(key_t ipc_key, void * shm_ptr)
  *         the fill value
  * Return: the address of the shared memory segment (NULL on error)
  */
-void * CreateShm(char * shm_name, off_t shm_size, mode_t perm, char fill) 
+void * CreateShm(char * shm_name, off_t shm_size, mode_t perm, int fill) 
 {
     void * shm_ptr;
     int fd;
@@ -199,6 +197,5 @@ void * FindShm(char * shm_name, off_t shm_size)
  */
 int RemoveShm(char * shm_name)
 {
-    shm_unlink(shm_name);
-    return 0;
+    return shm_unlink(shm_name);
 }