Veikka Tuominen
413577c881
std: adjust for stage2 semantics
2022-06-07 21:27:07 +03:00
Veikka Tuominen
6d44c0a16c
std: update tests to stage2 semantics
2022-06-03 20:21:20 +03:00
Jakub Konka
ba0f72363a
Merge pull request #10576 from schmee/macos-resolve-ip
...
Use libc if_nametoindex for macOS when parsing IPs
2022-01-15 00:47:12 +01:00
John Schmidt
c992164dc7
Check for isDarwin() instead of linked libc
2022-01-14 13:44:38 +01:00
bryfry
0d45c72d3e
Use allocPrintZ to avoid needing assumeSentinel
2022-01-14 00:17:38 -05:00
John Schmidt
66fe5bb0d8
Use libc if_nametoindex if available when parsing IPs
...
Fixes https://github.com/ziglang/zig/issues/10521 and makes a couple of
additional tests pass when linking libc.
2022-01-12 19:32:46 +01:00
Ali Chraghi
005e869abd
update function name in error
2021-12-02 12:35:17 -08:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator
2021-11-30 23:32:47 +00:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor
2021-11-30 23:32:47 +00:00
Andrew Kelley
902df103c6
std lib API deprecations for the upcoming 0.9.0 release
...
See #3811
2021-11-30 00:13:07 -07:00
Andrew Kelley
6115cf2240
migrate from std.Target.current to @import("builtin").target
...
closes #9388
closes #9321
2021-10-04 23:48:55 -07:00
Kirjastonhoitaja
e1bf350b4d
net.Address: Fix writing 0-bytes when formatting Unix addresses
...
The entire 'path' array would get written to the formatting function,
when it should instead be treated as a regular zero-terminated string.
Note that this doesn't handle abstract paths on Linux, those paths
*start* with a \0 byte and are hence treated as empty strings instead.
But fixing that would require more adjustments than just formatting, in
particular to getOsSockLen().
2021-09-16 11:35:12 +02:00
Andrew Kelley
7f03cfe161
std.os: more reorganization efforts
...
* std lib tests are passing on x86_64-linux with and without -lc
* stage2 is building from source on x86_64-linux
* down to 38 remaining uses of `usingnamespace`
2021-09-01 17:54:06 -07:00
Andrew Kelley
d29871977f
remove redundant license headers from zig standard library
...
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.
Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Frank Denis
2ccd023c6a
Ip4Address parser: reject 0-prefixed components ( #9538 )
...
Some parsers interpret these as octal, some don't, and the confusion can lead to vulnerabilities.
Return error.NonCanonical when parsing IPv4 addresses with 0 prefixes.
2021-08-09 22:44:23 +02:00
Ryan Liptak
d31352ee85
Update all usages of mem.split/mem.tokenize for generic version
2021-08-06 02:01:47 -07:00
Jacob G-W
9fffffb07b
fix code broken from previous commit
2021-06-21 17:03:03 -07:00
Andrew Kelley
83677074f9
std: update regarding std.builtin reorganization
...
There are also some regressed std.fmt tests here and I haven't figured
out what's wrong yet.
2021-05-17 16:08:09 -07:00
Andrew Kelley
429cd2b5dd
std: change @import("builtin") to std.builtin
2021-04-15 19:06:39 -07:00
Benjamin Graf
c70832bc41
replace ArrayList.shrinkAndFree by ArrayList.shrinkRetainingCapacity
2021-02-21 11:56:14 +02:00
Andrew Kelley
68e7726478
std.fs.net.Stream: add writev and writevAll
...
I noticed that the write function does not properly use non-blocking
I/O. This file needs to be reworked for evented I/O to properly take
advantage of non-blocking writes to network sockets.
2021-02-16 11:01:17 -07:00
LemonBoy
134f5fd3d6
std: Update test "" to test where it makes sense
2021-01-22 15:46:58 +01:00
LemonBoy
34720da3d0
Apparently unix sockets are supported on Windows
...
Starting from Windows 10 build 17063.
2021-01-11 21:43:15 +01:00
LemonBoy
89d6317b93
std: Decouple network streams from fs.File
...
The overlap between files and sockets is minimal and lumping them
together means supporting only a small subset of the functionalities
provided by the OS.
Moreover the socket and file handles are not always interchangeable: on
Windows one should use Winsock's close() call rather than the one used
for common files.
2021-01-11 21:43:09 +01:00
Jay Petacat
a9b505fa77
Reduce use of deprecated IO types
...
Related: #4917
2021-01-07 23:48:58 -08:00
Alex Cameron
89286376c6
std: Rename ArrayList shrink => shrinkAndFree
2021-01-06 00:55:51 +11:00
LemonBoy
dd973fb365
std: Use {s} instead of {} when printing strings
2021-01-02 17:12:57 -07:00
Frank Denis
6c2e0c2046
Year++
2020-12-31 15:45:24 -08:00
Veikka Tuominen
e5aab62228
move ArrayListSentineled to std lib orphanage
2020-12-23 16:24:22 +02:00
daurnimator
db0cb54f4e
Localhost is special ( #6955 )
...
* std: always return loopback address when looking up localhost
* std: also return Ipv6 loopback
* std: remove commented out obsolete code
2020-12-01 19:13:59 -05:00
Isaac Freund
92ec24f77c
std/os: remove unneeded error from accept errorset
...
POSIX compliant fnctl cannot return EPERM when getting/setting the given
flags. See the specification here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
2020-11-30 20:00:26 -08:00
Jonathan Marler
48660371a2
std.meta: add assumeSentinel
2020-11-29 10:36:02 -08:00
daurnimator
b7b3c1dfae
std: use mem.asBytes in Ip4Address.parse so it works at comptime
2020-11-25 15:40:46 -08:00
Josh Holland
c25b157dda
remove deprecated uses of ArrayList.span
2020-11-07 11:15:44 +00:00
LemonBoy
7f46672193
More fixups for Windows targets
...
* Use closeSocket on sockets instead of plain old close, the latter
doesn't work on them.
* Use winsocket2 everywhere, mingw has no BSD sockets.
2020-10-28 10:03:23 +01:00
LemonBoy
8044ed4c66
std: Add basic smoke test for net functionality
2020-10-27 21:52:47 +01:00
johnLate
0a619c68a6
fix type mismatch in std.net.StreamServer
...
Parameter in std.os.listen is u31.
Fixes ziglang#6775
2020-10-25 21:18:24 -04:00
heidezomp
1e07487904
Fix std.net.connectUnixSocket in evented I/O mode
...
The event loop constant was missing.
2020-10-21 23:32:12 -04:00
Loris Cro
c196c27af8
recvfrom
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
419aea54cb
sendto
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 22:06:41 +02:00
Loris Cro
730428bfd6
connect
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Loris Cro
e85c89630e
accept
...
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-24 21:56:27 +02:00
Kenta Iwasaki
50e3906951
os: return error.SocketNotListening for EINVAL on accept ( #6226 )
2020-09-03 13:57:08 -04:00
LemonBoy
dd4994a4e4
std: Fix C-string with missing NUL terminator
...
Spotted thanks to the stricter conversion rules.
2020-09-01 18:45:35 +02:00
Andrew Kelley
4a69b11e74
add license header to all std lib files
...
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Andrew Kelley
d159ba9295
zig fmt
2020-08-04 23:04:20 -07:00
Jonathan Marler
6cc72af03d
Provide Ip4Address and Ip6Address in addition to Address
2020-07-27 07:11:07 +00:00
Vexu
e85fe13e44
run zig fmt on std lib and self hosted
2020-07-11 20:41:19 +03:00
joachimschmidt557
0ae1157e45
std.mem.dupe is deprecated, move all references in std
...
Replaced all occurences of std.mem.dupe in stdlib with
Allocator.dupe/std.mem.dupeZ -> Allocator.dupeZ
2020-07-04 21:40:06 +03:00
Andrew Kelley
d4d954abd2
std.sort: give comparator functions a context parameter
2020-06-08 15:16:40 -04:00