blob: 4390bdce4491481f7d05c27c33dd123f640d72e8 [file] [log] [blame]
// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package overlord
import (
// #cgo LDFLAGS: -lc
// #include <unistd.h>
// Ttyname retuns the TTY name of a given file descriptor.
func Ttyname(fd uintptr) (string, error) {
var ttyname *C.char
ttyname = C.ttyname(
if ttyname == nil {
return "", errors.New("ttyname returned NULL")
return C.GoString(ttyname), nil