#Nyaux
1 messages Β· Page 64 of 1
okay
either you add a refcount field to the FileDescriptorHandle that you update (and finally free + destroy after it reaches zero) or you make some kind of generic refcounted object thing that you can use with other things too
well ill js create some refcount field, if closed is called on a fd and its refcount is 0 it gets cooked
typedef struct {
size_t count;
void (*destructor)(void *me);
} refobj_hdr;
void *refobj_create(size_t size, void (*destructor)(void *me)) {
refobj_hdr *hdr = kmalloc(size + sizeof(refobj_hdr));
if (!hdr) return NULL;
hdr->count = 1;
hdr->destructor = destructor;
return hdr + 1;
}
void refobj_ref(void *obj) {
refobj_hdr *hdr = (refobj_hdr *)obj - 1;
__atomic_fetch_add(&hdr->count, 1, __ATOMIC_RELAXED);
}
void refobj_unref(void *obj) {
refobj_hdr *hdr = (refobj_hdr *)obj - 1;
if (__atomic_sub_fetch(&hdr->count, 1, __ATOMIC_ACQ_REL) == 0) {
hdr->destructor(obj);
kfree(hdr);
}
}
let's go! 
posnyatral standard @elder shoal since we both use keyboard device files as our inputs
nice
Real
real
what should parameters to say a readdir vfs op, im not having the seeking being handled in the readdir op itself (hope thats okay) as my fd system does that fine, should it be (vnode, hnd, buffer, buffersize, offset)? and like hnd->position is ur pos???
idk
im so confused rn
probably vnode?
(vnode, dirent, &offset) I guess?
offset being read write
and possibly a version field as well so that you can deal with race conditions when someone else modifies the directory by adding/removing a file
I have these two:
/// Find a directory entry.
fn find_dirent(&self, name: &[u8]) -> EResult<Dirent>;
/// Get all directory entries.
fn get_dirents(&self) -> EResult<Vec<Dirent>>;
This is on my VNodeOps trait so &self implicitly includes the FS-specific data needed to do these calls.
The contract, then, is that the things like this:
/// Create a new file in this directory.
fn make_file(&mut self, name: &[u8], spec: MakeFileSpec) -> EResult<Box<dyn VNodeOps>>;
Take a multable reference, i.e. the generic VFS code ensures that make_file is not concurrently called when e.g. find_dirent is.
Having the two separate functions for finding a dirent and getting all of them has worked nicely so far for me.
To answer your question: A reference to the VNode should be all you need (and add filename for find_dirent ofc)
couldn't find_dirent basically just be the generic vfs lookup op?
or what is it used for
VFS defers dirent lookup to the filesystem to allow it to optimize how that works itself.
For example, RAMFS uses a BTreeMap where FAT will use a linear read of the directory's contents.
what I meant by generic vfs lookup op was fn lookup(&mut self, name: &str) -> Result<VNode>; that's implemented by the fs (not so generic ig, idk why I said generic lol)
yeah but you get the idea
ig your find_dirent is basically the same thing then?
just with a different name
All three functions you see above are functions of the trait VNodeOps
literally
Well except for the part where looking up a dirent need not actually open the VNode
That is handled by this function in VfsOps:
/// Open a file or directory.
/// The caller must guarantee `dirent` is up-to-date.
fn open(&self, dirent: &Dirent) -> EResult<Box<dyn VNodeOps>>;
The Dirent type contains some more info than an actual struct dirent in userspace would, so that all information needed to actually open the file can be stored in it.
ah, interesting
This lets you open a file directly from a dirent cache entry
What about position and offset
What abt position tho
POSIX semantics require loading all dirents at once when you start reading the first dirent in a directory through the read system call, so you'd simply call get_dirents at that point and store it in the file descriptor (in my case VfsFile, which implements the File trait).
With more dirent cache awareness, I could even optimize this to not duplicate memory in the future.
could I js use my hnd private data field do store a buffer and like if all the dirents arenβt in this buffer I load em on first read
Yes, but remember to clear that out when the position is set to 0 again as IIRC, these same semantics require you to load it again when you re-start reading from the beginning.
Why when position is set to 0?
Iβm confused
Position (file descriptor offset, etc.)
Because if you don't clear that (which is effectively a cache), then you could only get the dirents once every time you open a file descriptor on a directory.
uh huh
So the logic becomes:
On read, cache the dirents in the FD if offset is 0.
On seek, clear that cache if the offset becomes 0.
offset
Rightly
I mean starting pos lol
starting pos is zero
Oki
Note: POSIX allows you to use any number as the offset for directories, and says that applications must only use offsets obtained from tell for this reason.
If any other number is used, the result is undefined.
why would POSIX semantics require this
It's been a bit since I researched this, but doing a read (not getdents!) on a FD that refers to a directory should be consistent; if the directory is modified halfway through a loop reading it, undefined results could occur if you don't enforce these semantics.
pretty sure POSIX doesn't require readdir consistency when concurrent modification is involved
and read on a directory is not defined by POSIX
And in that case you're probably best of just not supporting it.
it couldn't be so under linux because some people (biologists) like to use the filesystem as a database and have folders full of millions of files
in dealing with readdir offsets, one of the useful properties of traditional filesystems like ufs, ext2, etc is that you can do something like this when asked to readdir starting at some offset x: let y be x rounded down to the nearest multiple-of-block-size. then follow the dirent chain starting from the dirent at y. when you find the first dirent >= x, then return that
that's the simplest way to implement readdir statelessly
im gonna impl it robots way
easiest from my point of view
we ball later today
also holy shit its been nearly 2 years since i started nyaux
i should make a late nyaux anniversary thing
okay we ball now
makes sense
is that okay @broken depot ?
yooooooooo terminal
weve had even doom
awesome
This seems right
wanna vc im kinda losing my shit trying to figure some stuff π
Maybe another day, I'm kinda nonverbal rn
i mean u dont have to speak, you can js mute and text
but no pressure
u dont have to lol ill totally understand if ya so no
im taking that slience as no, totally understand! sorry ur not feeling well :c
That just kinda happens sometimes
i understand
okay me impling that op is as much as im gonna do today, im losing my shit with how id get this working without somehow fucking it up lol
its hot
okay i dont know how much nyaux work i can get done today
today im going to contribute to gloire for the EC
we will see if i can get some nyaux work done too
also if i understand correctly, on seek set 0, ya clear dirents from fd->privatedata, on read offset 0, throw dirents into fd->privatedata, any other offset and any other seek is handled normally?
Yes.
epic, hows ur day btw
goot
Im painting me spaceship
epicc
Hoping to do a crystal fragments thing
What is that
EC is embedded controller
Gloire is a distro based on Ironclad kernel
doing gloire work rn
its the distro of ironclad
im js doing ironclad work
im js using it interchangbly
cool
mhm
What game is that
Go to sleep
Gn
holy shit i can barely sleep
Get a Yo-Kai Watch and summon Baku, boom, problem solved 
progress ig tho
yokai watch was so good
ayyy! Someone remembers yokai watch! π
crazy
im actually gonna go to sleep but before i do
why is the name in mlibc's define of name 1024
instead of a char ptr
why is that allowed
what abt names > 1024
wait gdb can show code ????
iirc, if you compile your code with -g or -ggdb, you can add the --tui flag to gdb when you run it, eg. cc -g -o my_prog src.c && gdb --tui ./my_prog
?
other libcs use 256 iirc
just don't have paths that are longer 
?????
what
how is that allowed
have you ever seen a path that long?
there are def names bigger then 1024
nope
ill make one rn
THATS FUCKING RETARDED
FILE NAME TOO LONG
HOW IS THIS EVEN ALLOWED VRO
π π
because paths that long don't exist in the wild
crazy shit
peak
worth noting that that particular limitation only really applies to individual components
the entire path has a different limit
which on linux I believe is 4096?
also the component name length limit is filesystem dependent
on ext4 it's 255 bytes iirc
if the dir entries are 1024 limited
it cant be fs dependent
cause at the end of the day its gonna be 1024
1024 is the absolute max yeah (on mlibc at least) but the real max (which can be lower) is fs dependent
fair
btw opinion on the new pc
looks nice
yes
love the free floating pc speaker
that looks clean bro
it very much is
Lianli enjoyer? or what case is that
ah it looked similar to the lianli that I have from the side 
fair 
nice
should put a fan on the back for that extra airflow
they're dirt cheap for the most part
i dont think so
that aio is crazy
fair
way overkill, a Pentium D + GT 210 is good enough for all usecases 
yo is this okay?? ls is trying to access '', what am i supposed to say, if i give it back the cwd it js fstats it until the end of time it doesnt rlly do much other then repeatably call fstat, if i return enoent it says this
what do i do
it js does this forever
like what do u want ls
anyone know?
are you compiling with linux sysdeps? it could be passing and empty path and AT_EMPTY_PATH to the fstatat call if you use that
If pathname is an empty string (or NULL, since Linux 6.11)
operate on the file referred to by dirfd (which may have
been obtained using the open(2) O_PATH flag). In this
case, dirfd can refer to any type of file, not just a
directory, and the behavior of fstatat() is similar to that
of fstat(). If dirfd is AT_FDCWD, the call operates on the
current working directory. This flag is Linux-specific;
define _GNU_SOURCE to obtain its definition
-100 is the AT_FDCWD magic number iirc
i am not provided that
i am provided with flag AT_SYMLINK_NOFOLLOW
@elder shoal
hm
Looks awesome
i dont know whats going on
i guess ill wait for the really smart ppl to come online to maybe help
by help i mean, point out what i did wrong
what exactly tries to spam fstat ???
like what program
a
ls
ls
i am going to personally shoot every coreutil developer in the head
someehow adding printfs to ls is causing weird ass behavior where sometimes it reaches a print sometimes it doenst
the only thing i can rlly do is atttach gdb and find out where ls is loaded so i can add the symbol file and bt and hope and pray
did you fix the AT_FDCWD thing
yea
fstat is handling AT_CWD
and i do check for AT_EMPTY_PATH
to which im not provided
i still give it the cwd vnode stat
even then
giving ENOENT js makes things not work and ls spam trying to access directory ''
do u have any ideas what may be happening?
what does it to try to stat?
fd: -100, path: '', flags: 100
trying to access directory '' or smt
idfk
thats all i know whats going on
-100 is AT_FWCWD which i do handle
@molten grotto some of my fstat code
my bad i had to use waypipe to get the screenshit
im too lazy to get on my chair
does your vfs_lookup correctly handle empty paths?
i pushed it now
if u give it a empty path its gonna give the vnode u passed in as its starting point
what does fstat return there
dope, all white. what are the specs?
so i returned the cwd vnode stat, if i dont return the cwd vnode stat and give it ENOENT it still doesnt work and js repeats it cannot access '' directory
ryzen 9 9600 32 gb ddr5 rx 9060 xt
good shit
what's not working when you're returning the stat?
ls?
i genuinely do not know what ls is trying to do cause adding printfs to the source js makes shit inconsisent
ENOENT if i return ENOENT for empty path
bro what error does it return when you give it stat
^
i js stated what i return?
π
that's when you give it enoent
mhm
it js repeats the fstat
forever
on the same node
same flags
same shit
What's in that stat
wdym
Maybe the issue is actually in readdir?
well like
i dont think so? i mean fastfetch would have shit itself if it was? considering it did do a readdir
tho it could be possible
mode is 4000
You could be returning an empty file name in readdir and its trying to open that
Check what it returns in userspace
i checked with gdb, it seems to be returning shit correctly, and uh yeh sure ill do that
whats the name of the dirent structure for mlibc in the sysdeps
i found it
@elder shoal
i found it lol
pain :c
every field?
every dent entry
okay
well i will do it when i get on my pc
im not doing it via waypipe
There is something wrong with that last one
i fixed
ls now exits
lovely
okay for any other offset, do i give it like one entry or still give it the entire list from beginning + offset to end?
anyone know? i really dont know what mlibc expects lmao
id assume the latter?
yea no i have no idea what im doing here
uhhhhhhhhhhhhhhhhhhhhhhhhhhhh
may js look at astral code or smt
or rather badgeros
since its similar to nyaux in the way readdir is impl'd
cause @broken depot gave the idea
I just noticed this but I'm in bed right now. I'll point you at my wacky old readdir code tomorrow since the new stuff isn't in yet
okii
did you setup d_reclen in dirent struct ?
yes?
u awake
Oh yes lemme grab that link for you
epic
did you write to bytes_read ?
yes

