Moved generated code into a separate file

This commit is contained in:
Cristian Maglie
2014-12-31 01:09:25 +01:00
parent 2629684436
commit e8f767688f
2 changed files with 23 additions and 9 deletions

View File

@@ -258,6 +258,8 @@ func setTermSettingsStopBits(bits StopBits, settings *syscall.Termios) error {
// native syscall wrapper functions // native syscall wrapper functions
//sys ioctl(fd int, req uint64, data uintptr) (err error)
func (port *linuxSerialPort) acquireExclusiveAccess() error { func (port *linuxSerialPort) acquireExclusiveAccess() error {
return ioctl(port.handle, syscall.TIOCEXCL, 0) return ioctl(port.handle, syscall.TIOCEXCL, 0)
} }
@@ -276,13 +278,4 @@ func (port *linuxSerialPort) setTermSettings(settings *syscall.Termios) error {
return ioctl(port.handle, syscall.TCSETS, uintptr(unsafe.Pointer(settings))) return ioctl(port.handle, syscall.TCSETS, uintptr(unsafe.Pointer(settings)))
} }
//sys ioctl(fd int, req uint64, data uintptr) (err error)
func ioctl(fd int, req uint64, data uintptr) (err error) {
_, _, e1 := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(data))
if e1 != 0 {
err = e1
}
return
}
// vi:ts=2 // vi:ts=2

21
syscall_linux.go Normal file
View File

@@ -0,0 +1,21 @@
//
// Copyright 2014 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// This file is machine generated by the command:
// mksyscall.pl serial_linux.go
// The generated stub is modified to make it compile under the "serial" package
package serial
import "syscall"
func ioctl(fd int, req uint64, data uintptr) (err error) {
_, _, e1 := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(data))
if e1 != 0 {
err = e1
}
return
}