aboutsummaryrefslogtreecommitdiff
path: root/runcap.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-19 11:29:27 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-07-19 11:29:27 +0300
commit651babfefa21536112cbcd799932b3595aeb2da4 (patch)
tree6922b7ea70642f4ce7a8cb97f01e62115e97d940 /runcap.h
parent3e59cfb01443a14962547ed75bbbaaefa25a7633 (diff)
downloadruncap-651babfefa21536112cbcd799932b3595aeb2da4.tar.gz
runcap-651babfefa21536112cbcd799932b3595aeb2da4.tar.bz2
Rename struct filecapture to stream_capture; portability fixes
Diffstat (limited to 'runcap.h')
-rw-r--r--runcap.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/runcap.h b/runcap.h
index c57f2e1..9537eee 100644
--- a/runcap.h
+++ b/runcap.h
@@ -17,22 +17,23 @@
#ifndef _RUNCAP_H_
# define _RUNCAP_H_ 1
-struct filecapture
+struct stream_capture
{
- size_t fc_size; /* size of the buffer */
- off_t fc_leng; /* total length of captured data */
- size_t fc_nlines; /* number of captured lines */
- size_t fc_cur; /* current offset in buffer */
- char * fc_base; /* buffer space */
- size_t fc_level; /* number of characters currently in buffer */
- void (*fc_linemon) (const char *, size_t, void *);
+ int sc_fd; /* Input descriptor */
+ char *sc_base; /* buffer space */
+ size_t sc_size; /* size of the buffer */
+ size_t sc_level; /* number of characters currently in buffer */
+ size_t sc_cur; /* current offset in buffer */
+ off_t sc_leng; /* total length of captured data */
+ size_t sc_nlines; /* number of captured lines */
+ int sc_storfd; /* Storage file descriptor */
+
+ void (*sc_linemon) (const char *, size_t, void *);
/* Line monitor function */
- void *fc_monarg; /* Line monitor argument */
- int fc_tmpfd; /* Storage file descriptor */
- int fc_fd; /* Input descriptor */
+ void *sc_monarg; /* Line monitor argument */
};
-#define FC_BUFSIZE 4096
+#define STRCAP_BUFSIZE 4096
enum {
RUNCAP_STDIN,
@@ -46,7 +47,7 @@ struct runcap
char *rc_program; /* [IN] (Path)name of the program to run */
char **rc_argv; /* [IN] Argument vector */
unsigned rc_timeout; /* [IN] Execution timeout */
- struct filecapture rc_cap[RUNCAP_NBUF];
+ struct stream_capture rc_cap[RUNCAP_NBUF];
/* rc_cap[RUNCAP_STDIN] - [IN], rest - [OUT] */
pid_t rc_pid; /* [OUT] - PID of the process */
int rc_status; /* [OUT] - Termination status */
@@ -61,16 +62,16 @@ struct runcap
#define RCF_STDERR_SIZE 0x0020
#define RCF_STDERR_LINEMON 0x0040
-int filecapture_init(struct filecapture *fc, size_t size);
-void filecapture_free(struct filecapture *fc);
+int stream_capture_init(struct stream_capture *fc, size_t size);
+void stream_capture_free(struct stream_capture *fc);
int runcap(struct runcap *rc, int flags);
void runcap_free(struct runcap *rc);
-static inline struct filecapture *
-runcap_filecapture(struct runcap *rc, int stream)
+static inline struct stream_capture *
+runcap_stream_capture(struct runcap *rc, int stream)
{
- struct filecapture *fp;
+ struct stream_capture *fp;
if (stream != RUNCAP_STDOUT && stream != RUNCAP_STDERR) {
errno = EINVAL;
@@ -79,7 +80,7 @@ runcap_filecapture(struct runcap *rc, int stream)
fp = &rc->rc_cap[stream];
- if (!fp->fc_base || fp->fc_size == 0) {
+ if (!fp->sc_base || fp->sc_size == 0) {
errno = EINVAL;
return NULL;
}

Return to:

Send suggestions and report system problems to the System administrator.