8d46c9bbe2
Kernel, libc: Fix a big bug in printf()
...
Every time printf flushes the buffer to us in sprintf() or snprintf(), we call strncat to append the data.
But we want to start from the beginning in the first flush. What if there was data already there?
Well, we just append to the old data. Which is not good, and breaks snprintf()'s maximum size policy.
This fix sets the first byte of str to NULL, to avoid this.
2022-10-30 09:53:23 +01:00
e705810af3
apps: Add a new date utility
...
This program tells you the current date and time :)
2022-10-30 09:09:24 +01:00
e2b5c1bfdd
uptime: Use clock_gettime instead of reading from /dev/uptime
2022-10-30 09:09:03 +01:00
324fb42ee2
libc: Add support for the new time functionality in the kernel
2022-10-30 09:08:29 +01:00
688a640a16
Kernel: Add the clock_gettime syscall, which replaces clock as it can be used for more stuff
2022-10-30 09:07:59 +01:00
baf97840e9
Kernel: Keep track of boot time
2022-10-30 09:07:03 +01:00
a9da58421f
su: do not pass out-of-bounds argv to execv when argc is 1
2022-10-29 20:13:40 +02:00
d1e4bc5504
Kernel: Use framebuffer virtual address instead of physical address
...
Just found out bootboot.fb_ptr was the physical address, not virtual.
That explains why we were getting page faults while writing to the physical address of the framebuffer. (we were in a user address space when doing so)
So this should probably make the system much more stable!!
2022-10-29 20:10:49 +02:00
8395eb16f6
session: endpwent on exit
2022-10-29 10:18:39 +02:00
7aad256acd
Update README.md
2022-10-29 10:13:36 +02:00
33ed6e5c17
su: endpwent on exit
2022-10-29 10:01:51 +02:00
8375701bf6
session, su: Split password-collecting logic into a separate function
2022-10-29 10:01:44 +02:00
3e052c72a0
init: don't wait before executing the session binary
2022-10-29 10:01:17 +02:00
32e09d3417
libc: Stub out more functionality so part of binutils builds
2022-10-29 09:39:12 +02:00
9db1e8cdb3
Inform of the default user configuration in the MOTD
2022-10-28 21:58:17 +02:00
e9092ab235
sh: Display username instead of shell's PID in prompt
2022-10-28 21:57:07 +02:00
0b838572e1
apps: Add a new session program which manages user login
2022-10-28 21:56:52 +02:00
702cc0442c
endpwent: Close all opened instances of /etc/passwd, including those used by getpwuid() and getpwnam()
2022-10-28 21:02:55 +02:00
2ca20c1a1e
compilation fix
2022-10-28 21:02:23 +02:00
91470851cd
stat: Show username of file owner
2022-10-28 21:00:33 +02:00
5aba1c5f15
su: Make it setuid root, ask for a password, and accept a username
...
It asks for a password only if you are not root, obviously.
2022-10-28 20:57:13 +02:00
477af66cdc
ps: Show usernames of processes, using getpwuid()
2022-10-28 20:55:39 +02:00
7d0e442cde
libc: Add /etc/passwd and the pwd.h API
...
getpwent, getpwnam, getpwuid... they may have been a pain to implement but once they work they're awesome :)
Right now passwords are stored in plaintext in the world-readable passwd file, which is not good.
But I don't have any sort of hashing implemented so it'll stay that way for now.
2022-10-28 20:55:00 +02:00
e05f3f5325
Kernel: Read file modes from the initrd, filtering out write permissions
2022-10-28 20:52:10 +02:00
a2d9ada4dc
oopsie
2022-10-28 19:38:04 +02:00
b8296eb92d
su: Also set group ID
2022-10-28 17:55:56 +02:00
fa0dc4b18c
apps: Remove sym and crash
...
Not necessary anymore.
2022-10-28 17:53:22 +02:00
68d0d0b759
apps: Add a new su utility
2022-10-28 17:52:46 +02:00
8f0e358360
libc: Add setuid, setgid, seteuid, setegid
2022-10-28 17:52:39 +02:00
09a615bd99
Kernel, libc: Expose processes' UID and GID in pstat()
2022-10-28 17:31:34 +02:00
acdc2d3ad7
init: Open /dev/console for appending
2022-10-28 17:31:00 +02:00
17671fd435
libc: Implement getuid, geteuid, getgid, getegid
2022-10-28 17:24:28 +02:00
1c4f1ab867
Kernel, libc: Add setuid() and setgid() system calls
2022-10-28 17:19:26 +02:00
2269ec267c
apps: Add a 'stat' utility
2022-10-28 17:14:20 +02:00
b1729689df
libc: Open stdout and stderr write-only on init
2022-10-28 17:14:09 +02:00
77d331b258
init: Open /etc/motd with O_CLOEXEC to avoid leaking this file to children
2022-10-28 17:13:45 +02:00
c312d81de4
Kernel, libc: Add st_uid and st_gid to stat, and handle st_mode differently
2022-10-28 17:13:20 +02:00
26b20938de
Kernel, libc: Use mode in mkdir()
2022-10-28 17:11:35 +02:00
0115cce750
Kernel/VFS: Add file owners and file modes, and check those in system calls
2022-10-28 17:10:28 +02:00
6ddfc5ee52
Kernel: Invoke sys_stat when asked
2022-10-28 17:06:33 +02:00
16dc227a05
Kernel: Add UID and GID fields to Task
2022-10-28 17:06:13 +02:00
3effe8b004
Kernel: Add EACCES to std/errno.h
2022-10-28 17:02:27 +02:00
b2f321c0b8
libc: Parse the mode string
2022-10-28 17:02:08 +02:00
8ed0ff1381
libc: Ensure /dev/random is opened with O_CLOEXEC on init
2022-10-27 17:50:15 +02:00
d93a4062a2
libc: Do not use the heavy variadic syscall() function for wrappers
...
That function is meant more for user programs, and should still be rarely used, since it's not portable.
Instead, we already know the number of arguments. We just call __lc_fast_syscallN, which also sets errno.
2022-10-27 17:42:00 +02:00
0eb0ca4028
libc: Add an empty locale.h
2022-10-27 17:23:59 +02:00
7155cf8d6b
libc: Add alloca.h
2022-10-27 17:23:50 +02:00
703b0a1435
libc: Make tv_usec in timeval signed, as it should be
2022-10-27 17:20:46 +02:00
50cda50f01
Kernel, libc: Add F_GETFD, F_SETFD and FD_CLOEXEC
2022-10-27 17:17:24 +02:00
fcf53ef6a5
Kernel: Make waitpid() block by default unless WNOHANG is specified
2022-10-27 17:05:42 +02:00