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
5bb92e54
Commit
5bb92e54
authored
May 24, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libgo: Make os.setenv_c work on systems without setenv.
From-SVN: r174147
parent
65773087
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
6 deletions
+25
-6
libgo/config.h.in
+3
-0
libgo/configure
+1
-1
libgo/configure.ac
+1
-1
libgo/runtime/go-setenv.c
+20
-4
No files found.
libgo/config.h.in
View file @
5bb92e54
...
...
@@ -24,6 +24,9 @@
/* Define to 1 if you have the `random' function. */
#undef HAVE_RANDOM
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `srandom' function. */
#undef HAVE_SRANDOM
...
...
libgo/configure
View file @
5bb92e54
...
...
@@ -14271,7 +14271,7 @@ else
fi
for
ac_func
in
srandom random strerror_r strsignal wait4 mincore
for
ac_func
in
srandom random strerror_r strsignal wait4 mincore
setenv
do
:
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
ac_fn_c_check_func
"
$LINENO
"
"
$ac_func
"
"
$as_ac_var
"
...
...
libgo/configure.ac
View file @
5bb92e54
...
...
@@ -431,7 +431,7 @@ esac
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h)
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4 mincore)
AC_CHECK_FUNCS(srandom random strerror_r strsignal wait4 mincore
setenv
)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
...
...
libgo/runtime/go-setenv.c
View file @
5bb92e54
...
...
@@ -4,6 +4,8 @@
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. */
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
...
...
@@ -25,24 +27,38 @@ setenv_c (struct __go_string k, struct __go_string v)
ks
=
k
.
__data
;
kn
=
NULL
;
vs
=
v
.
__data
;
vn
=
NULL
;
#ifdef HAVE_SETENV
if
(
ks
[
k
.
__length
]
!=
0
)
{
kn
=
__go_alloc
(
k
.
__length
+
1
);
__builtin_memcpy
(
kn
,
k
.
__data
,
k
.
__length
);
__builtin_memcpy
(
kn
,
k
s
,
k
.
__length
);
ks
=
kn
;
}
vs
=
v
.
__data
;
vn
=
NULL
;
if
(
vs
[
v
.
__length
]
!=
0
)
{
vn
=
__go_alloc
(
v
.
__length
+
1
);
__builtin_memcpy
(
vn
,
v
.
__data
,
v
.
__length
);
__builtin_memcpy
(
vn
,
v
s
,
v
.
__length
);
vs
=
vn
;
}
setenv
((
const
char
*
)
ks
,
(
const
char
*
)
vs
,
1
);
#else
/* !defined(HAVE_SETENV) */
kn
=
malloc
(
k
.
__length
+
v
.
__length
+
2
);
__builtin_memcpy
(
kn
,
ks
,
k
.
__length
);
kn
[
k
.
__length
]
=
'='
;
__builtin_memcpy
(
kn
+
k
.
__length
+
1
,
vs
,
v
.
__length
);
kn
[
k
.
__length
+
v
.
__length
+
1
]
=
'\0'
;
putenv
((
char
*
)
kn
);
#endif
/* !defined(HAVE_SETENV) */
if
(
kn
!=
NULL
)
__go_free
(
kn
);
if
(
vn
!=
NULL
)
...
...
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