what you do when you want to say what there's no more files
what
My current approach seems to be to just have a function that lets you get all dirents
Which is to be expected
which i do in offset 0
But I, for some reason, didn't make a readdir function for the file descriptors???
but i dont know what to do when offset is not 0
Depends what format you cache those dirents in
i mean when there's no more files in directory
you already gave all files with sys_read_entries
Do you just have a single big array with all the dirents in it in the linux_dirent format?
yuh
ok
readdir is impl'd per fs
tmpfs does it in a big array
and that is the format vnodes expect
they have this thing called a dirstream
struct dirstream {
size_t position; // currently useless
struct linux_dirent64 *nodes;
size_t cnt
}
@broken depot how it looks
ok cool
So since the position is something you get to define yourself, I'd just use it as an array index
Well if the offset isn't 0 then you do a bounds check, and then copy the node at that index to the read buffer provided by the caller of readdir
Like I said, you get to define what offset means for readdir, so I'd just define it to be the array index into nodes
struct __syscall_ret syscall_readdir(int fd, void *buf) {
sprintf("syscall_readdir(): fd %d, buf usr addr %p\r\n", fd, buf);
struct FileDescriptorHandle *hnd = get_fd(fd);
if (hnd == NULL) {
return (struct __syscall_ret){.ret = -1, .errno = EBADF};
}
if (hnd->node == NULL) {
return (struct __syscall_ret){.ret = -1, .errno = EIO};
}
if (hnd->offset == 0) {
// cache em
int res = 0;
struct dirstream *star = hnd->node->ops->getdirents(hnd->node, &res);
hnd->privatedata = star;
if (res != 0) {
return (struct __syscall_ret){.ret = -1, .errno = res};
}
// this is okay to do as no 1 FUCK YOU IM MEMCPYING TO USR SPACE
// 2 entries are at least ensured
memcpy(buf, star->list, (star->cnt) * sizeof(struct linux_dirent64));
star->position += (star->cnt) * sizeof(struct linux_dirent64);
hnd->offset += (star->cnt) * sizeof(struct linux_dirent64);
sprintf("done readdir\r\n");
return (struct __syscall_ret){.ret = (star->cnt) * sizeof(struct linux_dirent64), .errno = 0};
}
sprintf("READDIR OTHER SHIT IS UNIMPL'D\r\n");
UNIMPL
}
what my readdir looks like atm, also yea i do need to add the buf size as a parameter which ill do
the current array index?
yes
oki makes sense
Also, make sure you have something (for example a spinlock or mutex) in place to prevent that stuff from getting free'd mid-syscall by another thread seeking to position 0 on the same FD.
I personally would advocate for simply putting a mutex around both seek and readdir on directory FDs.
yea i can make a spinlock that you have to lock on writing to privatedata
perfect
Also, I'd recommend letting userspace specify how many entries it wants to fetch
yea with the size parameter
clearly
can you show linux_dirent64
struct linux_dirent64 {
uint64_t d_ino;
int64_t d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[1024]; // mlibc does this so like, we cant escape it...
// we cant be the epic kernel
};
file { contents[9999999999] } 

Linux NAME_MAX is 255, so why is this 1024 long?
nlibc has it 1024
nlibc
That seems wrong, as Linux has it as an unsized array at the end of the struct:
The linux_dirent structure is declared as follows:
struct linux_dirent {
unsigned long d_ino; /* Inode number */
unsigned long d_off; /* Not an offset; see below */
unsigned short d_reclen; /* Length of this linux_dirent */
char d_name[]; /* Filename (null-terminated) */
/* length is actually (d_reclen - 2 -
offsetof(struct linux_dirent, d_name)) */
/*
char pad; // Zero padding byte
char d_type; // File type (only since Linux
// 2.6.4); offset is (d_reclen - 1)
*/
}
And I do this: https://github.com/badgeteam/BadgerOS/blob/d65975a055df6e8ebd5832f9861072a6a5f70a6a/kernel/include/filesystem.h#L114
Imagine storing 4x NAME_MAX in a temporary value because fuck you that's why 
you don't have to copy that much tho, you can just copy offsetof(dirent, d_name) + len_of_name_including_null bytes and put that as the reclen
well what are you gonna do abt it 
mlibc wont cut off my balls if i dont do it like yall
yes its an optizmiation i guess
but has nyaux ever cared abt smt like that

i mean
a lot of shit in nyaux is still missing locks
idk what will happen if i ran some other threads on the other cores
nor is my scheduler advanced enough to load balance atm
actually
after sockets i may js stop any userspace shit js to work on load balancing and stuff
then get back to work and probs try to get xorg or impl signals idfk
where pipes


where firefox
mathew: where men
marvin: where opensuse plushies
me: where bitches 
wait no actually
marvin: where rewrite number #SIZE_T_MAX
ok vro get back to work with astral

crawl ur way back into ur astral thread /joking
waitwiaiwaiat @elder shoal you play factorio right
do u have space age
as if you have any right to talk 
i do
you can use firefox in astral if you ssh forawrd from your host 

factorio mutiplayer 
sorry I dont have time for another factory game in my life I'm still in EV in gregtech π
insane shit π
especially now with uni back
i was js gonna give u a tour of my factory lol
haha yes ping me I want to see it too
i willl
actually pipes is near ~100 lines of code so make it now !!!
(with c++)
chat we ball after i get up
im up
but first
i must give @elder shoal a tour in factorio
and @broken depot
yall ready?
I am not
dies
give me a few hours and I can
oki
you should start implementing pipes in the meantime
im writing uacpi bindings for streaks ironclad rn
honestly ill js get back to work on readdir
and write some more uacpi bindings later
ive already written a bunch
to my sadness
you workin' on ironclad too?
contributing for the ec driver
i see
Sorry I had to go to bed early today
i js like helping :)
ah okii all good
mathew isnt even getting on factorio for a bit anyway
Tomorrow same time would work though
alr epicc
me when i have to scroll up the nyaux thread to find important pieces of info
lol
wait i cannot find it but u def did say smt about a bounds check, if i wanted to get the idx it was bufsize / sizeof(struct linux_dirent64) right? id assume i have to round down bufsize
would i round down bufsize to the nearest linux_dirent
Yep
alr epic
i wish
i js realized my round down and up functions are align up and down
which makes sense
@broken depot quick question cause my math skills arent the best today
struct __syscall_ret syscall_readdir(int fd, void *buf, size_t size) {
sprintf("syscall_readdir(): fd %d, buf usr addr %p\r\n", fd, buf);
size = align_down(size, sizeof(struct linux_dirent64));
struct FileDescriptorHandle *hnd = get_fd(fd);
if (hnd == NULL) {
return (struct __syscall_ret){.ret = -1, .errno = EBADF};
}
if (hnd->node == NULL) {
return (struct __syscall_ret){.ret = -1, .errno = EIO};
}
// if (hnd->offset == 0) {
// cache em
int res = 0;
struct dirstream *star = hnd->node->ops->getdirents(hnd->node, &res);
hnd->privatedata = star;
if (res != 0) {
return (struct __syscall_ret){.ret = -1, .errno = res};
}
// this is okay to do as no 1 FUCK YOU IM MEMCPYING TO USR SPACE
// 2 entries are at least ensured
memcpy(buf, star->list, (star->cnt) * sizeof(struct linux_dirent64));
size_t new_idx = size / sizeof(struct linux_dirent64);
if (star->position + new_idx > star->cnt) {
new_idx = star->cnt;
size = star->cnt * sizeof(struct linux_dirent64);
}
star->position += new_idx;
hnd->offset += size;
sprintf("done readdir\r\n");
return (struct __syscall_ret){.ret = size, .errno = 0};
// }
//sprintf("READDIR OTHER SHIT IS UNIMPL'D\r\n");
// UNIMPL
}
is the math correct for this?
ill triple check
sorry i said something stupid eariler so i deleted it lol
thats not how that works
dw abt it
i think this is correct tho?
static_cast<struct dirent*>(sex)
um?? solved nothing?
@elder shoal factorio?
sure like 10 min so I can heat up dinner
oki
I was reading your code and saw that lol
oh fair
whats up with greg?
it must have not copied correctly
hi
havent played it much lately, in super early ev, got a titanium line and ae2 set up and slowly building towards the stuff needed for nitrobenzene production
added
is it a good idea to send it in a public discord
booting up factorio
doesnt matter that much but true I dont want random friend requests
just steam friend code
human tcp
join @elder shoal
its booting up let it think
Yeah I figured it out
my computer takes a bit to load space age
That is clearly a skill issue for not using an nvme raid 0 as your boot drive :^)
/s
Sorry I had the urge to flex on that
I do have a ssd on my boot drive but factorio is installed on a hard disk
Ah
space age takes a while to load from an ssd as well
How long does it take to load usually
idk its still loading
Tbf the only reason I have a raid 0 is because I used to have one 500gb nvme and it was too little
6 minutes to load
So I got another 500gb nvme and made a raid 0
Jeez
I should get Factorio and see the loading times on my machine lol
In all seriousness tho, is Factorio really worth it
It's unlike most of the stuff I've played
my align down is not working as intended?
so mlibc passed in 2048
i aligned down
i got back 2048
size of struct linux_dirent64 is 1048
so using astrals round down fixed it
crazy
Thats where I kinda got burned out
my case is mostly uni started again and my work break ended so time is kinda super sparse now
ls is able to read things all js fine
but it isnt displaying anything

oh and ls -la causes a deadlock
in fstat
yea i have no idea
. . . . . . . . . . . . . . . .
lol
hmmm, something ain't right here (β_β )
ayy, letsgo! π
something i have forgotten to do is wire up nyauxes ps2 driver correctly to the tty
its not wired up correctly so u cant use shift or anythin
ah, that might be helpful lol
nice!!
who needs shift anyways
Total 0 
im back
we ball with nyaux in a bit
what we gonna do today is basically wire up ps2 properly to the tty
if we get that done by today then um
pipes
which will be scary because i have ZERO idea on how they work
lol
Good news: I have a tested-ish pipe implementation you can steal re-write in C because it's Rust
id rather not lol
part of the fun of osdev is learning how shit works
so ima learn how pipes work and impl them myself
I use a ringbuffer for them
i see
Then I use some fancy atomic operations to make multi-read, multi-write possible without mutexes
insane shit
atomic cmpxchg weak my beloved
how do you pronounce cmpxchg
ye os
I like to say "cumpks chug"
Compare and exchange Iβm assuming
Imagine saying all those words
no it's actually to invalidate a tlb entry
Isnβt that invlpg

Wtf is that
BTW Nyaux what are you planning to port for your userspace?
oh nice
you mean mtcr dtbctrl?
first is X tho
we def wanna have X first
id probs do it before signals
to get X running
You'll really start wanting signals soon though
yea def
Do you not have them at all yet?
no not at all
signals are great
especially for job control
so you dont end up locking up the system with cat
and also you need signals for any terminal to be remotely usable in x
ik
I implemented my signals with a queue with the stipulation that synchronous signals like SIGSEGV or something with raise skips the queue.
no idea what ur saying but oki
Then when a user thread is scheduled, or returns from a syscall, I check for pending signals. I don't allow for recursively catching them, so it just kills the process in that case.
uh huh
is raise skipping the queue the right implementation, what if like the signal is blocked
idk I don't actually have raise
But I do have synchronous signals (SIGSEGV)
that is me after punching you and stealing all astral money in a hit and run
raise is just a kill() to self in my implementation iirc
I think this is the time to look up what the semantics for raise are supposed to be
Ok well that's nice and simple then
But uhh yeah signals really aren't that bad. But they are another thing where you need some specific manipulating of the thread context, just like scheduling is.
Maybe tomorrow I could help you with pipes and/or signals
very epic
UAPCs for signals π
or ASTs or whatever you call em
it seems like ASTs can be used for signals since they execute when returning to userspace
My signal impl makes them behave similar to DPCs but in userland (even though I don't support actual DPCs)
signals arent really that bad, you just have to redirect the address when entering the thread. for me:
- i copy in a tiny trampoline into userspace and push the signal handler, signum (and optionally siginfo)
- the interrupt frame of the thread is set to have its RIP point to this trampoline, and so the interrupt handler brings us there
- save current context in that trampoline
- jump to handler and let it do its thing
- restore context in that trampoline
okay guys
we are wokring on shit and like im trying to figure out how to give ctrl+c and ctrl+x and friends to the tty ringbuf?
like how would i do that?
store the state of ctrl at the time of the character being sent
i already do a state system
i already did that
im js asking
well
you send ctrl characters
these values
how does userspace expect them
^
what's ctrl x
userspace/terminal emulator is responsible for handling control
ctrl + x
im talking about the tty
what does that do?
if you're holding ctrl then the ASCII code of the character sent to the PTY should change
not a standard POSIX thing iirc
js stands for jupiter stupider
although also
nano has the tty in raw mode and is reading a character at a time
ctrl-x corresponds to a particular byte
there exists a control character for Ctrl + X
it reads this byte
^X 
what is this byte?
shit i forgot
iirc ctrl-A is 1, ctrl-B is 2, and so on
^
ctrl-@ is 0
yeah that's it
okay makes sense
these are ASCII values ^
thanks will and sasdallas and ilo
those are for characters unrelated to ctrl x
those are not part of the funny V family of macros
ctrl x is just an ASCII code
ik
those signals are recognized by the TTY to send specific signals
if the ISIG lflag is set
ohhhh
you mean
what the Vfamily of shit do
its used for isig
okay makes sense
alright thank you lmao
okay i got nano working
epic
REAL
so true
ayy! That's so cool lol π
now I need to get back to work so astral will be basically linux by the next 10 to 50 years
lol
chromium speedrun astral vs nyaux
vs my microkernel
I dont think I would have the patience to port chromium
vs your nt clone 
does it require something crazy?
lol very epic
idk but it just sounds laborious
nyaux would probably win lol
lmfao
maybe when the kernel is in a better state I can look at it
as in fully self hosting, stable, fast, etc
cd is very simple
that looks really cool!
thanks mint!!!!!!!!!!!!!!!!!!!!!!!!
Nyaux vs Astral is like the story of the bunny vs the turtle
real!!!!
Rayan is the turtle, and Mathew the bunny
yessss :3
:3
i really need to update nyaux's recipes to jinx 0.6 ngl
tbh maybe it would be slightly more likely if I'd actually work on the userspace side too instead of just spending days after days writing more and more kernel functions lol
rushing userspace is a bad thing
having a robust kernel would make it easier for userspace later on
it's probably a scary number of nt/win32 api functions needed
maybe
true ig
you need userland to know what syscalls you need and to test them, though
you cannot really only work on the kernel in isolation
nah we all know the #1 approach is to speedrun to userspace with a uniprocessor OS running off of a tmpfs and hopes and dreams 
i wonder if it's possible to measure how many nt/win32 apis it depends on
including the deps of all external dlls
interesting
I did that in i686 bentobox and it was not a good idea lmao
is it normal for 2 chdir calls to be made?
considering thereβs a very easy way to instrument all system calls iβd say yes
considering the first one failed.. yes?
maybe
This
yeah probably
make it not fail it should become a single one
big boy come pick up yo phone
okay
Port Lua and you're on my old kernel's level basically
what does lua need
also you should include nano syntax highlighting files
lua is known for its portability
its literally single file iirc
huh?
Yea
steal the moon
Lua is like 2 files
ig for the normal build you do have the makefile + multiple files
Thanks for the idea I will build Lua for my os tomorrow 
Yoinked the idea
nice
extremely easy
iirc its just make CC=<your GCC>
its quite a bit more but its extremely portable
At least modern Lua isn't, I ported it way back
nice
so baller
yuh
ill go get lua now
very easy
YOOOO @kind root @elder shoal @supple robin
Nice
yippee
awesome sauce 
why does the first two sentences sound like something Spooky would say 
very easy
thing goes in one end and thing come out other end
long answer: you have a read end and a write end, read end can read from a circular buffer, write end writes to the circular buffer
if the read pipe gets closed and the writer tries to write send SIGPIPE
that's it
LUA
you put things in one end and you get them in the other
like pipes
when nyaux roblox
probably never unless roblox starts supporting linux first (either native or in wine)

afaik you can run roblox on linux
ah interesting, I guess it changed since I last looked
the question is, when factorio on nyaux
hmmm how would you even run factorio on mlibc
you remove version info from the binary and use a preloaded compatibility library that overrides stuff like pthread functions where the structure size mlibc uses/some macro initialized fields differ from the ones used in glibc
its the one that I made for that yeah
well the addition of symbol versioning support to mlibc made it not work hence the need to strip the versioning info from the binary you want to run using a script, and the previous glibc detection inside the lib relied on the fact that glibc binaries/libraries contain symbols with glibc in their versions
I have changes for that locally, the new way is kinda weird because it changes the os abi in the binary to solaris and uses that to detect it lol
ah
its source closed
π€―
I know, crazy
reverse it and rewrite as open source 

though I wonder if it is obfuscated, it looks very gibberish even for c++ code
this is extremely cool
proud of you, potato boy
thanks π <3
BUT NO WAY U JS CALLED ME POTATO BOY
π π₯
NAHHHHH THATS INSANEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEe
:3
:3
Potato boy is crazy
oh yeah i added a option to turn off all nyaux debug prints and nyaux is like CRAZY fast without the debug prints
idk if its js me but booting nano somehow feels faster on nyaux then native linux?
probs bias lol
Niiiice
BTW @surreal path I have time now for I think at most another hour or two until dinner. I have more time after that.
alr!
yo chat
i am home
haha yes
yess
Uh, is this a good thing or a bad thing, I can't tell π
@broken depot im confused why its upset
okay we will debug this later today
i think its one of the syscalls not bound checking smt
i may log everything related to readding and writing
rip
okay i think we should add this into nyaux https://github.com/androidoffsec/baremetal_kasan
a kernel santizier will be extremely helpful
i saw this repo from #resources
sysdeps dont look hard
i think it will be extremely helpful to have this
oh hi qwinci lol
may the torture begin
I just got rid of kasan in my kernel because it's kinda annoying having to allocate shadow pages when allocating anything in the virtual memory 
no idea what shadow pages are lol
but fair
you should read about it before trying to port code you don't understand
the way kasan usually works is that there is a region in memory that contains the poison state of every 8 byte chunk in the higher half
and you can't just allocate the physical pages for that region to begin with because its a huge amount of memory so you have to map the pages backing the region on demand when you allocate new virtual memory in the higher half
right
well
yea well i mean im not add kasan then as this may js be me trying to avoid actually debugging this, honestly its probs a bounds check issue somewhere thats causing the elf memory to be leaked somehow
yea it may be helpful but its js kinda me moving from one thing to the next basically
get a rubber ducky
what i should do instead is focus on looking at every syscall made, look at each value passed to each syscall and look at the return values for smt sus
?
wowie
lol fair
Yap to an inanimate object about your bugs and eventually you will figure it out
what a napper
alright so
interesting shit
count is 262144 right
it reads only 1
FIXEd
now i need to figure out why this no workie
or well why wc with pipes not working in general
okay so
doing wc and typing shit does read it fine (tho pressing enter doesnt make it new line?)
but ls | wc does not work
tho the fifo does say it got read by 40 bytes and written to by 40 bytes
first written then read
most sane and rational gnu program:
gnu has quality coders 
yo
okay so i discovered the issue
its cause fifo_close isnt impled
also im missing some pipe semantics
ill impl this later after impling some shit for ironclad β’
im doing shit for pipes rn
js trying to die fixing them to work
pipes make me wanna do not okay things to people
like HOW
at least u catch a ub error instead of dying
yea fair lol
we are closer
but it deadlocks somewhere 
like with ls | wc it js doesnt even return to bash
js does nothing after running it
fastfetch gives u that then you cannot give input to bash anymore
lmao im stupid
nvm
it didnt fix it

π
vro
code still better than glibc
i have figured out why
but i do not know how to solve this
as you see i kfree both node and fifo right, but since this is basically IPC another process isnt gonna see it unmapped on its pagemap
bascially causing weird shit like this
i have no idea how to solve this to be honest in a reasonable way
does anyone know?
it's almost impossible to write worse looking code than glibc
even the indie game devs do better π₯
it is astounding that some gnu projects like gcc are even functional
genuinely baffling
im somehow corrupting the vnodes
idc anymore code is on github
mb i wasnt in a good mood yesterday
i have a feeling its cause of the way my hashmap works
i think it copies entries not keeps references to the same fd
i saw it memcpy in its hashmap_set function so
yea i may be cooked in that regard
that makes a lot of sense as to why shit dont work then if thats the case but i cannot really prove it to be fair
not unless i add more prints
I like your logo, very nice
thanks
try to disable your pmm free and check if it works
maybe something is writing to already freed memory
sure
inb4 it runs out of memory
okay so
yea im violating forks semantics
makes sense as to why pipe doesnt fucking work 
would you like help debugging?
i can handle it just fine on my own but sure that would be nice :3