libextractor
1.11
About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.
![]() ![]() |
IPC with plugin for GNU/POSIX systems. More...
#include "platform.h"
#include "extractor.h"
#include "extractor_datasource.h"
#include "extractor_logging.h"
#include "extractor_plugin_main.h"
#include "extractor_plugins.h"
#include "extractor_ipc.h"
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/shm.h>
#include <signal.h>
Go to the source code of this file.
Data Structures | |
struct | EXTRACTOR_SharedMemory |
struct | EXTRACTOR_Channel |
Functions | |
struct EXTRACTOR_SharedMemory * | EXTRACTOR_IPC_shared_memory_create_ (size_t size) |
unsigned int | EXTRACTOR_IPC_shared_memory_change_rc_ (struct EXTRACTOR_SharedMemory *shm, int delta) |
void | EXTRACTOR_IPC_shared_memory_destroy_ (struct EXTRACTOR_SharedMemory *shm) |
ssize_t | EXTRACTOR_IPC_shared_memory_set_ (struct EXTRACTOR_SharedMemory *shm, struct EXTRACTOR_Datasource *ds, uint64_t off, size_t size) |
uint64_t | EXTRACTOR_datasource_get_pos_ (struct EXTRACTOR_Datasource *ds) |
struct EXTRACTOR_Channel * | EXTRACTOR_IPC_channel_create_ (struct EXTRACTOR_PluginList *plugin, struct EXTRACTOR_SharedMemory *shm) |
void | EXTRACTOR_IPC_channel_destroy_ (struct EXTRACTOR_Channel *channel) |
ssize_t | EXTRACTOR_IPC_channel_send_ (struct EXTRACTOR_Channel *channel, const void *data, size_t size) |
int | EXTRACTOR_IPC_channel_recv_ (struct EXTRACTOR_Channel **channels, unsigned int num_channels, EXTRACTOR_ChannelMessageProcessor proc, void *proc_cls) |
IPC with plugin for GNU/POSIX systems.
Definition in file extractor_ipc_gnu.c.
uint64_t EXTRACTOR_datasource_get_pos_ | ( | struct EXTRACTOR_Datasource * | ds | ) |
Query datasource for current position
ds | data source to query |
Definition at line 259 of file extractor_ipc_gnu.c.
struct EXTRACTOR_Channel* EXTRACTOR_IPC_channel_create_ | ( | struct EXTRACTOR_PluginList * | plugin, |
struct EXTRACTOR_SharedMemory * | shm | ||
) |
Create a channel to communicate with a process wrapping the plugin of the given name. Starts the process as well.
plugin | the plugin |
shm | memory to share with the process |
Definition at line 280 of file extractor_ipc_gnu.c.
void EXTRACTOR_IPC_channel_destroy_ | ( | struct EXTRACTOR_Channel * | channel | ) |
Destroy communication channel with a plugin/process. Also destroys the process.
channel | channel to communicate with the plugin |
Definition at line 399 of file extractor_ipc_gnu.c.
Referenced by EXTRACTOR_IPC_channel_create_(), and EXTRACTOR_IPC_channel_recv_().
int EXTRACTOR_IPC_channel_recv_ | ( | struct EXTRACTOR_Channel ** | channels, |
unsigned int | num_channels, | ||
EXTRACTOR_ChannelMessageProcessor | proc, | ||
void * | proc_cls | ||
) |
Receive data from any of the given IPC channels (blocking). Wait for one of the plugins to reply. Selects on plugin output pipes, runs 'receive_reply' on each activated pipe until it gets a seek request or a done message. Called repeatedly by the user until all pipes are dry or broken.
channels | array of channels, channels that break may be set to NULL |
num_channels | length of the channels array |
proc | function to call to process messages (may be called more than once) |
proc_cls | closure for proc |
Definition at line 467 of file extractor_ipc_gnu.c.
ssize_t EXTRACTOR_IPC_channel_send_ | ( | struct EXTRACTOR_Channel * | channel, |
const void * | data, | ||
size_t | size | ||
) |
Send data via the given IPC channel (blocking).
channel | channel to communicate with the plugin |
buf | data to send |
size | number of bytes in buf to send |
Definition at line 428 of file extractor_ipc_gnu.c.
Referenced by EXTRACTOR_IPC_channel_create_().
unsigned int EXTRACTOR_IPC_shared_memory_change_rc_ | ( | struct EXTRACTOR_SharedMemory * | shm, |
int | delta | ||
) |
Change the reference counter for this shm instance.
shm | instance to update |
delta | value to change RC by |
Definition at line 196 of file extractor_ipc_gnu.c.
struct EXTRACTOR_SharedMemory* EXTRACTOR_IPC_shared_memory_create_ | ( | size_t | size | ) |
Create a shared memory area.
size | size of the shared area |
Definition at line 134 of file extractor_ipc_gnu.c.
void EXTRACTOR_IPC_shared_memory_destroy_ | ( | struct EXTRACTOR_SharedMemory * | shm | ) |
Destroy shared memory area.
shm | memory area to destroy |
Definition at line 211 of file extractor_ipc_gnu.c.
ssize_t EXTRACTOR_IPC_shared_memory_set_ | ( | struct EXTRACTOR_SharedMemory * | shm, |
struct EXTRACTOR_Datasource * | ds, | ||
uint64_t | off, | ||
size_t | size | ||
) |
Initialize shared memory area from data source.
shm | memory area to initialize |
ds | data source to use for initialization |
off | offset to use in data source |
size | number of bytes to copy |
Definition at line 231 of file extractor_ipc_gnu.c.