File system hangs.
-
- Posts: 18
- Joined: Wed May 28, 2025 8:20 am
- GitHub: https://github.com/Zeviraty
File system hangs.
github.com/Zeviraty/AOPOS is the code
after fs_init
it hangs and it happens at every return statement it just hangs not executing the next code i dont know what to do
roast me or stuff but just help me
after fs_init
it hangs and it happens at every return statement it just hangs not executing the next code i dont know what to do
roast me or stuff but just help me
Re: File system hangs.
What debugging have you done? For starters, enabling the qemu monitor will allow you to inspect the machine state when it hangs. You could gain even more info by running under gdb. A hang ought to be easier to trace than a triple-fault.
-
- Posts: 18
- Joined: Wed May 28, 2025 8:20 am
- GitHub: https://github.com/Zeviraty
Re: File system hangs.
Sorry but i cant figure it out 

Re: File system hangs.
If you are getting stuck at this stage of the proceedings and are not prepared, or able, to use common debugging techniques then perhaps you should consider whether OS development is a suitable hobby.
It's not going to get any easier when you move on to more advanced stuff.
I don't mean to be rude, but this sort of programming is not for everyone.
It's not going to get any easier when you move on to more advanced stuff.
I don't mean to be rude, but this sort of programming is not for everyone.
-
- Posts: 18
- Joined: Wed May 28, 2025 8:20 am
- GitHub: https://github.com/Zeviraty
Re: File system hangs.
Yeah i get it but this is my first time working with c and its ecosystem so im new to that but i have created a wordle os in rust and more projects in python & rust so its just that the c ecosystem is new to me
Re: File system hangs.
If the C ecosystem is new to you, the most sensible place to start would be to try your hand at userspace first. There will be plenty of reason to use debuggers doing that, and you would gain valuable experience doing so.
In this case, you have already identified the function that is doing something wrong. It is fs_init(). Here's a hint: How big is the single variable that function declares, and how many bytes does the code attempt to write in it?
In this case, you have already identified the function that is doing something wrong. It is fs_init(). Here's a hint: How big is the single variable that function declares, and how many bytes does the code attempt to write in it?
Carpe diem!
Re: File system hangs.
The process of debugging is pretty much the same whichever language - high level or low level - you use. I agree that if you are not comfortable with programming in C then an OS is not the place to learn.
If you’re good at Rust then that’s a fine language to write an OS in.
If you’re good at Rust then that’s a fine language to write an OS in.
-
- Posts: 18
- Joined: Wed May 28, 2025 8:20 am
- GitHub: https://github.com/Zeviraty
Re: File system hangs.
I am not uncomfortable
just unfamiliar and the programming is also no problem because the syntax is very similar to other programming languages. Just the debugging is completely different than normal
so i would love for some help
on where to begin to debug this issue.
i want to do it in another programming language
that is lower level to learn more of the stuff that happens below the abstraction layer
.



Because i already did that



-
- Member
- Posts: 5815
- Joined: Mon Mar 25, 2013 7:01 pm
Re: File system hangs.
In what way is debugging C different from debugging Rust?
You can use the same tool (gdb) or you can use the same simpler techniques (e.g. inserting statements to print the value of variables at certain points of the program or to show how far a program progresses before ceasing to work). And use of the qemu monitor is the same whatever language the program is written in. If anything it should be easier with C code as it’s closer to the underlying machine than Rust is.
I’m afraid I don’t see any evidence that you have done this sort of debugging. You simply say “my program hangs - help”. That’s not much information. You tell us you know where the program hangs but give no evidence of how you came to that conclusion.
As has already been suggested, postpone writing an OS in C until you are familiar, or better still comfortable - which to me indicates a greater level of competence - with the language. Write some straightforward user programs and learn how to use the toolset and debugger - learn to walk (in C) before trying to run.
You can use the same tool (gdb) or you can use the same simpler techniques (e.g. inserting statements to print the value of variables at certain points of the program or to show how far a program progresses before ceasing to work). And use of the qemu monitor is the same whatever language the program is written in. If anything it should be easier with C code as it’s closer to the underlying machine than Rust is.
I’m afraid I don’t see any evidence that you have done this sort of debugging. You simply say “my program hangs - help”. That’s not much information. You tell us you know where the program hangs but give no evidence of how you came to that conclusion.
As has already been suggested, postpone writing an OS in C until you are familiar, or better still comfortable - which to me indicates a greater level of competence - with the language. Write some straightforward user programs and learn how to use the toolset and debugger - learn to walk (in C) before trying to run.
-
- Member
- Posts: 450
- Joined: Tue Apr 03, 2018 2:44 am
Re: File system hangs.
Further to this, I'd recommend writing a useful runtime toolkit that you can use in user and kernel mode. The C runtime is pitiful, providing little in the way of abstractions or containers.iansjack wrote: ↑Mon Jun 02, 2025 11:11 am As has already been suggested, postpone writing an OS in C until you are familiar, or better still comfortable - which to me indicates a greater level of competence - with the language. Write some straightforward user programs and learn how to use the toolset and debugger - learn to walk (in C) before trying to run.
I'd recommend writing standard methods of organizing data, as OSes need to do a lot of that.
My goto runtime interface is the Map, using pointer sized integer keys and values, which can be wrapped and used as pointers if required. A Map can be:
- Ordered - Ordered key maps allow you to quickly and efficiently search using binary search, implemented as a sorted array or a binary search tree. Ordered key maps are also suitable for range searching.
- Unordered - Unordered key maps are typically hash tables, less useful for ranges, but in the absence of hash collisions, look-ups are O(1).
- Arrays - Indexed by key, I wrap my arrays in a Map interface to hide things such as resizing the array, obviating the need for client code to implement range checking (my wrapper does that.) Slower than a raw array, but much safer.
Almost all my code uses ordered key maps and lists, and I don't even actually implement hash based map yet.
But implementing all this in a manner that is platform independent will give you a good grounding in C, and you can use it in user space tools. I use my data structures in both my kernel and build time tools used to implement domain specific languages used to generate boiler plate code such as my system call interface.
You can also implement in user space things like threading libraries, implementing task switching in a user process to implement threads will give you a good springboard into implementing such functionality in a kernel.
-
- Posts: 18
- Joined: Wed May 28, 2025 8:20 am
- GitHub: https://github.com/Zeviraty
Re: File system hangs.
Well we ere talking about gdt and (of course) that doesnt exist in rust.
I came to that conclusion because i added debug statements and found out thats where it hangs it executes before the return statement and not after. And sorry if i dont give much evidence english is not my main language im dutch and that makes it hard to communicate.
Sorry for me trying something new you dont have to be rude about it and instead of constantly saying what i shouldn't do say where i can begin and help me to start instead of gatekeeping it and saying that i shouldn't do this.iansjack wrote: ↑Mon Jun 02, 2025 11:11 am As has already been suggested, postpone writing an OS in C until you are familiar, or better still comfortable - which to me indicates a greater level of competence - with the language. Write some straightforward user programs and learn how to use the toolset and debugger - learn to walk (in C) before trying to run.
Re: File system hangs.
I'm not sure what you mean by "gdt". If you mean Global Descriptor Table then of course it exists, for x86 processors, whatever implementation language you use. If you meant "gdb", well that does exist for Rust - and is a very useful tool.
OK, good to see that you used debugging statements (though not so good that you didn't give us any information about what debugging you had done). As with computer languages, I don't see that English not being your native language is relevant to this lack of information.
I'm sorry that you take umbrage at what is intended as constructive criticism and suggestion as to how you can improve your proficiency in C before attempting complex projects. But this site is not really intended to be a learning resource for basic C - there are plenty of those available - and assumes a certain level of knowledge and willingness to learn rather than just asking for solutions to problems.
So, rather than annoy you further I'll bow out at this stage.
OK, good to see that you used debugging statements (though not so good that you didn't give us any information about what debugging you had done). As with computer languages, I don't see that English not being your native language is relevant to this lack of information.
I'm sorry that you take umbrage at what is intended as constructive criticism and suggestion as to how you can improve your proficiency in C before attempting complex projects. But this site is not really intended to be a learning resource for basic C - there are plenty of those available - and assumes a certain level of knowledge and willingness to learn rather than just asking for solutions to problems.
So, rather than annoy you further I'll bow out at this stage.
-
- Member
- Posts: 5815
- Joined: Mon Mar 25, 2013 7:01 pm
-
- Member
- Posts: 229
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: File system hangs.
I think he is used to GUI-debuggers. When I started learning C/C++, I used Microsoft Visual Studio C/C++ and learned debugging with the UI there. I am still learning to use gdb as a command line tool. The Visual Studio UI back then you just clicked on a line to set a breakpoint and if you hovered your mouse above a variable in the code, it showed its value.
I am still working on my hobby OS project and learned gdb just half a year ago. Well, with the built-in help I got comfortable rather fast and easy. My problem with gdb and OS dev in general is, that often if I want to watch a variable, it was optimized out and therefore I can't see the value anymore.
