xref: /openbsd-src/usr.sbin/nsd/popen3.h (revision 3efee2e132f9af6db74577d714f3304be2b3af74)
1308d2509Sflorian /*
2308d2509Sflorian  * popen3.h -- execute a command and connect stdin, stdout and stderr
3308d2509Sflorian  *
4308d2509Sflorian  * Copyright (c) 2019, NLnet Labs. All rights reserved.
5308d2509Sflorian  *
6308d2509Sflorian  * See LICENSE for the license.
7308d2509Sflorian  *
8308d2509Sflorian  */
9*3efee2e1Sflorian #ifndef POPEN3_H
10*3efee2e1Sflorian #define POPEN3_H
11308d2509Sflorian 
12308d2509Sflorian #include <stdio.h>
13308d2509Sflorian #include <sys/types.h>
14308d2509Sflorian 
15308d2509Sflorian /*
16308d2509Sflorian  * Execute a command and connect stdin, stdout and stderr of the process to
17308d2509Sflorian  * respectively finptr, foutptr and ferrptr if non-NULL. The process
18308d2509Sflorian  * identifier of the new process is returned on success and the pointers to
19308d2509Sflorian  * the FILE handles will have been set. On failure, -1 is returned and none
20308d2509Sflorian  * of the pointers will have been set.
21308d2509Sflorian  */
22308d2509Sflorian pid_t popen3(char *const *command,
233f21e8ccSflorian              int *fdinptr,
243f21e8ccSflorian              int *fdoutptr,
253f21e8ccSflorian              int *fderrptr);
26308d2509Sflorian 
27*3efee2e1Sflorian #endif /* POPEN3_H */
28