1*eb7c1594Sagc /* $NetBSD: tcsetpgrp.c,v 1.9 2003/08/07 16:44:14 agc Exp $ */
25f11a56cSjtc
35f11a56cSjtc /*-
45f11a56cSjtc * Copyright (c) 1989, 1993
55f11a56cSjtc * The Regents of the University of California. All rights reserved.
65f11a56cSjtc *
75f11a56cSjtc * Redistribution and use in source and binary forms, with or without
85f11a56cSjtc * modification, are permitted provided that the following conditions
95f11a56cSjtc * are met:
105f11a56cSjtc * 1. Redistributions of source code must retain the above copyright
115f11a56cSjtc * notice, this list of conditions and the following disclaimer.
125f11a56cSjtc * 2. Redistributions in binary form must reproduce the above copyright
135f11a56cSjtc * notice, this list of conditions and the following disclaimer in the
145f11a56cSjtc * documentation and/or other materials provided with the distribution.
15*eb7c1594Sagc * 3. Neither the name of the University nor the names of its contributors
165f11a56cSjtc * may be used to endorse or promote products derived from this software
175f11a56cSjtc * without specific prior written permission.
185f11a56cSjtc *
195f11a56cSjtc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
205f11a56cSjtc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
215f11a56cSjtc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
225f11a56cSjtc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
235f11a56cSjtc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
245f11a56cSjtc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
255f11a56cSjtc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
265f11a56cSjtc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
275f11a56cSjtc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
285f11a56cSjtc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
295f11a56cSjtc * SUCH DAMAGE.
305f11a56cSjtc */
315f11a56cSjtc
323ad08ca2Schristos #include <sys/cdefs.h>
335f11a56cSjtc #if defined(LIBC_SCCS) && !defined(lint)
345f11a56cSjtc #if 0
355f11a56cSjtc static char sccsid[] = "@(#)termios.c 8.2 (Berkeley) 2/21/94";
365f11a56cSjtc #else
37*eb7c1594Sagc __RCSID("$NetBSD: tcsetpgrp.c,v 1.9 2003/08/07 16:44:14 agc Exp $");
385f11a56cSjtc #endif
395f11a56cSjtc #endif /* LIBC_SCCS and not lint */
405f11a56cSjtc
4143fa6fe3Sjtc #include "namespace.h"
425f11a56cSjtc #include <sys/types.h>
435f11a56cSjtc #include <sys/ioctl.h>
44b48252f3Slukem
45b48252f3Slukem #include <assert.h>
46b48252f3Slukem #include <errno.h>
475f11a56cSjtc #include <termios.h>
483ad08ca2Schristos #include <unistd.h>
495f11a56cSjtc
5043fa6fe3Sjtc #ifdef __weak_alias
__weak_alias(tcsetpgrp,_tcsetpgrp)5160549036Smycroft __weak_alias(tcsetpgrp,_tcsetpgrp)
5243fa6fe3Sjtc #endif
5343fa6fe3Sjtc
545f11a56cSjtc int
555f11a56cSjtc tcsetpgrp(int fd, pid_t pgrp)
565f11a56cSjtc {
575f11a56cSjtc int s;
585f11a56cSjtc
59b48252f3Slukem _DIAGASSERT(fd != -1);
60b48252f3Slukem
615f11a56cSjtc s = pgrp;
625f11a56cSjtc return (ioctl(fd, TIOCSPGRP, &s));
635f11a56cSjtc }
64