You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pty_solaris.go
    path of file: ./repos/docker-ce/components/cli/vendor/github.com/creack/pty
    
    the code of the file until where you have to start completion: package pty

/* based on:
http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/pt.c
*/

import (
	"errors"
	"golang.org/x/sys/unix"
	"os"
	"strconv"
	"syscall"
	"unsafe"
)

const NODEV = ^uint64(0)

func open() (pty, tty *os.File, err error) {
	masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|unix.O_NOCTTY, 0)
	//masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC|unix.O_NOCTTY, 0)
	if err != nil {
		return nil, nil, err
	
    
func open() (pty, tty *os.File, err error) {
	masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|unix.O_NOCTTY, 0)
	//masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC|unix.O_NOCTTY, 0)
	if err != nil {
		return nil, nil, err
	}
	p := os.NewFile(uintptr(masterfd), "/dev/ptmx")

	sname, err := ptsname(p)
	if err != nil {
		return nil, nil, err
	}

	err = grantpt(p)
	if err != nil {
		return nil, nil, err
	}

	err = unlockpt(p)
	if err != nil {
		return nil, nil, err
	}

	slavefd, err := syscall.Open(sname, os.O_RDWR|unix.O_NOCTTY, 0)
	if err != nil {
		return nil, nil, err
	}
	t := os.NewFile(uintptr(slavefd), sname)

	// pushing terminal driver STREAMS modules as per pts(7)
	for _, mod := range([]string{"ptem", "ldterm", "ttcompat"}) {
		err = streams_push(t, mod)
		if err != nil {
			return nil, nil, err
		}
	}
	
	return p, t, nil
}