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
a84bd8ba
Commit
a84bd8ba
authored
Dec 16, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os: Fix fileInfoFromStat for Solaris.
From Rainer Orth. From-SVN: r182402
parent
271d01df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
2 deletions
+66
-2
libgo/Makefile.am
+7
-1
libgo/Makefile.in
+3
-1
libgo/go/os/stat_solaris.go
+56
-0
No files found.
libgo/Makefile.am
View file @
a84bd8ba
...
...
@@ -763,6 +763,12 @@ endif
endif
endif
if
LIBGO_IS_SOLARIS
go_os_stat_file
=
go/os/stat_solaris.go
else
go_os_stat_file
=
go/os/stat.go
endif
go_os_files
=
\
$(go_os_dir_file)
\
go/os/dir.go
\
...
...
@@ -779,7 +785,7 @@ go_os_files = \
go/os/path.go
\
go/os/path_unix.go
\
go/os/proc.go
\
go/os/stat.go
\
$(go_os_stat_file)
\
go/os/str.go
\
$(go_os_sys_file)
\
go/os/time.go
\
...
...
libgo/Makefile.in
View file @
a84bd8ba
...
...
@@ -1096,6 +1096,8 @@ go_net_files = \
@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@
go_os_sys_file
=
go/os/sys_uname.go
@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@
go_os_sys_file
=
go/os/sys_uname.go
@LIBGO_IS_LINUX_TRUE@
go_os_sys_file
=
go/os/sys_linux.go
@LIBGO_IS_SOLARIS_FALSE@
go_os_stat_file
=
go/os/stat.go
@LIBGO_IS_SOLARIS_TRUE@
go_os_stat_file
=
go/os/stat_solaris.go
go_os_files
=
\
$(go_os_dir_file)
\
go/os/dir.go
\
...
...
@@ -1112,7 +1114,7 @@ go_os_files = \
go/os/path.go
\
go/os/path_unix.go
\
go/os/proc.go
\
go/os/stat.go
\
$(go_os_stat_file)
\
go/os/str.go
\
$(go_os_sys_file)
\
go/os/time.go
\
...
...
libgo/go/os/stat_solaris.go
0 → 100644
View file @
a84bd8ba
// 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.
package
os
import
(
"syscall"
"time"
)
func
sameFile
(
fs1
,
fs2
*
FileStat
)
bool
{
sys1
:=
fs1
.
Sys
.
(
*
syscall
.
Stat_t
)
sys2
:=
fs2
.
Sys
.
(
*
syscall
.
Stat_t
)
return
sys1
.
Dev
==
sys2
.
Dev
&&
sys1
.
Ino
==
sys2
.
Ino
}
func
fileInfoFromStat
(
st
*
syscall
.
Stat_t
,
name
string
)
FileInfo
{
fs
:=
&
FileStat
{
name
:
basename
(
name
),
size
:
int64
(
st
.
Size
),
modTime
:
timestrucToTime
(
st
.
Mtime
),
Sys
:
st
,
}
fs
.
mode
=
FileMode
(
st
.
Mode
&
0777
)
switch
st
.
Mode
&
syscall
.
S_IFMT
{
case
syscall
.
S_IFBLK
,
syscall
.
S_IFCHR
:
fs
.
mode
|=
ModeDevice
case
syscall
.
S_IFDIR
:
fs
.
mode
|=
ModeDir
case
syscall
.
S_IFIFO
:
fs
.
mode
|=
ModeNamedPipe
case
syscall
.
S_IFLNK
:
fs
.
mode
|=
ModeSymlink
case
syscall
.
S_IFREG
:
// nothing to do
case
syscall
.
S_IFSOCK
:
fs
.
mode
|=
ModeSocket
}
if
st
.
Mode
&
syscall
.
S_ISGID
!=
0
{
fs
.
mode
|=
ModeSetgid
}
if
st
.
Mode
&
syscall
.
S_ISUID
!=
0
{
fs
.
mode
|=
ModeSetuid
}
return
fs
}
func
timestrucToTime
(
ts
syscall
.
Timestruc
)
time
.
Time
{
return
time
.
Unix
(
int64
(
ts
.
Sec
),
int64
(
ts
.
Nsec
))
}
// For testing.
func
atime
(
fi
FileInfo
)
time
.
Time
{
return
timestrucToTime
(
fi
.
(
*
FileStat
)
.
Sys
.
(
*
syscall
.
Stat_t
)
.
Atime
)
}
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