Commit Graph

538 Commits

Author SHA1 Message Date
Enrico Fraccaroli (Galfurian) 91e1a116c7 Disable doxygen for fcvt.c file. 2024-02-29 12:51:04 -05:00
Enrico Fraccaroli (Galfurian) e67aced2c0 Add missing comments for pci_dump_device_data function. 2024-02-29 12:50:49 -05:00
Enrico Fraccaroli (Galfurian) 179a301c40 Merge branch 'develop' of github.com:mentos-team/MentOS into develop 2024-02-29 12:30:35 -05:00
Enrico Fraccaroli fb1a6fcf15 Merge pull request #35 from fischerling/restart-login
init: restart the login process after the user session terminated
2024-02-29 12:29:32 -05:00
Enrico Fraccaroli 9bb52a8494 Merge pull request #37 from fischerling/add-dev-null
drivers: implement memory device driver
2024-02-29 12:28:08 -05:00
Enrico Fraccaroli bd864fe384 Merge pull request #34 from fischerling/implement_dup
Implement dup syscall
2024-02-29 12:26:21 -05:00
Florian Fischer 3bf6119030 drivers: implement memory device driver
The first and only memory device mounted at /dev/null discards all data
written to it and always returns 0 bytes when read.
2024-02-29 17:59:24 +01:00
Florian Fischer 1a6a590eee init: restart the login process after the user session terminated 2024-02-29 17:47:00 +01:00
Florian Fischer cf8781398d use get_unused_fd helper to find the lowest available fd 2024-02-29 17:43:28 +01:00
Florian Fischer 2d8350f732 implement dup syscall 2024-02-29 17:43:20 +01:00
Enrico Fraccaroli (Galfurian) b79f768a0f Use the ptr_to_malloc_header function. 2024-02-29 11:18:03 -05:00
Enrico Fraccaroli (Galfurian) 45229810be - Check for errors from the brk;
- Use the new malloc_header_to_ptr function in malloc;
2024-02-29 11:17:09 -05:00
Enrico Fraccaroli (Galfurian) 670320df13 malloc(0) is implementation-dependant, we return NULL. 2024-02-29 11:16:29 -05:00
Enrico Fraccaroli (Galfurian) f088eb4058 - Add comments to the malloc_header_t structure;
- Add functions that extract the memory pointer from a pointer to the header, and vice versa;
2024-02-29 11:15:25 -05:00
Enrico Fraccaroli (Galfurian) 7b6076b612 Add an explanation for the swap macro. 2024-02-29 11:07:55 -05:00
Enrico Fraccaroli (Galfurian) d213276817 Add missing comment for the offset argument of tokenize. Add error checko on the offset. 2024-02-29 11:06:04 -05:00
Enrico Fraccaroli (Galfurian) ed7454f1e0 Translate italian text to english. 2024-02-29 11:04:47 -05:00
Enrico Fraccaroli 806664f61c Merge pull request #32 from fischerling/stopcont-test
remove infinite loop in t_stopcont
2024-02-29 11:03:43 -05:00
Enrico Fraccaroli 8852d09693 Merge pull request #31 from fischerling/test-semflg-test
fix t_semflg test
2024-02-29 10:59:41 -05:00
Enrico Fraccaroli 8262982e87 Merge pull request #30 from fischerling/cleanup-tests
Some miscellaneous cleanups for the included tests
2024-02-29 10:56:34 -05:00
Enrico Fraccaroli fbff702922 Merge pull request #29 from fischerling/add-utils
Add false and stat util
2024-02-29 10:50:14 -05:00
Enrico Fraccaroli cd60f1602e Merge pull request #28 from fischerling/improve-syscall-doc
doc: update the implemented syscalls
2024-02-29 10:46:22 -05:00
Enrico Fraccaroli 354470b85b Merge pull request #27 from fischerling/add-german-keymap
add german keymap
2024-02-29 10:44:40 -05:00
Florian Fischer 43054529d5 add creat test
Tesing commit f7e53f9b00.
2024-02-29 16:12:09 +01:00
Florian Fischer fe4c4e337e remove infinite loop in t_stopcont
Remove useless preprocessor define.

Terminate the child after 15 seconds.

Since the parent is waiting for the child to terminate it is still
guaranteed that the child was continued.
2024-02-29 16:09:39 +01:00
Florian Fischer 63b8d9420a fix t_semflg test
Remove the double semaphore cleanup in the child and the parent.

Set nops to 1 since there is only one operation not two.

Use a blocking semaphore operation in the parent to wait for the
child increasing the semaphore value.
2024-02-29 16:07:50 +01:00
Florian Fischer 7b54ff8d2a tests: exit with 0 when the test succeeds. 2024-02-29 16:05:11 +01:00
Florian Fischer 65393843a5 tests: use files that actually exist
Commit af79958f1a removed
a lot of files including /home/user/test7.txt used in some tests.

