extractor_plugin_main.c (libextractor-1.10) | : | extractor_plugin_main.c (libextractor-1.11) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
along with libextractor; see the file COPYING. If not, write to the | along with libextractor; see the file COPYING. If not, write to the | |||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |||
Boston, MA 02110-1301, USA. | Boston, MA 02110-1301, USA. | |||
*/ | */ | |||
/** | /** | |||
* @file main/extractor_plugin_main.c | * @file main/extractor_plugin_main.c | |||
* @brief main loop for an out-of-process plugin | * @brief main loop for an out-of-process plugin | |||
* @author Christian Grothoff | * @author Christian Grothoff | |||
*/ | */ | |||
#include "platform.h" | #include "platform.h" | |||
#include "plibc.h" | ||||
#include "extractor.h" | #include "extractor.h" | |||
#include "extractor_common.h" | #include "extractor_common.h" | |||
#include "extractor_datasource.h" | #include "extractor_datasource.h" | |||
#include "extractor_plugins.h" | #include "extractor_plugins.h" | |||
#include "extractor_ipc.h" | #include "extractor_ipc.h" | |||
#include "extractor_logging.h" | #include "extractor_logging.h" | |||
#include "extractor_plugin_main.h" | #include "extractor_plugin_main.h" | |||
#include <dirent.h> | #include <dirent.h> | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#if GNU_LINUX | #if GNU_LINUX | |||
skipping to change at line 108 | skipping to change at line 107 | |||
int in; | int in; | |||
/** | /** | |||
* Output stream. | * Output stream. | |||
*/ | */ | |||
int out; | int out; | |||
}; | }; | |||
/** | /** | |||
* Moves current absolute buffer position to 'pos' in 'whence' mode. | * Moves current absolute buffer position to 'pos' in 'whence' mode. | |||
* Will move logical position withouth shifting the buffer, if possible. | * Will move logical position without shifting the buffer, if possible. | |||
* Will not move beyond the end of file. | * Will not move beyond the end of file. | |||
* | * | |||
* @param plugin plugin context | * @param plugin plugin context | |||
* @param pos position to move to | * @param pos position to move to | |||
* @param whence seek mode (SEEK_CUR, SEEK_SET, SEEK_END) | * @param whence seek mode (SEEK_CUR, SEEK_SET, SEEK_END) | |||
* @return new absolute position, -1 on error | * @return new absolute position, -1 on error | |||
*/ | */ | |||
static int64_t | static int64_t | |||
plugin_env_seek (void *cls, | plugin_env_seek (void *cls, | |||
int64_t pos, | int64_t pos, | |||
skipping to change at line 252 | skipping to change at line 251 | |||
(unsigned long long) pc->shm_off + pc->shm_ready_bytes); | (unsigned long long) pc->shm_off + pc->shm_ready_bytes); | |||
return -1; | return -1; | |||
} | } | |||
/** | /** | |||
* Fills @a data with a pointer to the data buffer. | * Fills @a data with a pointer to the data buffer. | |||
* | * | |||
* @param plugin plugin context | * @param plugin plugin context | |||
* @param data location to store data pointer | * @param data location to store data pointer | |||
* @param count number of bytes to read | * @param count number of bytes to read | |||
* @return number of bytes (<= count) avalable in @a data, -1 on error | * @return number of bytes (<= count) available in @a data, -1 on error | |||
*/ | */ | |||
static ssize_t | static ssize_t | |||
plugin_env_read (void *cls, | plugin_env_read (void *cls, | |||
void **data, | void **data, | |||
size_t count) | size_t count) | |||
{ | { | |||
struct ProcessingContext *pc = cls; | struct ProcessingContext *pc = cls; | |||
unsigned char *dp; | unsigned char *dp; | |||
*data = NULL; | *data = NULL; | |||
skipping to change at line 546 | skipping to change at line 545 | |||
} | } | |||
break; | break; | |||
case MESSAGE_UPDATED_SHM: | case MESSAGE_UPDATED_SHM: | |||
LOG ("Illegal message\n"); | LOG ("Illegal message\n"); | |||
/* not allowed here, we're not waiting for SHM to move! */ | /* not allowed here, we're not waiting for SHM to move! */ | |||
return; | return; | |||
case MESSAGE_DISCARD_STATE: | case MESSAGE_DISCARD_STATE: | |||
/* odd, we're already in the start state... */ | /* odd, we're already in the start state... */ | |||
continue; | continue; | |||
default: | default: | |||
LOG ("Received invalid messag %d\n", (int) code); | LOG ("Received invalid message %d\n", (int) code); | |||
/* error, unexpected message */ | /* error, unexpected message */ | |||
return; | return; | |||
} | } | |||
} | } | |||
} | } | |||
/** | /** | |||
* Open '/dev/null' and make the result the given | * Open '/dev/null' and make the result the given | |||
* file descriptor. | * file descriptor. | |||
* | * | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added |