Repository navigation
Split up some files into modules/impl FS functions - #104
Conversation
|
Cool! I'll take a closer look in a few days, but I wanted to quickly check in here and say this looks like a great place to start. Also, there's a possibility that splitting lib.rs into multiple files will lead to undefined symbols at link time; if that happens, one option is to use |
|
At a first readthrough, this looks like a good direction. I'll be interested to see what happens when the current CI failures are fixed (rustfmt, and there are likely some conversions needed when dealing with |
|
I think you need to punch the button, as the CI hasn't been running for several commits. This seems like a good point to see how far I get in the CI anyways. |
|
Ok I've finally gotten to the linking errors. How is c-scape built (aka what crate-type), and how/where is it linked in? |
|
Currently, the way it works is:
The tricky part of this setup seems to be that some of the extern-C symbols get dropped before we reach the final link, when the linker realizes they're actually needed. Putting all the code in a single lib.rs file seems to avoid this problem, though I don't yet know why it works. I'm also open to other approaches here. "Put everything in lib.rs" is the only thing I've found that works, but if there's a better way to do it, I'm certainly open to it. |
|
Ok I've solved it with: I'm working on some rustc fixes in this space, but for now that's probably the best workaround for us. I'll take a look at the linking in more depth later. |
sunfishcode
left a comment
There was a problem hiding this comment.
Cool, thanks for figuring out the codegen-units fix. That'll make it much easier to organize this code.
| n if n < 0 => { | ||
| rustix::process::kill_process_group(Pid::from_raw(pid.unsigned_abs()).unwrap(), sig) | ||
| } | ||
| _ => unreachable!(), |
There was a problem hiding this comment.
This unreachable! could be avoided by making what is currently the 0 case be the default case after the n < 0 and n > 0 cases.
|
This is currently marked as a draft; is this ready for review? |
39d0683 to
341a05e
Compare
|
I think this is ready for review now, but I do need to figure out how to add tests for every function that I added though. |
sunfishcode
left a comment
There was a problem hiding this comment.
This looks great! It'll be much nicer having everything factored out into modules like this.
Concerning tests for new functions, my sense is that it's not necessary to have tests for every function at this point. A complete c-scape testsuite would effectively be a libc or POSIX testsuite, and there are already a number of such testsuites out there that we could potentially use, for example musl's. I expect we'll eventually wire some of these up, which will provide a lot more test coverage.
|
Build won't be green for a while until rustix gets updated, as I'm knocking out termios right now. a39ec76 should be reviewable however, so these changes can simply just be split into a seperate PR. |
|
Would you mind opening a new PR for the termios and any other changes? I'd like to land the main changes here, so that we can build on top of the new code organization. |
|
Yeah I just did, I realized after a short nap that I could just... use another branch. |
|
This new organization looks great! |
The main point of this change is to make sure all LFS functions are implemented in terms of the the
64variant, as well as move all of the fs located code outside of the single massive file. Where functions ending inatwere missing, they have been added and all calls updated to reduce code duplication.Closes (because that's probably better than putting a comment in each issue): #88, partial #87, #71.