Replace /home/user/test7.txt with /README.
2024-02-29 16:04:56 +01:00
Florian Fischer afa3d4fb66 tests: remove the not used t_exec_callee 2024-02-29 16:04:49 +01:00
Florian Fischer f124be1cf7 tests: add simple test for small consecutive writes
This test was written for: 4d4504486d.
2024-02-29 16:04:37 +01:00
Florian Fischer 88b1846a43 tests: fix paths to the other periodic tests 2024-02-29 15:58:48 +01:00
Florian Fischer 8e1696d701 add simple stat.1 implementation 2024-02-29 15:52:49 +01:00
Florian Fischer ebd07576fa programs: add simple false program 2024-02-29 15:52:34 +01:00
Florian Fischer ce99aff26b doc: update the implemented syscalls
Fix the listed source files for implemented syscalls and remove
the files for not implemented ones.
2024-02-29 15:48:27 +01:00
Florian Fischer 5b4c3bb0f4 add german keymap 2024-02-29 15:44:31 +01:00
Enrico Fraccaroli (Galfurian) 53d1e8ad68 Set the size of every new directory to the block_size 2024-02-28 12:14:54 -05:00
Enrico Fraccaroli (Galfurian) ed50926b46 Remove ext2_write_inode call from ext2_write_inode_block, because is already called by ext2_allocate_inode_block internally on success. 2024-02-28 12:13:35 -05:00
Enrico Fraccaroli (Galfurian) bc0c921316 Merge branch 'master' into develop 2024-02-28 12:10:37 -05:00
Enrico Fraccaroli ee2f95e51d Merge pull request #26 from fischerling/fix-ext2-write
Fix some regressions in ext2_write
2024-02-28 12:09:56 -05:00
Enrico Fraccaroli (Galfurian) 189f2ceb77 Merge branch 'master' into develop 2024-02-26 10:03:44 -05:00
Enrico Fraccaroli b617fccee4 Merge pull request #25 from fischerling/improve-text-printing
Improve text printing
2024-02-26 10:02:01 -05:00
Enrico Fraccaroli 14474130ad Merge pull request #24 from fischerling/improve-ls-long-output
ls: improve --long output format
2024-02-26 10:00:24 -05:00
Enrico Fraccaroli 18504170ec Merge pull request #23 from fischerling/add-some-man-pages
add simple manual pages for rmdir, mkdir, showpid
2024-02-26 09:59:16 -05:00
Enrico Fraccaroli 404f4c20f0 Merge pull request #22 from fischerling/fix-execvp
libc: prevent execvp to search for files containing '/'
2024-02-26 09:57:46 -05:00
Florian Fischer dea54c7dae libc: prevent execvpe to search for files containing '/'
The current implementation always searches for the file in PATH
if it is not an absolute path.
This prevents executing relative paths like ./executable.

As specified by exec(3) the p-family of exec functions only search if
the filename does not contain slash '/' characters.
2024-02-14 11:37:06 +01:00
Florian Fischer 44b1acf33c ext2: update the vfs_file_t length after writing
The vfs_file_t->length field is initialized but never used afterwards.
It seams correct to updated it after the inode size possibly changed.
2024-02-13 21:59:57 +01:00
Florian Fischer 4d4504486d ext2: write the inode back if its size is updated
If there is enough space in an inode but the file grows the
inode is never written back to the device and thus the new size is
not persisted.

	int fd = creat("foo", 660);
	write(fd, "foo", 3); // New blocks are allocated and inode written back
	write(fd, "\n", 1); // size is adapted but not written back
	close(fd);
	// Reading the file afterwards will only return "foo".

The code snippet reproduces the bug.

This is fixed by always writing the inode back to the device if
the size is updated.
2024-02-13 21:59:57 +01:00
Florian Fischer f7e53f9b00 ext2: do not update inode size when allocating new blocks
New blocks for an inode are allocated when data blocks
should be written and not enough blocks are allocated yet
or during allocating new direntries in ext2_allocate_direntry.

When writing the first time to a newly created file (inode.size==0),
new blocks must be allocated and the inode size is erroneously set to
(blocks_count / fs->blocks_per_block_count) * fs->block_size
regardless of the actually written data.

	int fd = creat("foo", 0660);
	write(fd, "foo", 3);

This code snippet will create a new inode with size 4096 instead
of the correct size 3.

ext2_write_inode_data will correctly set the size to 3.
However, ext2_allocate_block called by ext2_write_inode_block will
set the inode size to 4096.

This is fixed by removing the size update during ext2_allocate_block.
2024-02-13 21:51:04 +01:00
Florian Fischer beacbde52e man: use cat as pager to print man pages
This reduces the required code in man and additionally,
replaces the old broken read/puts implementation.

Puts expects a null-terminated string, but write does not return
a null-terminted string.
2024-02-13 13:15:58 +01:00
Florian Fischer cad4804a95 cat: improve exist status
Exit with status 1 if one or more arguments could not be printed.
2024-02-13 13:15:36 +01:00