42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
//******************************************************************/
|
|
///* IUT NICE-COTE D'AZUR - Departement INFORMATIQUE - R. CHIGNOLI */
|
|
///* Module M311 Theme IPC POSIX */
|
|
///******************************************************************/
|
|
///* shm_create.c : creation d'un nouveau segment de memoire de la */
|
|
///* taille d'un entier et initialisation a zero */
|
|
///* UTILISATION : commande nom_segment */
|
|
///* Utiliser ls -l /dev/shm et rm /dev/shm/... */
|
|
///******************************************************************/
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <sys/mman.h>
|
|
|
|
int main (int argc, char * argv[])
|
|
{
|
|
int fd;
|
|
int * compteur;
|
|
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Syntaxe : %s nom_segment\n", argv[0]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
fd = shm_open("applejack", O_CREAT | O_RDWR, 0777);
|
|
|
|
if(fd == -1) {
|
|
perror("shm_open");
|
|
exit(1);
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
|
/// A TERMINER
|
|
///
|
|
return EXIT_SUCCESS;
|
|
}
|