Cygwin: pipe: use /proc/PID/fd/... or /proc/self/fd/... name
Don't emit /dev/fd/... filename. This simplifies pipe path handling and avoids another symlink redirection. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
a3a5d52b39
commit
97d2fe2694
@ -73,8 +73,15 @@ fhandler_pipe::open (int flags, mode_t mode)
|
|||||||
bool inh;
|
bool inh;
|
||||||
bool got_one = false;
|
bool got_one = false;
|
||||||
|
|
||||||
sscanf (get_name (), "/proc/%d/fd/pipe:[%lld]",
|
if (sscanf (get_name (), "/proc/self/fd/pipe:[%lld]",
|
||||||
&pid, (long long *) &uniq_id);
|
(long long *) &uniq_id) == 1)
|
||||||
|
pid = myself->pid;
|
||||||
|
else if (sscanf (get_name (), "/proc/%d/fd/pipe:[%lld]",
|
||||||
|
&pid, (long long *) &uniq_id) < 2)
|
||||||
|
{
|
||||||
|
set_errno (ENOENT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (pid == myself->pid)
|
if (pid == myself->pid)
|
||||||
{
|
{
|
||||||
cygheap_fdenum cfd (true);
|
cygheap_fdenum cfd (true);
|
||||||
@ -439,8 +446,8 @@ pipe_worker (int filedes[2], unsigned int psize, int mode)
|
|||||||
{
|
{
|
||||||
cygheap_fdnew fdin;
|
cygheap_fdnew fdin;
|
||||||
cygheap_fdnew fdout (fdin, false);
|
cygheap_fdnew fdout (fdin, false);
|
||||||
char buf[sizeof ("/dev/fd/pipe:[9223372036854775807]")];
|
char buf[sizeof ("/proc/self/fd/pipe:[9223372036854775807]")];
|
||||||
__small_sprintf (buf, "/dev/fd/pipe:[%D]", fhs[0]->get_plain_ino ());
|
__small_sprintf (buf, "/proc/self/fd/pipe:[%D]", fhs[0]->get_plain_ino ());
|
||||||
fhs[0]->pc.set_posix (buf);
|
fhs[0]->pc.set_posix (buf);
|
||||||
__small_sprintf (buf, "pipe:[%D]", fhs[1]->get_plain_ino ());
|
__small_sprintf (buf, "pipe:[%D]", fhs[1]->get_plain_ino ());
|
||||||
fhs[1]->pc.set_posix (buf);
|
fhs[1]->pc.set_posix (buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user