pt.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
#include "synonyms.h"
#include <mtlib.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <wait.h>
#include <synch.h>
#include <thread.h>
#include <spawn.h>
#include <libc.h>
#include "tsd.h"
static void itoa(int, char *);
static int grantpt_u(int, int);
/*
* Check that fd argument is a file descriptor of an opened master.
* Do this by sending an ISPTM ioctl message down stream. Ioctl()
* will fail if:(1) fd is not a valid file descriptor.(2) the file
* represented by fd does not understand ISPTM(not a master device).
* If we have a valid master, get its minor number via fstat().
* Concatenate it to PTSNAME and return it as the name of the slave
* device.
*/
static dev_t
{
return (NODEV);
}
static int
ptscreate(void)
{
int ret;
lmutex_lock(&clk);
lmutex_unlock(&clk);
return (ret);
}
char *
{
char *sname;
return (NULL);
return (NULL);
/*
* devfsadm synchronization: if the node does not exist,
* attempt to synchronize with slave device node creation.
*/
return (sname);
return (NULL);
}
/*
* Send an ioctl down to the master device requesting the
*/
int
{
return (-1);
return (0);
}
/*
* Execute a setuid root program to change the mode, ownership and
* group of the slave device. The parent forks a child process that
* executes the setuid program. It then waits for the child to return.
*
* When create is 1, execute the setuid root program without arguments,
* to create minor nodes and symlinks for all slave devices.
*/
static int
{
extern char **environ;
char *argvec[3];
int st_loc;
int w;
char fds[24];
int error;
/* validate the file descriptor before proceeding */
return (-1);
return (-1);
return (-1);
return (-1);
if (error) {
return (-1);
}
/*
* waitpid() returns the process id for the child process
* on success or -1 on failure.
*/
continue;
/* Restore signal mask */
/*
* If SIGCHLD is currently ignored, waitpid() fails with
* ECHILD after the child terminates.
* This is not a failure; assume the child succeded.
*/
if (w == -1) {
return (-1);
st_loc = 0;
}
/*
* If child terminated due to exit() and the exit status is zero
* return success
* else it was an exit(-1) or it was struck by a signal
* return failure (EACCES)
*/
return (0);
return (-1);
}
int
{
int ret;
lmutex_lock(&glk);
lmutex_unlock(&glk);
return (ret);
}
/*
* be assigned to the given zone.
*/
int
{
return (-1);
}
return (0);
}
static void
{
int dig = 0;
int tempi;
tempi = i;
do {
dig++;
tempi /= 10;
} while (tempi);
*ptr = '\0';
while (--dig >= 0) {
i /= 10;
}
}
/*
* added for SUSv3 standard
*
* Open a pseudo-terminal device. External interface.
*/
int
posix_openpt(int oflag)
{
}