summaryrefslogtreecommitdiff
path: root/sys/kern
AgeCommit message (Collapse)Author
41 hourskernel: exit: Reassign children to init on exitIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
41 hourskernel: init_main: Store 'init' as g_initIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
41 hourskernel: spawn: Continue if procp NULLIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
45 hourskernel: accnt: Keep track of per-cpu statsIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
45 hourskernel: Sort out switch MI/MD switch logicIan Moffett
Certain operations dealing with context switches are better off being implemented as machine dependent routines which allows us to be flexible with what we can do, as well as the extra benefit of requiring less workarounds to keep things MI. Signed-off-by: Ian Moffett <ian@osmora.org>
46 hourskernel: Move 'g_nthreads' to kern_accnt.cIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
46 hourskernel: Add initial accounting logicIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
46 hourskernel: proc: Decrement proc count on exitIan Moffett
Previously, our process counter was monotonic (wuh oh!). We want to be sure that it decrements when a process exits. - Rename nthreads to g_nthreads as a global - Atomically increment on enter and decrement on exit Signed-off-by: Ian Moffett <ian@osmora.org>
48 hourskernel: filedesc: Ensure 'fd' is valid during r/wIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 dayskernel: sched: Ensure 'ci' is not NULLIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 dayskernel: exit: Detach console on exitIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 dayskernel: time: Leave interrupts be on sleepIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
6 dayskernel: Avoid using kprintf() during panicIan Moffett
Avoid using kprintf() during a system panic event as it relies on internal locking that may hang the system preventing diagnostics from being logged Signed-off-by: Ian Moffett <ian@osmora.org>
6 dayskernel: Make panic screen configurableIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
7 dayskernel: vnode: Refactor definitionsIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
8 dayskernel/sched: Undo sched_yield() changesIan Moffett
- Keep old sched_yield() logic as newer logic caused issues on QEMU - TODO: Actually fix and test Signed-off-by: Ian Moffett <ian@osmora.org>
9 dayskernel: exit: Clear out file descriptors on reapIan Moffett
Ensure all file descriptors are freed and their respective vnodes released. Signed-off-by: Ian Moffett <ian@osmora.org>
9 dayskernel: sched: Greatly simplify yield logicIan Moffett
The purpose of yielding to the scheduler is to tell it you want to preempt early in order to not starve processes while waiting for I/O. We can trigger the timer earlier on for stability as a ~10 usec delay should not be too terrible. Signed-off-by: Ian Moffett <ian@osmora.org>
9 dayskernel: ucred: Add SYS_getuidIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
10 dayskernel: proc: Add cred per processaIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
10 dayskernel: cred: Introduce SYS_setuid syscallIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
10 dayskernel: proc: Add initial setuid()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
10 dayskernel: exit: Panic if PID 1 diesIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
14 dayskernel/amd64: Add support for coredumpsIan Moffett
To make debugging userland program crashes easier, this commit introduces coredumps that store the last known process state into a temporary /tmp/core.X file (where X is the PID of the faulting process). Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03kernel: Ensure mutually exclusive console accessIan Moffett
If multiple processes try to write to the console, a race condition of sorts may occur. Similarly, if multiple processes try to read from the console and contend with the console input buffer. One process may steal keys from the other. Prevent this by implementing a mutex within the console descriptor. Each time a process reads or writes the console, it attaches itself. Any other processes attempting to read or write the console while another is attached will be yielded to the scheduler until the resource is free. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03kernel: synch: Use md_pause() in spinwait loopIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03kernel: synch: Add mutual exclusion locksIan Moffett
Add mutex locks, these differ from spinlocks as they are named and also yield to the scheduler instead of just spinning if the lock is acquired. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03usr: libc: Add POSIX getpid() and getppid()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03kernel: proc: Add getpid() and getppid()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-03kernel: driver: Implement driver blacklistIan Moffett
Sometimes one may not want *all* of the drivers to start up during system boot. The driver blacklist allows one to mark a driver to be ignored during startup. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-07-01kernel: descrip: Return new offset in fd_seek()Ian Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: driver: Only init non-deferred driversIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: syslog: Remove unused variableIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: Introduce SYS_inject syscallIan Moffett
The SYS_inject syscall will allow the user to inject Kernel Runtime Quantums (KRQs) into the running kernel. As of now, set paths are not supported and the initial implementation includes a NULL path used to load all deferrable drivers. Previously during kernel startup, all deferrable drivers were loaded automatically. This commit makes it so that they are only loaded when sys_inject() is called with a NULL path. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29usr.sbin: init: Allow start path to be overriddenIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: panic: Implement fresh panic screenIan Moffett
Clear the screen and tweak console foreground/background to urgent looking colors during a system panic Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: panic: Remove redundant newlineIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-29kernel: syslog: Remove problematic lockIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-28kernel: exec_elf64: Ensure '.bss' is zero filledIan Moffett
Implement logic to go through the section header table and explicitly zero fill all entries of type SHT_NOBITS Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-27kernel: descrip: Validate operations against sealIan Moffett
Ensure file I/O operations match the seal that their respective file descriptors were set with. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-27kernel: Add initial support for tmpfsIan Moffett
Introduce the initial support for tmpfs, a readable and writable in-memory filesystem. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-27kernel: vfs: Add support for O_CREAT flagIan Moffett
Add support for the O_CREAT flag which allows file creation upon an open() call. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-27kernel: namei: Add NAMEI_WANTPARENT flagIan Moffett
In some lookup cases, we may only be interested in the parent component. For example, the parent of "/foo/bar/mrow" is "/foo/bar/". The NAMEI_WANTPARENT asks namei to only look for the parent rather than the full path. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-25kernel: Add "starting init" message for verbosityIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-24usr: Start shell + rc through /usr/sbin/initIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-24usr: Add init.rc for userspace startup flexibilityIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-24kernel: exit: Only kill leaf if not exitingIan Moffett
During an exit(), the parent needs to kill all of the child processes that depend on it. However, there might be an occurrence where one or more is already exiting and trying to kill such processes would be problematic and may result in issues like double frees. This commit ensures that the exiting parent only kills child processes that aren't already exiting themselves. Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-17kernel: time: Introduce SYS_sleepIan Moffett
Add SYS_sleep to put a thread to sleep for some time through a timespec Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-13kernel: spawn: Add argv + stub envp argumentsIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>
2025-06-13kernel: Only free thread data on exitIan Moffett
Signed-off-by: Ian Moffett <ian@osmora.org>