375 Commits

Author SHA1 Message Date
Enrico Fraccaroli (Galfurian) 21728285a6 Reactivate test_write_read function. 2024-03-01 14:28:00 -05:00
Enrico Fraccaroli 636f8c68c5 Merge pull request #41 from fischerling/fix-permissions
Fix and rework our permission permissions
2024-03-01 14:26:43 -05:00
Enrico Fraccaroli (Galfurian) 50569ed1c8 Fix cat to handle symlinks correctly. 2024-03-01 13:51:06 -05:00
Enrico Fraccaroli (Galfurian) 81ca704adb Check for symbolic links in more function. 2024-03-01 13:45:29 -05:00
Enrico Fraccaroli a4091ca57b Merge pull request #40 from fischerling/add-pager
add simple `more(1)` implementation and use it for man pages
2024-03-01 13:32:27 -05:00
Enrico Fraccaroli (Galfurian) 57bd59bb43 Fix proper error checking with readlink in cat. 2024-03-01 13:21:21 -05:00
Florian Fischer f687b89c74 ext2: check directory permissions during resolving of paths 2024-03-01 18:29:25 +01:00
Florian Fischer 0347054fae fs: move and fix generic permission checks
As defined by POSIX permissions are checked for the first matching class,
user, group or others.
Only the permissions of this first matching class are considered.

For example:
Consider a process running for user and group.
A file with user:group -w- rw- --- is not readable by user, and
thus not readable by the process.
However, it is readable by anyone else in the group.

Additionally, since the permission checks are generic and not exclusive
to the ext2 driver, they are moved to the vfs code.
2024-03-01 17:55:58 +01:00
Enrico Fraccaroli 2df2f34f22 Merge pull request #39 from fischerling/fix-strlen
fix str[n]len implementations
2024-03-01 11:27:09 -05:00
Florian Fischer 9bb19e22be man: use more as pager for man 2024-03-01 17:22:04 +01:00
Florian Fischer 2644a07f66 add simple more implementation 2024-03-01 17:21:26 +01:00
Florian Fischer c8db92b7b7 fix str[n]len implementations
The current implementations do not count the length of empty strings
correctly.
The following buffer content "\0foo\0" is considered a string with
length 4, because the iteration pointer is incremented before
it is dereferenced to check for a null char.

Replace the broken strlen functions with the implementation of musl libc.
2024-03-01 17:13:39 +01:00
Enrico Fraccaroli (Galfurian) 082ea79648 Add newline at the end of fcvt. 2024-03-01 09:16:25 -05:00
Enrico Fraccaroli 272a246e29 Merge pull request #38 from fischerling/setattr
support setting file attributes
2024-03-01 09:14:46 -05:00
Enrico Fraccaroli (Galfurian) 67223d0edf Extend the write/read test. 2024-02-29 16:44:26 -05:00
Enrico Fraccaroli (Galfurian) e4e740c1c5 Add the ext2_clean_inode_content function to clear the content of an inode. Use it to implement the O_TRUNC. 2024-02-29 16:44:11 -05:00
Enrico Fraccaroli (Galfurian) d213be2bcf Add the bitmask_exact. 2024-02-29 16:43:33 -05:00
Florian Fischer 2ab2dd8a11 add manual pages for chown and chmod 2024-02-29 22:04:09 +01:00
Florian Fischer f4f57e0750 ext2: implement setattr support
This adds support for chown and chmod on etx2 filesystems.
2024-02-29 22:04:09 +01:00
Florian Fischer 548feeaf7d add simple chmod implementation 2024-02-29 22:04:09 +01:00
Florian Fischer 761abc0172 add simple chown program 2024-02-29 22:04:09 +01:00
Florian Fischer 61024ac3f3 add *chmod, and *chown syscalls 2024-02-29 21:49:01 +01:00
Florian Fischer 9ee6421e1b fs: add callbacks to change file attributes 2024-02-29 21:49:01 +01:00
Enrico Fraccaroli (Galfurian) 79a9897a61 Extend the test to include checks on truncate. 2024-02-29 14:28:22 -05:00
Enrico Fraccaroli (Galfurian) 0b1bc2844b Fix wrong check in sys_write. 2024-02-29 14:27:55 -05:00
Enrico Fraccaroli f538920b24 Merge pull request #36 from fischerling/implement-id-separation
Implement user and group ID separation
2024-02-29 13:58:04 -05:00
Enrico Fraccaroli (Galfurian) 152f141d5a Remove const from ata devices. 2024-02-29 13:17:37 -05:00
Enrico Fraccaroli (Galfurian) 61824151fb Add more missing comments. 2024-02-29 13:14:38 -05:00
Enrico Fraccaroli (Galfurian) 9950584c12 Add comment to the __debug_print_header function. 2024-02-29 12:56:45 -05:00
Enrico Fraccaroli (Galfurian) 113e902a62 Add comments to the function vm_area_compare. 2024-02-29 12:56:14 -05:00
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 dba41a3719 fix usage of pid_t instead of gid_t 2024-02-29 17:55:48 +01:00
Florian Fischer b149807ccc support and use the new uid syscalls from userspace 2024-02-29 17:55:48 +01:00
Florian Fischer 43c5bbaaff exec: support SUID and SGID bits 2024-02-29 17:55:48 +01:00
Florian Fischer 9f0d8eca0d implement effective and real user and group id separation
New syscalls:
  * geteuid
  * setreuid
  * getegid
  * setregid
2024-02-29 17:55:48 +01:00
Florian Fischer 9de28df51a stddef: make uid_t and gid_t signed
POSIX describes uid_t and gid_t as SIGNED integer types.
They need to be able to store -1 for various syscalls.
2024-02-29 17:55:47 +01:00
Florian Fischer 58ceead501 add simple id implementation 2024-02-29 17:55:47 +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
Florian Fischer e2e608b073 cat: properly output the read data
Using puts to output data retrieved through write is broken.
Puts expects a null-terminated string, which is not returned by read.
Use write to exactly output the data previously read.
2024-02-13 13:15:29 +01:00
Florian Fischer bb1bca458e ls: improve --long output format
Add padding using zeros instead of whitespace to the date values.
2024-02-13 13:11:03 +01:00
Florian Fischer b489df26ba add simple manual pages for rmdir, mkdir, showpid 2024-02-13 13:10:01 +01:00
Enrico Fraccaroli 1832c77fdb Merge pull request #21 from fischerling/fix-creat-fd-flags
creat: set flags in opened file descriptor
2024-01-29 05:24:58 +01:00
Enrico Fraccaroli ce98a0d3de Merge pull request #20 from fischerling/fix-dir-permission-check
vfs: fix permission check when creating files
2024-01-29 05:24:06 +01:00
Florian Fischer 89e6d75627 creat: set flags in opened file descriptor
creat.2 is supposed to be equivalent to open.2 with the
flags O_WRONLY|O_CREAT|O_TRUNC.

However, in MentOS the fd returned by creat.2 has no flags whatsoever
and is thus not writable.

Set the flags of the file descriptor before returning it.
2024-01-28 21:50:30 +01:00
Florian Fischer 4c6cbc3360 vfs: fix permission check when creating files
When creating new files in a directory the creating process
must be allowed to write the directory not to read it.
2024-01-28 21:47:50 +01:00
Enrico Fraccaroli e31e40ba2e Merge branch 'master' into develop 2024-01-25 16:03:26 +01:00
Enrico Fraccaroli c3c2ba824e Merge pull request #19 from fischerling/fix-grub-entry
Fix grub entry
2024-01-25 16:00:59 +01:00
Florian Fischer 015768793b fix bootloader file name in GRUB config
Fixes: 0b75cd9c
2024-01-24 19:52:16 +01:00
Enrico Fraccaroli (Galfurian) ce9d95e4e8 Merge tag 'v0.6.0' into develop
Release v0.6.0.
2024-01-17 13:50:23 +01:00
Enrico Fraccaroli (Galfurian) c0254bca6d Merge branch 'release/v0.6.0' 2024-01-17 13:50:06 +01:00
Enrico Fraccaroli (Galfurian) 30e01ba560 Update version 2024-01-17 13:49:48 +01:00
Enrico Fraccaroli (Galfurian) af79958f1a Clean up useless files from the filesystem 2024-01-17 13:38:53 +01:00
Enrico Fraccaroli (Galfurian) eca55dfed8 Clean up cmake files (Part 2)
I've kept just one cmake project, in the root directory. The
subdirectories just set up the targets.

The asm compiler is serached just one time, from the root
directory cmake file.

Global compilation flags are set in the root cmake file, and
each subdirectory cmake file sets specific flags if necessary
(e.g., programs need the -u_start specified)
2024-01-17 13:34:32 +01:00
Enrico Fraccaroli (Galfurian) 0b75cd9c2a Clean up cmake files (Part 1)
I've been cleaning up the way compilation flags are passed to the targets
and there are still some changes that must be made, in the next commit.

I've also done some renaming, all_programs into programs and the same for
tests.

The gdb initialization file now is just one, populated using the find command
and using realpath to get the absolute path to the files. I've tested if the
generated gdb.run file works and it does.
2024-01-17 13:16:50 +01:00
Enrico Fraccaroli 24367a58ae Update readme 2024-01-15 11:58:17 +01:00
Enrico Fraccaroli f40c4a6630 Update readme 2024-01-15 11:45:28 +01:00
Enrico Fraccaroli 7ad283d36a Remove windows github workflow 2024-01-15 11:36:04 +01:00
Enrico Fraccaroli e630f89547 Specify the linker 2024-01-15 11:30:52 +01:00
Enrico Fraccaroli 34eeedcbcf Improve the generation of programs and tests. 2024-01-15 11:26:20 +01:00
Enrico Fraccaroli 90ab346195 Remove github action for MacOs 2024-01-15 11:16:11 +01:00
Enrico Fraccaroli 5ce583fdd8 Rollback patch for archive creation that broke clang compilation 2024-01-15 11:14:34 +01:00
Enrico Fraccaroli c2f660f885 Merge pull request #18 from fischerling/improve-gdb-run
do not append to gdb.run
2024-01-15 11:11:11 +01:00
Enrico Fraccaroli 80af9c93fb Merge pull request #17 from fischerling/develop
Improve process termination
2024-01-15 11:10:52 +01:00
Florian Fischer 8b678be2b7 do not append to gdb.run
Currently each time the target gdbinit is executed a new line
containing 'target remote localhost:1234' will be added to the
gdb.run file.
2024-01-13 14:32:03 +01:00
Florian Fischer ef92ba670b exit: properly set the process' exit code when calling exit()
In order to detect the exit status using
WSTATUSCODE ((status & 0xff00) >> 8) the exit code must
be shifted by 8 to the left.

Separate the kernel process exit logic from the actual system call.
2024-01-13 14:31:00 +01:00
Florian Fischer 6f4d3b57f9 libc: fix waitpid not detecting process termination
Since 452aa40770 and the change to
properly return processes exit codes in the status argument, the
status will never be EXIT_ZOMBIE(16) except a process was terminated by
signal(16).

Return from waitpid if either an error occurred (__res < 0) or
we got the status of a child process (__res == cpid).

Additionally fix the weird alignment of the closing braces.
2024-01-13 14:31:00 +01:00
Enrico Fraccaroli (Galfurian) dd39e93194 Try to fix compilation under MacOS 2023-11-30 13:31:49 -05:00
Enrico Fraccaroli (Galfurian) 275cbbe7b3 Try to fix compilation under MacOS 2023-11-30 13:30:19 -05:00
Enrico Fraccaroli (Galfurian) 290ed59d0b Try to fix compilation under MacOS 2023-11-30 13:28:09 -05:00
Enrico Fraccaroli (Galfurian) 3e51197ae4 Try to fix compilation under MacOS 2023-11-30 13:16:09 -05:00
Enrico Fraccaroli (Galfurian) 3d49f0abf6 Try to fix compilation under MacOS 2023-11-30 13:07:13 -05:00
Enrico Fraccaroli (Galfurian) 391bba92a6 Try to fix compilation under MacOS 2023-11-30 13:04:10 -05:00
Enrico Fraccaroli (Galfurian) e96c13ff70 Try to fix compilation under MacOS 2023-11-30 13:02:55 -05:00
Enrico Fraccaroli (Galfurian) 9ef117cbc6 Try to fix compilation under MacOS 2023-11-30 13:01:56 -05:00
Enrico Fraccaroli (Galfurian) af95af6f3a Try to fix compilation under MacOS 2023-11-30 12:59:03 -05:00
Enrico Fraccaroli (Galfurian) d2fd6654eb Try to fix compilation under MacOS 2023-11-30 12:53:16 -05:00
Enrico Fraccaroli (Galfurian) 3fcc0f8964 Use gcc@11 under MacOS 2023-11-30 11:49:41 -05:00
Enrico Fraccaroli (Galfurian) 327e29791e Use gcc@11 under MacOS 2023-11-30 11:47:15 -05:00
Enrico Fraccaroli (Galfurian) f24b962e2b Use gcc@11 under MacOS 2023-11-30 11:44:42 -05:00
Enrico Fraccaroli (Galfurian) 40e4faad90 Use gcc@11 under MacOS 2023-11-30 11:43:45 -05:00
Enrico Fraccaroli (Galfurian) f4c35a09de Use gcc@11 under MacOS 2023-11-30 11:38:17 -05:00
Enrico Fraccaroli (Galfurian) 42d84be2c3 Use gcc@11 under MacOS 2023-11-30 11:35:13 -05:00
Enrico Fraccaroli (Galfurian) 28c00fd9ed Use gcc@11 under MacOS 2023-11-30 11:29:04 -05:00
Enrico Fraccaroli (Galfurian) 379950fb45 Fix minor conversion problems 2023-11-30 11:26:31 -05:00
Enrico Fraccaroli (Galfurian) 4292149567 Use x86_64-elf-gcc under MacOS 2023-11-29 10:45:27 -05:00
Enrico Fraccaroli (Galfurian) 030c16d29e Use x86_64-elf-gcc under MacOS 2023-11-29 10:40:27 -05:00
Enrico Fraccaroli (Galfurian) 29e9d2ff11 Use x86_64-elf-gcc under MacOS 2023-11-29 10:38:44 -05:00
Enrico Fraccaroli (Galfurian) 24b2182bec Use x86_64-elf-gcc under MacOS 2023-11-29 10:37:47 -05:00
Enrico Fraccaroli (Galfurian) a8cfac3c1f Use x86_64-elf-gcc under MacOS 2023-11-29 10:35:08 -05:00
Enrico Fraccaroli (Galfurian) 654a3165c0 Use x86_64-elf-gcc under MacOS 2023-11-29 10:34:42 -05:00
Enrico Fraccaroli (Galfurian) c8544ad6a4 Use x86_64-elf-gcc under MacOS 2023-11-29 10:29:11 -05:00
Enrico Fraccaroli (Galfurian) 61e6954265 Use x86_64-elf-gcc under MacOS 2023-11-29 10:20:23 -05:00
Enrico Fraccaroli (Galfurian) 237bfcefb3 Use x86_64-elf-gcc under MacOS 2023-11-29 10:17:45 -05:00
Enrico Fraccaroli (Galfurian) b7c32fc102 Use x86_64-elf-gcc under MacOS 2023-11-29 10:13:48 -05:00
Enrico Fraccaroli (Galfurian) 2ec77db77a Fix link to homebrew 2023-11-29 10:10:13 -05:00
Enrico Fraccaroli (Galfurian) 7ce609fddc Fix compilation with clang 15.0.7 2023-11-28 10:10:28 -05:00
Enrico Fraccaroli (Galfurian) 75abb84f25 Fix procfs inability to set st_mode properly 2023-11-24 15:50:20 -05:00
Enrico Fraccaroli (Galfurian) f066dd2ad9 Add support for reading symlinks 2023-11-21 14:20:41 -05:00
Enrico Fraccaroli (Galfurian) 1197797ee1 Add symlink function (not yet implemented in ext2) 2023-09-01 11:17:40 -04:00
Enrico Fraccaroli (Galfurian) 45f75bd00d Add readme to the list of compiled files. 2023-08-30 15:39:23 -04:00
Enrico Fraccaroli (Galfurian) 163e83009d Make tokenize work with a const char pointer. 2023-08-30 15:38:52 -04:00
Enrico Fraccaroli (Galfurian) ecf5907f83 Transform readline into a globally accessible function. 2023-08-30 15:38:24 -04:00
Enrico Fraccaroli (Galfurian) 78c1ff4bd4 Minor improvements to the string-related functions. 2023-08-30 11:51:25 -04:00
Enrico Fraccaroli (Galfurian) c82c13417d Move the list of programs at the beginning. 2023-08-30 10:57:01 -04:00
Enrico Fraccaroli (Galfurian) d50d997d6e Wrap single line statements inside braces. 2023-08-24 12:17:16 -04:00
Enrico Fraccaroli (Galfurian) f35abd187b Update readme. 2023-08-23 10:58:15 -04:00
Enrico Fraccaroli (Galfurian) a1071d50ef Update readme. 2023-08-23 10:56:24 -04:00
Enrico Fraccaroli (Galfurian) 24499a20e9 Update readme 2023-08-23 10:49:59 -04:00
Enrico Fraccaroli (Galfurian) 266f527d2a Merge branch 'feature/shm' into develop 2023-08-23 10:36:18 -04:00
Enrico Fraccaroli (Galfurian) 122551ab45 Revert init process changes. 2023-08-23 09:59:34 -04:00
Enrico Fraccaroli (Galfurian) 6b077ccfac Improve comments and code formatting. 2023-08-23 09:55:05 -04:00
Enrico Fraccaroli (Galfurian) 452aa40770 Properly set exit code for killed processed. 2023-08-22 16:32:43 -04:00
Enrico Fraccaroli (Galfurian) c82779f1af After queuing a SEGV for the process that caused a page fault, we call the scheduler to properly handle it. 2023-08-22 15:40:05 -04:00
Enrico Fraccaroli (Galfurian) bf59ccd0f4 Simplify debugging initialization, and allow vscode (Native Debug extension) to use .gdbinit. 2023-08-22 11:52:51 -04:00
Enrico Fraccaroli (Galfurian) aafa26ea38 Send a SIGSEGV whenever a page is not copy-on-write, and the user is trying to write on a readonly address. 2023-08-22 09:26:39 -04:00
Enrico Fraccaroli (Galfurian) 3fc0ba78ca Send a SIGSEGV whenever a page is not present and the user is involved. 2023-08-22 09:25:34 -04:00
Enrico Fraccaroli (Galfurian) a50c1a892f Return an integer from __page_handle_cow, allowing the caller to react to an error. 2023-08-22 09:24:55 -04:00
Enrico Fraccaroli (Galfurian) 08d87ea439 Add code that allows to create READONLY shared memory. 2023-08-22 09:24:01 -04:00
Enrico Fraccaroli (Galfurian) c37fbf6f40 Add shared memory tests. 2023-08-22 09:23:31 -04:00
Enrico Fraccaroli (Galfurian) 34319442aa Implement shmat and shmdt 2023-08-16 14:45:04 -04:00
Enrico Fraccaroli (Galfurian) dde6e6bc9e First rough implementation of shared memory. 2023-08-16 11:49:52 -04:00
Enrico Fraccaroli (Galfurian) 07d603f47a Fix wrong error check 2023-08-11 13:40:46 -04:00
Enrico Fraccaroli (Galfurian) df0a3701aa Improve format 2023-08-11 13:40:22 -04:00
Enrico Fraccaroli (Galfurian) 459d73b4e7 Change global format 2023-08-11 13:40:00 -04:00
Enrico Fraccaroli (Galfurian) 8578f078c6 Improve formatting and enable FLOATING_POINT_ERR 2023-08-11 13:39:45 -04:00
Enrico Fraccaroli (Galfurian) 20091b196f Start working on shared memory 2023-08-11 13:39:18 -04:00
Enrico Fraccaroli (Galfurian) b7f85b9500 Improve format 2023-08-11 13:38:57 -04:00
Enrico Fraccaroli (Galfurian) 83d4beb33d Clean up boot sequence code. 2023-08-11 13:31:32 -04:00
Enrico Fraccaroli (Galfurian) 63314a8363 Improve cd command output. 2023-08-11 13:29:01 -04:00
Enrico Fraccaroli (Galfurian) 23f2a036e7 Clean ps command code. 2023-08-11 13:28:36 -04:00
Enrico Fraccaroli (Galfurian) cd6f876fa8 Improve mkdir output 2023-08-11 13:28:19 -04:00
Enrico Fraccaroli (Galfurian) 954f6342ec Increase wait time. 2023-08-11 13:12:08 -04:00
Enrico Fraccaroli (Galfurian) 55b5eb8cee Fix format, and dela with type casting. 2023-08-11 13:04:34 -04:00
Enrico Fraccaroli (Galfurian) 24ebe9647c Minor format changes. 2023-08-11 11:37:30 -04:00
Enrico Fraccaroli (Galfurian) ee2c0ebd88 Fix how ATA driver determines the type of a device. 2023-07-12 14:28:36 -04:00
Enrico Fraccaroli (Galfurian) 1cbc7519c9 Add missing pragma once 2023-07-12 14:27:21 -04:00
Enrico Fraccaroli (Galfurian) 16b905625d Turn port-io into header-only. 2023-07-12 14:26:52 -04:00
Enrico Fraccaroli (Galfurian) 707c0e408b Improve dec_to_binary function 2023-07-12 14:26:14 -04:00
Enrico Fraccaroli (Galfurian) dc5a30573c Reorganize PCI functionalities, and ATA drivers. 2023-07-01 16:07:00 -04:00
Enrico Fraccaroli (Galfurian) 28276bf565 Add macro to compute number of elements inside an array. 2023-07-01 16:06:34 -04:00
Enrico Fraccaroli (Galfurian) 3ed59b6f55 Add function to count element in arrays. 2023-06-29 15:48:56 -04:00
Enrico Fraccaroli (Galfurian) d6c4dc3184 Add qemu disk flags to load ext2 drive first. 2023-06-29 13:17:37 -04:00
Enrico Fraccaroli (Galfurian) 86e046d080 Minor naming changes inside port_io 2023-06-29 13:00:15 -04:00
Enrico Fraccaroli (Galfurian) 760667e00f Show total size in human format in ls command. 2023-06-27 11:15:21 -04:00
Enrico Fraccaroli (Galfurian) f7fee4ca9b Refactor pmmngr_init function. 2023-06-27 11:14:51 -04:00
Enrico Fraccaroli (Galfurian) 4e35a1682f Clean up some comments in slab, and use round_up function instead of a custom one. 2023-06-27 11:13:54 -04:00
Enrico Fraccaroli (Galfurian) b7c82d7333 Rewrite realpath without memory allocation. 2023-06-23 15:02:17 -04:00
Enrico Fraccaroli (Galfurian) 7972ddeac7 - Add missing comments;
- Reimplement a more safer dirname;
- Implement a simple and safe tokenize function;
2023-06-23 14:37:24 -04:00
Enrico Fraccaroli (Galfurian) 394695784b Merge branch 'feature/kheap_rework' into develop 2023-06-23 11:26:08 -04:00
Enrico Fraccaroli (Galfurian) 8b6a72af3e Set logging to INFO for kheap. 2023-06-23 11:25:52 -04:00
Enrico Fraccaroli (Galfurian) ef6ef96576 Standardize the way we generate random numbers. 2023-06-22 15:42:00 -04:00
Enrico Fraccaroli (Galfurian) 87a796b440 Use bitfields to handle free blocks. Add check when creating new VM area. 2023-06-22 12:03:53 -04:00
Enrico Fraccaroli (Galfurian) 2cd03ccfe0 Check correctness of the kheap split and merge. Update memory test. 2023-06-22 11:08:39 -04:00
Enrico Fraccaroli (Galfurian) 90487afffc Use that beautiful list_head to implement the heap. 2023-06-19 19:32:10 -04:00
Enrico Fraccaroli (Galfurian) 96ee8198f8 Keep track of the tail of the heap, and of previous free blocks. 2023-06-19 19:06:12 -04:00
Enrico Fraccaroli (Galfurian) a872442aa3 Finish reworking the heap. 2023-06-19 17:44:27 -04:00
Enrico Fraccaroli (Galfurian) eb74fae1fd Add round_up math function. Add toggle_bit function. Minor clean up of the kheap code. 2023-06-16 10:18:22 -04:00
Enrico Fraccaroli (Galfurian) bb8bb799f9 Map the start of the brk to an helper structure. 2023-06-15 16:39:35 -04:00
Enrico Fraccaroli (Galfurian) 537c3a70bb Make find_vm_area public, so that kheap can use it too. 2023-06-15 14:42:36 -04:00
Enrico Fraccaroli (Galfurian) 8266274e84 Minor cleanup of the memory management code. 2023-06-15 14:37:39 -04:00
Enrico Fraccaroli (Galfurian) 3f2756ccf4 Implement a first version of mmap and munmap. 2023-06-14 12:57:11 -04:00
Enrico Fraccaroli (Galfurian) af77072301 Keep VM areas sorted, and add function to destroy VM areas. 2023-06-14 12:54:16 -04:00
Enrico Fraccaroli (Galfurian) e23c434cc6 Add new defines to the mman.h file. 2023-06-14 12:52:07 -04:00
Enrico Fraccaroli (Galfurian) 16c416cbea Add new functions to the list_head system. 2023-06-14 12:51:41 -04:00
Enrico Fraccaroli (Galfurian) 7c9e0fea03 Add functions to find a VM area, check if an address range is valid, and find a suitable spot of a given size for a new VM area. 2023-06-14 12:50:40 -04:00
Enrico Fraccaroli (Galfurian) 4275002414 Fix wrong type. 2023-06-14 12:49:16 -04:00
Enrico Fraccaroli (Galfurian) c5a62dda05 Disable logging. 2023-06-14 12:48:53 -04:00
Enrico Fraccaroli (Galfurian) fb0323c8ce Create a temporary solution to call a 6-arguments system call (specifically, mmap). 2023-06-09 15:36:03 -04:00
Enrico Fraccaroli (Galfurian) a007e4e4c7 Merge branch 'feature/ipc_msg' into develop 2023-06-09 14:32:08 -04:00
Enrico Fraccaroli (Galfurian) b0f7ceec1b Remove unused includes 2023-06-09 14:31:40 -04:00
Enrico Fraccaroli (Galfurian) d90e7ff02b Move list_head in libc 2023-06-09 10:45:51 -04:00
Enrico Fraccaroli (Galfurian) fb559d6f1b Finish testing message queues. 2023-06-09 10:03:40 -04:00
Enrico Fraccaroli (Galfurian) c17153318c Finish the implementation for message send, and receive. Implement their IPC_NOWAIT behaviour. 2023-06-08 17:06:42 -04:00
Enrico Fraccaroli (Galfurian) f515c44eb3 Implement message send and receive functions. 2023-06-08 16:38:42 -04:00
Enrico Fraccaroli (Galfurian) 8f6ff5a59a Add the core for creating a message queue. Write the code for sending messages. 2023-06-08 15:46:50 -04:00
Enrico Fraccaroli (Galfurian) e5370dff36 Prepare main structure for managing message queues. 2023-06-08 10:51:33 -04:00
Enrico Fraccaroli (Galfurian) 2fcce9360c Merge branch 'develop' into feature/ipc_msg 2023-06-08 10:45:35 -04:00
Enrico Fraccaroli (Galfurian) 63d36004b3 Move the pointer to the semaphores back into the kernel-only data structure sem_info_t. 2023-06-08 10:45:26 -04:00
Enrico Fraccaroli (Galfurian) ca3c769467 Initialize the message queue data structures. 2023-06-08 10:37:45 -04:00
Enrico Fraccaroli (Galfurian) 6c36106666 Simplify program compilation. 2023-06-02 16:14:17 -04:00
Enrico Fraccaroli (Galfurian) 974d37a25d Try setting text section address differently in macos. 2023-06-02 15:22:37 -04:00
Enrico Fraccaroli (Galfurian) 935b36d24b Try using linux-based section access. 2023-06-02 15:12:49 -04:00
Enrico Fraccaroli (Galfurian) 5dd4418ffd Remove include in boot section. 2023-06-02 15:04:07 -04:00
Enrico Fraccaroli (Galfurian) dbbdb907aa Change asm compilation command. 2023-06-02 14:41:00 -04:00
Enrico Fraccaroli 0576463aea Update macos.yml 2023-06-02 14:29:27 -04:00
Enrico Fraccaroli 681238c7c3 Update macos.yml 2023-06-02 14:23:03 -04:00
Enrico Fraccaroli 8bdc44bb10 Update macos.yml 2023-06-02 14:18:20 -04:00
Enrico Fraccaroli 046761c1b6 Update macos.yml 2023-06-02 14:14:31 -04:00
Enrico Fraccaroli (Galfurian) b0b1ae50e5 Update readme. 2023-06-02 14:01:48 -04:00
Enrico Fraccaroli (Galfurian) a9cd9db8c6 Enable and disable scheduling feedback from cmake. 2023-06-02 13:58:57 -04:00
Enrico Fraccaroli (Galfurian) 523cf39b5a Merge branch 'feature/Feature-Semaphores' into develop 2023-06-02 13:50:20 -04:00
Enrico Fraccaroli (Galfurian) 8891ed7d7a Fix semop return type. Do some minor style-based fixes. 2023-06-02 13:49:10 -04:00
Enrico Fraccaroli (Galfurian) 116f4a50f7 Reorganize includes 2023-05-31 08:56:52 -04:00
Enrico Fraccaroli (Galfurian) db050db01c Move list of semaphores inside semid_ds structure. 2023-05-24 13:31:44 -04:00
Enrico Fraccaroli (Galfurian) 1acec3e7b3 Fix third test program. Fix EAGAIN message. 2023-05-23 14:05:41 -04:00
Enrico Fraccaroli (Galfurian) 3ae9258347 Fix permission management for IPC and also for EXT2. 2023-05-23 13:40:02 -04:00
Enrico Fraccaroli e7c0334ac0 Hide semaphore info from user-space (WIP). 2023-05-23 10:43:52 -04:00
Enrico Fraccaroli (Galfurian) a9d84f3a5d Add functions to copy semaphore structures. 2023-05-23 09:43:19 -04:00
Enrico Fraccaroli (Galfurian) 3e03f1e6fd Clean up the semget example. Clean up the return values of semop function. 2023-05-19 14:24:04 -04:00
Enrico Fraccaroli (Galfurian) 9f63a93d63 Properly handle ipc and sem permissions. Fix return error codes. Fix private key generation. 2023-05-17 15:23:42 -04:00
Enrico Fraccaroli 97eedf450d Create ipc code for managing all ipcs and their keys 2023-05-10 14:21:54 -04:00
Enrico Fraccaroli 19e8ad309f Move IPC stuff from the libc side, inside the sys folder. 2023-05-08 12:53:17 +02:00
Enrico Fraccaroli e19354a9ee Implement ipcs mechanisms. 2023-04-27 10:10:34 +02:00
Enrico Fraccaroli bd3c8fb4fe Write procfs function for IPC semaphores. Clean up the semaphores code. 2023-04-27 09:47:24 +02:00
Enrico Fraccaroli 2198df5576 Prepare IPC procfs system. 2023-04-26 10:37:43 +02:00
Aldegheri Alessandro 09f0d145d0 IPCS, IPCRM, IPC_NOWAIT currently working 2023-04-22 16:14:40 +02:00
Aldegheri Alessandro b9244ab96b Merge between nsops fix and current ipcs and ipcrm implementation 2023-04-22 14:38:56 +02:00
Aldegheri Alessandro ef1ae0f3c7 Currently working on ipcs and ipcrm commands 2023-04-22 14:33:13 +02:00
Enrico Fraccaroli 20db826dd4 Fix scheduling feedback on file 2023-04-22 11:54:55 +02:00
notBiji dd8853af00 fixed nsops 2023-04-21 18:16:25 +02:00
Enrico Fraccaroli 8ad4e45b50 Add some more comments. Implement sempahore search function. Check correctness of the current semaphore code, and it works as expected. 2023-04-21 17:55:19 +02:00
Enrico Fraccaroli bfe30f797a Merge branch 'develop' into feature/Feature-Semaphores 2023-04-21 16:51:20 +02:00
Enrico Fraccaroli 136dd11069 Merge branch 'feature/feedback_scheduler' into develop 2023-04-21 16:44:14 +02:00
Enrico Fraccaroli 4e9d0ebaf2 Clean up the logging code for the scheduler feedback. 2023-04-21 16:41:01 +02:00
Enrico Fraccaroli 36b08c2d86 Merge develop into feedback_scheduler. 2023-04-20 09:12:10 +02:00
Enrico Fraccaroli 8adfe8d887 Update comments. 2023-04-20 09:00:04 +02:00
Enrico Fraccaroli 6ca621d506 Finalize the scheduling test program. 2023-04-19 14:24:32 +02:00
Enrico Fraccaroli cf0001fca6 Clean up the comments concerning the scheduler feedback. 2023-04-19 14:02:49 +02:00
Enrico Fraccaroli 6aa814f30a Improve scheduler feedback. 2023-04-19 10:22:14 +02:00
Enrico Fraccaroli d630fd55f7 Clean up the feedback code. 2023-04-18 17:52:19 +02:00
Enrico Fraccaroli 09aa9a6a39 Fix O_CREAT check. Fix inode cretion error during the boot phase. 2023-04-18 15:18:15 +02:00
Enrico Fraccaroli d8d2b9cb69 Add all commments 2023-04-12 15:12:16 +02:00
Enrico Fraccaroli 32b8bd898c Add all commments 2023-04-12 15:01:32 +02:00
Enrico Fraccaroli 79489757e3 Add all commments 2023-04-12 14:57:28 +02:00
Aldegheri Alessandro cc4eed7788 First working implementation of System V Semaphores with working tests. Check for comments inside the code 2023-04-11 21:12:44 +02:00
emmekappaa 998ffd2c29 Implemented Statistics 2023-04-07 23:01:29 +02:00
Aldegheri Alessandro 0fb3a8d5b2 Merge branch 'develop' into feature/Feature-Semaphores 2023-04-06 11:24:42 +02:00
Aldegheri Alessandro b955065ee1 first implementation semctl, first flags 2023-04-06 11:23:37 +02:00
Enrico Fraccaroli df347f51c0 Fix SystemCall definition 2023-04-06 11:20:25 +02:00
tommyvilo 84fbca5798 Bug fixing and detecting wrong parameters 2023-04-05 17:49:09 +02:00
tommyvilo 8e9b86476c Changing chmod permission file 2023-04-05 09:40:12 +02:00
emmekappaa c19da29ab7 Bug Fixing and add a new feature 2023-04-05 09:21:22 +02:00
Aldegheri Alessandro 7c166e73a3 First implementation of semget function with multiple flags working (see comments inside) 2023-04-03 21:27:49 +02:00
Aldegheri Alessandro 1c4fd2c388 first implementation of ftok function with working test 2023-04-01 15:23:50 +02:00
emmekappaa 2a123f6986 Bug Fixing start scheduler feedback 2023-03-31 18:25:04 +02:00
Enrico Fraccaroli (Galfurian) fc36a1dad0 Update scheduling feedback system. 2023-03-31 09:55:11 -04:00
emmekappaa e6c733a881 Function to start the session of PID's recording 2023-03-29 19:03:48 +02:00
emmekappaa 913deff2d4 add start command 2023-03-29 19:02:23 +02:00
emmekappaa d193fa1ced Update Task 2023-03-29 19:01:28 +02:00
emmekappaa 62db896e48 File where PID are saved 2023-03-29 18:58:55 +02:00
Aldegheri Alessandro cd74fd521c Pseudocode for semctl, semget and semop functions 2023-03-29 17:27:38 +02:00
emmekappaa bc5f3c2b2a adding the pid's process' name to writeFeedback's arguments 2023-03-25 16:12:27 +01:00
emmekappaa fa15355071 Defining general architecture of the task 2023-03-25 16:08:37 +01:00
emmekappaa 16a27a022f file for statistics 2023-03-21 18:50:45 +01:00
emmekappaa 0fcd132e85 fix and write on file 2023-03-21 18:49:28 +01:00
Enrico Fraccaroli (Galfurian) 25c8a1049b Use the right function for the kernel-side logging. 2023-03-21 09:20:55 -04:00
Aldegheri Alessandro 25c1c2c6fb Semids, Semun and various define added to sem.h, created a test for checking the actual presence of the syscalls 2023-03-19 10:18:26 +01:00
tommyvilo 40fac6e194 Add files via upload 2023-03-18 21:09:29 +01:00
emmekappaa 95ec1d8a33 Fix Scheduler_priority and CFS 2023-03-15 18:38:00 +01:00
emmekappaa a650fb9c62 Fix Scheduler_priority and Scheduler_CFS 2023-03-15 18:25:00 +01:00
emmekappaa 0d0cec9420 File di Prova by Cip e Tom 2023-03-15 15:59:23 +01:00
Enrico Fraccaroli (Galfurian) 188f42e531 Remove test file. 2023-03-13 10:14:56 -04:00
Enrico Fraccaroli (Galfurian) 464448c711 Merge origin/develop to local. 2023-03-13 09:57:07 -04:00
Enrico Fraccaroli (Galfurian) 0d99f26430 Modify test file. 2023-03-13 09:52:38 -04:00
Enrico Fraccaroli (Galfurian) 81c482e377 Modify test file. 2023-03-13 09:52:11 -04:00
Enrico Fraccaroli (Galfurian) 3bb21bb0f0 Merge branch 'feature/scheduling_feedback' into develop 2023-03-13 09:39:55 -04:00
Enrico Fraccaroli (Galfurian) af1389233d Merge branch 'develop' into feature/scheduling_feedback 2023-03-13 09:38:45 -04:00
Enrico Fraccaroli (Galfurian) 3b1f5b2ebe Add test file. 2023-03-13 09:37:20 -04:00
Enrico Fraccaroli (Galfurian) 3e16bc81a9 Add test file. 2023-03-13 09:36:09 -04:00
Enrico Fraccaroli (Galfurian) 59d9bcb596 Fix wrong argument of write. Fix return type of getdents. Fix procfs_getdents. Finish implementing the base version of the ps command. 2023-01-27 11:38:40 -05:00
Enrico Fraccaroli (Galfurian) e926850ce3 Make syscall table initialization clearer. Add comments to the sys_waitpid function. 2023-01-27 10:50:04 -05:00
Enrico Fraccaroli (Galfurian) 7a8ce1066a Update syscall checklist. Improve readability of sys_waitpid. 2023-01-27 09:42:07 -05:00
Enrico Fraccaroli (Galfurian) ac3dd9922a Try to fix github worflow. 2023-01-26 15:00:39 -05:00
Enrico Fraccaroli (Galfurian) 8faf044d1d Try to fix github worflow. 2023-01-26 14:57:44 -05:00
Enrico Fraccaroli (Galfurian) d14425d84a Try to fix github worflow. 2023-01-26 14:50:21 -05:00
Enrico Fraccaroli (Galfurian) 3f982e8034 Extend github worflow. 2023-01-26 14:43:04 -05:00
Enrico Fraccaroli (Galfurian) dbaa4c51f8 Extend github worflow. 2023-01-26 14:42:44 -05:00
Enrico Fraccaroli (Galfurian) 2abf5120a3 Extend github worflow. 2023-01-26 14:37:49 -05:00
Enrico Fraccaroli (Galfurian) 1afad50078 Extend github worflow. 2023-01-26 14:34:42 -05:00
Enrico Fraccaroli (Galfurian) 32192829ff Keep the same string.c in libc and mentos. 2023-01-24 13:26:37 -05:00
Enrico Fraccaroli 9dfebdf827 Remove useless keyword in undef directive. 2023-01-20 09:27:35 -05:00
Enrico Fraccaroli 2a06eb791a CHeck the output of setgid and setuid. 2023-01-20 09:26:31 -05:00
Enrico Fraccaroli 20323ba64e Remove ansi_colors.h from the programs. Add the volatile keyword to the memset operations. 2023-01-20 09:22:37 -05:00
Enrico Fraccaroli c9038205db Update copyright years. 2023-01-19 10:09:52 -05:00
Enrico Fraccaroli 8c3f30a4f7 Unify debugging setup in all sources. 2023-01-19 10:06:16 -05:00
Enrico Fraccaroli 4f99b6217f Unify debugging setup in system folder files. 2023-01-19 09:58:31 -05:00
Enrico Fraccaroli 5a84cd5e44 Unify debugging setup in sys folder files. 2023-01-19 09:57:44 -05:00
Enrico Fraccaroli b6403ff571 Unify debugging setup in process-related files. 2023-01-19 09:56:58 -05:00
Enrico Fraccaroli b5eccd40cf Add missing comments. Unify setup of debugging in memory files. 2023-01-19 09:55:24 -05:00
Enrico Fraccaroli 6e48298534 Fix missing newline at the end of file. 2023-01-18 14:56:57 -05:00
Enrico Fraccaroli 5aa2f21253 Add missing comments. 2023-01-18 14:38:36 -05:00
Enrico Fraccaroli debc7302c2 Fix errors in atomic operations. 2023-01-18 14:20:13 -05:00
Enrico Fraccaroli 3c3bcd692f Update README with an explanation on how to run MentOs from GRUB in QEMU, and which packets must be installed in Ubuntu. 2023-01-18 13:31:10 -05:00
Enrico Fraccaroli 2fee354b4b Remove mmio, port io, and debug headers from kernel side, and keep them on the libc. Simplify debugging functions. Add missing comments in several locations. Move ANSI color definitions in a separate file. 2023-01-18 11:40:53 -05:00
Enrico Fraccaroli 54d755e3d2 Use round-robin as a backup scheduler. 2023-01-17 13:33:09 -05:00
Enrico Fraccaroli 917e6a82ff Add the guidelines for implementing the periodic schedulers. 2023-01-17 13:31:03 -05:00
Enrico Fraccaroli 0ecda4d40c Update README.md 2023-01-13 10:32:42 -05:00
Enrico Fraccaroli 2a4822eca3 Try to compile with macosx 2023-01-12 11:57:16 -05:00
Enrico Fraccaroli 065e0dbf7c Try to compile with macosx 2023-01-12 11:52:40 -05:00
Enrico Fraccaroli e6162ba762 Use x86_64-elf- with macosx 2023-01-12 11:43:20 -05:00
Enrico Fraccaroli d5ee2e927a Remove brew upgrade 2023-01-12 11:34:16 -05:00
Enrico Fraccaroli ec37cda9c0 Remove verbose from compilation 2023-01-12 11:30:12 -05:00
Enrico Fraccaroli d2e25b94a4 Update github workflows 2023-01-12 11:27:37 -05:00
Enrico Fraccaroli 53ec90e8b4 Update github workflows 2023-01-12 11:26:58 -05:00
Enrico Fraccaroli d5bc9a96ca Update README.md 2023-01-12 11:02:16 -05:00
Enrico Fraccaroli 06e4eaf17c Update and rename main.yml to ubuntu.yml 2023-01-12 11:01:47 -05:00
Enrico Fraccaroli 0d3d5530bf Update README.md 2023-01-12 10:59:21 -05:00
Enrico Fraccaroli ae86834d4c Update README.md 2023-01-12 10:54:34 -05:00
Enrico Fraccaroli b91a267fe3 Update scheduler comment. 2022-12-19 12:25:58 +01:00
Enrico Fraccaroli 88fdb850dd Merge tag 'v0.5.4' into develop
Fix scheduler algorithm for-loop.
2022-12-19 12:22:09 +01:00
Enrico Fraccaroli 510a2c0e73 Merge branch 'hotfix/v0.5.4' 2022-12-19 12:21:50 +01:00
Enrico Fraccaroli 4f650b3704 Update version. 2022-12-19 12:21:40 +01:00
Enrico Fraccaroli e9264f925a Start the for-loop iteration from the start of the runqueue. 2022-12-19 12:20:42 +01:00
Enrico Fraccaroli 0414e3922c Merge tag 'v0.5.3' into develop
Version 0.5.3.
2022-12-19 11:59:50 +01:00
Enrico Fraccaroli 679b943e0e Merge branch 'release/v0.5.3' 2022-12-19 11:59:15 +01:00
Enrico Fraccaroli 2d5e3ad41f Update version. 2022-12-19 11:59:03 +01:00
Enrico Fraccaroli 48ac939566 Set block size of generated ext2 filesystem to 4096. 2022-12-19 11:56:22 +01:00
Enrico Fraccaroli 60873784d2 Fix how we retrieve the first element of the list. 2022-12-19 11:55:33 +01:00
Enrico Fraccaroli f643e11212 Disable missing-braces warning. 2022-12-13 17:01:26 -05:00
Enrico Fraccaroli e654600c27 Deal with an unused variable. 2022-12-13 16:58:30 -05:00
Enrico Fraccaroli d499a07b0f Remove -Wno-unused-but-set-variable flag. 2022-12-13 16:56:14 -05:00
Enrico Fraccaroli 918b00e43d Force linker to be ld. 2022-12-13 16:47:08 -05:00
Enrico Fraccaroli 3d3c713828 Add verbose option 2022-12-13 16:02:21 -05:00
Enrico Fraccaroli 55932ce89e [WIP] Test extensive workflow. 2022-12-13 15:54:29 -05:00
Enrico Fraccaroli a572db52fd Add newline at the end of the files. Add -Wno-unused-command-line-argument to programs compilation flow, to support clang. 2022-12-13 15:44:31 -05:00
Enrico Fraccaroli 3f73b8d8a0 Add newline at the end of the files. Use built in keywords properly. 2022-12-13 14:31:27 -05:00
Enrico Fraccaroli 0965669f4b Add newline at the end of the files. 2022-12-13 14:25:16 -05:00
Enrico Fraccaroli 565df959b1 Simplify doxygen documentation building. 2022-12-12 22:38:07 -05:00
Enrico Fraccaroli 45376a2bb3 [Important] Extend main README. Write some more man entries. 2022-12-12 22:21:39 -05:00
Enrico Fraccaroli de9daa4a85 Add some missing documentation. There is still some work to do. 2022-12-09 11:35:30 -05:00
Enrico Fraccaroli 8e1424fbec Update comments. 2022-12-09 11:03:50 -05:00
Enrico Fraccaroli 79f150a3d5 Update readme. Add SCHEDULER_AEDF to cmake options. Add exercise template inside the scheduler_algorithm.c file. 2022-12-09 10:58:09 -05:00
Enrico Fraccaroli b61655b9de Merge tag 'v0.5.2' into develop
Debugging hotfix
2022-12-08 13:23:31 -05:00
Enrico Fraccaroli 3cf8ae04f1 Merge branch 'hotfix/v0.5.2' 2022-12-08 13:23:10 -05:00
Enrico Fraccaroli 25b4a34f1b Update version. 2022-12-08 13:23:03 -05:00
Enrico Fraccaroli b1f3169310 Align README and debugging procedure. 2022-12-08 13:20:17 -05:00
Enrico Fraccaroli 26daf96b90 Merge tag 'v0.5.1' into develop
MentOS version 0.5.1
2022-12-08 11:28:48 -05:00
395 changed files with 13795 additions and 12193 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Always
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: Always
AlwaysBreakAfterDefinitionReturnType: None
-3
View File
@@ -1,3 +0,0 @@
symbol-file ./mentos/kernel.bin
exec-file ./mentos/kernel.bin
target remote localhost:1234
-52
View File
@@ -1,52 +0,0 @@
name: Main
on:
push:
branches-ignore:
- "releases/**"
paths-ignore:
- "**.md"
- ".gitignore"
pull_request:
paths-ignore:
- "**.md"
- ".gitignore"
jobs:
doxygen:
name: Doxygen
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Install Doxygen Ubuntu
run: |
sudo apt-get update
sudo apt-get install -y doxygen nasm
- name: Generate documentation
run: |
cmake -B build -D DOXYGEN_WARN_AS_ERROR=NO
cmake --build build --target doxygen_doc
test:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Install NASM Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y nasm
- name: Build
run: |
cmake -B build
cmake --build build --parallel 2
+86
View File
@@ -0,0 +1,86 @@
name: Ubuntu
on:
push:
branches-ignore:
- "releases/**"
paths-ignore:
- "**.md"
- ".gitignore"
- "**/macos.yml"
- "**/windows.yml"
pull_request:
paths-ignore:
- "**.md"
- ".gitignore"
- "**/macos.yml"
- "**/windows.yml"
jobs:
doxygen:
name: Doxygen
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y doxygen nasm
- name: Generate documentation
run: |
cmake -B build -D DOXYGEN_WARN_AS_ERROR=NO
cmake --build build --target mentos_documentation
build:
name: Build
strategy:
fail-fast: false
matrix:
include: [
# You can access the following values via ${{ matrix.??? }}
#
# pkgs : apt-get package names. It can include multiple package names which are delimited by space.
# cc : C compiler executable.
# cxx : C++ compiler executable for `make ctocpptest`.
# x32 : Set 'true' if compiler supports x32. Otherwise, set 'false'.
# Set 'fail' if it supports x32 but fails for now. 'fail' cases must be removed.
# x86 : Set 'true' if compiler supports x86 (-m32). Otherwise, set 'false'.
# Set 'fail' if it supports x86 but fails for now. 'fail' cases must be removed.
# cxxtest : Set 'true' if it can be compiled as C++ code. Otherwise, set 'false'.
# freestanding : Set 'true' if it can be compiled and execute freestanding code. Otherwise, set 'false'.
# Usually, it requires Linux, x86_64 and gcc/g++.
# os : GitHub Actions YAML workflow label. See https://github.com/actions/virtual-environments#available-environments
# gcc
{ pkgs: "nasm", cc: gcc, cxx: g++, os: ubuntu-latest },
{ pkgs: "gcc-12 g++-12 nasm", cc: gcc-12, cxx: g++-12, os: ubuntu-22.04 },
{ pkgs: "gcc-11 g++-11 nasm", cc: gcc-11, cxx: g++-11, os: ubuntu-22.04 },
{ pkgs: "gcc-10 g++-10 nasm", cc: gcc-10, cxx: g++-10, os: ubuntu-22.04 },
{ pkgs: "gcc-9 g++-9 nasm", cc: gcc-9, cxx: g++-9, os: ubuntu-22.04 },
{ pkgs: "gcc-8 g++-8 nasm", cc: gcc-8, cxx: g++-8, os: ubuntu-20.04 },
{ pkgs: "gcc-7 g++-7 nasm", cc: gcc-7, cxx: g++-7, os: ubuntu-20.04 },
# clang
{ pkgs: "nasm", cc: clang, cxx: clang++, os: ubuntu-latest },
{ pkgs: "clang-14 nasm", cc: clang-14, cxx: clang++-14, os: ubuntu-22.04 },
{ pkgs: "clang-13 nasm", cc: clang-13, cxx: clang++-13, os: ubuntu-22.04 },
{ pkgs: "clang-12 nasm", cc: clang-12, cxx: clang++-12, os: ubuntu-22.04 },
{ pkgs: "clang-11 nasm", cc: clang-11, cxx: clang++-11, os: ubuntu-22.04 },
{ pkgs: "clang-10 nasm", cc: clang-10, cxx: clang++-10, os: ubuntu-20.04 },
{ pkgs: "clang-9 nasm", cc: clang-9, cxx: clang++-9, os: ubuntu-20.04 },
{ pkgs: "clang-8 nasm", cc: clang-8, cxx: clang++-8, os: ubuntu-20.04 },
{ pkgs: "clang-7 nasm", cc: clang-7, cxx: clang++-7, os: ubuntu-20.04 },
]
runs-on: ${{ matrix.os }}
# Set environment variables
env:
# We globally set CC and CXX.
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.pkgs }}
- name: Build
run: |
cmake -B build
cmake --build build --parallel 2
+2 -2
View File
@@ -118,5 +118,5 @@ files/bin/**
# ISO creation files.
iso/boot/*.bin
# Visual Studio Code
.vscode
# ClangD stuff.
.cache
+13
View File
@@ -0,0 +1,13 @@
{
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "(gdb) Attach",
"target": "localhost:1234",
"remote": true,
"cwd": "${workspaceRoot}/build",
"valuesFormatting": "parseText"
}
]
}
+108 -52
View File
@@ -1,13 +1,13 @@
# =============================================================================
# PROJECT SETUP
# =============================================================================
# Set the minimum required version of cmake.
cmake_minimum_required(VERSION 3.1...3.22)
# Initialize the project.
project(mentos C ASM)
# =============================================================================
# BUILD TYPE (Debug/Release)
# =============================================================================
# Set the default build type to Debug.
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Debug' as none was specified.")
@@ -15,12 +15,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
# =============================================================================
# DOCUMENTATION
# =============================================================================
add_subdirectory(doc/doxygen)
# =============================================================================
# OS-SPECIFIC COMPILERS
# OS-SPECIFIC COMPILERS SETUP
# =============================================================================
# Add operating system specific option.
@@ -28,18 +23,6 @@ message(STATUS "Crosscompiling : ${CMAKE_CROSSCOMPILING}")
message(STATUS "System name : ${CMAKE_HOST_SYSTEM_NAME}")
message(STATUS "Kernel version : ${CMAKE_SYSTEM_VERSION}")
if((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") OR APPLE)
# Set the Apple MacOSx compilers.
if(CMAKE_VERSION VERSION_LESS "3.6.0")
include(CMakeForceCompiler)
cmake_force_c_compiler(i386-elf-gcc Clang)
cmake_force_cxx_compiler(i386-elf-g++ Clang)
else()
set(CMAKE_C_COMPILER i386-elf-gcc)
set(CMAKE_CXX_COMPILER i386-elf-g++)
set(CMAKE_AR i386-elf-ar)
endif()
# Speicfy the linker.
set(CMAKE_LINKER i386-elf-ld)
# Specify the linker flags.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib")
elseif((${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") OR WIN32)
@@ -68,10 +51,78 @@ else()
else()
# set(EMULATOR_FLAGS ${EMULATOR_FLAGS} -sdl)
endif()
# Speicfy the linker.
set(CMAKE_LINKER ld)
endif()
# =============================================================================
# COMPILATION
# ASSEMBLY COMPILER
# =============================================================================
# Find the NASM compiler.
find_program(ASM_COMPILER NAMES nasm HINTS /usr/bin/ /usr/local/bin/)
# Mark the variable ASM_COMPILER as advanced.
mark_as_advanced(ASM_COMPILER)
# Check that we have found the compiler.
if(NOT ASM_COMPILER)
message(FATAL_ERROR "ASM compiler not found!")
endif(NOT ASM_COMPILER)
# Set the asm compiler.
set(CMAKE_ASM_COMPILER ${ASM_COMPILER})
# Set the assembly compiler flags.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f elf -g -O0 -F dwarf -o <OBJECT> <SOURCE>")
else()
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f elf -g -O3 -o <OBJECT> <SOURCE>")
endif()
# =============================================================================
# GLOBAL COMPILATION FLAGS
# =============================================================================
# Warning flags.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
# Disable some specific warnings.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-braces")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-command-line-argument")
# Set the compiler options.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdlib")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-stack-protector")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-pic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Set the assembly compiler flags.
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -m32")
# =============================================================================
# SUB-DIRECTORIES SETUP
# =============================================================================
# Add the sub-directories.
@@ -79,6 +130,7 @@ add_subdirectory(programs)
add_subdirectory(programs/tests)
add_subdirectory(mentos)
add_subdirectory(libc)
add_subdirectory(doc)
# =============================================================================
# FILESYSTEM
@@ -93,11 +145,11 @@ add_custom_target(filesystem
COMMAND echo '============================================================================='
COMMAND mkdir -p ${CMAKE_SOURCE_DIR}/files/proc
COMMAND mkdir -p ${CMAKE_SOURCE_DIR}/files/dev
COMMAND mke2fs -L 'rootfs' -N 0 -d ${CMAKE_SOURCE_DIR}/files -m 5 -r 1 -t ext2 -v -F ${CMAKE_BINARY_DIR}/rootfs.img 32M
COMMAND mke2fs -L 'rootfs' -N 0 -d ${CMAKE_SOURCE_DIR}/files -b 4096 -m 5 -r 1 -t ext2 -v -F ${CMAKE_BINARY_DIR}/rootfs.img 32M
COMMAND echo '============================================================================='
COMMAND echo 'Done!'
COMMAND echo '============================================================================='
DEPENDS all_programs all_tests
DEPENDS programs tests
)
# =============================================================================
@@ -134,18 +186,18 @@ set(EMULATOR_FLAGS ${EMULATOR_FLAGS} -vga std)
# Set the amount of memory.
set(EMULATOR_FLAGS ${EMULATOR_FLAGS} -m 1096M)
# Set the EXT2 drive.
set(EMULATOR_FLAGS ${EMULATOR_FLAGS} -drive file=${CMAKE_BINARY_DIR}/rootfs.img,format=raw)
set(EMULATOR_FLAGS ${EMULATOR_FLAGS} -drive file=${CMAKE_BINARY_DIR}/rootfs.img,format=raw,index=0,media=disk)
# =============================================================================
# Booting with QEMU for fun
# =============================================================================
# This first target runs the emualtor passing the kernel binary file.
# This first target runs the emulator passing the kernel binary file.
add_custom_target(
qemu
COMMAND test -e ${CMAKE_BINARY_DIR}/rootfs.img || ${CMAKE_COMMAND} -E cmake_echo_color --red "No filesystem file detected, you need to run: make filesystem"
COMMAND ${EMULATOR} ${EMULATOR_FLAGS} -kernel ${CMAKE_BINARY_DIR}/mentos/kernel-bootloader.bin
DEPENDS kernel-bootloader.bin
COMMAND ${EMULATOR} ${EMULATOR_FLAGS} -kernel ${CMAKE_BINARY_DIR}/mentos/bootloader.bin
DEPENDS bootloader.bin
)
# =============================================================================
@@ -155,18 +207,20 @@ add_custom_target(
# First, we need to generate a GDB file containing all the symbols of all our
# executables.
add_custom_target(
.gdbinit
BYPRODUCTS ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/get_text_address.sh ${CMAKE_BINARY_DIR}/mentos/kernel.bin > ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/get_text_address.sh ${CMAKE_BINARY_DIR}/mentos/kernel-bootloader.bin >> ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/get_text_address.sh ${CMAKE_BINARY_DIR}/programs/tests/test_* >> ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND bash ${CMAKE_SOURCE_DIR}/scripts/get_text_address.sh ${CMAKE_BINARY_DIR}/programs/prog_* >> ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND echo "break boot.c: boot_main" >> ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND echo "break kernel.c: kmain" >> ${CMAKE_BINARY_DIR}/.gdbinit
COMMAND echo "target remote localhost:1234" >> ${CMAKE_BINARY_DIR}/.gdbinit
DEPENDS kernel-bootloader.bin
DEPENDS all_programs
DEPENDS all_tests
gdbinit
BYPRODUCTS ${CMAKE_BINARY_DIR}/gdb.run
# Create the generic gdb configuration.
COMMAND echo "add-symbol-file ${CMAKE_BINARY_DIR}/mentos/kernel.bin" > ${CMAKE_BINARY_DIR}/gdb.run
COMMAND echo "add-symbol-file ${CMAKE_BINARY_DIR}/mentos/bootloader.bin" >> ${CMAKE_BINARY_DIR}/gdb.run
COMMAND find ${CMAKE_SOURCE_DIR}/files/bin -type f | xargs realpath | sed 's/^/add-symbol-file /' >> ${CMAKE_BINARY_DIR}/gdb.run
COMMAND echo "break boot.c: boot_main" >> ${CMAKE_BINARY_DIR}/gdb.run
COMMAND echo "break kernel.c: kmain" >> ${CMAKE_BINARY_DIR}/gdb.run
# Create the GDB connection file.
COMMAND echo "target remote localhost:1234" >> ${CMAKE_BINARY_DIR}/gdb.run
DEPENDS ${CMAKE_BINARY_DIR}/mentos/bootloader.bin
DEPENDS ${CMAKE_BINARY_DIR}/mentos/kernel.bin
DEPENDS programs
DEPENDS tests
DEPENDS libc
)
@@ -176,15 +230,17 @@ add_custom_target(
add_custom_target(
qemu-gdb
COMMAND test -e ${CMAKE_BINARY_DIR}/rootfs.img || ${CMAKE_COMMAND} -E cmake_echo_color --red "No filesystem file detected, you need to run: make filesystem"
COMMAND echo "\n\n"
COMMAND echo "Now, QEMU has loaded the kernel, and it is waiting that you\n"
COMMAND echo "remotely connect to it. To start debugging, open a new shell\n"
COMMAND echo "in THIS same folder, and just type :\n"
COMMAND printf " cgdb -q -iex %q" "add-auto-load-safe-path ."
COMMAND echo "\n\n"
COMMAND ${EMULATOR} ${EMULATOR_FLAGS} -s -S -kernel ${CMAKE_BINARY_DIR}/mentos/kernel-bootloader.bin
DEPENDS kernel-bootloader.bin
DEPENDS .gdbinit
COMMAND echo ""
COMMAND echo "Now, QEMU has loaded the kernel, and it is waiting that you"
COMMAND echo "remotely connect to it. To start debugging, open a new shell"
COMMAND echo "in THIS same folder, and just type:"
COMMAND echo " gdb --quiet --command=gdb.run"
COMMAND echo "or if you want to use cgdb, type:"
COMMAND echo " cgdb --quiet --command=gdb.run"
COMMAND echo ""
COMMAND ${EMULATOR} ${EMULATOR_FLAGS} -s -S -kernel ${CMAKE_BINARY_DIR}/mentos/bootloader.bin
DEPENDS bootloader.bin
DEPENDS gdbinit
)
# =============================================================================
@@ -195,9 +251,9 @@ add_custom_target(
add_custom_target(
cdrom.iso
COMMAND cp -rf ${CMAKE_SOURCE_DIR}/iso .
COMMAND cp ${CMAKE_BINARY_DIR}/mentos/kernel-bootloader.bin ${CMAKE_BINARY_DIR}/iso/boot
COMMAND cp ${CMAKE_BINARY_DIR}/mentos/bootloader.bin ${CMAKE_BINARY_DIR}/iso/boot
COMMAND grub-mkrescue -o ${CMAKE_BINARY_DIR}/cdrom.iso ${CMAKE_BINARY_DIR}/iso
DEPENDS kernel-bootloader.bin
DEPENDS bootloader.bin
)
# This third target runs the emualtor, but this time, the kernel binary file is
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2014-2022 MentOs-Team.
Copyright (c) 2014-2024 MentOs-Team.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+206 -66
View File
@@ -1,10 +1,33 @@
# MentOS
# MentOS (Mentoring Operating System)
[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/made-with-c.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/for-you.svg)](https://forthebadge.com)
## 1. What is MentOS
[![Ubuntu](https://github.com/mentos-team/MentOS/actions/workflows/ubuntu.yml/badge.svg)](https://github.com/mentos-team/MentOS/actions/workflows/ubuntu.yml)
## Table of Contents
- [MentOS (Mentoring Operating System)](#mentos-mentoring-operating-system)
- [Table of Contents](#table-of-contents)
- [What is MentOS](#what-is-mentos)
- [Implemented features](#implemented-features)
- [Prerequisites](#prerequisites)
- [Installing the prerequisites](#installing-the-prerequisites)
- [Compiling MentOS](#compiling-mentos)
- [Generating the EXT2 filesystem](#generating-the-ext2-filesystem)
- [Running MentOS](#running-mentos)
- [Running MentOS from GRUB](#running-mentos-from-grub)
- [Running and adding new programs to MentOS](#running-and-adding-new-programs-to-mentos)
- [Create a new program](#create-a-new-program)
- [Add the new program to the list of compiled sources](#add-the-new-program-to-the-list-of-compiled-sources)
- [Running a program or a test](#running-a-program-or-a-test)
- [Kernel logging](#kernel-logging)
- [Change the scheduling algorithm](#change-the-scheduling-algorithm)
- [Debugging the kernel](#debugging-the-kernel)
- [Contributors](#contributors)
## What is MentOS
MentOS (Mentoring Operating System) is an open source educational operating
system. The goal of MentOS is to provide a project environment that is realistic
@@ -26,7 +49,10 @@ Parts of MentOS are inherited or inspired by a similar educational operating
system called [DreamOs](https://github.com/dreamos82/DreamOs) written by Ivan
Gualandri.
## 2. Implemented features
*[Back to the Table of Contents](#table-of-contents)*
## Implemented features
Follows the list of implemented features:
**Processes and Events**
@@ -61,24 +87,28 @@ Follows the list of implemented features:
- [x] Video drivers;
- [ ] VGA drivers;
**Inter-Process Communication (IPC)**
- [X] Semaphore
- [ ] Message queue
- [ ] Shared memory
- [ ] Named pipe
I will try to keep it updated...
## 3. Prerequisites
*[Back to the Table of Contents](#table-of-contents)*
## Prerequisites
MentOS is compatible with the main **unix-based** operating systems. It has been
tested with *Ubuntu*, *WSL1*, *WSL2*, and *MacOS*.
tested with *Ubuntu*, and under Windows with *WSL1* and *WSL2*.
### 3.1. Generic Prerequisites
For **compiling** the system we need:
#### 3.1.1. Compile
For compiling the system:
- nasm
- git
- gcc
- nasm
- make
- cmake
- git
- ccmake (suggested)
- e2fsprogs (should be already installed)
@@ -87,41 +117,29 @@ Under **MacOS**, for compiling, you have additional dependencies:
- i386-elf-binutils
- i386-elf-gcc
#### 3.1.2. Execute
To execute the operating system, you need to install:
For **executing** the operating system we need:
- qemu-system-i386 (or qemu-system-x86)
#### 3.1.3. Debug
For debugging we suggest using:
For **debugging** we suggest using:
- gdb or cgdb
### 3.2. installation Prerequisites
### Installing the prerequisites
Under **Ubuntu**, you can type the following commands:
```bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y build-essential git cmake qemu-system-x86 nasm e2fsprogs
sudo apt-get install -y git build-essential nasm make cmake cmake-curses-gui e2fsprogs
sudo apt-get install -y qemu-system-x86
sudo apt-get install -y gdb cgdb
```
Note: Older versions might have `qemu-system-i386` instead of `qemu-system-x86`.
Under **MacOS** you also need to install the i386-elf cross-compiler. The
simplest installation method is through Homebrew package manager.
Install [Homebrew](https://brew.sh/index_it) if you don't already have it, and
then type the following commands:
*[Back to the Table of Contents](#table-of-contents)*
```bash
brew update && brew upgrade
brew install i386-elf-binutils i386-elf-gcc git cmake qemu nasm e2fsprogs
brew install gdb cgdb #<- for debug only
```
## 4. Compiling MentOS and generating the EXT2 filesystem
## Compiling MentOS
Compile MentOS with:
@@ -133,14 +151,20 @@ cmake ..
make
```
Then, generate the EXT2 filesystem with:
*[Back to the Table of Contents](#table-of-contents)*
## Generating the EXT2 filesystem
Generate the EXT2 filesystem with:
```bash
make filesystem
```
you just need to generate the filesystem once. If you change a `program` you need to re-generate the entire filesystem with `make filesystem`, but this will override any changes you made to the files inside the `rootfs.img`. In the future I will find a way to update just the `/usr/bin` directory and the programs.
## 5. Running MentOS
*[Back to the Table of Contents](#table-of-contents)*
## Running MentOS
Boot MentOS with qemu:
@@ -150,11 +174,93 @@ make qemu
To login, use one of the usernames listed in `files/etc/passwd`.
## 6. Kernel logging
*[Back to the Table of Contents](#table-of-contents)*
## Running MentOS from GRUB
For booting MentOS from GRUB in QEMU we need the following tools:
- xorriso
- grub-mkrescue (from grub-common)
We also need `grub-pc-bin`, otherwise GRUB won't start in QEMU.
Which can be installed in Ubuntu with the following command:
```bash
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y grub-common grub-pc-bin xorriso
```
Boot MentOS with qemu through GRUB by calling:
```bash
make qemu-grub
```
*[Back to the Table of Contents](#table-of-contents)*
## Running and adding new programs to MentOS
This section explains how to add a new program to MentOS, and also how to run programs in mentos. It also explains how to add new tests, which are located in the `programs/tests` folder.
### Create a new program
Head to the `programs` (or the `programs/tests`) folder. Create and open a new program, for instance a file called `hello_world.c`, with your preferred editor, and add this content to the file:
```C
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello, World!\n\n");
return 0;
}
```
### Add the new program to the list of compiled sources
Now we can add the program to the list of files which are compiled and placed inside MentOS filesystem.
The following procedure is the same for both `programs` and `programs/tests`, what changes is which `CMakeLists.txt` file we modify.
You need to modify the `CMakeLists.txt` file, either `programs/CMakeLists.txt` or `programs/tests/CMakeLists.txt`, and add your program to the list of files to be compiled:
```Makefile
# Add the executables (manually).
set(PROGRAMS
init.c
...
hello_world.c
)
```
or
```Makefile
# Add the executables (manually).
set(TESTS
t_mem.c
...
hello_world.c
)
```
That's it, the `hello_world.c` file will be compiled and will appear inside the `/bin` or `/bin/tests` folder of MentOS.
### Running a program or a test
Once you login into MentOS, if you placed your source code in `programs`, you can execute the program by simply typing:
```bash
hello_world
```
because the file resides in `/bin`, and that folder is listed in the `PATH` environment variable.
Now, if you placed your source code inside the `programs/tests` folder, the executable will end up inside the `/bin/tests` folder.
However, the `/bin/tests` folder is not listed in `PATH`, so, if you want to execute a test from that folder you need to specify the full path:
```bash
/bin/tests/hello_world
```
*[Back to the Table of Contents](#table-of-contents)*
## Kernel logging
The kernel provides ways of printing logging messages *from* inside the kernel code *to* the bash where you executed the `make qemu`.
These *logging* functions are:
```C++
```C
#define pr_emerg(...)
#define pr_alert(...)
#define pr_crit(...)
@@ -167,7 +273,7 @@ These *logging* functions are:
```
You use them like you would use a `printf`:
```C++
```C
if (fd < 0) {
pr_err("Failed to open file '%s', received file descriptor %d.\n", filename, fd);
return 1;
@@ -177,7 +283,7 @@ You use them like you would use a `printf`:
By default only message that goes from `pr_notice` included down to `pr_emerg` are displayed.
Each logging function (they are actually macros) is a wrapper that automatically sets the desired **log level**. Each log level is identified by a number, and declared as follows:
```C++
```C
#define LOGLEVEL_DEFAULT (-1) ///< default-level messages.
#define LOGLEVEL_EMERG 0 ///< system is unusable.
#define LOGLEVEL_ALERT 1 ///< action must be taken immediately.
@@ -190,41 +296,58 @@ Each logging function (they are actually macros) is a wrapper that automatically
```
You can change the logging level by including the following lines at the beginning of your source code:
```C++
```C
// Include the kernel log levels.
#include "sys/kernel_levels.h"
/// Change the header.
#define __DEBUG_HEADER__ "[ATA ]"
/// Set the log level.
#define __DEBUG_LEVEL__ LOGLEVEL_INFO
// Include the debuggin header.
#include "io/debug.h"
```
This example sets the `__DEBUG_LEVEL__`, so that all the messages from `INFO` and below are shown. While `__DEBUG_HEADER__` is just a string that is automatically prepended to your message, helping you identifying from which code the message is coming from.
## 7. Change the scheduling algorithm
*[Back to the Table of Contents](#table-of-contents)*
MentOS provides three different scheduling algorithms:
## Change the scheduling algorithm
- Round-Robin
- Priority
- Completely Fair Scheduling
MentOS supports scheduling algorithms for aperiodic:
If you want to change the scheduling algorithm:
- Round-Robin (RR)
- Highest Priority
- Completely Fair Scheduling (CFS)
- Aperiodic Earliest Deadline First (AEDF)
It also supports periodic algorithms:
- Earliest Deadline First (EDF)
- Rate Monotonic (RM)
If you want to change the scheduling algorithm, to Round-Robin (RR) for instance:
```bash
cd build
# Round Robin scheduling algorithm
cmake -DSCHEDULER_TYPE=SCHEDULER_RR ..
# Priority scheduling algorithm
cmake -DSCHEDULER_TYPE=SCHEDULER_PRIORITY ..
# Completely Fair Scheduling algorithm
cmake -DSCHEDULER_TYPE=SCHEDULER_CFS ..
make
make qemu
```
or you can activate one of the others:
```bash
# Highest Priority
cmake -DSCHEDULER_TYPE=SCHEDULER_PRIORITY ..
# Completely Fair Scheduling (CFS)
cmake -DSCHEDULER_TYPE=SCHEDULER_CFS ..
# Earliest Deadline First (EDF)
cmake -DSCHEDULER_TYPE=SCHEDULER_EDF ..
# Rate Monotonic (RM)
cmake -DSCHEDULER_TYPE=SCHEDULER_RM ..
# Aperiodic Earliest Deadline First (AEDF)
cmake -DSCHEDULER_TYPE=SCHEDULER_AEDF ..
```
Otherwise you can use `ccmake`:
```bash
@@ -244,8 +367,7 @@ ENABLE_BUDDY_SYSTEM OFF
SCHEDULER_TYPE SCHEDULER_RR
```
Select SCHEDULER_TYPE, and type Enter to scroll the three available algorithms
(SCHEDULER_RR, SCHEDULER_PRIORITY, SCHEDULER_CFS). Afterwards,
Select SCHEDULER_TYPE, and type Enter to scroll the three available algorithms (SCHEDULER_RR, SCHEDULER_PRIORITY, SCHEDULER_CFS, SCHEDULER_EDF, SCHEDULER_RM, SCHEDULER_AEDF). Afterwards, you need to
```bash
<press c>
@@ -254,7 +376,9 @@ make
make qemu
```
## 8. Use Debugger
*[Back to the Table of Contents](#table-of-contents)*
## Debugging the kernel
If you want to use GDB to debug MentOS, first you need to compile everything:
@@ -264,33 +388,38 @@ cmake ..
make
```
Then, you need to generate a file called `.gdbinit` placed inside the `build` directory, which will tell **gdb** which *object* file he needs to read in order to allow proper debugging.
Then, you need to generate a file called `.gdbinit` placed inside the `build` directory, which will tell **gdb** which *object* file he needs to read in order to allow proper debugging. Basically, it provides for each binary file, the location of their `.text` section. To generate the file, just execute:
```bash
make gdb_file
make gdbinit
```
Finally, you run qemu in debugging mode with:
```bash
make qemu-gdb
```
If you did everything correctly, you should see an empty QEMU window. Basically, QEMU is waiting for you to connect *remotely* with gdb. Anyway, running `make qemu-gdb` will make your current shell busy, you cannot call `gdb` in it. You need to open a new shell inside the `build` folder and do a:
```bash
cgdb -q -iex 'add-auto-load-safe-path .'
gdb --quiet --command=gdb.run
```
or
```bash
cgdb --quiet --command=gdb.run
```
Now you will have:
1. the QEMU window waiting for you,
2. the shell where you ran `make qemu-gdb` also waiting for you,
3. the debugger that loaded a series of symbol files and the location of their `.text` section.
Now you should have in front of you:
1. the QEMU window waiting for you;
2. the **first** shell where you ran `make qemu-gdb`, which is also waiting for you;
3. the **second** shell where `gdb` is runnign and, you guessed it, is waiting for you.
By default I placed a breakpoint at the begginning of 1) the bootloader, 2) the `kmain` function of the kernel.
By default I placed a breakpoint at the begginning of (1) the *bootloader* and (2) the *kernel* itself.
So, when gdb starts you need to first give a continue:
```bash
(gdb) continue
```
This will make the kernel run, and stop at the first breakpoint which is inside the *bootloader*:
This will make the kernel run, and stop at the **first** breakpoint which is inside the *bootloader*:
```bash
Breakpoint 1, boot_main (...) at .../mentos/src/boot.c:220
220 {
@@ -298,13 +427,18 @@ Breakpoint 1, boot_main (...) at .../mentos/src/boot.c:220
giving a second `continue` will get you to the start of the operating system:
This will make the kernel run, and stop at the first breakpoint which is inside the *bootloader*:
This will make the kernel run, and stop at the **second** breakpoint which is inside the *kernel*:
```bash
Breakpoint 2, kmain (...) at .../mentos/src/kernel.c:95
95 {
```
## 9. Contributors
There is also a launch configuration for vscode in `.vscode/launch.json`, called `(gdb) Attach`, which should allow you
to connect to the running process.
*[Back to the Table of Contents](#table-of-contents)*
## Contributors
Project Manager:
@@ -326,3 +460,9 @@ Developers:
- Soft IRQs
- Timer
- Signals
* And many other valuable contributors
* [rouseabout](https://github.com/rouseabout)
* [seekbytes](https://github.com/seekbytes)
* [fischerling](https://github.com/fischerling)
*[Back to the Table of Contents](#table-of-contents)*
+299
View File
@@ -0,0 +1,299 @@
# Find Doxygen
find_package(Doxygen)
if (DOXYGEN_FOUND)
# Read the file with the version.
file(READ ${CMAKE_SOURCE_DIR}/mentos/inc/version.h version_file)
# Extract the OS version.
string(REGEX MATCH "OS_MAJOR_VERSION ([0-9]*)" _ ${version_file})
set(OS_MAJOR_VERSION ${CMAKE_MATCH_1})
string(REGEX MATCH "OS_MINOR_VERSION ([0-9]*)" _ ${version_file})
set(OS_MINOR_VERSION ${CMAKE_MATCH_1})
string(REGEX MATCH "OS_MICRO_VERSION ([0-9]*)" _ ${version_file})
set(OS_MICRO_VERSION ${CMAKE_MATCH_1})
# Setup the Doxygen documentation.
set(DOXYGEN_PROJECT_NAME "MentOS")
set(DOXYGEN_PROJECT_NUMBER "${OS_MAJOR_VERSION}.${OS_MINOR_VERSION}.${OS_MICRO_VERSION}")
set(DOXYGEN_PROJECT_BRIEF "The Mentoring Operating System")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE ${CMAKE_SOURCE_DIR}/README.md)
set(DOXYGEN_IMAGE_PATH ${CMAKE_SOURCE_DIR}/doc/resources)
set(DOXYGEN_SHOW_INCLUDE_FILES NO)
set(DOXYGEN_GENERATE_TREEVIEW NO)
set(DOXYGEN_WARN_NO_PARAMDOC YES)
set(DOXYGEN_ENABLE_PREPROCESSING YES)
set(DOXYGEN_EXTRACT_STATIC YES)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_EXPAND_ONLY_PREDEF YES)
set(DOXYGEN_PREDEFINED "__attribute__((x))= _syscall0= _syscall0(x)= _syscall1(x)= _syscall2(x)= _syscall3(x)=")
set(DOXYGEN_WARN_FORMAT "$file($line): $text")
set(DOXYGEN_HTML_STYLESHEET ${CMAKE_SOURCE_DIR}/doc/doxygen.css)
doxygen_add_docs(
mentos_documentation
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/LICENSE.md
${CMAKE_SOURCE_DIR}/doc/signal.md
${CMAKE_SOURCE_DIR}/doc/syscall.md
${CMAKE_SOURCE_DIR}/mentos/inc/boot.h
${CMAKE_SOURCE_DIR}/mentos/inc/descriptor_tables/gdt.h
${CMAKE_SOURCE_DIR}/mentos/inc/descriptor_tables/idt.h
${CMAKE_SOURCE_DIR}/mentos/inc/descriptor_tables/isr.h
${CMAKE_SOURCE_DIR}/mentos/inc/descriptor_tables/tss.h
${CMAKE_SOURCE_DIR}/mentos/inc/devices/fpu.h
${CMAKE_SOURCE_DIR}/mentos/inc/devices/pci.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/ata/ata.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/ata/ata_types.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/fdc.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/keyboard/keyboard.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/keyboard/keymap.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/mouse.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/ps2.h
${CMAKE_SOURCE_DIR}/mentos/inc/drivers/rtc.h
${CMAKE_SOURCE_DIR}/mentos/inc/elf/elf.h
${CMAKE_SOURCE_DIR}/mentos/inc/fs/ext2.h
${CMAKE_SOURCE_DIR}/mentos/inc/fs/ioctl.h
${CMAKE_SOURCE_DIR}/mentos/inc/fs/procfs.h
${CMAKE_SOURCE_DIR}/mentos/inc/fs/vfs.h
${CMAKE_SOURCE_DIR}/mentos/inc/fs/vfs_types.h
${CMAKE_SOURCE_DIR}/mentos/inc/hardware/cpuid.h
${CMAKE_SOURCE_DIR}/mentos/inc/hardware/pic8259.h
${CMAKE_SOURCE_DIR}/mentos/inc/hardware/timer.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/proc_modules.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/vga/vga.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/vga/vga_font.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/vga/vga_mode.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/vga/vga_palette.h
${CMAKE_SOURCE_DIR}/mentos/inc/io/video.h
${CMAKE_SOURCE_DIR}/mentos/inc/kernel.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/compiler.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/hashmap.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/irqflags.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/list.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/list_head.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/mutex.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/ndtree.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/rbtree.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/spinlock.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/stack_helper.h
${CMAKE_SOURCE_DIR}/mentos/inc/klib/stdatomic.h
${CMAKE_SOURCE_DIR}/mentos/inc/link_access.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/buddysystem.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/gfp.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/kheap.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/paging.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/slab.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/vmem_map.h
${CMAKE_SOURCE_DIR}/mentos/inc/mem/zone_allocator.h
${CMAKE_SOURCE_DIR}/mentos/inc/multiboot.h
${CMAKE_SOURCE_DIR}/mentos/inc/process/prio.h
${CMAKE_SOURCE_DIR}/mentos/inc/process/process.h
${CMAKE_SOURCE_DIR}/mentos/inc/process/scheduler.h
${CMAKE_SOURCE_DIR}/mentos/inc/process/wait.h
${CMAKE_SOURCE_DIR}/mentos/inc/proc_access.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/errno.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/ipc.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/module.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/reboot.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/types.h
${CMAKE_SOURCE_DIR}/mentos/inc/sys/utsname.h
${CMAKE_SOURCE_DIR}/mentos/inc/system/panic.h
${CMAKE_SOURCE_DIR}/mentos/inc/system/printk.h
${CMAKE_SOURCE_DIR}/mentos/inc/system/signal.h
${CMAKE_SOURCE_DIR}/mentos/inc/system/syscall.h
${CMAKE_SOURCE_DIR}/mentos/inc/version.h
${CMAKE_SOURCE_DIR}/mentos/src/boot.c
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/exception.c
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/gdt.c
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/idt.c
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/interrupt.c
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/tss.c
${CMAKE_SOURCE_DIR}/mentos/src/devices/fpu.c
${CMAKE_SOURCE_DIR}/mentos/src/devices/pci.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/ata.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/fdc.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/keyboard/keyboard.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/keyboard/keymap.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/mouse.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/ps2.c
${CMAKE_SOURCE_DIR}/mentos/src/drivers/rtc.c
${CMAKE_SOURCE_DIR}/mentos/src/elf/elf.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/ext2.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/ioctl.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/namei.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/open.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/procfs.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/readdir.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/read_write.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/stat.c
${CMAKE_SOURCE_DIR}/mentos/src/fs/vfs.c
${CMAKE_SOURCE_DIR}/mentos/src/hardware/cpuid.c
${CMAKE_SOURCE_DIR}/mentos/src/hardware/pic8259.c
${CMAKE_SOURCE_DIR}/mentos/src/hardware/timer.c
${CMAKE_SOURCE_DIR}/mentos/src/io/debug.c
${CMAKE_SOURCE_DIR}/mentos/src/io/mm_io.c
${CMAKE_SOURCE_DIR}/mentos/src/io/proc_running.c
${CMAKE_SOURCE_DIR}/mentos/src/io/proc_system.c
${CMAKE_SOURCE_DIR}/mentos/src/io/proc_video.c
${CMAKE_SOURCE_DIR}/mentos/src/io/stdio.c
${CMAKE_SOURCE_DIR}/mentos/src/io/vga/vga.c
${CMAKE_SOURCE_DIR}/mentos/src/io/video.c
${CMAKE_SOURCE_DIR}/mentos/src/ipc/msg.c
${CMAKE_SOURCE_DIR}/mentos/src/ipc/sem.c
${CMAKE_SOURCE_DIR}/mentos/src/ipc/shm.c
${CMAKE_SOURCE_DIR}/mentos/src/kernel/sys.c
${CMAKE_SOURCE_DIR}/mentos/src/kernel.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/assert.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/ctype.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/fcvt.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/hashmap.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/libgen.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/list.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/math.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/mutex.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/ndtree.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/rbtree.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/spinlock.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/strerror.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/string.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/time.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/vscanf.c
${CMAKE_SOURCE_DIR}/mentos/src/klib/vsprintf.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/buddysystem.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/kheap.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/paging.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/slab.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/vmem_map.c
${CMAKE_SOURCE_DIR}/mentos/src/mem/zone_allocator.c
${CMAKE_SOURCE_DIR}/mentos/src/multiboot.c
${CMAKE_SOURCE_DIR}/mentos/src/process/process.c
${CMAKE_SOURCE_DIR}/mentos/src/process/scheduler.c
${CMAKE_SOURCE_DIR}/mentos/src/process/scheduler_algorithm.c
${CMAKE_SOURCE_DIR}/mentos/src/process/wait.c
${CMAKE_SOURCE_DIR}/mentos/src/sys/module.c
${CMAKE_SOURCE_DIR}/mentos/src/sys/utsname.c
${CMAKE_SOURCE_DIR}/mentos/src/system/errno.c
${CMAKE_SOURCE_DIR}/mentos/src/system/panic.c
${CMAKE_SOURCE_DIR}/mentos/src/system/printk.c
${CMAKE_SOURCE_DIR}/mentos/src/system/signal.c
${CMAKE_SOURCE_DIR}/mentos/src/system/syscall.c
${CMAKE_SOURCE_DIR}/mentos/src/boot.S
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/exception.S
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/gdt.S
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/idt.S
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/interrupt.S
${CMAKE_SOURCE_DIR}/mentos/src/descriptor_tables/tss.S
${CMAKE_SOURCE_DIR}/mentos/src/process/user.S
${CMAKE_SOURCE_DIR}/libc/inc/array.h
${CMAKE_SOURCE_DIR}/libc/inc/assert.h
${CMAKE_SOURCE_DIR}/libc/inc/bits/ioctls.h
${CMAKE_SOURCE_DIR}/libc/inc/bits/stat.h
${CMAKE_SOURCE_DIR}/libc/inc/bits/termios-struct.h
${CMAKE_SOURCE_DIR}/libc/inc/ctype.h
${CMAKE_SOURCE_DIR}/libc/inc/fcntl.h
${CMAKE_SOURCE_DIR}/libc/inc/fcvt.h
${CMAKE_SOURCE_DIR}/libc/inc/grp.h
${CMAKE_SOURCE_DIR}/libc/inc/io/ansi_colors.h
${CMAKE_SOURCE_DIR}/libc/inc/io/debug.h
${CMAKE_SOURCE_DIR}/libc/inc/io/mm_io.h
${CMAKE_SOURCE_DIR}/libc/inc/io/port_io.h
${CMAKE_SOURCE_DIR}/libc/inc/ipc/ipc.h
${CMAKE_SOURCE_DIR}/libc/inc/ipc/msg.h
${CMAKE_SOURCE_DIR}/libc/inc/ipc/sem.h
${CMAKE_SOURCE_DIR}/libc/inc/ipc/shm.h
${CMAKE_SOURCE_DIR}/libc/inc/libgen.h
${CMAKE_SOURCE_DIR}/libc/inc/limits.h
${CMAKE_SOURCE_DIR}/libc/inc/math.h
${CMAKE_SOURCE_DIR}/libc/inc/pwd.h
${CMAKE_SOURCE_DIR}/libc/inc/ring_buffer.h
${CMAKE_SOURCE_DIR}/libc/inc/sched.h
${CMAKE_SOURCE_DIR}/libc/inc/signal.h
${CMAKE_SOURCE_DIR}/libc/inc/stdarg.h
${CMAKE_SOURCE_DIR}/libc/inc/stdbool.h
${CMAKE_SOURCE_DIR}/libc/inc/stddef.h
${CMAKE_SOURCE_DIR}/libc/inc/stdint.h
${CMAKE_SOURCE_DIR}/libc/inc/stdio.h
${CMAKE_SOURCE_DIR}/libc/inc/stdlib.h
${CMAKE_SOURCE_DIR}/libc/inc/strerror.h
${CMAKE_SOURCE_DIR}/libc/inc/string.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/bitops.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/dirent.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/errno.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/ioctl.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/kernel_levels.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/reboot.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/stat.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/types.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/unistd.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/utsname.h
${CMAKE_SOURCE_DIR}/libc/inc/sys/wait.h
${CMAKE_SOURCE_DIR}/libc/inc/system/syscall_types.h
${CMAKE_SOURCE_DIR}/libc/inc/termios.h
${CMAKE_SOURCE_DIR}/libc/inc/time.h
${CMAKE_SOURCE_DIR}/libc/src/abort.c
${CMAKE_SOURCE_DIR}/libc/src/assert.c
${CMAKE_SOURCE_DIR}/libc/src/ctype.c
${CMAKE_SOURCE_DIR}/libc/src/fcvt.c
${CMAKE_SOURCE_DIR}/libc/src/grp.c
${CMAKE_SOURCE_DIR}/libc/src/io/debug.c
${CMAKE_SOURCE_DIR}/libc/src/io/mm_io.c
${CMAKE_SOURCE_DIR}/libc/src/ipc/ipc.c
${CMAKE_SOURCE_DIR}/libc/src/libc_start.c
${CMAKE_SOURCE_DIR}/libc/src/libgen.c
${CMAKE_SOURCE_DIR}/libc/src/math.c
${CMAKE_SOURCE_DIR}/libc/src/pwd.c
${CMAKE_SOURCE_DIR}/libc/src/sched.c
${CMAKE_SOURCE_DIR}/libc/src/setenv.c
${CMAKE_SOURCE_DIR}/libc/src/stdio.c
${CMAKE_SOURCE_DIR}/libc/src/stdlib.c
${CMAKE_SOURCE_DIR}/libc/src/strerror.c
${CMAKE_SOURCE_DIR}/libc/src/string.c
${CMAKE_SOURCE_DIR}/libc/src/sys/errno.c
${CMAKE_SOURCE_DIR}/libc/src/sys/ioctl.c
${CMAKE_SOURCE_DIR}/libc/src/sys/unistd.c
${CMAKE_SOURCE_DIR}/libc/src/sys/utsname.c
${CMAKE_SOURCE_DIR}/libc/src/termios.c
${CMAKE_SOURCE_DIR}/libc/src/time.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/chdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/close.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/creat.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/exec.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/exit.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/fork.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getcwd.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getdents.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getpgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getpid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getppid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getsid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getuid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/interval.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/kill.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/lseek.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/mkdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/nice.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/open.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/read.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/reboot.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/rmdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setpgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setsid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setuid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/signal.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/stat.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/unlink.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/waitpid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/write.c
${CMAKE_SOURCE_DIR}/libc/src/vscanf.c
${CMAKE_SOURCE_DIR}/libc/src/vsprintf.c
${CMAKE_SOURCE_DIR}/libc/src/crt0.S
)
endif (DOXYGEN_FOUND)
+44 -13
View File
@@ -26,6 +26,31 @@
outline: none;
}
.sm-dox a:hover {
color: #4b5263;
background-color: #A9B7C6;
}
.sm-dox ul,
.sm-dox ul a {
color: #A9B7C6;
background-color: #4b5263;
}
.sm-dox ul a.highlighted {
color: #4b5263;
background-color: #A9B7C6;
}
.sm-dox ul a:hover {
color: #4b5263;
background-color: #A9B7C6;
background-image: none;
background-repeat: no-repeat;
text-shadow: none;
outline: none;
}
.memberdecls tr:not(:first-child) {
background-color: #333842;
}
@@ -599,7 +624,8 @@ table.memberdecls {
}
.memTemplParams {
color: #4665A2;
color: #728dc2;
font-weight: bold;
white-space: nowrap;
font-size: 80%;
}
@@ -633,9 +659,10 @@ table.memberdecls {
.memtemplate {
font-size: 80%;
color: #4665A2;
font-weight: normal;
color: #728dc2;
font-weight: bold;
margin-left: 9px;
white-space: nowrap;
}
.memnav {
@@ -686,6 +713,12 @@ dl.reflist dd {
padding: 1em;
}
.memdoc p {
padding: 0.25em;
border-radius: 4px;
background-color: #3A3F49;
}
dl.reflist dt {
padding: 5px;
}
@@ -857,6 +890,7 @@ div.directory {
font-family: Arial, Helvetica;
font-weight: bold;
font-size: 12px;
line-height: 16px;
height: 16px;
width: 16px;
display: inline-block;
@@ -879,7 +913,7 @@ div.directory {
height: 18px;
margin-bottom: 4px;
background-image: url("folderopen.png");
background-position: 0px -4px;
/* background-position: 0px -4px; */
background-repeat: repeat-y;
vertical-align: top;
display: inline-block;
@@ -890,7 +924,7 @@ div.directory {
height: 18px;
margin-bottom: 4px;
background-image: url("folderclosed.png");
background-position: 0px -4px;
/* background-position: 0px -4px; */
background-repeat: repeat-y;
vertical-align: top;
display: inline-block;
@@ -901,7 +935,7 @@ div.directory {
height: 18px;
margin-bottom: 4px;
background-image: url("doc.png");
background-position: 0px -4px;
/* background-position: 0px -4px; */
background-repeat: repeat-y;
vertical-align: top;
display: inline-block;
@@ -950,7 +984,7 @@ table.doxtable th {
}
table.fieldtable {
/*width: 100%;*/
width: fit-content;
margin-bottom: 10px;
border: 1px solid #A8B8D9;
border-spacing: 0px;
@@ -960,7 +994,6 @@ table.fieldtable {
-moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
-webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15);
width: fit-content;
}
.fieldtable td,
@@ -998,11 +1031,9 @@ table.fieldtable {
}
.fieldtable th {
background-image: url("nav_f.png");
background-repeat: repeat-x;
background-color: #E2E8F2;
font-size: 90%;
color: #253555;
font-size: 100%;
color: #d7dee4;
background-color: #49515f;
padding-bottom: 4px;
padding-top: 5px;
text-align: left;
-37
View File
@@ -1,37 +0,0 @@
# Find Doxygen
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/html/index.html)
# Replace variables inside @@ with the current values.
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY)
# Copy the files needd by the documentation.
set(DOXYFILE_CSS ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.css)
set(DOXYFILE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/header.html)
set(DOXYFILE_FOOTER ${CMAKE_CURRENT_SOURCE_DIR}/footer.html)
# Doxygen won't create this for us.
file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR})
add_custom_command(
OUTPUT ${DOXYGEN_INDEX_FILE}
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT}
MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN}
COMMENT "Generating docs"
)
add_custom_target(
doxygen_doc
DEPENDS
${DOXYGEN_INDEX_FILE}
${DOXYFILE_IN}
${DOXYFILE_CSS}
${DOXYFILE_HEADER}
${DOXYFILE_FOOTER}
)
endif (DOXYGEN_FOUND)
-2530
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-40
View File
@@ -1,40 +0,0 @@
<!-- HTML footer for doxygen 1.8.16-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath">
<!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen" />
</a> $doxygenversion
</li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<div class="footer">
<hr class="footer" />
<ul class="footer-info">
<li class="footer-info-lastmode">
This page was last modified on $datetime.
</li>
<li class="footer-info-copyright">
MentOs © 20142022 the MentOs-Team, and numerous contributors.<br>
It is available for use and modification under the&#160;
<a href="$relpath^md_LICENSE.html">MIT License</a>.<br>
</li>
</ul>
<hr class="footer" />
<address class="footer">
$generatedby&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen" />
</a> $doxygenversion
</address>
</div>
<!--END !GENERATE_TREEVIEW-->
</body>
</html>
-66
View File
@@ -1,66 +0,0 @@
<!-- HTML header for doxygen 1.8.17-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta name="generator" content="Doxygen $doxygenversion" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--BEGIN PROJECT_NAME-->
<title>$projectname: $title</title>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<title>$title</title>
<!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<div id="top">
<!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo" /></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span>
<!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF-->
<div id="projectbrief">$projectbrief</div>
<!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

+165 -165
View File
@@ -7,6 +7,7 @@ specifically:
1. Implemented
2. Tested
X. Obsolete
If the column is empty it means that it's not implemented yet.
@@ -15,184 +16,183 @@ If the column is empty it means that it's not implemented yet.
```
S | EAX | Name | Source | EBX | ECX | EDX | ESX | EDI |
---+-----+----------------------------+-----------------------------+--------------------------+------------------------------+-------------------------+-----------------+------------------|
2 | 1 | sys_exit | kernel/exit.c | int | - | - | - | - |
2 | 2 | sys_fork | arch/i386/kernel/process.c | struct pt_regs | - | - | - | - |
2 | 1 | sys_exit | process/scheduler.c | int | - | - | - | - |
2 | 2 | sys_fork | process/process.c | struct pt_regs | - | - | - | - |
2 | 3 | sys_read | fs/read_write.c | unsigned int | char * | size_t | - | - |
2 | 4 | sys_write | fs/read_write.c | unsigned int | const char * | size_t | - | - |
2 | 5 | sys_open | fs/open.c | const char * | int | int | - | - |
2 | 6 | sys_close | fs/open.c | int | - | - | - | - |
2 | 7 | sys_waitpid | kernel/exit.c | pid_t | unsigned int * | int | - | - |
| 8 | sys_creat | fs/open.c | const char * | int | - | - | - |
| 9 | sys_link | fs/namei.c | const char * | const char * | - | - | - |
2 | 7 | sys_waitpid | process/scheduler.c | pid_t | unsigned int * | int | - | - |
2 | 8 | sys_creat | fs/namei.c | const char * | int | - | - | - |
| 9 | sys_link | | const char * | const char * | - | - | - |
2 | 10 | sys_unlink | fs/namei.c | const char * | - | - | - | - |
2 | 11 | sys_execve | arch/i386/kernel/process.c | struct pt_regs | - | - | - | - |
2 | 12 | sys_chdir | fs/open.c | const char * | - | - | - | - |
2 | 13 | sys_time | kernel/time.c | int * | - | - | - | - |
| 14 | sys_mknod | fs/namei.c | const char * | int | dev_t | - | - |
| 15 | sys_chmod | fs/open.c | const char * | mode_t | - | - | - |
| 16 | sys_lchown | fs/open.c | const char * | uid_t | gid_t | - | - |
2 | 11 | sys_execve | process/process.c | struct pt_regs | - | - | - | - |
2 | 12 | sys_chdir | process/process.c | const char * | - | - | - | - |
2 | 13 | sys_time | klib/time.c | int * | - | - | - | - |
| 14 | sys_mknod | | const char * | int | dev_t | - | - |
1 | 15 | sys_chmod | fs/attr.c | const char * | mode_t | - | - | - |
| 16 | sys_lchown | fs/attr.c | const char * | uid_t | gid_t | - | - |
2 | 18 | sys_stat | fs/stat.c | char * | struct __old_kernel_stat * | - | - | - |
2 | 19 | sys_lseek | fs/read_write.c | unsigned int | off_t | unsigned int | - | - |
2 | 20 | sys_getpid | kernel/sched.c | - | - | - | - | - |
| 21 | sys_mount | fs/super.c | char * | char * | char * | - | - |
| 22 | sys_oldumount | fs/super.c | char * | - | - | - | - |
| 23 | sys_setuid | kernel/sys.c | uid_t | - | - | - | - |
| 24 | sys_getuid | kernel/sched.c | - | - | - | - | - |
| 25 | sys_stime | kernel/time.c | int * | - | - | - | - |
| 26 | sys_ptrace | arch/i386/kernel/ptrace.c | long | long | long | long | - |
| 27 | sys_alarm | kernel/sched.c | unsigned int | - | - | - | - |
2 | 20 | sys_getpid | process/scheduler.c | - | - | - | - | - |
| 21 | sys_mount | | char * | char * | char * | - | - |
| 22 | sys_oldumount | | char * | - | - | - | - |
2 | 23 | sys_setuid | process/scheduler.c | uid_t | - | - | - | - |
2 | 24 | sys_getuid | process/scheduler.c | - | - | - | - | - |
| 25 | sys_stime | | int * | - | - | - | - |
| 26 | sys_ptrace | | long | long | long | long | - |
2 | 27 | sys_alarm | hardware/timer.c | unsigned int | - | - | - | - |
2 | 28 | sys_fstat | fs/stat.c | unsigned int | struct __old_kernel_stat * | - | - | - |
| 29 | sys_pause | arch/i386/kernel/sys_i386.c | - | - | - | - | - |
| 30 | sys_utime | fs/open.c | char * | struct utimbuf * | - | - | - |
| 33 | sys_access | fs/open.c | const char * | int | - | - | - |
1 | 34 | sys_nice | kernel/sched.c | int | - | - | - | - |
| 36 | sys_sync | fs/buffer.c | - | - | - | - | - |
1 | 37 | sys_kill | kernel/signal.c | int | int | - | - | - |
| 38 | sys_rename | fs/namei.c | const char * | const char * | - | - | - |
| 29 | sys_pause | | - | - | - | - | - |
| 30 | sys_utime | | char * | struct utimbuf * | - | - | - |
| 33 | sys_access | | const char * | int | - | - | - |
1 | 34 | sys_nice | process/scheduler.c | int | - | - | - | - |
| 36 | sys_sync | | - | - | - | - | - |
1 | 37 | sys_kill | system/signal.c | int | int | - | - | - |
| 38 | sys_rename | | const char * | const char * | - | - | - |
2 | 39 | sys_mkdir | fs/namei.c | const char * | int | - | - | - |
2 | 40 | sys_rmdir | fs/namei.c | const char * | - | - | - | - |
| 41 | sys_dup | fs/fcntl.c | unsigned int | - | - | - | - |
| 42 | sys_pipe | arch/i386/kernel/sys_i386.c | unsigned long * | - | - | - | - |
| 43 | sys_times | kernel/sys.c | struct tms * | - | - | - | - |
2 | 45 | sys_brk | mm/mmap.c | unsigned long | - | - | - | - |
| 46 | sys_setgid | kernel/sys.c | gid_t | - | - | - | - |
| 47 | sys_getgid | kernel/sched.c | - | - | - | - | - |
1 | 48 | sys_signal | kernel/signal.c | int | __sighandler_t | - | - | - |
| 49 | sys_geteuid | kernel/sched.c | - | - | - | - | - |
| 50 | sys_getegid | kernel/sched.c | - | - | - | - | - |
| 51 | sys_acct | kernel/acct.c | const char * | - | - | - | - |
| 52 | sys_umount | fs/super.c | char * | int | - | - | - |
1 | 41 | sys_dup | fs/vfs.c | unsigned int | - | - | - | - |
| 42 | sys_pipe | | unsigned long * | - | - | - | - |
| 43 | sys_times | | struct tms * | - | - | - | - |
2 | 45 | sys_brk | mem/kheap.c | unsigned long | - | - | - | - |
2 | 46 | sys_setgid | process/scheduler.c | gid_t | - | - | - | - |
2 | 47 | sys_getgid | process/scheduler.c | - | - | - | - | - |
1 | 48 | sys_signal | system/signal.c | int | __sighandler_t | - | - | - |
1 | 49 | sys_geteuid | process/scheduler.c | - | - | - | - | - |
1 | 50 | sys_getegid | process/scheduler.c | - | - | - | - | - |
| 51 | sys_acct | | const char * | - | - | - | - |
| 52 | sys_umount | | char * | int | - | - | - |
1 | 54 | sys_ioctl | fs/ioctl.c | unsigned int | unsigned int | unsigned long | - | - |
| 55 | sys_fcntl | fs/fcntl.c | unsigned int | unsigned int | unsigned long | - | - |
| 57 | sys_setpgid | kernel/sys.c | pid_t | pid_t | - | - | - |
| 59 | sys_olduname | arch/i386/kernel/sys_i386.c | struct oldold_utsname * | - | - | - | - |
| 60 | sys_umask | kernel/sys.c | int | - | - | - | - |
| 61 | sys_chroot | fs/open.c | const char * | - | - | - | - |
| 62 | sys_ustat | fs/super.c | dev_t | struct ustat * | - | - | - |
| 63 | sys_dup2 | fs/fcntl.c | unsigned int | unsigned int | - | - | - |
2 | 64 | sys_getppid | kernel/sched.c | - | - | - | - | - |
| 65 | sys_getpgrp | kernel/sys.c | - | - | - | - | - |
| 66 | sys_setsid | kernel/sys.c | - | - | - | - | - |
1 | 67 | sys_sigaction | arch/i386/kernel/signal.c | int | const struct old_sigaction * | struct old_sigaction * | - | - |
| 68 | sys_sgetmask | kernel/signal.c | - | - | - | - | - |
| 69 | sys_ssetmask | kernel/signal.c | int | - | - | - | - |
| 70 | sys_setreuid | kernel/sys.c | uid_t | uid_t | - | - | - |
| 71 | sys_setregid | kernel/sys.c | gid_t | gid_t | - | - | - |
| 72 | sys_sigsuspend | arch/i386/kernel/signal.c | int | int | old_sigset_t | - | - |
| 73 | sys_sigpending | kernel/signal.c | old_sigset_t * | - | - | - | - |
| 74 | sys_sethostname | kernel/sys.c | char * | int | - | - | - |
| 75 | sys_setrlimit | kernel/sys.c | unsigned int | struct rlimit * | - | - | - |
| 76 | sys_getrlimit | kernel/sys.c | unsigned int | struct rlimit * | - | - | - |
| 77 | sys_getrusage | kernel/sys.c | int | struct rusage * | - | - | - |
| 78 | sys_gettimeofday | kernel/time.c | struct timeval * | struct timezone * | - | - | - |
| 79 | sys_settimeofday | kernel/time.c | struct timeval * | struct timezone * | - | - | - |
| 80 | sys_getgroups | kernel/sys.c | int | gid_t * | - | - | - |
| 81 | sys_setgroups | kernel/sys.c | int | gid_t * | - | - | - |
| 83 | sys_symlink | fs/namei.c | const char * | const char * | - | - | - |
| 84 | sys_lstat | fs/stat.c | char * | struct __old_kernel_stat * | - | - | - |
| 85 | sys_readlink | fs/stat.c | const char * | char * | int | - | - |
| 86 | sys_uselib | fs/exec.c | const char * | - | - | - | - |
| 87 | sys_swapon | mm/swapfile.c | const char * | int | - | - | - |
| 55 | sys_fcntl | | unsigned int | unsigned int | unsigned long | - | - |
2 | 57 | sys_setpgid | process/scheduler.c | pid_t | pid_t | - | - | - |
| 59 | sys_olduname | | struct oldold_utsname * | - | - | - | - |
| 60 | sys_umask | | int | - | - | - | - |
| 61 | sys_chroot | | const char * | - | - | - | - |
| 62 | sys_ustat | | dev_t | struct ustat * | - | - | - |
| 63 | sys_dup2 | | unsigned int | unsigned int | - | - | - |
2 | 64 | sys_getppid | process/scheduler.c | - | - | - | - | - |
| 65 | sys_getpgrp | | - | - | - | - | - |
2 | 66 | sys_setsid | process/scheduler.c | - | - | - | - | - |
1 | 67 | sys_sigaction | system/signal.c | int | const struct old_sigaction * | struct old_sigaction * | - | - |
X | 68 | sys_sgetmask | | - | - | - | - | - |
X | 69 | sys_ssetmask | | int | - | - | - | - |
1 | 70 | sys_setreuid | process/scheduler.c | uid_t | uid_t | - | - | - |
1 | 71 | sys_setregid | process/scheduler.c | gid_t | gid_t | - | - | - |
| 72 | sys_sigsuspend | | int | int | old_sigset_t | - | - |
| 73 | sys_sigpending | | old_sigset_t * | - | - | - | - |
| 74 | sys_sethostname | | char * | int | - | - | - |
| 75 | sys_setrlimit | | unsigned int | struct rlimit * | - | - | - |
| 76 | sys_getrlimit | | unsigned int | struct rlimit * | - | - | - |
| 77 | sys_getrusage | | int | struct rusage * | - | - | - |
| 78 | sys_gettimeofday | | struct timeval * | struct timezone * | - | - | - |
| 79 | sys_settimeofday | | struct timeval * | struct timezone * | - | - | - |
| 80 | sys_getgroups | | int | gid_t * | - | - | - |
| 81 | sys_setgroups | | int | gid_t * | - | - | - |
| 83 | sys_symlink | | const char * | const char * | - | - | - |
| 84 | sys_lstat | | char * | struct __old_kernel_stat * | - | - | - |
| 85 | sys_readlink | | const char * | char * | int | - | - |
| 86 | sys_uselib | | const char * | - | - | - | - |
| 87 | sys_swapon | | const char * | int | - | - | - |
1 | 88 | sys_reboot | kernel/sys.c | int | int | int | void * | - |
1 | 89 | old_readdir | fs/readdir.c | unsigned int | void * | unsigned int | - | - |
| 90 | old_mmap | arch/i386/kernel/sys_i386.c | struct mmap_arg_struct * | - | - | - | - |
| 91 | sys_munmap | mm/mmap.c | unsigned long | size_t | - | - | - |
| 92 | sys_truncate | fs/open.c | const char * | unsigned long | - | - | - |
| 93 | sys_ftruncate | fs/open.c | unsigned int | unsigned long | - | - | - |
| 94 | sys_fchmod | fs/open.c | unsigned int | mode_t | - | - | - |
| 95 | sys_fchown | fs/open.c | unsigned int | uid_t | gid_t | - | - |
| 96 | sys_getpriority | kernel/sys.c | int | int | - | - | - |
| 97 | sys_setpriority | kernel/sys.c | int | int | int | - | - |
| 99 | sys_statfs | fs/open.c | const char * | struct statfs * | - | - | - |
| 100 | sys_fstatfs | fs/open.c | unsigned int | struct statfs * | - | - | - |
| 101 | sys_ioperm | arch/i386/kernel/ioport.c | unsigned long | unsigned long | int | - | - |
| 102 | sys_socketcall | net/socket.c | int | unsigned long * | - | - | - |
| 103 | sys_syslog | kernel/printk.c | int | char * | int | - | - |
| 104 | sys_setitimer | kernel/itimer.c | int | struct itimerval * | struct itimerval * | - | - |
| 105 | sys_getitimer | kernel/itimer.c | int | struct itimerval * | - | - | - |
| 106 | sys_newstat | fs/stat.c | char * | struct stat * | - | - | - |
| 107 | sys_newlstat | fs/stat.c | char * | struct stat * | - | - | - |
| 108 | sys_newfstat | fs/stat.c | unsigned int | struct stat * | - | - | - |
1 | 109 | sys_uname | arch/i386/kernel/sys_i386.c | struct old_utsname * | - | - | - | - |
| 110 | sys_iopl | arch/i386/kernel/ioport.c | unsigned long | - | - | - | - |
| 111 | sys_vhangup | fs/open.c | - | - | - | - | - |
| 112 | sys_idle | arch/i386/kernel/process.c | - | - | - | - | - |
| 113 | sys_vm86old | arch/i386/kernel/vm86.c | unsigned long | struct vm86plus_struct * | - | - | - |
| 114 | sys_wait4 | kernel/exit.c | pid_t | unsigned long * | int options | struct rusage * | - |
| 115 | sys_swapoff | mm/swapfile.c | const char * | - | - | - | - |
| 116 | sys_sysinfo | kernel/info.c | struct sysinfo * | - | - | - | - |
* | 117 | sys_ipc(*Note) | arch/i386/kernel/sys_i386.c | uint | int | int | int | void * |
| 118 | sys_fsync | fs/buffer.c | unsigned int | - | - | - | - |
| 119 | sys_sigreturn | arch/i386/kernel/signal.c | unsigned long | - | - | - | - |
| 120 | sys_clone | arch/i386/kernel/process.c | struct pt_regs | - | - | - | - |
| 121 | sys_setdomainname | kernel/sys.c | char * | int | - | - | - |
| 122 | sys_newuname | kernel/sys.c | struct new_utsname * | - | - | - | - |
| 123 | sys_modify_ldt | arch/i386/kernel/ldt.c | int | void * | unsigned long | - | - |
| 124 | sys_adjtimex | kernel/time.c | struct timex * | - | - | - | - |
| 125 | sys_mprotect | mm/mprotect.c | unsigned long | size_t | unsigned long | - | - |
1 | 126 | sys_sigprocmask | kernel/signal.c | int | old_sigset_t * | old_sigset_t * | - | - |
| 127 | sys_create_module | kernel/module.c | const char * | size_t | - | - | - |
| 128 | sys_init_module | kernel/module.c | const char * | struct module * | - | - | - |
| 129 | sys_delete_module | kernel/module.c | const char * | - | - | - | - |
| 130 | sys_get_kernel_syms | kernel/module.c | struct kernel_sym * | - | - | - | - |
| 131 | sys_quotactl | fs/dquot.c | int | const char * | int | caddr_t | - |
| 132 | sys_getpgid | kernel/sys.c | pid_t | - | - | - | - |
1 | 133 | sys_fchdir | fs/open.c | unsigned int | - | - | - | - |
| 134 | sys_bdflush | fs/buffer.c | int | long | - | - | - |
| 135 | sys_sysfs | fs/super.c | int | unsigned long | unsigned long | - | - |
| 136 | sys_personality | kernel/exec_domain.c | unsigned long | - | - | - | - |
| 138 | sys_setfsuid | kernel/sys.c | uid_t | - | - | - | - |
| 139 | sys_setfsgid | kernel/sys.c | gid_t | - | - | - | - |
| 140 | sys_llseek | fs/read_write.c | unsigned int | unsigned long | unsigned long | loff_t * | unsigned int |
| 89 | old_readdir | | unsigned int | void * | unsigned int | - | - |
| 90 | old_mmap | | struct mmap_arg_struct * | - | - | - | - |
| 91 | sys_munmap | | unsigned long | size_t | - | - | - |
| 92 | sys_truncate | | const char * | unsigned long | - | - | - |
| 93 | sys_ftruncate | | unsigned int | unsigned long | - | - | - |
| 94 | sys_fchmod | | unsigned int | mode_t | - | - | - |
1 | 95 | sys_fchown | fs/attr.c | unsigned int | uid_t | gid_t | - | - |
| 96 | sys_getpriority | | int | int | - | - | - |
| 97 | sys_setpriority | | int | int | int | - | - |
| 99 | sys_statfs | | const char * | struct statfs * | - | - | - |
| 100 | sys_fstatfs | | unsigned int | struct statfs * | - | - | - |
| 101 | sys_ioperm | | unsigned long | unsigned long | int | - | - |
| 102 | sys_socketcall | | int | unsigned long * | - | - | - |
1 | 103 | sys_syslog | system/printk.c | int | char * | int | - | - |
1 | 104 | sys_setitimer | hardware/timer.c | int | struct itimerval * | struct itimerval * | - | - |
1 | 105 | sys_getitimer | hardware/timer.c | int | struct itimerval * | - | - | - |
| 106 | sys_newstat | | char * | struct stat * | - | - | - |
| 107 | sys_newlstat | | char * | struct stat * | - | - | - |
| 108 | sys_newfstat | | unsigned int | struct stat * | - | - | - |
1 | 109 | sys_uname | sys/utsname.c | struct old_utsname * | - | - | - | - |
| 110 | sys_iopl | | unsigned long | - | - | - | - |
| 111 | sys_vhangup | | - | - | - | - | - |
| 112 | sys_idle | | - | - | - | - | - |
| 113 | sys_vm86old | | unsigned long | struct vm86plus_struct * | - | - | - |
| 114 | sys_wait4 | | pid_t | unsigned long * | int options | struct rusage * | - |
| 115 | sys_swapoff | | const char * | - | - | - | - |
| 116 | sys_sysinfo | | struct sysinfo * | - | - | - | - |
* | 117 | sys_ipc(*Note) | | uint | int | int | int | void * |
| 118 | sys_fsync | | unsigned int | - | - | - | - |
1 | 119 | sys_sigreturn | system/signal.c | unsigned long | - | - | - | - |
| 120 | sys_clone | | struct pt_regs | - | - | - | - |
| 121 | sys_setdomainname | | char * | int | - | - | - |
| 122 | sys_newuname | | struct new_utsname * | - | - | - | - |
| 123 | sys_modify_ldt | | int | void * | unsigned long | - | - |
| 124 | sys_adjtimex | | struct timex * | - | - | - | - |
| 125 | sys_mprotect | | unsigned long | size_t | unsigned long | - | - |
1 | 126 | sys_sigprocmask | system/signal.c | int | old_sigset_t * | old_sigset_t * | - | - |
| 127 | sys_create_module | | const char * | size_t | - | - | - |
| 128 | sys_init_module | | const char * | struct module * | - | - | - |
| 129 | sys_delete_module | | const char * | - | - | - | - |
| 130 | sys_get_kernel_syms | | struct kernel_sym * | - | - | - | - |
| 131 | sys_quotactl | | int | const char * | int | caddr_t | - |
| 132 | sys_getpgid | | pid_t | - | - | - | - |
1 | 133 | sys_fchdir | process/process.c | unsigned int | - | - | - | - |
| 134 | sys_bdflush | | int | long | - | - | - |
| 135 | sys_sysfs | | int | unsigned long | unsigned long | - | - |
| 136 | sys_personality | | unsigned long | - | - | - | - |
| 138 | sys_setfsuid | | uid_t | - | - | - | - |
| 139 | sys_setfsgid | | gid_t | - | - | - | - |
| 140 | sys_llseek | | unsigned int | unsigned long | unsigned long | loff_t * | unsigned int |
2 | 141 | sys_getdents | fs/readdir.c | unsigned int | void * | unsigned int | - | - |
| 142 | sys_select | fs/select.c | int | fd_set * | fd_set * | fd_set * | struct timeval * |
| 143 | sys_flock | fs/locks.c | unsigned int | unsigned int | - | - | - |
| 144 | sys_msync | mm/filemap.c | unsigned long | size_t | int | - | - |
| 145 | sys_readv | fs/read_write.c | unsigned long | const struct iovec * | unsigned long | - | - |
| 146 | sys_writev | fs/read_write.c | unsigned long | const struct iovec * | unsigned long | - | - |
| 147 | sys_getsid | kernel/sys.c | pid_t | - | - | - | - |
| 148 | sys_fdatasync | fs/buffer.c | unsigned int | - | - | - | - |
| 149 | sys_sysctl | kernel/sysctl.c | struct __sysctl_args * | - | - | - | - |
| 150 | sys_mlock | mm/mlock.c | unsigned long | size_t | - | - | - |
| 151 | sys_munlock | mm/mlock.c | unsigned long | size_t | - | - | - |
| 152 | sys_mlockall | mm/mlock.c | int | - | - | - | - |
| 153 | sys_munlockall | mm/mlock.c | - | - | - | - | - |
1 | 154 | sys_sched_setparam | kernel/sched.c | pid_t | struct sched_param * | - | - | - |
1 | 155 | sys_sched_getparam | kernel/sched.c | pid_t | struct sched_param * | - | - | - |
| 156 | sys_sched_setscheduler | kernel/sched.c | pid_t | int | struct sched_param * | - | - |
| 157 | sys_sched_getscheduler | kernel/sched.c | pid_t | - | - | - | - |
| 158 | sys_sched_yield | kernel/sched.c | - | - | - | - | - |
| 159 | sys_sched_get_priority_max | kernel/sched.c | int | - | - | - | - |
| 160 | sys_sched_get_priority_min | kernel/sched.c | int | - | - | - | - |
| 161 | sys_sched_rr_get_interval | kernel/sched.c | pid_t | struct timespec * | - | - | - |
| 162 | sys_nanosleep | kernel/sched.c | struct timespec * | struct timespec * | - | - | - |
| 163 | sys_mremap | mm/mremap.c | unsigned long | unsigned long | unsigned long | unsigned long | - |
| 164 | sys_setresuid | kernel/sys.c | uid_t | uid_t | uid_t | - | - |
| 165 | sys_getresuid | kernel/sys.c | uid_t * | uid_t * | uid_t * | - | - |
| 166 | sys_vm86 | arch/i386/kernel/vm86.c | struct vm86_struct * | - | - | - | - |
| 167 | sys_query_module | kernel/module.c | const char * | int | char * | size_t | size_t * |
| 168 | sys_poll | fs/select.c | struct pollfd * | unsigned int | long | - | - |
| 169 | sys_nfsservctl | fs/filesystems.c | int | void * | void * | - | - |
| 170 | sys_setresgid | kernel/sys.c | gid_t | gid_t | gid_t | - | - |
| 171 | sys_getresgid | kernel/sys.c | gid_t * | gid_t * | gid_t * | - | - |
| 172 | sys_prctl | kernel/sys.c | int | unsigned long | unsigned long | unsigned long | unsigned long |
| 173 | sys_rt_sigreturn | arch/i386/kernel/signal.c | unsigned long | - | - | - | - |
| 174 | sys_rt_sigaction | kernel/signal.c | int | const struct sigaction * | struct sigaction * | size_t | - |
| 175 | sys_rt_sigprocmask | kernel/signal.c | int | sigset_t * | sigset_t * | size_t | - |
| 176 | sys_rt_sigpending | kernel/signal.c | sigset_t * | size_t | - | - | - |
| 177 | sys_rt_sigtimedwait | kernel/signal.c | const sigset_t * | siginfo_t * | const struct timespec * | size_t | - |
| 178 | sys_rt_sigqueueinfo | kernel/signal.c | int | int | siginfo_t * | - | - |
| 179 | sys_rt_sigsuspend | arch/i386/kernel/signal.c | sigset_t * | size_t | - | - | - |
| 180 | sys_pread | fs/read_write.c | unsigned int | char * | size_t | loff_t | - |
| 181 | sys_pwrite | fs/read_write.c | unsigned int | const char * | size_t | loff_t | - |
| 182 | sys_chown | fs/open.c | const char * | uid_t | gid_t | - | - |
1 | 183 | sys_getcwd | fs/dcache.c | char * | unsigned long | - | - | - |
| 184 | sys_capget | kernel/capability.c | cap_user_header_t | cap_user_data_t | - | - | - |
| 185 | sys_capset | kernel/capability.c | cap_user_header_t | const cap_user_data_t | - | - | - |
| 186 | sys_sigaltstack | arch/i386/kernel/signal.c | const stack_t * | stack_t * | - | - | - |
| 187 | sys_sendfile | mm/filemap.c | int | int | off_t * | size_t | - |
| | | | | | | | |
2 | 188 | sys_waitperiod | kernel/sched.c | | | | | |
| 142 | sys_select | | int | fd_set * | fd_set * | fd_set * | struct timeval * |
| 143 | sys_flock | | unsigned int | unsigned int | - | - | - |
| 144 | sys_msync | | unsigned long | size_t | int | - | - |
| 145 | sys_readv | | unsigned long | const struct iovec * | unsigned long | - | - |
| 146 | sys_writev | | unsigned long | const struct iovec * | unsigned long | - | - |
1 | 147 | sys_getsid | process/scheduler.c | pid_t | - | - | - | - |
| 148 | sys_fdatasync | | unsigned int | - | - | - | - |
| 149 | sys_sysctl | | struct __sysctl_args * | - | - | - | - |
| 150 | sys_mlock | | unsigned long | size_t | - | - | - |
| 151 | sys_munlock | | unsigned long | size_t | - | - | - |
| 152 | sys_mlockall | | int | - | - | - | - |
| 153 | sys_munlockall | | - | - | - | - | - |
1 | 154 | sys_sched_setparam | process/scheduler.c | pid_t | struct sched_param * | - | - | - |
1 | 155 | sys_sched_getparam | process/scheduler.c | pid_t | struct sched_param * | - | - | - |
| 156 | sys_sched_setscheduler | | pid_t | int | struct sched_param * | - | - |
| 157 | sys_sched_getscheduler | | pid_t | - | - | - | - |
| 158 | sys_sched_yield | | - | - | - | - | - |
| 159 | sys_sched_get_priority_max | | int | - | - | - | - |
| 160 | sys_sched_get_priority_min | | int | - | - | - | - |
| 161 | sys_sched_rr_get_interval | | pid_t | struct timespec * | - | - | - |
1 | 162 | sys_nanosleep | hardware/timer.c | struct timespec * | struct timespec * | - | - | - |
| 163 | sys_mremap | | unsigned long | unsigned long | unsigned long | unsigned long | - |
| 164 | sys_setresuid | | uid_t | uid_t | uid_t | - | - |
| 165 | sys_getresuid | | uid_t * | uid_t * | uid_t * | - | - |
| 166 | sys_vm86 | | struct vm86_struct * | - | - | - | - |
| 167 | sys_query_module | | const char * | int | char * | size_t | size_t * |
| 168 | sys_poll | | struct pollfd * | unsigned int | long | - | - |
| 169 | sys_nfsservctl | | int | void * | void * | - | - |
| 170 | sys_setresgid | | gid_t | gid_t | gid_t | - | - |
| 171 | sys_getresgid | | gid_t * | gid_t * | gid_t * | - | - |
| 172 | sys_prctl | | int | unsigned long | unsigned long | unsigned long | unsigned long |
| 173 | sys_rt_sigreturn | | unsigned long | - | - | - | - |
| 174 | sys_rt_sigaction | | int | const struct sigaction * | struct sigaction * | size_t | - |
| 175 | sys_rt_sigprocmask | | int | sigset_t * | sigset_t * | size_t | - |
| 176 | sys_rt_sigpending | | sigset_t * | size_t | - | - | - |
| 177 | sys_rt_sigtimedwait | | const sigset_t * | siginfo_t * | const struct timespec * | size_t | - |
| 178 | sys_rt_sigqueueinfo | | int | int | siginfo_t * | - | - |
| 179 | sys_rt_sigsuspend | | sigset_t * | size_t | - | - | - |
| 180 | sys_pread | | unsigned int | char * | size_t | loff_t | - |
| 181 | sys_pwrite | | unsigned int | const char * | size_t | loff_t | - |
1 | 182 | sys_chown | vfs/attr.c | const char * | uid_t | gid_t | - | - |
1 | 183 | sys_getcwd | process/process.c | char * | unsigned long | - | - | - |
| 184 | sys_capget | | cap_user_header_t | cap_user_data_t | - | - | - |
| 185 | sys_capset | | cap_user_header_t | const cap_user_data_t | - | - | - |
| 186 | sys_sigaltstack | | const stack_t * | stack_t * | - | - | - |
| 187 | sys_sendfile | | int | int | off_t * | size_t | - |
2 | 188 | sys_waitperiod | process/scheduler.c | | | | | |
| 189 | sys_msgctl | | int | | | | |
| 190 | sys_msgget | | | | | | |
| 191 | sys_msgrcv | | | | | | |
+2 -3
View File
@@ -1,9 +1,8 @@
MentOS 0.1
MentOS 0.6.0
Welcome to the MentOS, the Mentoring Operating System.
If you want some help enter the "help" command into the cli.
If you want some help enter the "man" command into the cli.
Bye,
The Ment(OS) Team
-1
View File
@@ -1 +0,0 @@
io ti vi bi!
+1
View File
@@ -0,0 +1 @@
../../README
+1
View File
@@ -0,0 +1 @@
../../root
-1
View File
@@ -1 +0,0 @@
tanto questa e' solo una prova :\
-1
View File
@@ -1 +0,0 @@
ciao mondo
-3
View File
@@ -1,3 +0,0 @@
come va ?
AAA
-1
View File
@@ -1 +0,0 @@
bho, io credo bene eh eh eh
-1
View File
@@ -1 +0,0 @@
tanto questa e' solo una prova :\
-1
View File
@@ -1 +0,0 @@
io ti vi bi!
+8
View File
@@ -0,0 +1,8 @@
SYNOPSIS
cat [FILE]
DESCRIPTION
Prints the content of the given file.
OPTIONS
-h --help : shows command help.
+22
View File
@@ -0,0 +1,22 @@
SYNOPSIS
chmod MODE FILE
DESCRIPTION
chmod changes the file mode bits of the given file according to mode, which
must be an octal number representing the bit pattern for the new mode bits.
The numeric mode is from one to four octal digits (0-7), derived by adding
up the bits with values 4, 2, and 1. Omitted digits are assumed to be
leading zeros. The first digit selects the set user ID (4) and set group
ID (2) and restricted deletion or sticky (1) attributes. The second digit
selects permissions for the user who owns the file: read (4), write (2),
and execute (1); the third selects permissions for other users in the file's
group, with the same values; and the fourth for other users not in the
file's group, with the same values.
chmod never changes the permissions of symbolic links; the chmod system call
cannot change their permissions.
EXAMPLES
chmod 555 executable
Changes the mode bits of executable to r-xr-xr-x.
+19
View File
@@ -0,0 +1,19 @@
SYNOPSIS
chown [OWNER][:[GROUP]] FILE
DESCRIPTION
chown changes the user and/or group ownership of the given file.
If only a owner is given the file's group is not changed. If the owner
is followed by a colon and a group name (or numeric group ID), the group
ownership is changed as well. If the colon and group are given, but the
owner is omitted, only the group of the file is changed.
chown never changes the ownership of symbolic links; the chown system call
cannot change their ownership.
EXAMPLES
chown root /u
Change the owner of /u to "root".
chown root:staff /u
Likewise, but also change its group to "staff".
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
clear
DESCRIPTION
Clears the screen.
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
cpuid
DESCRIPTION
Not currently implemented.
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
date
DESCRIPTION
Shows the current date.
+6
View File
@@ -0,0 +1,6 @@
SYNOPSIS
echo [STRING]
DESCRIPTION
Displays a line of text.
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
false
DESCRIPTION
false sets the exit status to 1.
+15
View File
@@ -0,0 +1,15 @@
SYNOPSIS
id [OPTIONS]
DESCRIPTION
Print user and group information for the current process.
The following options are available:
-g, --group
print only the effective group ID
-u, --user
print only the effective user ID
--help display a help message and exit
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
ipcs [options]
DESCRIPTION
Ipcs shows information on System V inter-process communication facilities.
+3 -5
View File
@@ -1,6 +1,3 @@
NAME
ls - list directory contents
SYNOPSIS
ls [OPTIONS] [FILE/FOLDER]
@@ -10,5 +7,6 @@ DESCRIPTION
inside the current folder.
OPTIONS
-a : list all entries.
-l : show the entries as a detailed list.
-h --help : shows command help.
-a --all : list all entries.
-l --long : show the entries as a detailed long list.
+8
View File
@@ -0,0 +1,8 @@
SYNOPSIS
mkdir DIRECTORY
DESCRIPTION
Create the DIRECTORY, if it does not exist.
OPTIONS
--help : shows command help.
+13
View File
@@ -0,0 +1,13 @@
SYNOPSIS
more [FILE]
DESCRIPTION
more is a filter for paging through text one screenful at a time.
OPTIONS
-h, --help: shows command help.
KEY BINDINGS
q Exit from more
space Display next screen size
return Display next line
+8
View File
@@ -0,0 +1,8 @@
SYNOPSIS
rmdir DIRECTORY
DESCRIPTION
Remove the DIRECTORY, if it is empty.
OPTIONS
--help : shows command help.
+5
View File
@@ -0,0 +1,5 @@
SYNOPSIS
showpid
DESCRIPTION
showpid uses getppid() to print the ID of the parent process.
+12
View File
@@ -0,0 +1,12 @@
SYNOPSIS
start [OPTIONS] [FILE]
DESCRIPTION
Start a recording session aimed at displaying an ordered list of 50 items
containing information about the processes that the CPU has just processed.
OPTIONS
-h: shows command help. //non funziona per ora lol
-p: start the session with generated children
-f [FILE]: start the session launching a specified program
+2 -2
View File
@@ -1,7 +1,7 @@
set timeout=1
set timeout=5
set default=0
menuentry "MentOS" {
multiboot /boot/kernel-bootloader.bin
multiboot /boot/bootloader.bin
boot
}
+70 -138
View File
@@ -1,148 +1,80 @@
# =============================================================================
# Author: Enrico Fraccaroli
# =============================================================================
# Set the minimum required version of cmake.
cmake_minimum_required(VERSION 3.1...3.22)
# Initialize the project.
project(libc C ASM)
# =============================================================================
# ASSEMBLY
# LIBRARY
# =============================================================================
# Enable the assembly language.
enable_language(ASM)
# Find the NASM compiler.
find_program(ASM_COMPILER NAMES nasm HINTS /usr/bin/ /usr/local/bin/)
# Mark the variable ASM_COMPILER as advanced.
mark_as_advanced(ASM_COMPILER)
# Check that we have found the compiler.
if(NOT ASM_COMPILER)
message(FATAL_ERROR "ASM compiler not found!")
endif(NOT ASM_COMPILER)
# Set the asm compiler.
set(CMAKE_ASM_COMPILER ${ASM_COMPILER})
# Set the assembly compiler flags.
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -f elf")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -O0")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -F dwarf")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -O3")
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
# =============================================================================
# C WARNINGs
# =============================================================================
# Warning flags.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic-errors")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
# Disable some specific warnings.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-but-set-variable")
# Set the compiler options.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdlib")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-builtin")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-stack-protector")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-pic")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
# =============================================================================
# Add the library.
add_library(
${PROJECT_NAME}
${PROJECT_SOURCE_DIR}/src/stdio.c
${PROJECT_SOURCE_DIR}/src/ctype.c
${PROJECT_SOURCE_DIR}/src/string.c
${PROJECT_SOURCE_DIR}/src/stdlib.c
${PROJECT_SOURCE_DIR}/src/math.c
${PROJECT_SOURCE_DIR}/src/fcvt.c
${PROJECT_SOURCE_DIR}/src/time.c
${PROJECT_SOURCE_DIR}/src/strerror.c
${PROJECT_SOURCE_DIR}/src/termios.c
${PROJECT_SOURCE_DIR}/src/libgen.c
${PROJECT_SOURCE_DIR}/src/vsprintf.c
${PROJECT_SOURCE_DIR}/src/vscanf.c
${PROJECT_SOURCE_DIR}/src/pwd.c
${PROJECT_SOURCE_DIR}/src/grp.c
${PROJECT_SOURCE_DIR}/src/sched.c
${PROJECT_SOURCE_DIR}/src/setenv.c
${PROJECT_SOURCE_DIR}/src/assert.c
${PROJECT_SOURCE_DIR}/src/abort.c
${PROJECT_SOURCE_DIR}/src/io/mm_io.c
${PROJECT_SOURCE_DIR}/src/io/port_io.c
${PROJECT_SOURCE_DIR}/src/ipc/ipc.c
${PROJECT_SOURCE_DIR}/src/sys/unistd.c
${PROJECT_SOURCE_DIR}/src/sys/errno.c
${PROJECT_SOURCE_DIR}/src/sys/utsname.c
${PROJECT_SOURCE_DIR}/src/sys/ioctl.c
${PROJECT_SOURCE_DIR}/src/unistd/creat.c
${PROJECT_SOURCE_DIR}/src/unistd/getppid.c
${PROJECT_SOURCE_DIR}/src/unistd/getpid.c
${PROJECT_SOURCE_DIR}/src/unistd/exit.c
${PROJECT_SOURCE_DIR}/src/unistd/setsid.c
${PROJECT_SOURCE_DIR}/src/unistd/getsid.c
${PROJECT_SOURCE_DIR}/src/unistd/setpgid.c
${PROJECT_SOURCE_DIR}/src/unistd/getpgid.c
${PROJECT_SOURCE_DIR}/src/unistd/setgid.c
${PROJECT_SOURCE_DIR}/src/unistd/getgid.c
${PROJECT_SOURCE_DIR}/src/unistd/setuid.c
${PROJECT_SOURCE_DIR}/src/unistd/getuid.c
${PROJECT_SOURCE_DIR}/src/unistd/fork.c
${PROJECT_SOURCE_DIR}/src/unistd/read.c
${PROJECT_SOURCE_DIR}/src/unistd/write.c
${PROJECT_SOURCE_DIR}/src/unistd/exec.c
${PROJECT_SOURCE_DIR}/src/unistd/nice.c
${PROJECT_SOURCE_DIR}/src/unistd/open.c
${PROJECT_SOURCE_DIR}/src/unistd/reboot.c
${PROJECT_SOURCE_DIR}/src/unistd/waitpid.c
${PROJECT_SOURCE_DIR}/src/unistd/chdir.c
${PROJECT_SOURCE_DIR}/src/unistd/getcwd.c
${PROJECT_SOURCE_DIR}/src/unistd/close.c
${PROJECT_SOURCE_DIR}/src/unistd/stat.c
${PROJECT_SOURCE_DIR}/src/unistd/rmdir.c
${PROJECT_SOURCE_DIR}/src/unistd/mkdir.c
${PROJECT_SOURCE_DIR}/src/unistd/unlink.c
${PROJECT_SOURCE_DIR}/src/unistd/getdents.c
${PROJECT_SOURCE_DIR}/src/unistd/lseek.c
${PROJECT_SOURCE_DIR}/src/unistd/kill.c
${PROJECT_SOURCE_DIR}/src/unistd/signal.c
${PROJECT_SOURCE_DIR}/src/unistd/interval.c
${PROJECT_SOURCE_DIR}/src/libc_start.c
${PROJECT_SOURCE_DIR}/src/debug.c
${PROJECT_SOURCE_DIR}/src/crt0.S
libc
${CMAKE_SOURCE_DIR}/libc/src/unistd/dup.c
${CMAKE_SOURCE_DIR}/libc/src/stdio.c
${CMAKE_SOURCE_DIR}/libc/src/ctype.c
${CMAKE_SOURCE_DIR}/libc/src/string.c
${CMAKE_SOURCE_DIR}/libc/src/stdlib.c
${CMAKE_SOURCE_DIR}/libc/src/math.c
${CMAKE_SOURCE_DIR}/libc/src/fcvt.c
${CMAKE_SOURCE_DIR}/libc/src/time.c
${CMAKE_SOURCE_DIR}/libc/src/strerror.c
${CMAKE_SOURCE_DIR}/libc/src/termios.c
${CMAKE_SOURCE_DIR}/libc/src/libgen.c
${CMAKE_SOURCE_DIR}/libc/src/vsprintf.c
${CMAKE_SOURCE_DIR}/libc/src/vscanf.c
${CMAKE_SOURCE_DIR}/libc/src/pwd.c
${CMAKE_SOURCE_DIR}/libc/src/grp.c
${CMAKE_SOURCE_DIR}/libc/src/sched.c
${CMAKE_SOURCE_DIR}/libc/src/readline.c
${CMAKE_SOURCE_DIR}/libc/src/setenv.c
${CMAKE_SOURCE_DIR}/libc/src/assert.c
${CMAKE_SOURCE_DIR}/libc/src/abort.c
${CMAKE_SOURCE_DIR}/libc/src/io/mm_io.c
${CMAKE_SOURCE_DIR}/libc/src/io/debug.c
${CMAKE_SOURCE_DIR}/libc/src/sys/ipc.c
${CMAKE_SOURCE_DIR}/libc/src/sys/unistd.c
${CMAKE_SOURCE_DIR}/libc/src/sys/errno.c
${CMAKE_SOURCE_DIR}/libc/src/sys/utsname.c
${CMAKE_SOURCE_DIR}/libc/src/sys/mman.c
${CMAKE_SOURCE_DIR}/libc/src/sys/ioctl.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/chmod.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/chown.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/creat.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getppid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getpid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/exit.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setsid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getsid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setpgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getpgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getgid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/setuid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getuid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/fork.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/read.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/write.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/exec.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/nice.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/open.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/reboot.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/waitpid.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/chdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getcwd.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/close.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/stat.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/rmdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/mkdir.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/unlink.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/getdents.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/lseek.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/kill.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/signal.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/interval.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/symlink.c
${CMAKE_SOURCE_DIR}/libc/src/unistd/readlink.c
${CMAKE_SOURCE_DIR}/libc/src/libc_start.c
${CMAKE_SOURCE_DIR}/libc/src/crt0.S
)
# Add the includes.
target_include_directories(${PROJECT_NAME} PUBLIC inc)
target_include_directories(libc PUBLIC inc)
# Remove the 'lib' prefix.
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
set_target_properties(libc PROPERTIES PREFIX "")
+3 -3
View File
@@ -1,6 +1,6 @@
/// @file array.h
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -34,5 +34,5 @@
ARRAY_FREE(arr->buffer); \
}
#undef ARRAY_ALLOC malloc
#undef ARRAY_FREE free
#undef ARRAY_ALLOC
#undef ARRAY_FREE
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file assert.h
/// @brief Defines the function and pre-processor macro for assertions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file ioctls.h
/// @brief Input/Output ConTroL (IOCTL) numbers.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file stat.h
/// @brief Defines the structure used by the functiosn fstat(), lstat(), and stat().
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+2 -2
View File
@@ -1,6 +1,6 @@
/// @file termios-struct.h
/// @brief Definition of the `termios` structure.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -43,4 +43,4 @@ typedef struct termios {
#define IEXTEN 0x00000400 ///< Enables implementation-defined input processing.
/// @brief Mask for extracting control values.
#define CTRL(x) (x & 037)
#define CTRL(x) ((x) & 037)
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file ctype.h
/// @brief Functions related to character handling.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
-44
View File
@@ -1,44 +0,0 @@
/// @file debug.h
/// @brief Debugging primitives.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#ifndef __DEBUG_HEADER__
/// Header for identifying outputs coming from a mechanism.
#define __DEBUG_HEADER__
#endif
/// @brief Extract the filename from the full path provided by __FILE__.
#define __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
/// @brief Prints the given character to debug output.
/// @param c The character to print.
void dbg_putchar(char c);
/// @brief Prints the given string to debug output.
/// @param s The string to print.
void dbg_puts(const char *s);
/// @brief Prints the given string to the debug output.
/// @param file The name of the file.
/// @param fun The name of the function.
/// @param line The line inside the file.
/// @param format The format to used, see printf.
/// @param ... The list of arguments.
void dbg_printf(const char *file, const char *fun, int line, const char *format, ...);
/// @brief Transforms the given amount of bytes to a readable string.
/// @param bytes The bytes to turn to string.
/// @return String representing the bytes in human readable form.
const char *to_human_size(unsigned long bytes);
/// @brief Transforms the given value to a binary string.
/// @param value to print.
/// @param length of the binary output.
/// @return String representing the binary value.
const char *dec_to_binary(unsigned long value, unsigned length);
/// Prints a debugging message.
#define pr_debug(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__ __VA_ARGS__)
+14 -13
View File
@@ -1,10 +1,11 @@
/// @file fcntl.h
/// @brief Headers of functions fcntl() and open().
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#define O_ACCMODE 0003 ///< Bits defining the open mode
#define O_RDONLY 00000000U ///< Open for reading only.
#define O_WRONLY 00000001U ///< Open for writing only.
#define O_RDWR 00000002U ///< Open for reading and writing.
@@ -22,18 +23,18 @@
#define S_ISUID 0x0800 ///< Set user id on execution
#define S_ISGID 0x0400 ///< Set group id on execution
#define S_ISVTX 0x0200 ///< Save swapped text even after use (Sticky Bit)
#define S_IRWXU 0x01C0 ///< rwx------- : User can read/write/execute
#define S_IRUSR 0x0100 ///< -r-------- : User can read
#define S_IWUSR 0x0080 ///< --w------- : User can write
#define S_IXUSR 0x0040 ///< ---x------ : User can execute
#define S_IRWXG 0x0038 ///< ----rwx--- : Group can read/write/execute
#define S_IRGRP 0x0020 ///< ----r----- : Group can read
#define S_IWGRP 0x0010 ///< -----w---- : Group can write
#define S_IXGRP 0x0008 ///< ------x--- : Group can execute
#define S_IRWXO 0x0007 ///< -------rwx : Others can read/write/execute
#define S_IROTH 0x0004 ///< -------r-- : Others can read
#define S_IWOTH 0x0002 ///< --------w- : Others can write
#define S_IXOTH 0x0001 ///< ---------x : Others can execute
#define S_IRWXU 0x01C0 ///< rwx------ : User can read/write/execute
#define S_IRUSR 0x0100 ///< r-------- : User can read
#define S_IWUSR 0x0080 ///< -w------- : User can write
#define S_IXUSR 0x0040 ///< --x------ : User can execute
#define S_IRWXG 0x0038 ///< ---rwx--- : Group can read/write/execute
#define S_IRGRP 0x0020 ///< ---r----- : Group can read
#define S_IWGRP 0x0010 ///< ----w---- : Group can write
#define S_IXGRP 0x0008 ///< -----x--- : Group can execute
#define S_IRWXO 0x0007 ///< ------rwx : Others can read/write/execute
#define S_IROTH 0x0004 ///< ------r-- : Others can read
#define S_IWOTH 0x0002 ///< -------w- : Others can write
#define S_IXOTH 0x0001 ///< --------x : Others can execute
#define S_ISDIR(m) (((m)&0170000) == 0040000) ///< directory.
#define S_ISCHR(m) (((m)&0170000) == 0020000) ///< char special
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file fcvt.h
/// @brief Declare the functions required to turn double values into a string.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file grp.h
/// @brief Defines the structures and functions for managing groups.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -1,6 +1,7 @@
/// @file ansi_colors.h
/// @author Enrico Fraccaroli (enry.frak@gmail.com)
/// @brief Macros for ANSI colors.
/// @brief List of ANSI colors.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+47 -34
View File
@@ -1,16 +1,14 @@
/// @file debug.h
/// @brief Debugging primitives.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/kernel_levels.h"
struct pt_regs;
#ifndef __DEBUG_LEVEL__
/// Defines the debug level.
/// Defines the debug level, by default we set it to notice.
#define __DEBUG_LEVEL__ LOGLEVEL_NOTICE
#endif
@@ -28,7 +26,7 @@ void set_log_level(int level);
/// @brief Returns the current loglevel.
/// @return The current loglevel
int get_log_level();
int get_log_level(void);
/// @brief Prints the given character to debug output.
/// @param c The character to print.
@@ -39,17 +37,14 @@ void dbg_putchar(char c);
void dbg_puts(const char *s);
/// @brief Prints the given string to the debug output.
/// @param file The name of the file.
/// @param fun The name of the function.
/// @param line The line inside the file.
/// @param header The header to print.
/// @param format The format to used, see printf.
/// @param ... The list of arguments.
void dbg_printf(const char *file, const char *fun, int line, char *header, const char *format, ...);
/// @brief Prints the registers on debug output.
/// @param frame Pointer to the register.
void dbg_print_regs(struct pt_regs *frame);
/// @param file the name of the file.
/// @param fun the name of the function.
/// @param line the line inside the file.
/// @param header the header to print.
/// @param log_level the log level.
/// @param format the format to used, see printf.
/// @param ... the list of arguments.
void dbg_printf(const char *file, const char *fun, int line, char *header, short log_level, const char *format, ...);
/// @brief Transforms the given amount of bytes to a readable string.
/// @param bytes The bytes to turn to string.
@@ -62,53 +57,71 @@ const char *to_human_size(unsigned long bytes);
/// @return String representing the binary value.
const char *dec_to_binary(unsigned long value, unsigned length);
/// Prints a KERN_DEFAULT.
#define pr_default(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_DEFAULT __VA_ARGS__)
/// Prints a KERN_EMERG.
/// Prints a default message, which is always shown.
#define pr_default(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEFAULT, __VA_ARGS__)
/// Prints an emergency message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_EMERG
#define pr_emerg(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_EMERG __VA_ARGS__)
#define pr_emerg(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_EMERG, __VA_ARGS__)
#else
#define pr_emerg(...)
#endif
/// Prints a KERN_ALERT.
/// Prints an alert message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_ALERT
#define pr_alert(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_ALERT __VA_ARGS__)
#define pr_alert(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ALERT, __VA_ARGS__)
#else
#define pr_alert(...)
#endif
/// Prints a KERN_CRIT.
/// Prints a critical message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_CRIT
#define pr_crit(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_CRIT __VA_ARGS__)
#define pr_crit(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_CRIT, __VA_ARGS__)
#else
#define pr_crit(...)
#endif
/// Prints a KERN_ERR.
/// Prints an error message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_ERR
#define pr_err(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_ERR __VA_ARGS__)
#define pr_err(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ERR, __VA_ARGS__)
#else
#define pr_err(...)
#endif
/// Prints a KERN_WARNING.
/// Prints a warning message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_WARNING
#define pr_warning(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_WARNING __VA_ARGS__)
#define pr_warning(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_WARNING, __VA_ARGS__)
#else
#define pr_warning(...)
#endif
/// Prints a KERN_NOTICE.
/// Prints a notice message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_NOTICE
#define pr_notice(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_NOTICE __VA_ARGS__)
#define pr_notice(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_NOTICE, __VA_ARGS__)
#else
#define pr_notice(...)
#endif
/// Prints a KERN_INFO.
/// Prints a info message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_INFO
#define pr_info(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_INFO __VA_ARGS__)
#define pr_info(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_INFO, __VA_ARGS__)
#else
#define pr_info(...)
#endif
/// Prints a KERN_DEBUG.
/// Prints a debug message.
#if __DEBUG_LEVEL__ >= LOGLEVEL_DEBUG
#define pr_debug(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, KERN_DEBUG __VA_ARGS__)
#define pr_debug(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEBUG, __VA_ARGS__)
#else
#define pr_debug(...)
#endif
#ifdef __KERNEL__
struct pt_regs;
/// @brief Prints the registers on debug output.
/// @param frame Pointer to the register.
void dbg_print_regs(struct pt_regs *frame);
#endif
+13 -1
View File
@@ -1,6 +1,6 @@
/// @file mm_io.h
/// @brief Memory Mapped IO functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -8,19 +8,31 @@
#include "stdint.h"
/// @brief Reads a 8-bit value from the given address.
/// @param addr the address we want to read from.
/// @return the value we read.
uint8_t in_memb(uint32_t addr);
/// @brief Reads a 16-bit value from the given address.
/// @param addr the address we want to read from.
/// @return the value we read.
uint16_t in_mems(uint32_t addr);
/// @brief Reads a 32-bit value from the given address.
/// @param addr the address we want to read from.
/// @return the value we read.
uint32_t in_meml(uint32_t addr);
/// @brief Writes a 8-bit value at the given address.
/// @param addr the address we want to write to.
/// @param value the value we want to write.
void out_memb(uint32_t addr, uint8_t value);
/// @brief Writes a 16-bit value at the given address.
/// @param addr the address we want to write to.
/// @param value the value we want to write.
void out_mems(uint32_t addr, uint16_t value);
/// @brief Writes a 32-bit value at the given address.
/// @param addr the address we want to write to.
/// @param value the value we want to write.
void out_meml(uint32_t addr, uint32_t value);
+136 -28
View File
@@ -1,42 +1,150 @@
/// @file port_io.h
/// @brief Byte I/O on ports prototypes.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "stdint.h"
/// @brief Reads a 8-bit value from the given port.
/// @param port the port we want to read from.
/// @return the value we read.
static inline unsigned char inportb(unsigned short port)
{
unsigned char result;
__asm__ __volatile__("inb %%dx, %%al"
: "=a"(result)
: "dN"(port)
: "memory");
return result;
}
/// @brief Used for reading from the I/O ports.
/// @param port The input port.
/// @return The read value.
uint8_t inportb(uint16_t port);
/// @brief Reads a 16-bit value from the given port.
/// @param port the port we want to read from.
/// @return the value we read.
static inline unsigned short inports(unsigned short port)
{
unsigned short result;
__asm__ __volatile__("inw %1, %0"
: "=a"(result)
: "dN"(port)
: "memory");
return result;
}
/// @brief Used for reading 2 bytes from the I/O ports.
/// @param port The input port.
/// @return The read value.
uint16_t inports(uint16_t port);
/// @brief Reads a 32-bit value from the given port.
/// @param port the port we want to read from.
/// @return the value we read.
static inline unsigned int inportl(unsigned short port)
{
unsigned int result;
__asm__ __volatile__("inl %%dx, %%eax"
: "=a"(result)
: "dN"(port)
: "memory");
return result;
}
void inportsm(uint16_t port, uint8_t *data, unsigned long size);
/// @brief Writes a 8-bit value at the given port.
/// @param port the port we want to write to.
/// @param value the value we want to write.
static inline void outportb(unsigned short port, unsigned char value)
{
__asm__ __volatile__("outb %%al, %%dx"
:
: "a"(value), "dN"(port)
: "memory");
}
/// @brief Used for reading 4 bytes from the I/O ports.
/// @param port The input port.
/// @return The read value.
uint32_t inportl(uint16_t port);
/// @brief Writes a 16-bit value at the given port.
/// @param port the port we want to write to.
/// @param value the value we want to write.
static inline void outports(unsigned short port, unsigned short value)
{
__asm__ __volatile__("outw %1, %0"
:
: "dN"(port), "a"(value)
: "memory");
}
/// @brief Use this to write to I/O ports to send bytes to devices.
/// @param port The output port.
/// @param data The data to write.
void outportb(uint16_t port, uint8_t data);
/// @brief Writes a 32-bit value at the given port.
/// @param port the port we want to write to.
/// @param value the value we want to write.
static inline void outportl(unsigned short port, unsigned int value)
{
__asm__ __volatile__("outl %%eax, %%dx"
:
: "dN"(port), "a"(value)
: "memory");
}
/// @brief Use this to write to I/O ports to send 2 bytes to devices.
/// @param port The output port.
/// @param data The data to write.
void outports(uint16_t port, uint16_t data);
/// @brief Reads multiple 8-bit values from the given port.
/// @param port the port we want to read from.
/// @param addr the location where we store the values we read.
/// @param count the number of values we want to read.
static inline void inportsb(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; insb "
: "=D"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
void outportsm(uint16_t port, uint8_t *data, uint16_t size);
/// @brief Reads multiple 16-bit values from the given port.
/// @param port the port we want to read from.
/// @param addr the location where we store the values we read.
/// @param count the number of values we want to read.
static inline void inportsw(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; insw "
: "=D"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
/// @brief Use this to write to I/O ports to send 4 bytes to devices.
/// @param port The output port.
/// @param data The data to write.
void outportl(uint16_t port, uint32_t data);
/// @brief Reads multiple 32-bit values from the given port.
/// @param port the port we want to read from.
/// @param addr the location where we store the values we read.
/// @param count the number of values we want to read.
static inline void inportsl(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; insl "
: "=D"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
/// @brief Writes multiple 8-bit values to the given port.
/// @param port the port we want to write to.
/// @param addr the location where we get the values we need to write.
/// @param count the number of values we want to write.
static inline void outportsb(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; outsb "
: "=S"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
/// @brief Writes multiple 16-bit values to the given port.
/// @param port the port we want to write to.
/// @param addr the location where we get the values we need to write.
/// @param count the number of values we want to write.
static inline void outportsw(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; outsw "
: "=S"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
/// @brief Writes multiple 32-bit values to the given port.
/// @param port the port we want to write to.
/// @param addr the location where we get the values we need to write.
/// @param count the number of values we want to write.
static inline void outportsl(unsigned short port, void *addr, unsigned long count)
{
__asm__ __volatile__(
"cld ; rep ; outsl "
: "=S"(addr), "=c"(count)
: "d"(port), "0"(addr), "1"(count));
}
-24
View File
@@ -1,24 +0,0 @@
/// @file ipc.h
/// @brief Inter-Process Communication (IPC) structures.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
/// @brief Permission details of an IPC object.
struct ipc_perm {
/// Key supplied to msgget(2).
key_t __key;
/// Effective UID of owner.
uid_t uid;
/// Effective GID of owner.
gid_t gid;
/// Effective UID of creator.
uid_t cuid;
/// Effective GID of creator.
gid_t cgid;
/// Permissions.
unsigned short mode;
/// Sequence number.
unsigned short __seq;
};
+20 -31
View File
@@ -1,40 +1,29 @@
/// @file libgen.h
/// @brief String routines.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "stddef.h"
// TODO: doxygen comment.
/// @brief
/// @param out
/// @param cur
/// @param sep
/// @param max
/// @result
int parse_path(char *out, char **cur, char sep, size_t max);
/// @brief Extracts the parent directory of the given path and saves it inside
/// the given buffer, e.g., from "/home/user/test.txt" it extracts "/home/user".
/// If the path does not contain a '/', it will return ".".
/// @param path the path we are parsing.
/// @param buffer the buffer where we save the directory name.
/// @param buflen the length of the buffer.
/// @return 1 if succesfull, or 0 if the buffer cannot contain the path.
int dirname(const char *path, char *buffer, size_t buflen);
// TODO: doxygen comment.
/// @brief
/// @param path
/// @result
char *dirname(const char *path);
// TODO: doxygen comment.
/// @brief
/// @param path
/// @result
char *basename(const char *path);
/// @brief Extract the component after the final '/'.
/// @param path the path from which we extract the final component.
/// @return a pointer after the final '/', or path itself it none was found.
const char *basename(const char *path);
/// @brief Return the canonicalized absolute pathname.
/// @param path The path we are canonicalizing.
/// @param resolved The canonicalized path.
/// @return
/// If there is no error, realpath() returns a pointer to the resolved.
/// Otherwise, it returns NULL, the contents of the array resolved
/// are undefined, and errno is set to indicate the error.
/// @details
/// If resolved is NULL, then realpath() uses malloc
/// to allocate a buffer of up to PATH_MAX bytes to hold the
/// resolved pathname, and returns a pointer to this buffer.
char *realpath(const char *path, char *resolved);
/// @param path the path we are canonicalizing.
/// @param buffer where we will store the canonicalized path.
/// @param buflen the size of the buffer.
/// @return If there is no error, realpath() returns a pointer to the buffer.
/// Otherwise, it returns NULL, the contents of the array buffer are undefined,
/// and errno is set to indicate the error.
char *realpath(const char *path, char *buffer, size_t buflen);
+4 -1
View File
@@ -1,6 +1,6 @@
/// @file limits.h
/// @brief OS numeric limits.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -53,5 +53,8 @@
/// Maximum number of characters in a path name.
#define PATH_MAX 4096
/// Maximum length of arguments provided to exec function.
#define ARG_MAX 256
/// Maximum pid number.
#define PID_MAX_LIMIT 32768
+4 -1
View File
@@ -1,6 +1,6 @@
/// @file math.h
/// @brief Mathematical constants and functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -17,6 +17,9 @@
/// @brief The sign the the passed value.
#define sign(x) ((x < 0) ? -1 : ((x > 0) ? 1 : 0))
/// @brief Returns a rounded up, away from zero, to the nearest multiple of b.
#define round_up(number, base) (((number) + (base)-1) & ~((base)-1))
/// @brief e
#define M_E 2.7182818284590452354
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file pwd.h
/// @brief Contains the structure and functions for managing passwords.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+14
View File
@@ -0,0 +1,14 @@
/// @file readline.h
/// @brief
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "stddef.h"
/// @brief Reads a line from the file.
/// @param fd the file descriptor.
/// @param buffer the buffer where we place the line.
/// @param buflen the length of the buffer.
/// @param readlen the amount we read, if negative, we did not encounter a newline.
/// @return 0 if we are done reading, 1 if we encountered a newline, -1 if otherwise.
int readline(int fd, char *buffer, size_t buflen, ssize_t *read_len);
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file ring_buffer.h
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+2 -2
View File
@@ -1,6 +1,6 @@
/// @file sched.h
/// @brief Structures and functions for managing the scheduler.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "sys/types.h"
@@ -40,4 +40,4 @@ int sched_getparam(pid_t pid, sched_param_t *param);
/// @brief Placed at the end of an infinite while loop, stops the process until,
/// its next period starts. The calling process must be a periodic one.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
int waitperiod();
int waitperiod(void);
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file signal.h
/// @brief Signals definition.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file stdarg.h
/// @brief Contains the macros required to manage variable number of arguments.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file stdbool.h
/// @brief Defines the boolean values.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+20 -3
View File
@@ -1,6 +1,6 @@
/// @file stddef.h
/// @brief Define basic data types.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -37,10 +37,10 @@ typedef unsigned int ino_t;
typedef unsigned int dev_t;
/// The type of user-id.
typedef unsigned int uid_t;
typedef int uid_t;
/// The type of group-id.
typedef unsigned int gid_t;
typedef int gid_t;
/// The type of offset.
typedef long int off_t;
@@ -68,3 +68,20 @@ typedef unsigned int pgprot_t;
/// Returns the alignment, in bytes, of the specified type.
#define alignof(type) offsetof( \
struct { char c; type member; }, member)
/// Counts the number of elements of an array.
#define count_of(x) ((sizeof(x) / sizeof((x)[0])) / ((size_t)(!(sizeof(x) % sizeof((x)[0])))))
/// @brief Swaps two values.
/// @details
/// do { ... } while (0) allows to place multistatement operations, for
/// instance, inside the following if stantement:
/// if (condition)
/// swap(var1, var2)
/// which otherwise would be wrong.
#define swap(a, b) \
do { \
typeof(a) temp = (a); \
(a) = (b); \
(b) = temp; \
} while (0)
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file stdint.h
/// @brief Standard integer data-types.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+7 -3
View File
@@ -1,6 +1,6 @@
/// @file stdio.h
/// @brief Standard I/0 functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -30,11 +30,11 @@ void putchar(int character);
/// @brief Writes the string pointed by str to the standard output (stdout)
/// and appends a newline character.
/// @param str The string to send to stdout.
void puts(char *str);
void puts(const char *str);
/// @brief Returns the next character from the standard input (stdin).
/// @return The character received from stdin.
int getchar();
int getchar(void);
/// @brief Reads characters from the standard input (stdin).
/// @param str Where the characters are stored.
@@ -124,3 +124,7 @@ int sscanf(const char *str, const char *fmt, ...);
/// argument list successfully filled. EOF otherwise.
int fscanf(int fd, const char *fmt, ...);
#endif
/// @brief Prints a system error message.
/// @param s the message we prepend to the actual error message.
void perror(const char *s);
+42 -13
View File
@@ -1,12 +1,17 @@
/// @file stdlib.h
/// @brief Useful generic functions and macros.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#ifndef __KERNEL__
#include "stddef.h"
#define EXIT_SUCCESS 0 ///< Successful execution of a program.
#define EXIT_FAILURE 1 ///< Unsuccessful execution of a program.
/// @brief Returns the number of usable bytes in the block pointed to by ptr.
/// @param ptr The pointer for which we want to retrieve the usable size.
/// @return The number of usable bytes in the block of allocated memory
@@ -38,19 +43,8 @@ void *realloc(void *ptr, size_t size);
/// @param ptr The pointer to the allocated memory.
void free(void *ptr);
/// The maximum value returned by the rand function.
#define RAND_MAX ((1U << 31U) - 1U)
/// @brief Allows to set the seed of the random value generator.
/// @param x The new seed.
void srand(int x);
/// @brief Generates a random value.
/// @return The random value.
int rand();
/// @brief Cause an abnormal program termination with core-dump.
void abort();
void abort(void);
/// @brief Tries to adds the variable to the environment.
/// @param name Name of the variable.
@@ -68,3 +62,38 @@ int unsetenv(const char *name);
/// @param name Name of the variable.
/// @return A pointer to the value, or NULL if there is no match.
char *getenv(const char *name);
#endif
/// The maximum value returned by the rand function.
#define RAND_MAX ((1U << 31U) - 1U)
/// @brief Allows to set the seed of the random value generator.
/// @param x The new seed.
void srand(unsigned x);
/// @brief Generates a random unsigned integer between 0 and RAND_MAX.
/// @return the random value.
unsigned rand(void);
/// @brief Generates a random floating point number between 0 and 1.
/// @return the random value.
float randf(void);
/// @brief Generates a random integer between lb and ub.
/// @param lb the lower-bound value.
/// @param ub the upper-bound value.
/// @return the random value.
int randint(int lb, int ub);
/// @brief Generates a random unsigned between lb and ub.
/// @param lb the lower-bound value.
/// @param ub the upper-bound value.
/// @return the random value.
unsigned randuint(unsigned lb, unsigned ub);
/// @brief Generates a random float between lb and ub.
/// @param lb the lower-bound value.
/// @param ub the upper-bound value.
/// @return the random value.
float randfloat(float lb, float ub);
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file strerror.h
/// @brief Contains the function that transfornms an errno into a string.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+11 -1
View File
@@ -1,6 +1,6 @@
/// @file string.h
/// @brief String routines.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -170,6 +170,16 @@ char *strtok(char *str, const char *delim);
/// should be NULL, and saveptr should be unchanged since the previous call.
char *strtok_r(char *str, const char *delim, char **saveptr);
/// @brief Parses the string using the separator, and at each call it saves the
/// parsed token in buffer. The pointer `string` will be modified.
/// @param string cursor used to parse the string, it will be modified.
/// @param separators the list of separators we are using.
/// @param offset the offset character from which we start extracting the next token.
/// @param buffer the buffer where we save the parsed token.
/// @param buflen the length of the buffer.
/// @return 1 if we still have things to parse, 0 if we finished parsing.
int tokenize(const char *string, char *separators, size_t *offset, char *buffer, ssize_t buflen);
/// @brief Copies the values of num bytes from the location pointed by source
/// to the memory block pointed by destination.
/// @param dst Pointer to the destination array where the content is to be
+30 -19
View File
@@ -1,40 +1,51 @@
/// @file bitops.h
/// @brief Bitmasks functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#define bit_set(V, B) ((V) | (1U << (B))) ///< Sets the given bit.
#define bit_clear(V, B) ((V) & ~(1U << (B))) ///< Clears the given bit.
#define bit_flip(V, B) ((V) ^ (1U << (B))) ///< Flips the given bit.
#define bit_set_assign(V, B) ((V) |= (1U << (B))) ///< Sets the given bit, permanently.
#define bit_clear_assign(V, B) ((V) &= ~(1U << (B))) ///< Clears the given bit, permanently.
#define bit_flip_assign(V, B) ((V) ^= (1U << (B))) ///< Flips the given bit, permanently.
#define bit_check(V, B) ((V) & (1U << (B))) ///< Checks if the given bit is 1.
#define bit_set(V, B) ((V) | (1U << (B))) ///< Sets the given bit.
#define bit_clear(V, B) ((V) & ~(1U << (B))) ///< Clears the given bit.
#define bit_flip(V, B) ((V) ^ (1U << (B))) ///< Flips the given bit.
#define bit_check(V, B) ((V) & (1U << (B))) ///< Checks if the given bit is 1.
#define bit_toggle(V, B, C) ((C) ? bit_set(V, B) : bit_clear(V, B)) ///< Sets the given bit based on control bit C.
#define bit_set_assign(V, B) ((V) |= (1U << (B))) ///< Sets the given bit, permanently.
#define bit_clear_assign(V, B) ((V) &= ~(1U << (B))) ///< Clears the given bit, permanently.
#define bit_flip_assign(V, B) ((V) ^= (1U << (B))) ///< Flips the given bit, permanently.
#define bit_toggle_assign(V, B, C) ((C) ? bit_set_assign(V, B) : bit_clear_assign(V, B)) ///< Sets the given bit based on control bit C.
#define bitmask_set(V, M) ((V) | (M)) ///< Sets the bits identified by the mask.
#define bitmask_clear(V, M) ((V) & ~(M)) ///< Clears the bits identified by the mask.
#define bitmask_flip(V, M) ((V) ^ (M)) ///< Flips the bits identified by the mask.
#define bitmask_set_assign(V, M) ((V) |= (M)) ///< Sets the bits identified by the mask, permanently.
#define bitmask_clear_assign(V, M) ((V) &= ~(M)) ///< Clears the bits identified by the mask, permanently.
#define bitmask_flip_assign(V, M) ((V) ^= (M)) ///< Flips the bits identified by the mask, permanently.
#define bitmask_check(V, M) ((V) & (M)) ///< Checks if the bits identified by the mask are all 1.
#define bitmask_set(V, M) ((V) | (M)) ///< Sets the bits identified by the mask.
#define bitmask_clear(V, M) ((V) & ~(M)) ///< Clears the bits identified by the mask.
#define bitmask_flip(V, M) ((V) ^ (M)) ///< Flips the bits identified by the mask.
#define bitmask_check(V, M) ((V) & (M)) ///< Checks if the bits identified by the mask are all 1.
#define bitmask_exact(V, M) (((V) & (M)) == (M)) ///< Checks if all the bits identified by the mask are all 1.
#define bitmask_set_assign(V, M) ((V) |= (M)) ///< Sets the bits identified by the mask, permanently.
#define bitmask_clear_assign(V, M) ((V) &= ~(M)) ///< Clears the bits identified by the mask, permanently.
#define bitmask_flip_assign(V, M) ((V) ^= (M)) ///< Flips the bits identified by the mask, permanently.
/// @brief Finds the first bit at zero, starting from the less significative bit.
/// @param value the value we need to analyze.
/// @return the position of the first zero bit.
static inline int find_first_zero(unsigned long value)
{
for (int i = 0; i < 32; ++i)
if (!bit_check(value, i))
for (int i = 0; i < 32; ++i) {
if (!bit_check(value, i)) {
return i;
}
}
return 0;
}
/// @brief Finds the first bit not zero, starting from the less significative bit.
/// @param value the value we need to analyze.
/// @return the position of the first non-zero bit.
static inline int find_first_non_zero(unsigned long value)
{
for (int i = 0; i < 32; ++i)
if (bit_check(value, i))
for (int i = 0; i < 32; ++i) {
if (bit_check(value, i)) {
return i;
}
}
return 0;
}
+10 -9
View File
@@ -1,6 +1,6 @@
/// @file dirent.h
/// @brief Functions used to manage directories.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -21,22 +21,23 @@ enum {
DT_WHT = 14
};
/// @brief Characters describing the direactory entry.
static const char dt_char_array[] = {
'?', // DT_UNKNOWN = 0,
'p', //DT_FIFO = 1,
'c', //DT_CHR = 2,
'p', // DT_FIFO = 1,
'c', // DT_CHR = 2,
'*',
'd', //DT_DIR = 4,
'd', // DT_DIR = 4,
'*',
'b', //DT_BLK = 6,
'b', // DT_BLK = 6,
'*',
'-', //DT_REG = 8,
'-', // DT_REG = 8,
'*',
'l', //DT_LNK = 10,
'l', // DT_LNK = 10,
'*',
's', //DT_SOCK = 12,
's', // DT_SOCK = 12,
'*',
'?', //DT_WHT = 14
'?', // DT_WHT = 14
};
/// Directory entry.
+3 -3
View File
@@ -1,11 +1,11 @@
/// @file errno.h
/// @brief System call errors definition.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
extern int *__geterrno();
extern int *__geterrno(void);
/// Provide easy access to the error number.
#define errno (*__geterrno())
@@ -20,7 +20,7 @@ extern int *__geterrno();
#define ENOEXEC 8 ///< Exec format error.
#define EBADF 9 ///< Bad file number.
#define ECHILD 10 ///< No child processes.
#define EAGAIN 11 ///< Try again.
#define EAGAIN 11 ///< Resource temporarily unavailable.
#define ENOMEM 12 ///< Out of memory.
#define EACCES 13 ///< Permission denied.
#define EFAULT 14 ///< Bad address.
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file ioctl.h
/// @brief Input/Output ConTroL (IOCTL) functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+43
View File
@@ -0,0 +1,43 @@
/// @file ipc.h
/// @brief Inter-Process Communication (IPC) structures.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/types.h"
#include "stddef.h"
#define IPC_CREAT 01000 ///< Create key if key does not exist.
#define IPC_EXCL 02000 ///< Fail if key exists.
#define IPC_NOWAIT 04000 ///< Return error on wait.
#define IPC_RMID 0 ///< Remove identifier.
#define IPC_SET 1 ///< Set `ipc_perm' options.
#define IPC_STAT 2 ///< Get `ipc_perm' options.
#define IPC_INFO 3 ///< See ipcs.
#define IPC_PRIVATE ((key_t)0) ///< assures getting a new ipc_key.
/// @brief Permission details of an IPC object.
struct ipc_perm {
/// Key associated to the IPC.
key_t key;
/// Effective UID of owner.
uid_t uid;
/// Effective GID of owner.
gid_t gid;
/// Effective UID of creator.
uid_t cuid;
/// Effective GID of creator.
gid_t cgid;
/// Permissions.
unsigned short mode;
/// Sequence number.
unsigned short __seq;
};
/// @brief Returns a possible IPC key based upon the filepath and the id.
/// @param path The file path.
/// @param id the project id.
/// @return the IPC key.
key_t ftok(char *path, int id);
+17
View File
@@ -0,0 +1,17 @@
/// @file kernel_levels.h
/// @brief
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
// Integer equivalents of KERN_<LEVEL>
#define LOGLEVEL_DEFAULT (-1) ///< default-level messages.
#define LOGLEVEL_EMERG 0 ///< system is unusable.
#define LOGLEVEL_ALERT 1 ///< action must be taken immediately.
#define LOGLEVEL_CRIT 2 ///< critical conditions.
#define LOGLEVEL_ERR 3 ///< error conditions.
#define LOGLEVEL_WARNING 4 ///< warning conditions.
#define LOGLEVEL_NOTICE 5 ///< normal but significant condition.
#define LOGLEVEL_INFO 6 ///< informational.
#define LOGLEVEL_DEBUG 7 ///< debug-level messages.
@@ -1,6 +1,6 @@
/// @file list_head.h
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -22,31 +22,37 @@ typedef struct list_head {
#define list_entry(ptr, type, member) container_of(ptr, type, member)
/// @brief Iterates over a list.
/// @param pos The &list_head to use as a loop cursor.
/// @param head The head for your list.
/// @param pos the name of the iterator used to visit the list.
/// @param head the head for your list.
#define list_for_each(pos, head) \
for ((pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)
/// @brief Iterates over a list backwards.
/// @param pos The &list_head to use as a loop cursor.
/// @param head The head for your list.
#define list_for_each_prev(pos, head) \
for ((pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev)
/// @brief Iterates over a list safe against removal of list entry.
/// @param pos The &list_head to use as a loop cursor.
/// @param store Another &list_head to use as temporary storage.
/// @param head The head for your list.
/// @param pos the name of the iterator used to visit the list.
/// @param store another list iterator to use as temporary storage.
/// @param head the head for your list.
#define list_for_each_safe(pos, store, head) \
for ((pos) = (head)->next, (store) = (pos)->next; (pos) != (head); \
(pos) = (store), (store) = (pos)->next)
/// @brief Iterates over a list.
/// @param pos The &list_head to use as a loop cursor.
/// @param head The head for your list.
/// @brief Iterates over a list, but declares the iterator.
/// @param pos the name of the iterator used to visit the list.
/// @param head the head for your list.
#define list_for_each_decl(pos, head) \
for (list_head * (pos) = (head)->next; (pos) != (head); (pos) = (pos)->next)
/// @brief Iterates over a list backwards.
/// @param pos the name of the iterator used to visit the list.
/// @param head the head for your list.
#define list_for_each_prev(pos, head) \
for ((pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev)
/// @brief Iterates over a list backwards, but declares the iterator.
/// @param pos the name of the iterator used to visit the list.
/// @param head the head for your list.
#define list_for_each_prev_decl(pos, head) \
for (list_head * (pos) = (head)->prev; (pos) != (head); (pos) = (pos)->prev)
/// @brief Initializes the list_head.
/// @param head The head of your list.
static inline void list_head_init(list_head *head)
@@ -62,13 +68,15 @@ static inline int list_head_empty(const list_head *head)
return head->next == head;
}
/// @brief Initializes the list_head.
/// @param head The head for your list.
/// @brief Computes the size of the list.
/// @param head The head of the list.
/// @return the size of the list.
static inline unsigned list_head_size(const list_head *head)
{
unsigned size = 0;
if (!list_head_empty(head))
if (!list_head_empty(head)) {
list_for_each_decl(it, head) size += 1;
}
return size;
}
@@ -160,3 +168,32 @@ static inline void list_head_append(list_head *main, list_head *secondary)
list_head_init(secondary);
}
}
/// @brief Replaces entry1 with entry2, entry1 will be removed from the list.
/// @param entry1 the first entry to remove.
/// @param entry2 the second entry which will take the place of the first entry.
static inline void list_head_replace(list_head *entry1, list_head *entry2)
{
// First we need to remove the second entry.
list_head_remove(entry2);
// Then, we can place second entry where the first entry is.
entry2->next = entry1->next;
entry2->next->prev = entry2;
entry2->prev = entry1->prev;
entry2->prev->next = entry2;
// Re-initialize the first entry.
list_head_init(entry1);
}
/// @brief Swaps entry1 and entry2 inside the list.
/// @param entry1 the first entry.
/// @param entry2 the second entry.
static inline void list_head_swap(list_head *entry1, list_head *entry2)
{
list_head *pos = entry2->prev;
list_head_replace(entry1, entry2);
if (pos == entry1) {
pos = entry2;
}
list_head_insert_after(entry1, pos);
}
+47
View File
@@ -0,0 +1,47 @@
/// @file list_head_algorithm.h
/// @author Enrico Fraccaroli (enry.frak@gmail.com)
/// @brief Some general algorithm that might come in handy while using list_head.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "list_head.h"
/// @brief list_head comparison function.
typedef int (*list_head_compare)(const list_head *, const list_head *);
/// @brief -
/// @param list
/// @param compare
static inline void list_head_sort(list_head *list, list_head_compare compare)
{
list_head *current = NULL, *index = NULL, *next = NULL;
// Check whether list is empty
if (!list_head_empty(list)) {
// Keeps track if we need to restart the outer loop.
int restart = 0;
// Current will point to head
for (current = list->next; current->next != list;) {
// Save pointer to next.
next = current->next;
// Reset restart flag.
restart = 0;
// Index will point to node next to current
for (index = current->next; index != list; index = index->next) {
// If current's data is greater than index's data, swap the data of
// current and index
if (compare(current, index)) {
list_head_swap(index, current);
restart = 1;
}
}
// Check if we need to restart.
if (restart) {
current = list->next;
} else {
current = next;
}
}
}
}
+30
View File
@@ -0,0 +1,30 @@
/// @file mman.h
/// @author Enrico Fraccaroli (enry.frak@gmail.com)
/// @brief Functions for managing mappings in virtual address space.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "stddef.h"
#define PROT_READ 0x1 ///< Page can be read.
#define PROT_WRITE 0x2 ///< Page can be written.
#define PROT_EXEC 0x4 ///< Page can be executed.
#define MAP_SHARED 0x01 ///< The memory is shared.
#define MAP_PRIVATE 0x02 ///< The memory is private.
#ifndef __KERNEL__
void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
int munmap(void *addr, size_t length);
#else
void *sys_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
int sys_munmap(void *addr, size_t length);
#endif
+47 -24
View File
@@ -1,31 +1,48 @@
/// @file msg.h
/// @brief Definition of structure for managing message queues.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/types.h"
#include "sys/ipc.h"
#include "stddef.h"
#include "sys/types.h"
#include "time.h"
#include "ipc.h"
/// Type for storing the number of messages in a message queue.
typedef unsigned int msgqnum_t;
/// The maximum size for a message text.
#define MSGMAX 8192
/// The default maximum size in bytes of a message queue.
#define MSGMNB 16384
/// Type for storing the number of bytes in a message queue.
typedef unsigned int msglen_t;
/// Specify that we should not treat as an error if the message we are trying to
/// return to the user, is too big. That message will be truncated to fit the
/// user-defined reading buffer. If not specified, the message is kept in the
/// queue, and an error is returned.
#define MSG_NOERROR 010000
/// @brief Buffer to use with the message queue IPC.
typedef struct msgbuf {
struct msgbuf {
/// Type of the message.
long mtype;
/// Text of the message.
char mtext[1];
} msgbuf_t;
};
/// Keeps track of a stored message.
struct msg {
/// Pointer to the next message on queue.
struct msg *msg_next;
/// The type of message.
long msg_type;
/// Pointer to the beginning of the message.
char *msg_ptr;
/// The length of the message.
size_t msg_size;
};
/// @brief Message queue data structure.
typedef struct msqid_ds {
struct msqid_ds {
/// Ownership and permissions.
struct ipc_perm msg_perm;
/// Time of last msgsnd(2).
@@ -35,26 +52,30 @@ typedef struct msqid_ds {
/// Time of creation or last modification by msgctl().
time_t msg_ctime;
/// Number of bytes in queue.
unsigned long msg_cbytes;
unsigned short msg_cbytes;
/// Number of messages in queue.
msgqnum_t msg_qnum;
unsigned short msg_qnum;
/// Maximum number of bytes in queue.
msglen_t msg_qbytes;
unsigned short msg_qbytes;
/// PID of last msgsnd(2).
pid_t msg_lspid;
/// PID of last msgrcv(2).
pid_t msg_lrpid;
} msqid_ds_t;
};
#ifdef __KERNEL__
/// @brief Initializes the message queue system.
/// @return 0 on success, 1 on failure.
int msq_init(void);
/// @brief Get a System V message queue identifier.
/// @param key can be used either to obtain the identifier of a previously
/// created message queue, or to create a new set.
/// @param msgflg controls the behaviour of the function.
/// @return the message queue identifier, -1 on failure, and errno is set to
/// indicate the error.
long sys_msgget(key_t key, int msgflg);
int sys_msgget(key_t key, int msgflg);
/// @brief Used to send messages.
/// @param msqid the message queue identifier.
@@ -62,7 +83,7 @@ long sys_msgget(key_t key, int msgflg);
/// @param msgsz specifies the size in bytes of mtext.
/// @param msgflg specifies the action to be taken in case of specific events.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long sys_msgsnd(int msqid, msgbuf_t *msgp, size_t msgsz, int msgflg);
int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
/// @brief Used to receive messages.
/// @param msqid the message queue identifier.
@@ -74,15 +95,16 @@ long sys_msgsnd(int msqid, msgbuf_t *msgp, size_t msgsz, int msgflg);
/// - msgtyp < 0: the first message of the lowest type that is less than or
/// equal to the absolute value of msgtyp is received.
/// @param msgflg specifies the action to be taken in case of specific events.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long sys_msgrcv(int msqid, msgbuf_t *msgp, size_t msgsz, long msgtyp, int msgflg);
/// @return the number of bytes actually copied on success, -1 on failure and
/// errno is set to indicate the error.
ssize_t sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
/// @brief Message queue control operations.
/// @param msqid the message queue identifier.
/// @param cmd The command to perform.
/// @param buf used with IPC_STAT and IPC_SET.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long sys_msgctl(int msqid, int cmd, msqid_ds_t *buf);
int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf);
#else
@@ -92,7 +114,7 @@ long sys_msgctl(int msqid, int cmd, msqid_ds_t *buf);
/// @param msgflg controls the behaviour of the function.
/// @return the message queue identifier, -1 on failure, and errno is set to
/// indicate the error.
long msgget(key_t key, int msgflg);
int msgget(key_t key, int msgflg);
/// @brief Used to send messages.
/// @param msqid the message queue identifier.
@@ -100,7 +122,7 @@ long msgget(key_t key, int msgflg);
/// @param msgsz specifies the size in bytes of mtext.
/// @param msgflg specifies the action to be taken in case of specific events.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long msgsnd(int msqid, msgbuf_t *msgp, size_t msgsz, int msgflg);
int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);
/// @brief Used to receive messages.
/// @param msqid the message queue identifier.
@@ -112,14 +134,15 @@ long msgsnd(int msqid, msgbuf_t *msgp, size_t msgsz, int msgflg);
/// - msgtyp < 0: the first message of the lowest type that is less than or
/// equal to the absolute value of msgtyp is received.
/// @param msgflg specifies the action to be taken in case of specific events.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long msgrcv(int msqid, msgbuf_t *msgp, size_t msgsz, long msgtyp, int msgflg);
/// @return the number of bytes actually copied on success, -1 on failure and
/// errno is set to indicate the error.
ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);
/// @brief Message queue control operations.
/// @param msqid the message queue identifier.
/// @param cmd The command to perform.
/// @param buf used with IPC_STAT and IPC_SET.
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long msgctl(int msqid, int cmd, msqid_ds_t *buf);
int msgctl(int msqid, int cmd, struct msqid_ds *buf);
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file reboot.h
/// @brief Defines the values required to issue a reboot.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+67 -7
View File
@@ -1,27 +1,87 @@
/// @file sem.h
/// @brief Definition of structure for managing semaphores.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/types.h"
#include "stddef.h"
#include "sys/ipc.h"
#include "time.h"
#include "ipc.h"
#define SEM_UNDO 0x1000 ///< Undo the operation on exit.
/// @defgroup SemaphoreCommands semctl commands
/// @brief List of commands for semctl function.
/// @{
#define GETPID 11 ///< Get sempid.
#define GETVAL 12 ///< Get semval.
#define GETALL 13 ///< Get all semval's.
#define GETNCNT 14 ///< Get semncnt.
#define GETZCNT 15 ///< Get semzcnt.
#define SETVAL 16 ///< Set semval.
#define SETALL 17 ///< Set all semval's.
#define SEM_STAT 18 ///< Return a semid_ds structure.
#define SEM_INFO 19 ///< Return a seminfo structure.
/// }@
#define SEM_SET_MAX 256
/// @brief Optional argument for semctl() function
union semun {
/// @brief Value for SETVAL.
int val;
/// @brief Buffer for IPC_STAT & IPC_SET.
struct semid_ds *buf;
/// @brief Array for GETALL & SETALL.
unsigned short *array;
/// @brief Buffer for IPC_INFO.
struct seminfo *__buf;
};
/// @brief Single Semaphore.
struct sem {
/// @brief Process ID of the last operation.
pid_t sem_pid;
/// @brief Semaphore Value.
unsigned short sem_val;
/// @brief Number of processes waiting for the semaphore.
unsigned short sem_ncnt;
/// @brief Number of processes waiting for the value to become 0.
unsigned short sem_zcnt;
};
/// @brief Semaphore set
struct semid_ds {
/// @brief Ownership and permissions.
struct ipc_perm sem_perm;
/// @brief Last semop time.
time_t sem_otime;
/// @brief Last change time.
time_t sem_ctime;
/// @brief Number of semaphores in set.
unsigned short sem_nsems;
};
/// @brief Buffer to use with the semaphore IPC.
struct sembuf {
/// Semaphore index in array.
/// @brief Semaphore index in array.
unsigned short sem_num;
/// Semaphore operation.
/// @brief Semaphore operation.
short sem_op;
/// Operation flags.
/// @brief Operation flags.
short sem_flg;
};
#ifdef __KERNEL__
/// @brief Initializes the semaphore system.
/// @return 0 on success, 1 on failure.
int sem_init(void);
/// @brief Get a System V semaphore set identifier.
/// @param key can be used either to obtain the identifier of a previously
/// created semaphore set, or to create a new set.
@@ -44,7 +104,7 @@ long sys_semop(int semid, struct sembuf *sops, unsigned nsops);
/// @param cmd the command to perform.
/// @param arg
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);
long sys_semctl(int semid, int semnum, int cmd, union semun *arg);
#else
@@ -70,6 +130,6 @@ long semop(int semid, struct sembuf *sops, unsigned nsops);
/// @param cmd the command to perform.
/// @param arg
/// @return 0 on success, -1 on failure and errno is set to indicate the error.
long semctl(int semid, int semnum, int cmd, unsigned long arg);
long semctl(int semid, int semnum, int cmd, union semun *arg);
#endif
+21 -64
View File
@@ -1,14 +1,14 @@
/// @file shm.h
/// @brief Definition of structure for managing shared memories.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/types.h"
#include "stddef.h"
#include "sys/ipc.h"
#include "time.h"
#include "ipc.h"
/// Data type for storing the number of attaches.
typedef unsigned long shmatt_t;
@@ -19,27 +19,22 @@ struct shmid_ds {
struct ipc_perm shm_perm;
/// Size of segment in bytes.
size_t shm_segsz;
/// Time of last shmat().
/// Time of last attach.
time_t shm_atime;
/// Time of last shmdt().
/// Time of last detach.
time_t shm_dtime;
/// Time of last change by shmctl().
/// Time of last change.
time_t shm_ctime;
/// Pid of creator.
pid_t shm_cpid;
/// Pid of last shmop.
/// Pid of last operator.
pid_t shm_lpid;
/// Number of current attaches.
shmatt_t shm_nattch;
/// Pointer to the next shared memory data structure.
struct shmid_ds *next;
/// Where shm created is memorized, should be a file.
void *shm_location;
};
#if 0
#include "ipc.h"
#include "debug.h"
#include "time.h"
#include "kheap.h"
@@ -56,20 +51,6 @@ struct shmid_ds {
#define SHM_W 0200
//==============================================================================
//======== Flags for shmat =====================================================
// Attach read-only else read-write.
#define SHM_RDONLY 010000
// Round attach address to SHMLBA.
#define SHM_RND 020000
// Take-over region on attach.
#define SHM_REMAP 040000
// Execution access.
#define SHM_EXEC 0100000
//==============================================================================
//======== Commands for shmctl =================================================
// Lock segment (root only).
#define SHM_LOCK 11
@@ -98,51 +79,27 @@ struct shmid_ds {
// Don't check for reservations.
#define SHM_NORESERVE 010000
/// @@brief Syscall Service Routine: Shared memory control operation.
int syscall_shmctl(int *args);
/// @@brief Syscall Service Routine: Get shared memory segment.
int syscall_shmget(int *args);
/// @@brief Syscall Service Routine: Attach shared memory segment.
void *syscall_shmat(int *args);
/// @@brief Syscall Service Routine: Detach shared memory segment.
int syscall_shmdt(int *args);
/// @@brief User Wrapper: Shared memory control operation.
int shmctl(int shmid, int cmd, struct shmid_ds *buf);
/// @@brief User Wrapper: Get shared memory segment.
int shmget(key_t key, size_t size, int flags);
/// @@brief User Wrapper: Attach shared memory segment.
void *shmat(int shmid, void *shmaddr, int flag);
/// @@brief User Wrapper: Detach shared memory segment.
int shmdt(void *shmaddr);
/// @@brief Find shmid_ds on list.
struct shmid_ds *find_shm_fromid(int shmid);
/// @@brief Find shmid_ds on list.
struct shmid_ds *find_shm_fromkey(key_t key);
/// @@brief shmid_ds on list.
struct shmid_ds *find_shm_fromvaddr(void *shmvaddr);
#endif
#define SHM_RDONLY 010000 ///< Attach read-only else read-write.
#define SHM_RND 020000 ///< Round attach address to SHMLBA.
#define SHM_REMAP 040000 ///< Take-over region on attach.
#define SHM_EXEC 0100000 ///< Execution access.
#ifdef __KERNEL__
/// @brief Initializes the shared memory.
/// @return 0 on success, 1 on failure.
int shm_init(void);
/// @brief Get a System V shared memory identifier.
/// @param key can be used either to obtain the identifier of a previously
/// created shared memory, or to create a new one.
/// @param size of the shared memory, rounded up to a multiple of PAGE_SIZE.
/// @param flag controls the behaviour of the function.
/// @param shmflg controls the behaviour of the function.
/// @return the shared memory identifier, -1 on failure, and errno is set to
/// indicate the error.
long sys_shmget(key_t key, size_t size, int flag);
long sys_shmget(key_t key, size_t size, int shmflg);
/// @brief Attaches the shared memory segment identified by shmid to the address
/// space of the calling process.
@@ -151,7 +108,7 @@ long sys_shmget(key_t key, size_t size, int flag);
/// @param shmflg controls the behaviour of the function.
/// @return returns the address of the attached shared memory segment; on error
/// (void *) -1 is returned, and errno is set to indicate the error.
void * sys_shmat(int shmid, const void *shmaddr, int shmflg);
void *sys_shmat(int shmid, const void *shmaddr, int shmflg);
/// @brief Detaches the shared memory segment located at the address specified
/// by shmaddr from the address space of the calling process
@@ -174,10 +131,10 @@ long sys_shmctl(int shmid, int cmd, struct shmid_ds *buf);
/// @param key can be used either to obtain the identifier of a previously
/// created shared memory, or to create a new one.
/// @param size of the shared memory, rounded up to a multiple of PAGE_SIZE.
/// @param flag controls the behaviour of the function.
/// @param shmflg controls the behaviour of the function.
/// @return the shared memory identifier, -1 on failure, and errno is set to
/// indicate the error.
long shmget(key_t key, size_t size, int flag);
long shmget(key_t key, size_t size, int shmflg);
/// @brief Attaches the shared memory segment identified by shmid to the address
/// space of the calling process.
@@ -186,7 +143,7 @@ long shmget(key_t key, size_t size, int flag);
/// @param shmflg controls the behaviour of the function.
/// @return returns the address of the attached shared memory segment; on error
/// (void *) -1 is returned, and errno is set to indicate the error.
void * shmat(int shmid, const void *shmaddr, int shmflg);
void *shmat(int shmid, const void *shmaddr, int shmflg);
/// @brief Detaches the shared memory segment located at the address specified
/// by shmaddr from the address space of the calling process
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file stat.h
/// @brief Stat functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file types.h
/// @brief Collection of Kernel datatype
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+96 -17
View File
@@ -1,13 +1,13 @@
/// @file unistd.h
/// @brief Functions used to manage files.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
#include "sys/types.h"
#include "sys/dirent.h"
#include "stddef.h"
#include "sys/dirent.h"
#define STDIN_FILENO 0 ///< Standard input.
#define STDOUT_FILENO 1 ///< Standard output.
@@ -25,7 +25,7 @@ ssize_t read(int fd, void *buf, size_t nbytes);
/// @param buf The buffer collecting data to written.
/// @param nbytes The number of bytes to write.
/// @return The number of written bytes.
ssize_t write(int fd, void *buf, size_t nbytes);
ssize_t write(int fd, const void *buf, size_t nbytes);
/// @brief Opens the file specified by pathname.
/// @param pathname A pathname for a file.
@@ -54,13 +54,26 @@ off_t lseek(int fd, off_t offset, int whence);
/// @return
int unlink(const char *path);
/// @brief Creates a symbolic link.
/// @param linkname the name of the link.
/// @param path the entity it is linking to.
/// @return 0 on success, a negative number if fails and errno is set.
int symlink(const char *linkname, const char *path);
/// @brief Read the symbolic link, if present.
/// @param path the file for which we want to read the symbolic link information.
/// @param buffer the buffer where we will store the symbolic link path.
/// @param bufsize the size of the buffer.
/// @return The number of read characters on success, -1 otherwise and errno is set to indicate the error.
int readlink(const char *path, char *buffer, size_t bufsize);
/// @brief Wrapper for exit system call.
/// @param status The exit status.
extern void exit(int status);
/// @brief Returns the process ID (PID) of the calling process.
/// @return pid_t process identifier.
extern pid_t getpid();
extern pid_t getpid(void);
///@brief Return session id of the given process.
/// If pid == 0 return the SID of the calling process
@@ -78,7 +91,7 @@ extern pid_t getsid(pid_t pid);
/// is made the same as its process ID).
///@return On success return SID of the session just created
/// Otherwise return -1 with errno : EPERM
extern pid_t setsid();
extern pid_t setsid(void);
///@brief returns the Process Group ID (PGID) of the process specified by pid.
/// If pid is zero, the process ID of the calling process is used.
@@ -93,36 +106,58 @@ pid_t getpgid(pid_t pid);
/// @return returns zero. On error, -1 is returned, and errno is set appropriately.
int setpgid(pid_t pid, pid_t pgid);
///@brief returns the group ID of the calling process.
///@brief returns the real group ID of the calling process.
///@return GID of the current process
extern pid_t getgid();
extern gid_t getgid(void);
///@brief sets the effective group ID of the calling process.
///@param pid process identifier to
///@brief returns the effective group ID of the calling process.
///@return GID of the current process
extern gid_t getegid(void);
///@brief sets the group IDs of the calling process.
///@param gid the Group ID to set
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
extern int setgid(pid_t pid);
extern int setgid(gid_t gid);
///@brief Returns the User ID of the calling process.
///@brief sets the real and effective group IDs of the calling process.
///@param rgid the new real Group ID.
///@param egid the effective real Group ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set EPERM
extern int setregid(gid_t rgid, gid_t egid);
///@brief Returns the real User ID of the calling process.
///@return User ID of the current process.
extern uid_t getuid();
extern uid_t getuid(void);
///@brief Sets the effective User ID of the calling process.
///@brief Returns the effective User ID of the calling process.
///@return User ID of the current process.
extern uid_t geteuid(void);
///@brief Sets the User IDs of the calling process.
///@param uid the new User ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to :EINVAL or EPERM
extern int setuid(uid_t uid);
///@brief Sets the effective and real User IDs of the calling process.
///@param ruid the new real User ID.
///@param euid the effective real User ID.
///@return On success, zero is returned.
/// Otherwise returns -1 with errno set to EPERM
extern int setreuid(uid_t ruid, uid_t euid);
/// @brief Returns the parent process ID (PPID) of the calling process.
/// @return pid_t parent process identifier.
extern pid_t getppid();
extern pid_t getppid(void);
/// @brief Clone the calling process, but without copying the whole address space.
/// The calling process is suspended until the new process exits or is
/// replaced by a call to `execve'.
/// @return Return -1 for errors, 0 to the new process, and the process ID of
/// the new process to the old process.
extern pid_t fork();
extern pid_t fork(void);
/// @brief Replaces the current process image with a new process image (argument list).
/// @param path The absolute path to the binary file to execute.
@@ -238,7 +273,13 @@ int fchdir(int fd);
/// @return On success, the number of bytes read is returned. On end of
/// directory, 0 is returned. On error, -1 is returned, and errno is set
/// appropriately.
int getdents(int fd, dirent_t *dirp, unsigned int count);
ssize_t getdents(int fd, dirent_t *dirp, unsigned int count);
/// @brief Return a new file descriptor
/// @param fd The fd pointing to the opened file.
/// @return On success, a new file descriptor is returned.
/// On error, -1 is returned, and errno is set appropriately.
int dup(int fd);
/// @brief Send signal to calling thread after desired seconds.
/// @param seconds the amount of seconds.
@@ -246,4 +287,42 @@ int getdents(int fd, dirent_t *dirp, unsigned int count);
/// shall return a non-zero value that is the number of seconds until the
/// previous request would have generated a SIGALRM signal. Otherwise, alarm()
/// shall return 0.
int alarm(int seconds);
unsigned alarm(int seconds);
/// @brief Change the file's mode bits.
/// @param pathname The pathname of the file to change mode.
/// @param mode The mode bits to set.
/// @return On success, 0 is returned.
/// On error, -1 is returned, and errno is set appropriately.
int chmod(const char *pathname, mode_t mode);
/// @brief Change the file's mode bits.
/// @param fd The fd pointing to the opened file.
/// @param mode The mode bits to set.
/// @return On success, 0 is returned.
/// On error, -1 is returned, and errno is set appropriately.
int fchmod(int fd, mode_t mode);
/// @brief Change the owner and group of a file.
/// @param pathname The pathname of the file to change.
/// @param owner The new owner to set.
/// @param owner The new group to set.
/// @return On success, 0 is returned.
/// On error, -1 is returned, and errno is set appropriately.
int chown(const char *pathname, uid_t owner, gid_t group);
/// @brief Change the owner and group of a file.
/// @param fd The fd pointing to the opened file.
/// @param owner The new owner to set.
/// @param owner The new group to set.
/// @return On success, 0 is returned.
/// On error, -1 is returned, and errno is set appropriately.
int fchown(int fd, uid_t owner, gid_t group);
/// @brief Change the owner and group of a file.
/// @param pathname The pathname of the file to change.
/// @param owner The new owner to set.
/// @param owner The new group to set.
/// @return On success, 0 is returned.
/// On error, -1 is returned, and errno is set appropriately.
int lchown(const char *pathname, uid_t owner, gid_t group);
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file utsname.h
/// @brief Functions used to provide information about the machine & OS.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file wait.h
/// @brief Event management functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+49 -25
View File
@@ -1,6 +1,6 @@
/// @file syscall_types.h
/// @brief System Call numbers.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
@@ -207,6 +207,17 @@
return (type)(res); \
} while (0)
// Few things about what follows:
//
// 1. The symbol "=", is a a constraint modifier, and it means that the operand
// is write-only, meaning that the previous value is discarded and replaced
// by output data.
//
// 2. Using "0" here specifies that the input is read from a variable which also
// serves as an output, the 0-th output variable in this case.
//
//
/// @brief Heart of the code that calls a system call with 0 parameters.
#define __inline_syscall0(res, name) \
__asm__ __volatile__("int $0x80" \
@@ -214,42 +225,39 @@
: "0"(__NR_##name))
/// @brief Heart of the code that calls a system call with 1 parameter.
#define __inline_syscall1(res, name, arg1) \
__asm__ __volatile__("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"((int)(arg1)) \
#define __inline_syscall1(res, name, arg1) \
__asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"(arg1) \
: "memory");
/// @brief Heart of the code that calls a system call with 2 parameters.
#define __inline_syscall2(res, name, arg1, arg2) \
__asm__ __volatile__("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"((int)(arg1)), "c"((int)(arg2)) \
#define __inline_syscall2(res, name, arg1, arg2) \
__asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"(arg1), "c"(arg2) \
: "memory");
/// @brief Heart of the code that calls a system call with 3 parameters.
#define __inline_syscall3(res, name, arg1, arg2, arg3) \
__asm__ __volatile__("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"((int)(arg1)), "c"((int)(arg2)), \
"d"((int)(arg3)) \
#define __inline_syscall3(res, name, arg1, arg2, arg3) \
__asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"(arg1), "c"(arg2), "d"(arg3) \
: "memory");
/// @brief Heart of the code that calls a system call with 4 parameters.
#define __inline_syscall4(res, name, arg1, arg2, arg3, arg4) \
__asm__ __volatile__("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"((int)(arg1)), "c"((int)(arg2)), \
"d"((int)(arg3)), "S"((int)(arg4)) \
#define __inline_syscall4(res, name, arg1, arg2, arg3, arg4) \
__asm__ __volatile__("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
: "=a"(res) \
: "0"(__NR_##name), "ri"(arg1), "c"(arg2), "d"(arg3), "S"(arg4) \
: "memory");
/// @brief Heart of the code that calls a system call with 5 parameters.
#define __inline_syscall5(res, name, arg1, arg2, arg3, arg4, arg5) \
__asm__ __volatile__("push %%ebx ; movl %2,%%ebx ; movl %1,%%eax ; " \
"int $0x80 ; pop %%ebx" \
: "=a"(res) \
: "i"(__NR_##name), "ri"((int)(arg1)), "c"((int)(arg2)), \
"d"((int)(arg3)), "S"((int)(arg4)), "D"((int)(arg5)) \
#define __inline_syscall5(res, name, arg1, arg2, arg3, arg4, arg5) \
__asm__ __volatile__("push %%ebx; movl %2,%%ebx; movl %1,%%eax; " \
"int $0x80; pop %%ebx" \
: "=a"(res) \
: "i"(__NR_##name), "ri"(arg1), "c"(arg2), "d"(arg3), "S"(arg4), "D"(arg5) \
: "memory");
/// @brief System call with 0 parameters.
@@ -305,3 +313,19 @@
__inline_syscall5(__res, name, arg1, arg2, arg3, arg4, arg5); \
__syscall_return(type, __res); \
}
/// @brief System call with 5 parameters.
#define _syscall6(type, name, type1, arg1, type2, arg2, type3, arg3, type4, arg4, type5, arg5, type6, arg6) \
type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
{ \
long __res; \
unsigned args[6] = { 0 }; \
args[0] = (unsigned)arg1; \
args[1] = (unsigned)arg2; \
args[2] = (unsigned)arg3; \
args[3] = (unsigned)arg4; \
args[4] = (unsigned)arg5; \
args[5] = (unsigned)arg6; \
__inline_syscall1(__res, name, args); \
__syscall_return(type, __res); \
}
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file termios.h
/// @brief Defines the termios functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+1 -1
View File
@@ -1,6 +1,6 @@
/// @file time.h
/// @brief Time-related functions.
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#pragma once
+4 -5
View File
@@ -1,15 +1,15 @@
/// @file abort.c
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "sys/unistd.h"
#include "string.h"
#include "signal.h"
#include "stdio.h"
#include "string.h"
// Since there could be signal handlers listening for the abort, we
// need to keep track at which stage of the abort we are.
/// @brief Since there could be signal handlers listening for the abort, we need
/// to keep track at which stage of the abort we are.
static int stage = 0;
void abort(void)
@@ -28,7 +28,6 @@ void abort(void)
/* Send signal which possibly calls a user handler. */
if (stage == 1) {
// We must allow recursive calls of abort
int save_stage = stage;
+2 -2
View File
@@ -1,11 +1,11 @@
/// @file assert.c
/// @brief
/// @copyright (c) 2014-2022 This file is distributed under the MIT License.
/// @copyright (c) 2014-2024 This file is distributed under the MIT License.
/// See LICENSE.md for details.
#include "assert.h"
#include "stdlib.h"
#include "stdio.h"
#include "stdlib.h"
void __assert_fail(const char *assertion, const char *file, const char *function, unsigned int line)
{

Some files were not shown because too many files have changed in this diff Show More