Age | Commit message (Collapse) | Author |
|
we apply .env files from both the current working directory and the
directory of the executable we're running from
very simple .env format, KEY=VALUE, comments prepended with # on first
character of line only.
|
|
|
|
also: empty signal set before using due to malloc
|
|
|
|
enforce 78 character limit
add comments for reasoning and description purposes
|
|
includes heartbeat mechanism
|
|
use switch{case} instead of if statements for determining action upon
signal
|
|
design choice since 1 << n == pow(2,n)
|
|
since we moved our signal handlers to be created before subsystems are
created, our new signal handlers (which namely blocks SIGTERM, used for
panicing) are passed on. in order to restore full panic functionality,
we clear all signal blocks before passing execution to the subsystem
|
|
in panic, when killing process group, set pid to 0, where it gets our
pgid for us, using kernel optimisations, saving a trip to kernel land to
get the pgid ourselves
|
|
prevents potential race condition where a subsystem can terminate before
we fully block SIGCHLD, causing SIGCHLD to be sent to init and having
our entire process terminated ungracefully.
prevents bash and family from sending "Terminated" due to our process
receiving SIGTERM during a panic, since we already exit in there and
it'd be queued up if we do receive one
|
|
in log: we ensure we panic by killing our process group with SIGTERM,
raising it for ourselves, and exiting (if all else fails simply).
in init: we catch SIGTERM and exit with 0 if we get it, as bash (and
likely others) prints a nasty "Terminated" to stderr
|
|
libcurl requires first 3 characters of a wss url
(i.e. wss://example.com) to be capital, so instead WSS://example.com.
so we modify the assume url to use WSS and ensure the returned URL from
discord uses the WSS capital scheme
|
|
|
|
|
|
also: change panic signal to be SIGKILL as sigint being caught would
result in a loop
|
|
also: modify log to exit status 0 on panic instead of 1 (only runs exit
on panicmode respawn which shouldn't cause a fatal termination)
|
|
break out of WSS compatability checker loop when we find a valid match
for wss
|
|
|
|
just read the note on osdev wiki that stated that input operands
shouldn't be changed, so we move both rax and the console lock to the
output operands so the compiler knows we are modifying them for our
lovely optimisation
|
|
move spin locks to dedicated function so we can minimise repetition of
code. now uses more C and less assembly.
init.c uses 8192 * 512 as a maximum even if the stack rlimit is larger
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basic api http_get function, (which the definition of will def. change
in the future)
uses libcurl to get the api /gateway to get the wss url, and assumes a
url in case of failure so we at least try authenticating
|
|
(also add loglevel for failed to reap message)
token is required and init will panic without TOKEN in the environment
|
|
|
|
|
|
|
|
rearrange print to use internal vaprint to accomadate print
added additional options to vaprint (nolock, noparsecolon, etc)
use subsystem modes to accomadate restarting
|
|
|
|
potential copyright violations??
doesnt matter anyway since i'm going to implement my own panic soon
which should address the downfalls of a generic `die`
|
|
|
|
|
|
(log)
- create LOGLEVEL constant numbers
- implement CONSOLE_LOGLEVEL
- color array now uses loglevel constants
- timestamp now shown (thanks util-linux)
(init)
- register mainpid
- hello world print
- fix process reaper to refer to subsys when reaping
(subsys)
- create maximum subsystem count
- create subsystem table
- add debugging prints to subsystem entry and termination
- create function to handle process termination (unmap stack, free
subsystem malloc, clear entry in table)
- disable subsystem inception
- change die references to fail with print
- supply clone with signal to send on termination (SIGCHLD)
|
|
sprinkle a little bit of commenting throughout the codebase. hopefully
i dont regret what i've written
- clone: bottom of stack is passed through
- print: write newline at end of message
- initcall: functions return void type
very basic net startup. hopefully i dont regret implementing the
websocket protocol myself in a language as holy as C.
|
|
- create subsystem system using clone syscall, shared memory, shared
file descriptors
- printk-like logging facility (TODO: console loglevel)
- initcall system (like linux kernel)
TODO: determine license
factors: linker.ld, linux kernel licensing (some ideas are more
liberally taken rather than paraphrased)
|