From owner-freebsd-arch@FreeBSD.ORG Thu Nov 10 01:18:24 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D251106564A; Thu, 10 Nov 2011 01:18:24 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id D2FB48FC0A; Thu, 10 Nov 2011 01:18:23 +0000 (UTC) Received: by ggnk3 with SMTP id k3so3323720ggn.13 for ; Wed, 09 Nov 2011 17:18:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=lzQDNjjA4t+0L5IsD51Xnj2KBQqT5/fplBQxuXb2Kq0=; b=z8NKl1vbBgedZX+6WxGMZguSNu3MnjqTUHcBk6+/bVniQ2yzUZT4+kiASb8UF7rJvD o9xjuYdqxaJojp9I81Azqp25VxLtxCodQcEb/rwVeIaqo/NMg1oGaNlyUYKyQ1xNIgMt Q5UuoaKC0lrL3eXFhnahvBLZKC6AYKHkjmYJc= MIME-Version: 1.0 Received: by 10.50.17.197 with SMTP id q5mr5719457igd.2.1320886177763; Wed, 09 Nov 2011 16:49:37 -0800 (PST) Received: by 10.50.186.233 with HTTP; Wed, 9 Nov 2011 16:49:37 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Nov 2011 16:49:37 -0800 Message-ID: From: Peter Wemm To: Giovanni Trematerra Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-arch@freebsd.org Subject: Re: deprecated TIOCSPGRP and TIOCGPGRP ioctl command X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Nov 2011 01:18:24 -0000 On Wed, Nov 9, 2011 at 3:39 PM, Giovanni Trematerra wr= ote: > Are they deprecated enough to be removed, now? > FYI FIFO doesn't support them. > > -- > Gianni > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D > --- 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) > =A0 =A0 =A0 =A0*(int *)data =3D fgetown(&mpipe->pipe_sigio); > =A0 =A0 =A0 =A0break; > > - =A0 /* This is deprecated, FIOSETOWN should be used instead. */ > - =A0 case TIOCSPGRP: > - =A0 =A0 =A0 PIPE_UNLOCK(mpipe); > - =A0 =A0 =A0 error =3D fsetown(-(*(int *)data), &mpipe->pipe_sigio); > - =A0 =A0 =A0 goto out_unlocked; > - > - =A0 /* This is deprecated, FIOGETOWN should be used instead. */ > - =A0 case TIOCGPGRP: > - =A0 =A0 =A0 *(int *)data =3D -fgetown(&mpipe->pipe_sigio); > - =A0 =A0 =A0 break; > - > =A0 =A0default: > =A0 =A0 =A0 =A0error =3D 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 =3D 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. --=20 Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell