-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
InfluxDB is an open source time series database with no external dependencies. It is useful for recording metrics, events, and performing analytics. Patches and testing provided by Bill Welliver in TritonDataCenter#194
- Loading branch information
Showing
9 changed files
with
732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
InfluxDB is an open source time series database with no external | ||
dependencies. It's useful for recording metrics, events, and performing | ||
analytics. | ||
|
||
Features: | ||
|
||
* Built-in HTTP API so you don't have to write any server side code to | ||
get up and running. | ||
* Data can be tagged, allowing very flexible querying. | ||
* SQL-like query language. | ||
* Simple to install and manage, and fast to get data in and out. | ||
* It aims to answer queries in real-time. That means every data point | ||
is indexed as it comes in and is immediately available in queries | ||
that should return in < 100ms. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# $NetBSD: Makefile,v 1.1 2019/05/15 18:03:33 jperkin Exp $ | ||
|
||
DISTNAME= influxdb-1.7.6 | ||
MASTER_SITES= ${MASTER_SITE_GITHUB:=influxdata/} | ||
CATEGORIES= databases | ||
GITHUB_PROJECT= influxdb | ||
GITHUB_TAG= v${PKGVERSION_NOREV} | ||
|
||
MAINTAINER= pkgsrc-users@NetBSD.org | ||
HOMEPAGE= https://github.com/influxdata/influxdb | ||
COMMENT= Scalable datastore for metrics, events, and real-time analytics | ||
LICENSE= mit | ||
|
||
BUILD_DEPENDS+= asciidoc-[0-9]*:../../textproc/asciidoc | ||
BUILD_DEPENDS+= xmlto-[0-9]*:../../textproc/xmlto | ||
|
||
USE_TOOLS+= gmake | ||
|
||
GO_DIST_BASE= ${DISTNAME} | ||
GO_SRCPATH= github.com/influxdata/influxdb | ||
|
||
PKG_SYSCONFSUBDIR= influxdb | ||
|
||
DATADIR= ${VARBASE}/lib/influxdb | ||
LOGDIR= ${VARBASE}/log/influxdb | ||
|
||
BUILD_DEFS+= INFLUXDB_USER INFLUXDB_GROUP VARBASE | ||
FILES_SUBST+= INFLUXDB_USER=${INFLUXDB_USER:Q} | ||
FILES_SUBST+= INFLUXDB_GROUP=${INFLUXDB_GROUP:Q} | ||
FILES_SUBST+= DATADIR=${DATADIR:Q} | ||
FILES_SUBST+= LOGDIR=${LOGDIR:Q} | ||
|
||
INFLUXDB_USER?= influxdb | ||
INFLUXDB_GROUP?= influxdb | ||
OWN_DIRS_PERMS+= ${DATADIR} ${INFLUXDB_USER} ${INFLUXDB_GROUP} 0700 | ||
OWN_DIRS_PERMS+= ${LOGDIR} ${INFLUXDB_USER} ${INFLUXDB_GROUP} 0700 | ||
PKG_USERS_VARS+= INFLUXDB_USER | ||
PKG_GROUPS_VARS+= INFLUXDB_GROUP | ||
PKG_GROUPS= ${INFLUXDB_GROUP} | ||
PKG_USERS= ${INFLUXDB_USER}:${INFLUXDB_GROUP} | ||
RCD_SCRIPTS= influxdb | ||
|
||
INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 | ||
INSTALLATION_DIRS+= share/doc/influxdb share/examples/influxdb | ||
|
||
DOC_FILES+= LICENSE DEPENDENCIES.md QUERIES.md README.md CHANGELOG.md | ||
BIN_FILES+= influx influx_inspect influx_stress influx_tsm influxd | ||
BIN_FILES+= stress_test_server test_client | ||
CONF_FILES+= ${PREFIX}/share/examples/${PKGBASE}/config.sample.toml \ | ||
${PKG_SYSCONFDIR}/config.toml | ||
|
||
.include "go-deps.mk" | ||
|
||
INFLUX_GO_FLAGS= -s | ||
INFLUX_GO_FLAGS+= -X main.version=${PKGVERSION_NOREV} | ||
INFLUX_GO_FLAGS+= -X main.commit=${GITHUB_TAG} | ||
INFLUX_GO_FLAGS+= -X main.buildstamp=pkgsrc | ||
|
||
do-build: | ||
${RUN} ${PKGSRC_SETENV} ${MAKE_ENV} \ | ||
${GO} build -ldflags "${INFLUX_GO_FLAGS}" ${GO_BUILD_PATTERN} | ||
${RUN} ${PKGSRC_SETENV} ${MAKE_ENV} \ | ||
${GO} install -ldflags "${INFLUX_GO_FLAGS}" ${GO_BUILD_PATTERN} | ||
${RUN} cd ${WRKSRC}/man && ${PKGSRC_SETENV} ${MAKE_ENV} ${GMAKE} | ||
${RUN} ${SED} \ | ||
-e 's,/var,${VARBASE},g' \ | ||
-e 's,^# reporting.*,reporting-disabled = true,g' \ | ||
${WRKSRC}/etc/config.sample.toml >${WRKDIR}/.config.toml | ||
|
||
do-install: | ||
for manpage in ${WRKSRC}/man/*.1; do \ | ||
${INSTALL_MAN} $$manpage ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1; \ | ||
done | ||
.for x in ${BIN_FILES} | ||
${INSTALL_PROGRAM} ${WRKDIR}/bin/${x} \ | ||
${DESTDIR}${PREFIX}/bin/${x} | ||
.endfor | ||
.for x in ${DOC_FILES} | ||
${INSTALL_DATA} ${WRKSRC}/${x} \ | ||
${DESTDIR}${PREFIX}/share/doc/influxdb/${x} | ||
.endfor | ||
${INSTALL_DATA} ${WRKSRC}/etc/config.sample.toml ${DESTDIR}${PREFIX}/share/examples/${PKGBASE} | ||
|
||
.include "../../lang/go/go-package.mk" | ||
.include "../../mk/bsd.pkg.mk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@comment $NetBSD: PLIST,v 1.1 2019/05/15 18:03:33 jperkin Exp $ | ||
bin/influx | ||
bin/influx_inspect | ||
bin/influx_stress | ||
bin/influx_tsm | ||
bin/influxd | ||
bin/stress_test_server | ||
bin/test_client | ||
man/man1/influx.1 | ||
man/man1/influx_inspect.1 | ||
man/man1/influx_stress.1 | ||
man/man1/influx_tsm.1 | ||
man/man1/influxd-backup.1 | ||
man/man1/influxd-config.1 | ||
man/man1/influxd-restore.1 | ||
man/man1/influxd-run.1 | ||
man/man1/influxd-version.1 | ||
man/man1/influxd.1 | ||
share/doc/influxdb/CHANGELOG.md | ||
share/doc/influxdb/DEPENDENCIES.md | ||
share/doc/influxdb/LICENSE | ||
share/doc/influxdb/QUERIES.md | ||
share/doc/influxdb/README.md | ||
share/examples/influxdb/config.sample.toml | ||
@pkgdir man1 | ||
@pkgdir etc/influxdb |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!@RCD_SCRIPTS_SHELL@ | ||
|
||
# PROVIDE: influxdb | ||
# REQUIRE: DAEMON | ||
# KEYWORD: shutdown | ||
|
||
if [ -f /etc/rc.subr ] | ||
then | ||
. /etc/rc.subr | ||
fi | ||
|
||
name="influxdb" | ||
rcvar=$name | ||
influxdb_user="@INFLUXDB_USER@" | ||
influxdb_group="@INFLUXDB_GROUP@" | ||
influxdb_chdir="@VARBASE@/lib/influxdb" | ||
pidfile="@VARBASE@/lib/influxdb/data/influxdb.pid" | ||
STDERR="@LOGDIR@/influxdb.log" | ||
command="@PREFIX@/bin/influxd" | ||
command_args="-config @PREFIX@/etc/influxdb/config.toml -pidfile ${pidfile} 1>/dev/null 2>> $STDERR &" | ||
|
||
load_rc_config $name | ||
run_rc_command "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | ||
<service_bundle type='manifest' name='@SMF_NAME@:default'> | ||
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'> | ||
<create_default_instance enabled='false' /> | ||
<single_instance /> | ||
<dependency name='network' grouping='require_all' restart_on='none' type='service'> | ||
<service_fmri value='svc:/milestone/network:default' /> | ||
</dependency> | ||
<dependency name='fs-local' grouping='require_all' restart_on='none' type='service'> | ||
<service_fmri value='svc:/system/filesystem/local:default' /> | ||
</dependency> | ||
<method_context working_directory="@DATADIR@"> | ||
<method_credential user='@INFLUXDB_USER@' group='@INFLUXDB_GROUP@' /> | ||
</method_context> | ||
<exec_method type='method' name='start' | ||
exec='@PREFIX@/bin/influxd -config @PKG_SYSCONFDIR@/config.toml -pidfile @DATADIR@/influxdb.pid 2>> @LOGDIR@/influxdb.log &' | ||
timeout_seconds="60" /> | ||
<exec_method type='method' name='stop' exec=':kill' timeout_seconds="60" /> | ||
<template> | ||
<common_name> | ||
<loctext xml:lang='C'>InfluxDB Time Series database</loctext> | ||
</common_name> | ||
<documentation> | ||
<manpage title='influx' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influx_inspect' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influx_stress' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influx_tsm' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd-backup' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd-config' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd-restore' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd-run' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd-version' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<manpage title='influxd' section='1' manpath='@PREFIX@/@PKGMANDIR@'/> | ||
<doc_link name='homepage' uri='https://docs.influxdata.com/influxdb/' /> | ||
</documentation> | ||
</template> | ||
</service> | ||
</service_bundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# $NetBSD: go-deps.mk,v 1.1 2019/05/15 18:03:33 jperkin Exp $ | ||
|
||
GO_DEPS+= github.com/collectd/go-collectd:2ce14454:collectd.org | ||
GO_DEPS+= github.com/BurntSushi/toml:a368813c | ||
GO_DEPS+= github.com/Masterminds/semver:c7af1294 | ||
GO_DEPS+= github.com/alecthomas/kingpin:947dcec5 | ||
GO_DEPS+= github.com/alecthomas/template:a0175ee3 | ||
GO_DEPS+= github.com/alecthomas/units:2efee857 | ||
GO_DEPS+= github.com/apache/arrow:f5df7735 | ||
GO_DEPS+= github.com/apex/log:941dea75 | ||
GO_DEPS+= github.com/aws/aws-sdk-go:dd947f47 | ||
GO_DEPS+= github.com/beorn7/perks:3a771d99 | ||
GO_DEPS+= github.com/blakesmith/ar:8bd4349a | ||
GO_DEPS+= github.com/bmizerany/pat:6226ea59 | ||
GO_DEPS+= github.com/boltdb/bolt:2f1ce7a8 | ||
GO_DEPS+= github.com/c-bata/go-prompt:e99fbc79 | ||
GO_DEPS+= github.com/caarlos0/ctrlc:70dc48d5 | ||
GO_DEPS+= github.com/campoy/unique:88950e53 | ||
GO_DEPS+= github.com/cespare/xxhash:5c37fe37 | ||
GO_DEPS+= github.com/davecgh/go-spew:346938d6 | ||
GO_DEPS+= github.com/dgrijalva/jwt-go:06ea1031 | ||
GO_DEPS+= github.com/dgryski/go-bitstream:3522498c | ||
GO_DEPS+= github.com/fatih/color:570b54ca | ||
GO_DEPS+= github.com/glycerine/go-unsnap-stream:9f0cb551 | ||
GO_DEPS+= github.com/go-ini/ini:7b294651 | ||
GO_DEPS+= github.com/go-sql-driver/mysql:72cd26f2 | ||
GO_DEPS+= github.com/gogo/protobuf:636bf030 | ||
GO_DEPS+= github.com/golang/protobuf:b4deda09 | ||
GO_DEPS+= github.com/golang/snappy:d9eb7a3d | ||
GO_DEPS+= github.com/google/go-cmp:3af367b6 | ||
GO_DEPS+= github.com/google/go-github:dd29b543 | ||
GO_DEPS+= github.com/google/go-querystring:44c6ddd0 | ||
GO_DEPS+= github.com/goreleaser/goreleaser:f99940ff | ||
GO_DEPS+= github.com/goreleaser/nfpm:de75d679 | ||
GO_DEPS+= github.com/imdario/mergo:9f23e2d6 | ||
GO_DEPS+= github.com/influxdata/flux:bcfc535f | ||
GO_DEPS+= github.com/influxdata/influxql:1cbfca8e | ||
GO_DEPS+= github.com/influxdata/line-protocol:a3afd890 | ||
GO_DEPS+= github.com/influxdata/roaring:fc520f41 | ||
GO_DEPS+= github.com/influxdata/tdigest:bf2b5ad3 | ||
GO_DEPS+= github.com/influxdata/usage-client:6d389537 | ||
GO_DEPS+= github.com/jmespath/go-jmespath:0b12d6b5 | ||
GO_DEPS+= github.com/jsternberg/zap-logfmt:ac4bd917 | ||
GO_DEPS+= github.com/jwilder/encoding:b4e1701a | ||
GO_DEPS+= github.com/kisielk/gotool:80517062 | ||
GO_DEPS+= github.com/klauspost/compress:b939724e | ||
GO_DEPS+= github.com/klauspost/cpuid:ae7887de | ||
GO_DEPS+= github.com/klauspost/crc32:cb6bfca9 | ||
GO_DEPS+= github.com/klauspost/pgzip:0bf5dcad | ||
GO_DEPS+= github.com/lib/pq:4ded0e93 | ||
GO_DEPS+= github.com/mattn/go-colorable:167de6bf | ||
GO_DEPS+= github.com/mattn/go-isatty:6ca4dbf5 | ||
GO_DEPS+= github.com/mattn/go-runewidth:9e777a83 | ||
GO_DEPS+= github.com/mattn/go-tty:13ff1204 | ||
GO_DEPS+= github.com/mattn/go-zglob:2ea3427b | ||
GO_DEPS+= github.com/matttproud/golang_protobuf_extensions:c12348ce | ||
GO_DEPS+= github.com/mitchellh/go-homedir:ae18d6b8 | ||
GO_DEPS+= github.com/mschoch/smat:90eadee7 | ||
GO_DEPS+= github.com/opentracing/opentracing-go:bd9c3193 | ||
GO_DEPS+= github.com/paulbellamy/ratecounter:524851a9 | ||
GO_DEPS+= github.com/peterh/liner:8c1271fc | ||
GO_DEPS+= github.com/philhofer/fwd:bb6d471d | ||
GO_DEPS+= github.com/pkg/errors:645ef004 | ||
GO_DEPS+= github.com/pkg/term:bffc007b | ||
GO_DEPS+= github.com/prometheus/client_golang:661e31bf | ||
GO_DEPS+= github.com/prometheus/client_model:5c3871d8 | ||
GO_DEPS+= github.com/prometheus/common:7600349d | ||
GO_DEPS+= github.com/prometheus/procfs:ae68e2d4 | ||
GO_DEPS+= github.com/retailnext/hllpp:101a6d2f | ||
GO_DEPS+= github.com/satori/go.uuid:f58768cc | ||
GO_DEPS+= github.com/segmentio/kafka-go:0b3aacc5 | ||
GO_DEPS+= github.com/spf13/cast:8c9545af | ||
GO_DEPS+= github.com/tinylib/msgp:b2b6a672 | ||
GO_DEPS+= github.com/willf/bitset:d860f346 | ||
GO_DEPS+= github.com/xlab/treeprint:d6fb6747 | ||
GO_DEPS+= github.com/uber-go/atomic:1ea20fb1:go.uber.org/atomic | ||
GO_DEPS+= github.com/uber-go/multierr:3c493748:go.uber.org/multierr | ||
GO_DEPS+= github.com/uber-go/zap:4d45f961:go.uber.org/zap | ||
GO_DEPS+= github.com/golang/crypto:a2144134:golang.org/x/crypto | ||
GO_DEPS+= github.com/golang/net:a680a1ef:golang.org/x/net | ||
GO_DEPS+= github.com/golang/oauth2:c57b0fac:golang.org/x/oauth2 | ||
GO_DEPS+= github.com/golang/sync:1d60e460:golang.org/x/sync | ||
GO_DEPS+= github.com/golang/sys:ac767d65:golang.org/x/sys | ||
GO_DEPS+= github.com/golang/text:f21a4dfb:golang.org/x/text | ||
GO_DEPS+= github.com/golang/time:fbb02b22:golang.org/x/time | ||
GO_DEPS+= github.com/golang/tools:45ff765b:golang.org/x/tools | ||
GO_DEPS+= github.com/golang/appengine:ae0ab99d:google.golang.org/appengine | ||
GO_DEPS+= github.com/google/go-genproto:fedd2861:google.golang.org/genproto | ||
GO_DEPS+= github.com/grpc/grpc-go:168a6198:google.golang.org/grpc | ||
GO_DEPS+= github.com/go-yaml/yaml:5420a8b6:gopkg.in/yaml.v2 | ||
GO_DEPS+= github.com/dominikh/go-tools:d73ab98e:honnef.co/go/tools |
13 changes: 13 additions & 0 deletions
13
databases/influxdb/patches/patch-.._.._pkg_term_termios_ioctl__solaris.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$NetBSD: patch-.._.._pkg_term_termios_ioctl__solaris.go,v 1.1 2019/05/15 18:03:34 jperkin Exp $ | ||
|
||
Apply SunOS fix from https://github.com/pkg/term/pull/41 | ||
|
||
--- ../../pkg/term/termios/ioctl_solaris.go.orig 2018-07-30 02:16:39.000000000 +0000 | ||
+++ ../../pkg/term/termios/ioctl_solaris.go | ||
@@ -3,5 +3,5 @@ package termios | ||
import "golang.org/x/sys/unix" | ||
|
||
func ioctl(fd, request, argp uintptr) error { | ||
- return unix.IoctlSetInt(int(fd), int(request), int(argp)) | ||
+ return unix.IoctlSetInt(int(fd), uint(request), int(argp)) | ||
} |
77 changes: 77 additions & 0 deletions
77
databases/influxdb/patches/patch-.._.._pkg_term_termios_termios__solaris.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
$NetBSD: patch-.._.._pkg_term_termios_termios__solaris.go,v 1.1 2019/05/15 18:03:34 jperkin Exp $ | ||
|
||
Apply SunOS fix from https://github.com/pkg/term/pull/41 | ||
|
||
--- ../../pkg/term/termios/termios_solaris.go.orig 2019-04-25 03:19:22.118815385 +0000 | ||
+++ ../../pkg/term/termios/termios_solaris.go | ||
@@ -31,13 +31,13 @@ const FIORDCHK = C.FIORDCHK | ||
// Tcgetattr gets the current serial port settings. | ||
func Tcgetattr(fd uintptr, argp *syscall.Termios) error { | ||
termios, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) | ||
- *argp = syscall.Termios(*termios) | ||
+ *argp = *(tiosToSyscall(termios)) | ||
return err | ||
} | ||
|
||
// Tcsetattr sets the current serial port settings. | ||
func Tcsetattr(fd, action uintptr, argp *syscall.Termios) error { | ||
- return unix.IoctlSetTermios(int(fd), int(action), (*unix.Termios)(argp)) | ||
+ return unix.IoctlSetTermios(int(fd), uint(action), tiosToUnix(argp)) | ||
} | ||
|
||
// Tcsendbreak transmits a continuous stream of zero-valued bits for a specific | ||
@@ -77,26 +77,50 @@ func Tiocoutq(fd uintptr, argp *int) err | ||
|
||
// Cfgetispeed returns the input baud rate stored in the termios structure. | ||
func Cfgetispeed(attr *syscall.Termios) uint32 { | ||
- solTermios := (*unix.Termios)(attr) | ||
+ solTermios := tiosToUnix(attr) | ||
return uint32(C.cfgetispeed((*C.termios_t)(unsafe.Pointer(solTermios)))) | ||
} | ||
|
||
// Cfsetispeed sets the input baud rate stored in the termios structure. | ||
func Cfsetispeed(attr *syscall.Termios, speed uintptr) error { | ||
- solTermios := (*unix.Termios)(attr) | ||
+ solTermios := tiosToUnix(attr) | ||
_, err := C.cfsetispeed((*C.termios_t)(unsafe.Pointer(solTermios)), C.speed_t(speed)) | ||
return err | ||
} | ||
|
||
// Cfgetospeed returns the output baud rate stored in the termios structure. | ||
func Cfgetospeed(attr *syscall.Termios) uint32 { | ||
- solTermios := (*unix.Termios)(attr) | ||
+ solTermios := tiosToUnix(attr) | ||
return uint32(C.cfgetospeed((*C.termios_t)(unsafe.Pointer(solTermios)))) | ||
} | ||
|
||
// Cfsetospeed sets the output baud rate stored in the termios structure. | ||
func Cfsetospeed(attr *syscall.Termios, speed uintptr) error { | ||
- solTermios := (*unix.Termios)(attr) | ||
+ solTermios := tiosToUnix(attr) | ||
_, err := C.cfsetospeed((*C.termios_t)(unsafe.Pointer(solTermios)), C.speed_t(speed)) | ||
return err | ||
} | ||
+ | ||
+// tiosToUnix copies a syscall.Termios to a x/sys/unix.Termios. | ||
+// This is needed since type conversions between the two fail due to | ||
+// more recent x/sys/unix.Termios renaming the padding field. | ||
+func tiosToUnix(st *syscall.Termios) *unix.Termios { | ||
+ return &unix.Termios{ | ||
+ Iflag: st.Iflag, | ||
+ Oflag: st.Oflag, | ||
+ Cflag: st.Cflag, | ||
+ Lflag: st.Lflag, | ||
+ Cc: st.Cc, | ||
+ } | ||
+} | ||
+ | ||
+// tiosToSyscall copies a x/sys/unix.Termios to a syscall.Termios. | ||
+func tiosToSyscall(ut *unix.Termios) *syscall.Termios { | ||
+ return &syscall.Termios{ | ||
+ Iflag: ut.Iflag, | ||
+ Oflag: ut.Oflag, | ||
+ Cflag: ut.Cflag, | ||
+ Lflag: ut.Lflag, | ||
+ Cc: ut.Cc, | ||
+ } | ||
+} |