diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-04-25 19:36:12 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-04-25 19:36:12 +0000 |
commit | 9f3b1e6c603e255e87ff8fe087591d795cf2b974 (patch) | |
tree | 8c44faa207647f4f8db0f245add06c9ed21e26f5 /libgo/go/syslog/syslog_libc.go | |
parent | e5b0dad8fdd72fa4d19343b47546c89f2595c864 (diff) | |
download | gcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.zip gcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.tar.gz gcc-9f3b1e6c603e255e87ff8fe087591d795cf2b974.tar.bz2 |
libgo: Irix 6 patches.
From Rainer Orth.
From-SVN: r172935
Diffstat (limited to 'libgo/go/syslog/syslog_libc.go')
-rw-r--r-- | libgo/go/syslog/syslog_libc.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libgo/go/syslog/syslog_libc.go b/libgo/go/syslog/syslog_libc.go new file mode 100644 index 0000000..044351d --- /dev/null +++ b/libgo/go/syslog/syslog_libc.go @@ -0,0 +1,37 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// gccgo specific implementation of syslog for Solaris. Solaris uses +// STREAMS to communicate with syslogd. That is enough of a pain that +// we just call the libc function. + +package syslog + +import ( + "fmt" + "os" + "syscall" +) + +func unixSyslog() (conn serverConn, err os.Error) { + return libcConn(0), nil +} + +type libcConn int + +func syslog_c(int, *byte) + +func (libcConn) writeBytes(p Priority, prefix string, b []byte) (int, os.Error) { + syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, b))) + return len(b), nil +} + +func (libcConn) writeString(p Priority, prefix string, s string) (int, os.Error) { + syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, s))) + return len(s), nil +} + +func (libcConn) close() os.Error { + return nil +} |