Commit Graph

104 Commits

Author SHA1 Message Date
Speedy_Lex eff610eac6 Fix many clippy lints 2026-05-07 00:05:07 +02:00
auronandace 8cec0c2280 import socklen_t from sys_socket instead of bits 2026-05-03 16:54:46 +01:00
auronandace 05b8ffbcb7 import timespec from time rather than bits 2026-05-03 14:33:39 +01:00
Connor-GH 7c8259dfd6 fix some lints caught by Clippy
Most of these changes are very simple. Among the changes made involve
taking advantage of auto-deref (`(*val).foo()` -> `val.foo()`) and
removing instances where we create a ref and immediately dereference it
(`&*val` -> `val`). There was a pretty neat case in `posix_openpt` where
some pointer verbosity was able to be reduced by using the more modern C
strings rather than the byte strings with an explicit NUL at the end.

Additionally, `exit()` now calls `unreachable!()` at the end. We
previously did `loop {}`, but clippy didn't like this. It can be up for
debate whether we want to make this `unreachable_unchecked` or similar.

There is only one change that might cause any sort of concern, and that
is the change from `.skip_while(!p).next()` -> `.find(p)`. This, like
everything else, was caught in a Clippy lint but I believe it deserves
some explanation because it isn't immediately obvious. Info about the
lint is here: https://rust-lang.github.io/rust-clippy/rust-1.89.0/index.html#skip_while_next
2026-04-30 19:02:35 -05:00
auronandace df5deb2b59 use uint32_t for n_net in netent 2026-04-27 15:09:53 +01:00
auronandace 1544554ceb add include guard to netdb cbindgen trailer 2026-04-27 08:51:26 +01:00
sourceturner 4ffd337b9b add #[allow(deprecated)] annotations
allow using deprecated functions and data structures
in deprecated functions
2026-04-20 21:37:52 +00:00
auronandace b0c66cf470 split out sa_family_t to a bits header 2026-04-14 08:44:13 +01:00
auronandace f0e3574f30 remove sys_socket include from ifaddrs and netdb 2026-04-13 10:59:23 +01:00
auronandace 49f96a96e6 rename bits_time to bits_timespec for consistency 2026-04-09 10:50:04 +01:00
auronandace 306cd8b68f move netdb bits to cbindgen 2026-03-28 17:44:18 +00:00
auronandace d826d1fdc2 verify netinet_in header includes 2026-03-25 10:50:01 +00:00
auronandace 9b76fce0cc move 4 conversion functions from netinet_in to arpa_inet 2026-03-24 11:22:14 +00:00
auronandace 8a6e085121 do not derive Copy on in_addr struct 2026-03-17 09:18:45 +00:00
auronandace ae91f48fae remove duplicate socklen_t definition 2026-03-11 12:42:53 +00:00
auronandace 6933287a94 enforce borrow-as-ptr clippy lint 2026-03-01 19:54:31 +00:00
auronandace d76417587c pty and signal header cleanup 2026-02-28 14:36:46 +00:00
auronandace 533cdd8c39 netdb header cleanup 2026-02-22 18:48:17 +00:00
auronandace 8a656d7727 avoid unneeded transmute on aarch64 and riscv 2026-02-17 14:35:08 +00:00
auronandace 1191d8e1b4 extract timespec to a bits header 2026-02-12 13:07:24 +00:00
auronandace a3c67e898d add unused_must_use lint 2026-02-11 09:48:47 +00:00
auronandace 7d1582a555 add unused_imports lint 2026-02-10 15:55:32 +00:00
auronandace c3f3e051e1 add unused-unsafe lint 2026-02-08 15:39:48 +00:00
auronandace 64f18ca89a add unused_mut lint 2026-02-08 09:00:14 +00:00
auronandace 46edf9ba65 sys_socket and netdb header cleanup 2026-02-02 09:43:33 +00:00
Wildan M f15322453b Convert all println to log or todo 2026-01-25 05:27:38 +07:00
Wildan M 7b9402783d Add log crate, use it to all trace cmd 2026-01-24 22:39:05 +07:00
Wildan M 6a455159ae Fix getaddrinfo hang due to infinite loop 2026-01-22 16:48:13 +07:00
sourceturner defd2ce7c3 Deny deny-unsafe_op_in_unsafe_fn on the crate level 2026-01-21 00:41:57 +01:00
sourceturner e57ef36d3c Use unsafe blocks in netdb.h implementation 2026-01-18 21:01:15 +01:00
auronandace 1ed1096e60 add clippy annotation to netdb thanks to safety note 2025-12-08 08:41:00 +00:00
auronandace 651768ad54 only import the needed types in netdb and poll 2025-12-08 08:34:38 +00:00
auronandace e45c7de6f6 update and add spec links for netdb and poll 2025-12-08 08:30:17 +00:00
Jeremy Soller 339e97ac65 Fix type of ai_addrlen 2025-11-21 11:37:16 -07:00
Jeremy Soller ced734c162 Add RawCell::unsafe_set 2025-10-04 07:50:16 -06:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Jacob Lorentzon 9c5f11fbc8 Add Out<T> wrapper 2025-09-21 14:36:12 +02:00
Wildan M 726a0fb1a8 Implement getaddrinfo NULL nodename, AI_PASSIVE, AI_NUMERICHOST 2025-09-15 15:10:50 +07:00
Wildan M 14bb1c87c3 Fix fmt 2025-08-20 18:40:18 +07:00
Wildan M 5334455a20 Implement getnameinfo and getaddrinfo loopback 2025-08-20 18:26:27 +07:00
Josh Megnauth f85b33c3ed Handle unwraps in get_dns_server() 2025-05-02 23:01:12 -04:00
Jeremy Soller 863171105d Move htonl, htons, ntohl, ntohs to netinet/in.h to support more packages 2025-05-02 09:49:37 -06:00
Jeremy Soller 121e733990 Merge branch 'fix_arm64' into 'master'
Fix building for arm64

See merge request redox-os/relibc!636
2025-03-30 16:26:41 +00:00
bjorn3 8650ac293e Fix building on targets with unsigned c_char 2025-03-30 16:35:29 +02:00
Josh Megnauth 51c04d2470 Use C string literals & deprecate c_str! 2025-03-14 21:17:53 -04:00
Anhad Singh c286ad2868 fix(ld.so): do not depend on TLS at all
In the next big refactor (next PR), all of the platform functionality
used by both relibc and ld.so will be moved into a `platform`/`sysdeps`
crate and then ld.so would be moved out of relibc and not link with it.

I think doing it in a seperate PR would make it more managable, as when
I did half of it, the diff was pretty huge and that way it would be
easier to review too :)

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-05 23:11:59 +11:00
Josh Megnauth fc1e220a99 fix(netdb): Buffer overrun when parsing DNS 2024-11-18 13:43:22 +00:00
Jeremy Soller ce7b85b0df Merge branch 'dont-overallocate-cstrings' into 'master'
Avoid over allocations & reallocations

See merge request redox-os/relibc!558
2024-11-17 16:17:22 +00:00
Josh Megnauth 5348273ccc Emit C attributes via cbindgen 2024-11-17 16:15:07 +00:00
Josh Megnauth d6ac5f8947 Avoid over allocations & reallocations
As we know, vectors amortize the cost of adding new elements by reserving
space for multiple elements when full. This is useful but may lead to
allocating more memory than necessary.

`relibc` generally avoids over allocations by reserving the exact amount
of space when possible. I fixed a few areas that still over allocated or
reallocated unnecessarily by leveraging iterators that are more likely
to know sizes.
2024-11-14 22:53:12 -05:00