Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Nov 2011 09:38:02 +0100
From:      Giovanni Trematerra <gianni@freebsd.org>
To:        Peter Wemm <peter@wemm.org>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: deprecated TIOCSPGRP and TIOCGPGRP ioctl command
Message-ID:  <CACfq091u60KtDFksuto08oScJaMZ=-UkUjMyzCrnjX7J05fUwA@mail.gmail.com>
In-Reply-To: <CAGE5yCor9c%2Bb7hZaF8NLdxc2F8PPfi0kTZFLXY5nvA%2Bbm1Ytuw@mail.gmail.com>
References:  <CACfq09210zdar=%2BM40gLoVtZnwLda88T1FJBbLXiy9e3t8-9NQ@mail.gmail.com> <CAGE5yCor9c%2Bb7hZaF8NLdxc2F8PPfi0kTZFLXY5nvA%2Bbm1Ytuw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, Nov 10, 2011 at 1:49 AM, Peter Wemm <peter@wemm.org> wrote:
> On Wed, Nov 9, 2011 at 3:39 PM, Giovanni Trematerra <gianni@freebsd.org> wrote:
>> Are they deprecated enough to be removed, now?
>> FYI FIFO doesn't support them.
>>
>> --
>> Gianni
>>
>> =================================
>> --- sys/kern/sys_pipe.c (revision 227233)
>> +++ sys/kern/sys_pipe.c (working copy)
>> @@ -1304,17 +1304,6 @@ pipe_ioctl(fp, cmd, data, active_cred, td)
>>        *(int *)data = fgetown(&mpipe->pipe_sigio);
>>        break;
>>
>> -   /* This is deprecated, FIOSETOWN should be used instead. */
>> -   case TIOCSPGRP:
>> -       PIPE_UNLOCK(mpipe);
>> -       error = fsetown(-(*(int *)data), &mpipe->pipe_sigio);
>> -       goto out_unlocked;
>> -
>> -   /* This is deprecated, FIOGETOWN should be used instead. */
>> -   case TIOCGPGRP:
>> -       *(int *)data = -fgetown(&mpipe->pipe_sigio);
>> -       break;
>> -
>>    default:
>>        error = ENOTTY;
>
> Be very very careful with this.  It's part of the classic BSD job
> control API.  It would be wise to survey whether any ports shells use
> this.
>
> You might also want to consider things like this in libc:
> int
> tcsetpgrp(int fd, pid_t pgrp)
> {
>        int s;
>
>        s = pgrp;
>        return (_ioctl(fd, TIOCSPGRP, &s));
> }
> Our own libc code uses this, albeit on an API intended to be used on a tty.
>
> The shell I'd be most concerned about is csh/tcsh in our tree. It has
> quite an #ifdef legacy layer and I couldn't convince myself it wasn't
> using this indirectly (or the tc* functions) on pipes.
>
> It might also be an idea to see if the linux compat layer can be
> switched over to using the newer API.
>

Thank you Peter for commenting.
I meant just to remove them from pipe_pool because I was wondering that
they weren't used anymore. As others pointed out, they are.

--
Gianni



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACfq091u60KtDFksuto08oScJaMZ=-UkUjMyzCrnjX7J05fUwA>