cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pipes.h
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 #ifndef CFENGINE_PIPES_H
26 #define CFENGINE_PIPES_H
27 
28 #include <cf3.defs.h>
29 
30 typedef struct
31 {
32  int write_fd;
33  int read_fd;
34 } IOData;
35 
36 IOData cf_popen_full_duplex(const char *command, bool capture_stderr, bool require_full_path);
37 int cf_pclose_full_duplex(IOData *data);
38 int cf_pclose_full_duplex_side(int fd);
39 
40 FILE *cf_popen(const char *command, const char *type, bool capture_stderr);
41 FILE *cf_popensetuid(const char *command, const char *type, uid_t uid, gid_t gid, char *chdirv, char *chrootv, int background);
42 FILE *cf_popen_sh(const char *command, const char *type);
43 FILE *cf_popen_shsetuid(const char *command, const char *type, uid_t uid, gid_t gid, char *chdirv, char *chrootv, int background);
44 int cf_pclose(FILE *pp);
45 void cf_pclose_nowait(FILE *pp);
46 bool PipeToPid(pid_t *pid, FILE *pp);
47 bool PipeTypeIsOk(const char *type);
48 
49 int PipeIsReadWriteReady(const IOData *io, int timeout_sec);
50 Rlist *PipeReadData(const IOData *io, int pipe_timeout_secs, int pipe_termination_check_secs);
51 int PipeWrite(IOData *io, const char *data);
52 int PipeWriteData(const char *base_cmd, const char *args, const char *data);
53 int PipeReadWriteData(const char *base_command, const char *args, const char *request,
54  Rlist **response, int pipe_timeout_secs, int pipe_termination_check_secs);
55 
56 #ifdef __MINGW32__
57 FILE *cf_popen_powershell(const char *command, const char *type);
58 FILE *cf_popen_powershell_setuid(const char *command, const char *type, uid_t uid, gid_t gid, char *chdirv, char *chrootv,
59  int background);
60 #endif
61 
62 #endif
FILE * cf_popensetuid(const char *command, const char *type, uid_t uid, gid_t gid, char *chdirv, char *chrootv, int background)
Definition: pipes_unix.c:440
int PipeWrite(IOData *io, const char *data)
Definition: pipes.c:135
int cf_pclose(FILE *pp)
Definition: pipes_unix.c:812
int PipeWriteData(const char *base_cmd, const char *args, const char *data)
Definition: pipes.c:159
Rlist * PipeReadData(const IOData *io, int pipe_timeout_secs, int pipe_termination_check_secs)
Definition: pipes.c:62
int PipeReadWriteData(const char *base_command, const char *args, const char *request, Rlist **response, int pipe_timeout_secs, int pipe_termination_check_secs)
Definition: pipes.c:201
FILE * cf_popen_shsetuid(const char *command, const char *type, uid_t uid, gid_t gid, char *chdirv, char *chrootv, int background)
Definition: pipes_unix.c:649
int cf_pclose_full_duplex_side(int fd)
Definition: pipes_unix.c:852
IOData cf_popen_full_duplex(const char *command, bool capture_stderr, bool require_full_path)
Definition: pipes_unix.c:242
void cf_pclose_nowait(FILE *pp)
Definition: pipes_unix.c:798
int PipeIsReadWriteReady(const IOData *io, int timeout_sec)
Definition: pipes_unix.c:995
int cf_pclose_full_duplex(IOData *data)
Definition: pipes_unix.c:880
bool PipeTypeIsOk(const char *type)
Definition: pipes.c:31
FILE * cf_popen(const char *command, const char *type, bool capture_stderr)
Definition: pipes_unix.c:332
FILE * cf_popen_sh(const char *command, const char *type)
Definition: pipes_unix.c:560
bool PipeToPid(pid_t *pid, FILE *pp)
Definition: pipes_unix.c:930
Definition: pipes.h:31
int read_fd
Definition: pipes.h:33
int write_fd
Definition: pipes.h:32
Definition: rlist.h:35