mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Added _getpty interface.
This commit is contained in:
parent
ae311bd503
commit
43021932bc
1 changed files with 30 additions and 0 deletions
|
@ -28,6 +28,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "modsupport.h"
|
#include "modsupport.h"
|
||||||
#include "ceval.h"
|
#include "ceval.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
extern int sginap(long);
|
extern int sginap(long);
|
||||||
|
|
||||||
static object *
|
static object *
|
||||||
|
@ -45,8 +51,32 @@ sgi_nap(self, args)
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern char *_getpty(int *, int, mode_t, int);
|
||||||
|
|
||||||
|
static object *
|
||||||
|
sgi__getpty(self, args)
|
||||||
|
object *self;
|
||||||
|
object *args;
|
||||||
|
{
|
||||||
|
int oflag;
|
||||||
|
int mode;
|
||||||
|
int nofork;
|
||||||
|
char *name;
|
||||||
|
int fildes;
|
||||||
|
if (!getargs(args, "(iii)", &oflag, &mode, &nofork))
|
||||||
|
return NULL;
|
||||||
|
errno = 0;
|
||||||
|
name = _getpty(&fildes, oflag, (mode_t)mode, nofork);
|
||||||
|
if (name == NULL) {
|
||||||
|
err_errno(IOError);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return mkvalue("(si)", name, fildes);
|
||||||
|
}
|
||||||
|
|
||||||
static struct methodlist sgi_methods[] = {
|
static struct methodlist sgi_methods[] = {
|
||||||
{"nap", sgi_nap},
|
{"nap", sgi_nap},
|
||||||
|
{"_getpty", sgi__getpty},
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue