// Code generated by cmd/cgo; DO NOT EDIT.

//line /home/xzl/work/golang-1.22/golang-1.22/src/internal/testpty/pty_cgo.go:1:1
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build cgo && (aix || dragonfly || freebsd || (linux && !android) || netbsd || openbsd)

package testpty

/*
#define _XOPEN_SOURCE 600
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
*/
import _ "unsafe"

import "os"

func open() (pty *os.File, processTTY string, err error) {
	m, err := ( /*line :20:12*/_C2func_posix_openpt /*line :20:25*/)(( /*line :20:27*/_Ciconst_O_RDWR /*line :20:34*/))
	if m < 0 {
		return nil, "", ptyError("posix_openpt", err)
	}
	if res, err := ( /*line :24:17*/_C2func_grantpt /*line :24:25*/)(m); res < 0 {
		( /*line :25:3*/_Cfunc_close /*line :25:9*/)(m)
		return nil, "", ptyError("grantpt", err)
	}
	if res, err := ( /*line :28:17*/_C2func_unlockpt /*line :28:26*/)(m); res < 0 {
		( /*line :29:3*/_Cfunc_close /*line :29:9*/)(m)
		return nil, "", ptyError("unlockpt", err)
	}
	processTTY = ( /*line :32:15*/_Cfunc_GoString /*line :32:24*/)(( /*line :32:26*/_Cfunc_ptsname /*line :32:34*/)(m))
	return os.NewFile(uintptr(m), "pty"), processTTY, nil
}
