Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
3e4e83ab
Commit
3e4e83ab
authored
Jun 26, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sys.readfile()
add args to linux runtime SVN=124961
parent
7e21ec30
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
238 additions
and
81 deletions
+238
-81
sys.go
src/cmd/gc/sys.go
+5
-0
sysimport.c
src/cmd/gc/sysimport.c
+80
-75
Makefile
src/runtime/Makefile
+2
-1
rt0_amd64_darwin.s
src/runtime/rt0_amd64_darwin.s
+30
-2
rt0_amd64_linux.s
src/runtime/rt0_amd64_linux.s
+36
-3
runtime.h
src/runtime/runtime.h
+5
-0
sys_file.c
src/runtime/sys_file.c
+80
-0
No files found.
src/cmd/gc/sys.go
View file @
3e4e83ab
...
...
@@ -40,6 +40,8 @@ func mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
func
mapassign1
(
hmap
*
map
[
any
]
any
,
key
any
,
val
any
);
func
mapassign2
(
hmap
*
map
[
any
]
any
,
key
any
,
val
any
,
pres
bool
);
func
readfile
(
string
)
(
string
,
bool
);
// read file into string; boolean status
export
mal
breakpoint
...
...
@@ -79,4 +81,7 @@ export
mapassign1
mapassign2
// files
readfile
;
src/cmd/gc/sysimport.c
View file @
3e4e83ab
...
...
@@ -3,10 +3,10 @@ char* sysimport =
"type sys._e002 {}
\n
"
"type sys.any 24
\n
"
"type sys._e003 *sys.any
\n
"
"type sys._o
181 {_e179
sys._e003}
\n
"
"type sys._o
207 {_e205
sys._e003}
\n
"
"type sys.uint32 6
\n
"
"type sys._i
183 {_e180
sys.uint32}
\n
"
"type sys._e001 (sys._e002 sys._o
181 sys._i183
)
\n
"
"type sys._i
209 {_e206
sys.uint32}
\n
"
"type sys._e001 (sys._e002 sys._o
207 sys._i209
)
\n
"
"var !sys.mal sys._e001
\n
"
"type sys._e005 {}
\n
"
"type sys._e006 {}
\n
"
...
...
@@ -16,151 +16,156 @@ char* sysimport =
"type sys._e009 {}
\n
"
"type sys._e010 {}
\n
"
"type sys.int32 5
\n
"
"type sys._i
189 {_e188
sys.int32}
\n
"
"type sys._e008 (sys._e009 sys._e010 sys._i
189
)
\n
"
"type sys._i
215 {_e214
sys.int32}
\n
"
"type sys._e008 (sys._e009 sys._e010 sys._i
215
)
\n
"
"var !sys.panicl sys._e008
\n
"
"type sys._e012 {}
\n
"
"type sys._e013 {}
\n
"
"type sys.bool 12
\n
"
"type sys._i
194 {_e193
sys.bool}
\n
"
"type sys._e011 (sys._e012 sys._e013 sys._i
194
)
\n
"
"type sys._i
220 {_e219
sys.bool}
\n
"
"type sys._e011 (sys._e012 sys._e013 sys._i
220
)
\n
"
"var !sys.printbool sys._e011
\n
"
"type sys._e015 {}
\n
"
"type sys._e016 {}
\n
"
"type sys.float64 10
\n
"
"type sys._i
199 {_e198
sys.float64}
\n
"
"type sys._e014 (sys._e015 sys._e016 sys._i
199
)
\n
"
"type sys._i
225 {_e224
sys.float64}
\n
"
"type sys._e014 (sys._e015 sys._e016 sys._i
225
)
\n
"
"var !sys.printfloat sys._e014
\n
"
"type sys._e018 {}
\n
"
"type sys._e019 {}
\n
"
"type sys.int64 7
\n
"
"type sys._i2
04 {_e203
sys.int64}
\n
"
"type sys._e017 (sys._e018 sys._e019 sys._i2
04
)
\n
"
"type sys._i2
30 {_e229
sys.int64}
\n
"
"type sys._e017 (sys._e018 sys._e019 sys._i2
30
)
\n
"
"var !sys.printint sys._e017
\n
"
"type sys._e021 {}
\n
"
"type sys._e022 {}
\n
"
"type sys._e023 25
\n
"
"type sys.string *sys._e023
\n
"
"type sys._i2
09 {_e208
sys.string}
\n
"
"type sys._e020 (sys._e021 sys._e022 sys._i2
09
)
\n
"
"type sys._i2
35 {_e234
sys.string}
\n
"
"type sys._e020 (sys._e021 sys._e022 sys._i2
35
)
\n
"
"var !sys.printstring sys._e020
\n
"
"type sys._e025 {}
\n
"
"type sys._e026 {}
\n
"
"type sys.uint8 2
\n
"
"type sys._e027 *sys.uint8
\n
"
"type sys._i2
14 {_e213
sys._e027}
\n
"
"type sys._e024 (sys._e025 sys._e026 sys._i2
14
)
\n
"
"type sys._i2
40 {_e239
sys._e027}
\n
"
"type sys._e024 (sys._e025 sys._e026 sys._i2
40
)
\n
"
"var !sys.printpointer sys._e024
\n
"
"type sys._e029 {}
\n
"
"type sys._o2
21 {_e218
sys.string}
\n
"
"type sys._i2
23 {_e219 sys.string _e220
sys.string}
\n
"
"type sys._e028 (sys._e029 sys._o2
21 sys._i223
)
\n
"
"type sys._o2
47 {_e244
sys.string}
\n
"
"type sys._i2
49 {_e245 sys.string _e246
sys.string}
\n
"
"type sys._e028 (sys._e029 sys._o2
47 sys._i249
)
\n
"
"var !sys.catstring sys._e028
\n
"
"type sys._e031 {}
\n
"
"type sys._o2
31 {_e228
sys.int32}
\n
"
"type sys._i2
33 {_e229 sys.string _e230
sys.string}
\n
"
"type sys._e030 (sys._e031 sys._o2
31 sys._i233
)
\n
"
"type sys._o2
57 {_e254
sys.int32}
\n
"
"type sys._i2
59 {_e255 sys.string _e256
sys.string}
\n
"
"type sys._e030 (sys._e031 sys._o2
57 sys._i259
)
\n
"
"var !sys.cmpstring sys._e030
\n
"
"type sys._e033 {}
\n
"
"type sys._o2
42 {_e238
sys.string}
\n
"
"type sys._i2
44 {_e239 sys.string _e240 sys.int32 _e241
sys.int32}
\n
"
"type sys._e032 (sys._e033 sys._o2
42 sys._i244
)
\n
"
"type sys._o2
68 {_e264
sys.string}
\n
"
"type sys._i2
70 {_e265 sys.string _e266 sys.int32 _e267
sys.int32}
\n
"
"type sys._e032 (sys._e033 sys._o2
68 sys._i270
)
\n
"
"var !sys.slicestring sys._e032
\n
"
"type sys._e035 {}
\n
"
"type sys._o2
53 {_e250
sys.uint8}
\n
"
"type sys._i2
55 {_e251 sys.string _e252
sys.int32}
\n
"
"type sys._e034 (sys._e035 sys._o2
53 sys._i255
)
\n
"
"type sys._o2
79 {_e276
sys.uint8}
\n
"
"type sys._i2
81 {_e277 sys.string _e278
sys.int32}
\n
"
"type sys._e034 (sys._e035 sys._o2
79 sys._i281
)
\n
"
"var !sys.indexstring sys._e034
\n
"
"type sys._e037 {}
\n
"
"type sys._o2
62 {_e260
sys.string}
\n
"
"type sys._i2
64 {_e261
sys.int64}
\n
"
"type sys._e036 (sys._e037 sys._o2
62 sys._i264
)
\n
"
"type sys._o2
88 {_e286
sys.string}
\n
"
"type sys._i2
90 {_e287
sys.int64}
\n
"
"type sys._e036 (sys._e037 sys._o2
88 sys._i290
)
\n
"
"var !sys.intstring sys._e036
\n
"
"type sys._e039 {}
\n
"
"type sys._o2
71 {_e268
sys.string}
\n
"
"type sys._o2
97 {_e294
sys.string}
\n
"
"type sys._e040 *sys.uint8
\n
"
"type sys._i2
73 {_e269 sys._e040 _e270
sys.int32}
\n
"
"type sys._e038 (sys._e039 sys._o2
71 sys._i273
)
\n
"
"type sys._i2
99 {_e295 sys._e040 _e296
sys.int32}
\n
"
"type sys._e038 (sys._e039 sys._o2
97 sys._i299
)
\n
"
"var !sys.byteastring sys._e038
\n
"
"type sys._e042 {}
\n
"
"type sys._e043 <>
\n
"
"type sys._o
282 {_e278
sys._e043}
\n
"
"type sys._o
308 {_e304
sys._e043}
\n
"
"type sys._e044 *sys.uint8
\n
"
"type sys._e045 *sys.uint8
\n
"
"type sys._s
289
{}
\n
"
"type sys._e046 *sys._s
289
\n
"
"type sys._i
284 {_e279 sys._e044 _e280 sys._e045 _e281
sys._e046}
\n
"
"type sys._e041 (sys._e042 sys._o
282 sys._i284
)
\n
"
"type sys._s
315
{}
\n
"
"type sys._e046 *sys._s
315
\n
"
"type sys._i
310 {_e305 sys._e044 _e306 sys._e045 _e307
sys._e046}
\n
"
"type sys._e041 (sys._e042 sys._o
308 sys._i310
)
\n
"
"var !sys.mkiface sys._e041
\n
"
"type sys._e048 {}
\n
"
"type sys._o
293 {_e292
sys.int32}
\n
"
"type sys._o
319 {_e318
sys.int32}
\n
"
"type sys._e049 {}
\n
"
"type sys._e047 (sys._e048 sys._o
293
sys._e049)
\n
"
"type sys._e047 (sys._e048 sys._o
319
sys._e049)
\n
"
"var !sys.argc sys._e047
\n
"
"type sys._e051 {}
\n
"
"type sys._o298 {_e296 sys.string}
\n
"
"type sys._i300 {_e297 sys.int32}
\n
"
"type sys._e050 (sys._e051 sys._o298 sys._i300)
\n
"
"var !sys.argv sys._e050
\n
"
"type sys._e053 {}
\n
"
"type sys._o306 {_e304 sys.string}
\n
"
"type sys._i308 {_e305 sys.int32}
\n
"
"type sys._e052 (sys._e053 sys._o306 sys._i308)
\n
"
"var !sys.envv sys._e052
\n
"
"type sys._e055 {}
\n
"
"type sys._o313 {_e312 sys.int32}
\n
"
"type sys._o323 {_e322 sys.int32}
\n
"
"type sys._e052 {}
\n
"
"type sys._e050 (sys._e051 sys._o323 sys._e052)
\n
"
"var !sys.envc sys._e050
\n
"
"type sys._e054 {}
\n
"
"type sys._o328 {_e326 sys.string}
\n
"
"type sys._i330 {_e327 sys.int32}
\n
"
"type sys._e053 (sys._e054 sys._o328 sys._i330)
\n
"
"var !sys.argv sys._e053
\n
"
"type sys._e056 {}
\n
"
"type sys._e054 (sys._e055 sys._o313 sys._e056)
\n
"
"var !sys.envc sys._e054
\n
"
"type sys._o336 {_e334 sys.string}
\n
"
"type sys._i338 {_e335 sys.int32}
\n
"
"type sys._e055 (sys._e056 sys._o336 sys._i338)
\n
"
"var !sys.envv sys._e055
\n
"
"type sys._e058 {}
\n
"
"type sys._o3
19 {_e316 sys.int32 _e317
sys.float64}
\n
"
"type sys._i3
21 {_e318
sys.float64}
\n
"
"type sys._e057 (sys._e058 sys._o3
19 sys._i321
)
\n
"
"type sys._o3
45 {_e342 sys.int32 _e343
sys.float64}
\n
"
"type sys._i3
47 {_e344
sys.float64}
\n
"
"type sys._e057 (sys._e058 sys._o3
45 sys._i347
)
\n
"
"var !sys.frexp sys._e057
\n
"
"type sys._e060 {}
\n
"
"type sys._o3
28 {_e325
sys.float64}
\n
"
"type sys._i3
30 {_e326 sys.int32 _e327
sys.float64}
\n
"
"type sys._e059 (sys._e060 sys._o3
28 sys._i330
)
\n
"
"type sys._o3
54 {_e351
sys.float64}
\n
"
"type sys._i3
56 {_e352 sys.int32 _e353
sys.float64}
\n
"
"type sys._e059 (sys._e060 sys._o3
54 sys._i356
)
\n
"
"var !sys.ldexp sys._e059
\n
"
"type sys._e062 {}
\n
"
"type sys._o3
38 {_e335 sys.float64 _e336
sys.float64}
\n
"
"type sys._i3
40 {_e337
sys.float64}
\n
"
"type sys._e061 (sys._e062 sys._o3
38 sys._i340
)
\n
"
"type sys._o3
64 {_e361 sys.float64 _e362
sys.float64}
\n
"
"type sys._i3
66 {_e363
sys.float64}
\n
"
"type sys._e061 (sys._e062 sys._o3
64 sys._i366
)
\n
"
"var !sys.modf sys._e061
\n
"
"type sys._e064 {}
\n
"
"type sys._e066 [sys.any] sys.any
\n
"
"type sys._e065 *sys._e066
\n
"
"type sys._o3
44
{hmap sys._e065}
\n
"
"type sys._i3
46
{keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}
\n
"
"type sys._e063 (sys._e064 sys._o3
44 sys._i346
)
\n
"
"type sys._o3
70
{hmap sys._e065}
\n
"
"type sys._i3
72
{keysize sys.uint32 valsize sys.uint32 keyalg sys.uint32 valalg sys.uint32 hint sys.uint32}
\n
"
"type sys._e063 (sys._e064 sys._o3
70 sys._i372
)
\n
"
"var !sys.newmap sys._e063
\n
"
"type sys._e068 {}
\n
"
"type sys._o3
54
{val sys.any}
\n
"
"type sys._o3
80
{val sys.any}
\n
"
"type sys._e070 [sys.any] sys.any
\n
"
"type sys._e069 *sys._e070
\n
"
"type sys._i3
56
{hmap sys._e069 key sys.any}
\n
"
"type sys._e067 (sys._e068 sys._o3
54 sys._i356
)
\n
"
"type sys._i3
82
{hmap sys._e069 key sys.any}
\n
"
"type sys._e067 (sys._e068 sys._o3
80 sys._i382
)
\n
"
"var !sys.mapaccess1 sys._e067
\n
"
"type sys._e072 {}
\n
"
"type sys._o3
61
{val sys.any pres sys.bool}
\n
"
"type sys._o3
87
{val sys.any pres sys.bool}
\n
"
"type sys._e074 [sys.any] sys.any
\n
"
"type sys._e073 *sys._e074
\n
"
"type sys._i3
63
{hmap sys._e073 key sys.any}
\n
"
"type sys._e071 (sys._e072 sys._o3
61 sys._i363
)
\n
"
"type sys._i3
89
{hmap sys._e073 key sys.any}
\n
"
"type sys._e071 (sys._e072 sys._o3
87 sys._i389
)
\n
"
"var !sys.mapaccess2 sys._e071
\n
"
"type sys._e076 {}
\n
"
"type sys._e077 {}
\n
"
"type sys._e079 [sys.any] sys.any
\n
"
"type sys._e078 *sys._e079
\n
"
"type sys._i3
68
{hmap sys._e078 key sys.any val sys.any}
\n
"
"type sys._e075 (sys._e076 sys._e077 sys._i3
68
)
\n
"
"type sys._i3
94
{hmap sys._e078 key sys.any val sys.any}
\n
"
"type sys._e075 (sys._e076 sys._e077 sys._i3
94
)
\n
"
"var !sys.mapassign1 sys._e075
\n
"
"type sys._e081 {}
\n
"
"type sys._e082 {}
\n
"
"type sys._e084 [sys.any] sys.any
\n
"
"type sys._e083 *sys._e084
\n
"
"type sys._i
374
{hmap sys._e083 key sys.any val sys.any pres sys.bool}
\n
"
"type sys._e080 (sys._e081 sys._e082 sys._i
374
)
\n
"
"type sys._i
400
{hmap sys._e083 key sys.any val sys.any pres sys.bool}
\n
"
"type sys._e080 (sys._e081 sys._e082 sys._i
400
)
\n
"
"var !sys.mapassign2 sys._e080
\n
"
"type sys._e086 {}
\n
"
"type sys._o410 {_e407 sys.string _e408 sys.bool}
\n
"
"type sys._i412 {_e409 sys.string}
\n
"
"type sys._e085 (sys._e086 sys._o410 sys._i412)
\n
"
"var !sys.readfile sys._e085
\n
"
"))
\n
"
;
src/runtime/Makefile
View file @
3e4e83ab
...
...
@@ -16,9 +16,10 @@ LIBOFILES=\
rt1_
$(GOARCH)
_
$(GOOS)
.
$O
\
rt2_
$(GOARCH)
.
$O
\
runtime.
$O
\
sys_file.
$O
\
OFILES
=
$(RT0OFILES)
$(LIBOFILES)
HFILES
=
HFILES
=
runtime.h
install
:
rt0 $(LIB)
cp
$(RT0OFILES)
$(GOROOT)
/lib
...
...
src/runtime/rt0_amd64_darwin.s
View file @
3e4e83ab
...
...
@@ -7,8 +7,8 @@ TEXT _rt0_amd64_darwin(SB),1,$-8
PUSHQ $0
MOVQ SP, BP
ANDQ $~15, SP
MOVQ 8(BP), DI
LEAQ 16(BP), SI
MOVQ 8(BP), DI
// argc
LEAQ 16(BP), SI
// argv
MOVL DI, DX
ADDL $1, DX
SHLL $3, DX
...
...
@@ -57,6 +57,34 @@ TEXT sys·write(SB),1,$-8
CALL notok(SB)
RET
TEXT open(SB),1,$-8
MOVQ 8(SP), DI
MOVL 16(SP), SI
MOVL $5, AX // syscall entry
SYSCALL
RET
TEXT close(SB),1,$-8
MOVL 8(SP), DI
MOVL $6, AX // syscall entry
SYSCALL
RET
TEXT fstat(SB),1,$-8
MOVL 8(SP), DI
MOVQ 16(SP), SI
MOVL $189, AX // syscall entry
SYSCALL
RET
TEXT read(SB),1,$-8
MOVL 8(SP), DI
MOVQ 16(SP), SI
MOVL 24(SP), DX
MOVL $3, AX // syscall entry
SYSCALL
RET
TEXT sys·sigaction(SB),1,$-8
MOVL 8(SP), DI // arg 1 sig
MOVQ 16(SP), SI // arg 2 act
...
...
src/runtime/rt0_amd64_linux.s
View file @
3e4e83ab
...
...
@@ -7,8 +7,8 @@ TEXT _rt0_amd64_linux(SB),1,$-8
PUSHQ $0
MOVQ SP, BP
ANDQ $~15, SP
MOVQ 8(BP), DI
LEAQ 16(BP), SI
MOVQ 8(BP), DI
// argc
LEAQ 16(BP), SI
// argv
MOVL DI, DX
ADDL $1, DX
SHLL $3, DX
...
...
@@ -24,6 +24,11 @@ loop:
done:
ADDQ $8, CX
SUBQ $16, SP
MOVL DI, 0(SP)
MOVQ SI, 8(SP)
CALL args(SB)
ADDQ $16, SP
CALL check(SB)
CALL main·main(SB)
CALL sys·exit(SB)
...
...
@@ -52,6 +57,34 @@ TEXT sys·write(SB),1,$-8
CALL notok(SB)
RET
TEXT open(SB),1,$-8
MOVQ 8(SP), DI
MOVL 16(SP), SI
MOVL $2, AX // syscall entry
SYSCALL
RET
TEXT close(SB),1,$-8
MOVL 8(SP), DI
MOVL $3, AX // syscall entry
SYSCALL
RET
TEXT fstat(SB),1,$-8
MOVL 8(SP), DI
MOVQ 16(SP), SI
MOVL $5, AX // syscall entry
SYSCALL
RET
TEXT read(SB),1,$-8
MOVL 8(SP), DI
MOVQ 16(SP), SI
MOVL 24(SP), DX
MOVL $0, AX // syscall entry
SYSCALL
RET
TEXT sys·rt_sigaction(SB),1,$-8
MOVL 8(SP), DI
MOVQ 16(SP), SI
...
...
@@ -94,7 +127,7 @@ TEXT sys·mmap(SB),1,$-8
MOVL $9, AX // syscall entry
SYSCALL
CMPQ AX, $0xfffffffffffff001
J
NE
2(PC)
J
LS
2(PC)
CALL notok(SB)
RET
...
...
src/runtime/runtime.h
View file @
3e4e83ab
...
...
@@ -90,6 +90,10 @@ void* mal(uint32);
uint32
cmpstring
(
string
,
string
);
void
initsig
(
void
);
void
traceback
(
uint8
*
pc
,
uint8
*
sp
);
int32
open
(
byte
*
,
int32
);
int32
read
(
int32
,
void
*
,
int32
);
void
close
(
int32
);
int32
fstat
(
int32
,
void
*
);
struct
SigTab
{
int32
catch
;
...
...
@@ -124,3 +128,4 @@ void sys·intstring(int64, string);
void
sys
·
ifaces2i
(
Sigi
*
,
Sigs
*
,
Map
*
,
void
*
);
void
sys
·
ifacei2i
(
Sigi
*
,
Map
*
,
void
*
);
void
sys
·
ifacei2s
(
Sigs
*
,
Map
*
,
void
*
);
void
sys
·
readfile
(
string
,
string
,
bool
);
src/runtime/sys_file.c
0 → 100644
View file @
3e4e83ab
// Copyright 2009 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.
#include "runtime.h"
typedef
uint64
dev_t
;
typedef
uint64
ino_t
;
typedef
uint32
mode_t
;
typedef
uint64
nlink_t
;
typedef
uint32
uid_t
;
typedef
uint32
gid_t
;
typedef
int64
off_t
;
typedef
int64
blksize_t
;
typedef
int64
blkcnt_t
;
typedef
int64
time_t
;
struct
timespec
{
time_t
tv_sec
;
int64
tv_nsec
;
};
struct
stat
{
dev_t
st_dev
;
/* ID of device containing file */
ino_t
st_ino
;
/* inode number */
nlink_t
st_nlink
;
/* number of hard links */
mode_t
st_mode
;
/* protection */
uid_t
st_uid
;
/* user ID of owner */
gid_t
st_gid
;
/* group ID of owner */
int32
pad0
;
dev_t
st_rdev
;
/* device ID (if special file) */
off_t
st_size
;
/* total size, in bytes */
blksize_t
st_blksize
;
/* blocksize for filesystem I/O */
blkcnt_t
st_blocks
;
/* number of blocks allocated */
struct
timespec
st_atime
;
/* time of last access */
struct
timespec
st_mtime
;
/* time of last modification */
struct
timespec
st_ctime
;
/* time of last status change */
};
void
sys
·
readfile
(
string
filein
,
string
fileout
,
bool
okout
)
{
int32
fd
;
byte
namebuf
[
256
];
struct
stat
statbuf
;
fileout
=
nil
;
okout
=
false
;
if
(
filein
==
nil
||
filein
->
len
>=
sizeof
(
namebuf
))
goto
out
;
mcpy
(
namebuf
,
filein
->
str
,
filein
->
len
);
namebuf
[
filein
->
len
]
=
'\0'
;
fd
=
open
(
namebuf
,
0
);
if
(
fd
<
0
)
goto
out
;
if
(
fstat
(
fd
,
&
statbuf
)
<
0
)
goto
close_out
;
if
(
statbuf
.
st_size
<=
0
)
goto
close_out
;
fileout
=
mal
(
sizeof
(
fileout
->
len
)
+
statbuf
.
st_size
+
1
);
fileout
->
len
=
statbuf
.
st_size
;
if
(
read
(
fd
,
fileout
->
str
,
statbuf
.
st_size
)
!=
statbuf
.
st_size
)
{
fileout
=
nil
;
goto
close_out
;
}
okout
=
1
;
close_out
:
close
(
fd
);
out
:
FLUSH
(
&
fileout
);
FLUSH
(
&
okout
);
return
;
}
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