summaryrefslogtreecommitdiffstats
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-12-09 10:47:09 +0200
committerTimo Teräs <timo.teras@iki.fi>2010-12-09 10:47:09 +0200
commitd92df520790dffbc114cd17c4cd1d45a09c118f9 (patch)
treeec9072833a950a71782c871cb754fb4d7665d906 /src/apk_io.h
parentc9690b0e7cdb977184e9649cd1bd3688787c1fb5 (diff)
downloadapk-tools-d92df520790dffbc114cd17c4cd1d45a09c118f9.tar.bz2
apk-tools-d92df520790dffbc114cd17c4cd1d45a09c118f9.tar.xz
io: enhance istream/bstreams with pipe to forked child
* prunes the child pid to avoid zombies * handles the errors so e.g. file-not-found is reported properly
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
index 20051a6..3845554 100644
--- a/src/apk_io.h
+++ b/src/apk_io.h
@@ -73,7 +73,7 @@ static inline struct apk_istream *apk_bstream_gunzip(struct apk_bstream *bs)
struct apk_ostream *apk_ostream_gzip(struct apk_ostream *);
struct apk_ostream *apk_ostream_counter(off_t *);
-struct apk_istream *apk_istream_from_fd(int fd);
+struct apk_istream *apk_istream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int));
struct apk_istream *apk_istream_from_file(int atfd, const char *file);
struct apk_istream *apk_istream_from_file_gz(int atfd, const char *file);
struct apk_istream *apk_istream_from_url(const char *url);
@@ -82,12 +82,22 @@ size_t apk_istream_skip(struct apk_istream *istream, size_t size);
size_t apk_istream_splice(void *stream, int fd, size_t size,
apk_progress_cb cb, void *cb_ctx);
+static inline struct apk_istream *apk_istream_from_fd(int fd)
+{
+ return apk_istream_from_fd_pid(fd, 0, NULL);
+}
+
struct apk_bstream *apk_bstream_from_istream(struct apk_istream *istream);
-struct apk_bstream *apk_bstream_from_fd(int fd);
+struct apk_bstream *apk_bstream_from_fd_pid(int fd, pid_t pid, int (*translate_status)(int));
struct apk_bstream *apk_bstream_from_file(int atfd, const char *file);
struct apk_bstream *apk_bstream_from_url(const char *url);
struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to);
+static inline struct apk_bstream *apk_bstream_from_fd(int fd)
+{
+ return apk_bstream_from_fd_pid(fd, 0, NULL);
+}
+
struct apk_ostream *apk_ostream_to_fd(int fd);
struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, const char *tmpfile, mode_t mode);
struct apk_ostream *apk_ostream_to_file_gz(int atfd, const char *file, const char *tmpfile, mode_t mode);