From e8f767688f90d91a233d8f1e9be8dbe1dca8bf6e Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 31 Dec 2014 01:09:25 +0100 Subject: [PATCH] Moved generated code into a separate file --- serial_linux.go | 11 ++--------- syscall_linux.go | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 syscall_linux.go diff --git a/serial_linux.go b/serial_linux.go index b197505..c1e9e3e 100644 --- a/serial_linux.go +++ b/serial_linux.go @@ -258,6 +258,8 @@ func setTermSettingsStopBits(bits StopBits, settings *syscall.Termios) error { // native syscall wrapper functions +//sys ioctl(fd int, req uint64, data uintptr) (err error) + func (port *linuxSerialPort) acquireExclusiveAccess() error { 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))) } -//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 diff --git a/syscall_linux.go b/syscall_linux.go new file mode 100644 index 0000000..1a925e4 --- /dev/null +++ b/syscall_linux.go @@ -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 +}