Re:Asmttpd – Web server for Linux written in amd64 assembly
by eddyb on Tuesday May 19, 2015 @03:01PM
(#9572325)
AFAIK Linux doesn't use zero-terminated strings anywhere in its syscalls, or at least not in those like write, where you pass a size alongside the buffer.
[ Parent
| on HN ]
Re:Asmttpd – Web server for Linux written in amd64 assembly
by reipahb on Tuesday May 19, 2015 @03:34PM
(#9572557)
However (almost?) all syscalls dealing with filesystem paths take null-terminated strings. See for example the implementation of the open() syscall:
https://github.com/torvalds/linux/blob/fb65d872d7a8dc629837a...
(Hence the need for the strncpy_from_user()-function: https://github.com/torvalds/linux/blob/fb65d872d7a8dc629837a...)
Re:Asmttpd – Web server for Linux written in amd64 assembly
by eddyb on Tuesday May 19, 2015 @05:29PM
(#9573284)
Ahh, I totally missed the path arguments, my bad.
Re:Asmttpd – Web server for Linux written in amd64 assembly
by ranit on Tuesday May 19, 2015 @03:53PM
(#9572674)
write() syscall writes a sequence of bytes (not string) therefore cannot use zero-terminated convention.
Re:Asmttpd – Web server for Linux written in amd64 assembly
by JoshTriplett on Tuesday May 19, 2015 @04:16PM
(#9572826)
open takes a NUL-terminated filename.