ContainerTracer  0.1
Functions
docker-shm.c File Reference

This has the contents of creating and using Shared Memory. More...

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <fcntl.h>
#include <trace_replay.h>
#include <log.h>
#include <driver/docker-driver.h>
Include dependency graph for docker-shm.c:

Functions

static int __docker_sem_init (struct docker_info *info)
 Initialize the Semaphore. More...
 
static int __docker_shm_init (struct docker_info *info)
 Initialize the Shared Memory. More...
 
static void docker_sem_wait (const struct docker_info *info)
 Acquire the semaphore lock. More...
 
static void docker_sem_post (const struct docker_info *info)
 Release the semaphore lock. More...
 
int docker_shm_init (struct docker_info *info)
 Do the __docker_shm_init() and __docker_sem_init() More...
 
int docker_shm_get (const struct docker_info *info, void *buffer)
 Retrieve the data from Shared Memory. More...
 
void docker_shm_free (struct docker_info *info, int flags)
 Deallocate the Shared Memory resources. More...
 

Detailed Description

This has the contents of creating and using Shared Memory.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Author
SuhoSon (ngeol.nosp@m.564@.nosp@m.gmail.nosp@m..com)
Version
0.1
Date
2020-08-19

Function Documentation

◆ __docker_sem_init()

static int __docker_sem_init ( struct docker_info info)
static

Initialize the Semaphore.

Parameters
[in]infodocker_info structure which wants to init.
Returns
SemaphoreID for success to init, negative value for fail to init.

◆ __docker_shm_init()

static int __docker_shm_init ( struct docker_info info)
static

Initialize the Shared Memory.

Parameters
[in]infodocker_info structure which wants to init.
Returns
Shared MemoryID for success to init, negative value for fail to init.

◆ docker_sem_post()

static void docker_sem_post ( const struct docker_info info)
static

Release the semaphore lock.

Parameters
[in]infoThis is an information pointer that wants to release the semaphore.

◆ docker_sem_wait()

static void docker_sem_wait ( const struct docker_info info)
static

Acquire the semaphore lock.

Parameters
[in]infoThis is an information pointer that wants to acquire the semaphore.

◆ docker_shm_free()

void docker_shm_free ( struct docker_info info,
int  flags 
)

Deallocate the Shared Memory resources.

Parameters
[in]infodocker_info structure which wants to deallocate.
[in]flagsSet a range of deallocation.

◆ docker_shm_get()

int docker_shm_get ( const struct docker_info info,
void *  buffer 
)

Retrieve the data from Shared Memory.

Parameters
[in]infodocker_info structure which wants to get data.
[out]bufferDestination of data will be stored
Returns
0 for success to init, negative value for fail to init.
Here is the call graph for this function:

◆ docker_shm_init()

int docker_shm_init ( struct docker_info info)

Do the __docker_shm_init() and __docker_sem_init()

Parameters
[in]infodocker_info structure which wants to init.
Returns
0 for success to init, negative value for fail to init.
Here is the call graph for this function: