Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
a57bf407
Commit
a57bf407
authored
Dec 17, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log/syslog: Solaris portability patches.
From-SVN: r194566
parent
a48bd7c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
libgo/go/log/syslog/syslog_libc.go
+13
-8
No files found.
libgo/go/log/syslog/syslog_libc.go
View file @
a57bf407
...
...
@@ -10,7 +10,9 @@ package syslog
import
(
"fmt"
"os"
"syscall"
"time"
)
func
unixSyslog
()
(
conn
serverConn
,
err
error
)
{
...
...
@@ -21,14 +23,17 @@ type libcConn int
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment