DRAFT lib: Add missing pipe prototype.
* include/unistd.h (pipe: New prototype.
This commit is contained in:
parent
a41e27284a
commit
e7e70a9f48
|
@ -82,6 +82,7 @@ int getpgid (pid_t pid);
|
||||||
int isatty (int fd);
|
int isatty (int fd);
|
||||||
int link (char const *old_name, char const *new_name);
|
int link (char const *old_name, char const *new_name);
|
||||||
off_t lseek (int fd, off_t offset, int whence);
|
off_t lseek (int fd, off_t offset, int whence);
|
||||||
|
int pipe (int filedes[2]);
|
||||||
ssize_t read (int fd, void *buffer, size_t size);
|
ssize_t read (int fd, void *buffer, size_t size);
|
||||||
ssize_t readlink (char const *file_name, char *buffer, size_t size);
|
ssize_t readlink (char const *file_name, char *buffer, size_t size);
|
||||||
#if __SBRK_CHAR_PTRDIFF
|
#if __SBRK_CHAR_PTRDIFF
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
extern int *__ungetc_buf;
|
||||||
|
|
||||||
int
|
int
|
||||||
pclose (FILE *stream)
|
pclose (FILE *stream)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -34,8 +35,6 @@
|
||||||
#define SHELL_COMMAND_NAME "sh"
|
#define SHELL_COMMAND_NAME "sh"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int *__ungetc_buf;
|
|
||||||
|
|
||||||
FILE *
|
FILE *
|
||||||
popen (char const *command, char const *mode)
|
popen (char const *command, char const *mode)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +60,7 @@ popen (char const *command, char const *mode)
|
||||||
// child
|
// child
|
||||||
int dup = (*mode == 'w'
|
int dup = (*mode == 'w'
|
||||||
? dup2 (pipedes[STDIN], STDIN)
|
? dup2 (pipedes[STDIN], STDIN)
|
||||||
: dup2 (pipedes[STDOUT], STDOUT))
|
: dup2 (pipedes[STDOUT], STDOUT));
|
||||||
if (dup < 0)
|
if (dup < 0)
|
||||||
_exit (127);
|
_exit (127);
|
||||||
|
|
||||||
|
@ -109,6 +108,6 @@ popen (char const *command, char const *mode)
|
||||||
// XXX misuse ungetc buffer for PID
|
// XXX misuse ungetc buffer for PID
|
||||||
// XXX TODO: make proper FILE struct
|
// XXX TODO: make proper FILE struct
|
||||||
__ungetc_init ();
|
__ungetc_init ();
|
||||||
__ungetc_set (filedes, pidchild);
|
__ungetc_set (filedes, pid);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue