public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Rainer Orth <ro@cebitec.uni-bielefeld.de>
Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Re: libgo patch committed: Update to current library
Date: Mon, 17 Dec 2012 21:08:00 -0000	[thread overview]
Message-ID: <CAKOQZ8ykjtvifkX2h4gfmDaisTMR-GDkN-O56481_-VoR3Patg@mail.gmail.com> (raw)
In-Reply-To: <yddmwxcd97v.fsf@lokon.CeBiTec.Uni-Bielefeld.DE>

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

On Mon, Dec 17, 2012 at 6:49 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
> Ian Lance Taylor <iant@google.com> writes:
>
>> I've updated libgo to the current master Go library sources.  As usual
>> this e-mail only includes patches to files that are substantially
>> specific to gccgo.  The bulk of the patch is available from the
>> repository or from the master Go repository.  Bootstrapped and ran Go
>> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.
>
> This patch broke Solaris bootstrap:
>
> /vol/gcc/src/hg/trunk/local/libgo/go/log/syslog/syslog_libc.go:17:9: error: incompatible type for return value 1 (incompatible type for method 'writeString' (different number of parameters))
>   return libcConn(0), nil
>          ^

Sorry about that.  This patch should fix the build.  I have not yet
tested whether it passes the tests.  Bootstrapped on
x86_64-unknown-linux-gnu, which proves nothing since the file is not
used on GNU/Linux.  Committed to mainline.

Ian

[-- Attachment #2: foo.patch --]
[-- Type: application/octet-stream, Size: 1165 bytes --]

diff -r 16989f6d7711 libgo/go/log/syslog/syslog_libc.go
--- a/libgo/go/log/syslog/syslog_libc.go	Fri Dec 14 06:54:14 2012 -0800
+++ b/libgo/go/log/syslog/syslog_libc.go	Mon Dec 17 13:06:13 2012 -0800
@@ -10,7 +10,9 @@
 
 import (
 	"fmt"
+	"os"
 	"syscall"
+	"time"
 )
 
 func unixSyslog() (conn serverConn, err error) {
@@ -21,14 +23,17 @@
 
 func syslog_c(int, *byte)
 
-func (libcConn) writeBytes(p Priority, prefix string, b []byte) (int, 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, error) {
-	syslog_c(int(p), syscall.StringBytePtr(fmt.Sprintf("%s: %s", prefix, s)))
-	return len(s), nil
+func (libcConn) writeString(p Priority, hostname, tag, msg string) (int, error) {
+	timestamp := time.Now().Format(time.RFC3339)
+	log := fmt.Sprintf("%s %s %s[%d]: %s", timestamp, hostname, tag, os.Getpid(), msg)
+	buf, err := syscall.BytePtrFromString(log)
+	if err != nil {
+		return 0, err
+	}
+	syscall.Entersyscall()
+	syslog_c(int(p), buf)
+	syscall.Exitsyscall()
+	return len(msg), nil
 }
 
 func (libcConn) close() error {

  reply	other threads:[~2012-12-17 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 23:13 Ian Lance Taylor
2012-12-17 14:50 ` Rainer Orth
2012-12-17 21:08   ` Ian Lance Taylor [this message]
2012-12-19 14:04     ` Rainer Orth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKOQZ8ykjtvifkX2h4gfmDaisTMR-GDkN-O56481_-VoR3Patg@mail.gmail.com \
    --to=iant@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).