mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:52:44 +00:00 
			
		
		
		
	Everywhere: Fix more typos
This commit is contained in:
		
							parent
							
								
									4e86c34ef0
								
							
						
					
					
						commit
						bcfc6f0c57
					
				
					 57 changed files with 108 additions and 108 deletions
				
			
		|  | @ -332,7 +332,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     // The function will return the next range of unset bits starting from the
 |     // The function will return the next range of unset bits starting from the
 | ||||||
|     // @from value.
 |     // @from value.
 | ||||||
|     // @from: the postition from which the search starts. The var will be
 |     // @from: the position from which the search starts. The var will be
 | ||||||
|     //        changed and new value is the offset of the found block.
 |     //        changed and new value is the offset of the found block.
 | ||||||
|     // @min_length: minimum size of the range which will be returned.
 |     // @min_length: minimum size of the range which will be returned.
 | ||||||
|     // @max_length: maximum size of the range which will be returned.
 |     // @max_length: maximum size of the range which will be returned.
 | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ namespace AK { | ||||||
| 
 | 
 | ||||||
| class InputStream : public virtual AK::Detail::Stream { | class InputStream : public virtual AK::Detail::Stream { | ||||||
| public: | public: | ||||||
|     // Reads at least one byte unless none are requested or none are avaliable. Does nothing
 |     // Reads at least one byte unless none are requested or none are available. Does nothing
 | ||||||
|     // and returns zero if there is already an error.
 |     // and returns zero if there is already an error.
 | ||||||
|     virtual size_t read(Bytes) = 0; |     virtual size_t read(Bytes) = 0; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -302,7 +302,7 @@ bool String::equals_ignoring_case(const StringView& other) const | ||||||
|     return StringUtils::equals_ignoring_case(view(), other); |     return StringUtils::equals_ignoring_case(view(), other); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int String::replace(const String& needle, const String& replacement, bool all_occurences) | int String::replace(const String& needle, const String& replacement, bool all_occurrences) | ||||||
| { | { | ||||||
|     if (is_empty()) |     if (is_empty()) | ||||||
|         return 0; |         return 0; | ||||||
|  | @ -316,7 +316,7 @@ int String::replace(const String& needle, const String& replacement, bool all_oc | ||||||
| 
 | 
 | ||||||
|         pos = ptr - characters(); |         pos = ptr - characters(); | ||||||
|         positions.append(pos); |         positions.append(pos); | ||||||
|         if (!all_occurences) |         if (!all_occurrences) | ||||||
|             break; |             break; | ||||||
| 
 | 
 | ||||||
|         start = pos + 1; |         start = pos + 1; | ||||||
|  |  | ||||||
|  | @ -252,7 +252,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     StringView view() const; |     StringView view() const; | ||||||
| 
 | 
 | ||||||
|     int replace(const String& needle, const String& replacement, bool all_occurences = false); |     int replace(const String& needle, const String& replacement, bool all_occurrences = false); | ||||||
| 
 | 
 | ||||||
|     template<typename T, typename... Rest> |     template<typename T, typename... Rest> | ||||||
|     bool is_one_of(const T& string, Rest... rest) const |     bool is_one_of(const T& string, Rest... rest) const | ||||||
|  |  | ||||||
|  | @ -152,14 +152,14 @@ void TestSuite::main(const String& suite_name, int argc, char** argv) | ||||||
| 
 | 
 | ||||||
|     args_parser.add_option(do_tests_only, "Only run tests.", "tests", 0); |     args_parser.add_option(do_tests_only, "Only run tests.", "tests", 0); | ||||||
|     args_parser.add_option(do_benchmarks_only, "Only run benchmarks.", "bench", 0); |     args_parser.add_option(do_benchmarks_only, "Only run benchmarks.", "bench", 0); | ||||||
|     args_parser.add_option(do_list_cases, "List avaliable test cases.", "list", 0); |     args_parser.add_option(do_list_cases, "List available test cases.", "list", 0); | ||||||
|     args_parser.add_positional_argument(search_string, "Only run matching cases.", "pattern", Core::ArgsParser::Required::No); |     args_parser.add_positional_argument(search_string, "Only run matching cases.", "pattern", Core::ArgsParser::Required::No); | ||||||
|     args_parser.parse(argc, argv); |     args_parser.parse(argc, argv); | ||||||
| 
 | 
 | ||||||
|     const auto& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only); |     const auto& matching_tests = find_cases(search_string, !do_benchmarks_only, !do_tests_only); | ||||||
| 
 | 
 | ||||||
|     if (do_list_cases) { |     if (do_list_cases) { | ||||||
|         out() << "Avaliable cases for " << suite_name << ":"; |         out() << "Available cases for " << suite_name << ":"; | ||||||
|         for (const auto& test : matching_tests) { |         for (const auto& test : matching_tests) { | ||||||
|             out() << "    " << test.name(); |             out() << "    " << test.name(); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -158,7 +158,7 @@ TEST_CASE(set_range) | ||||||
|         bitmap.set_range(48, 32, true); |         bitmap.set_range(48, 32, true); | ||||||
|         bitmap.set_range(94, 39, true); |         bitmap.set_range(94, 39, true); | ||||||
|         bitmap.set_range(190, 71, true); |         bitmap.set_range(190, 71, true); | ||||||
|         bitmap.set_range(190 + 71 - 7, 21, false); // slighly overlapping clear
 |         bitmap.set_range(190 + 71 - 7, 21, false); // slightly overlapping clear
 | ||||||
|         for (size_t i = 0; i < bitmap.size(); i++) { |         for (size_t i = 0; i < bitmap.size(); i++) { | ||||||
|             bool should_be_set = (i >= 48 && i < 48 + 32) |             bool should_be_set = (i >= 48 && i < 48 + 32) | ||||||
|                 || (i >= 94 && i < 94 + 39) |                 || (i >= 94 && i < 94 + 39) | ||||||
|  |  | ||||||
|  | @ -151,10 +151,10 @@ static bool handle_breakpoint_command(const String& command) | ||||||
| 
 | 
 | ||||||
|     bool success = g_debug_session->insert_breakpoint(reinterpret_cast<void*>(breakpoint_address)); |     bool success = g_debug_session->insert_breakpoint(reinterpret_cast<void*>(breakpoint_address)); | ||||||
|     if (!success) { |     if (!success) { | ||||||
|         fprintf(stderr, "coult not insert breakpoint at: %08x\n", breakpoint_address); |         fprintf(stderr, "could not insert breakpoint at: %08x\n", breakpoint_address); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|     printf("breakpoint insterted at: %08x\n", breakpoint_address); |     printf("breakpoint inserted at: %08x\n", breakpoint_address); | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -184,8 +184,8 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio | ||||||
|     auto left = config->read_num_entry("Window", "Left", 150); |     auto left = config->read_num_entry("Window", "Left", 150); | ||||||
|     auto top = config->read_num_entry("Window", "Top", 75); |     auto top = config->read_num_entry("Window", "Top", 75); | ||||||
|     auto width = config->read_num_entry("Window", "Width", 640); |     auto width = config->read_num_entry("Window", "Width", 640); | ||||||
|     auto heigth = config->read_num_entry("Window", "Heigth", 480); |     auto height = config->read_num_entry("Window", "Height", 480); | ||||||
|     window->set_rect({ left, top, width, heigth }); |     window->set_rect({ left, top, width, height }); | ||||||
| 
 | 
 | ||||||
|     auto& widget = window->set_main_widget<GUI::Widget>(); |     auto& widget = window->set_main_widget<GUI::Widget>(); | ||||||
|     widget.set_layout<GUI::VerticalBoxLayout>(); |     widget.set_layout<GUI::VerticalBoxLayout>(); | ||||||
|  | @ -683,7 +683,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio | ||||||
| 
 | 
 | ||||||
|     window->show(); |     window->show(); | ||||||
| 
 | 
 | ||||||
|     // Read direcory read mode from config.
 |     // Read directory read mode from config.
 | ||||||
|     auto dir_view_mode = config->read_entry("DirectoryView", "ViewMode", "Icon"); |     auto dir_view_mode = config->read_entry("DirectoryView", "ViewMode", "Icon"); | ||||||
| 
 | 
 | ||||||
|     if (dir_view_mode.contains("Table")) { |     if (dir_view_mode.contains("Table")) { | ||||||
|  | @ -702,7 +702,7 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio | ||||||
|         config->write_num_entry("Window", "Left", window->x()); |         config->write_num_entry("Window", "Left", window->x()); | ||||||
|         config->write_num_entry("Window", "Top", window->y()); |         config->write_num_entry("Window", "Top", window->y()); | ||||||
|         config->write_num_entry("Window", "Width", window->width()); |         config->write_num_entry("Window", "Width", window->width()); | ||||||
|         config->write_num_entry("Window", "Heigth", window->height()); |         config->write_num_entry("Window", "Height", window->height()); | ||||||
|         config->sync(); |         config->sync(); | ||||||
| 
 | 
 | ||||||
|         return GUI::Window::CloseRequestDecision::Close; |         return GUI::Window::CloseRequestDecision::Close; | ||||||
|  |  | ||||||
|  | @ -213,7 +213,7 @@ pop3s		995/tcp				# POP-3 over SSL | ||||||
| #> providing services to unknown callers, a service contact port is | #> providing services to unknown callers, a service contact port is | ||||||
| #> defined.  This list specifies the port used by the server process as its | #> defined.  This list specifies the port used by the server process as its | ||||||
| #> contact port.  While the IANA can not control uses of these ports it | #> contact port.  While the IANA can not control uses of these ports it | ||||||
| #> does register or list uses of these ports as a convienence to the | #> does register or list uses of these ports as a convenience to the | ||||||
| #> community. | #> community. | ||||||
| # | # | ||||||
| socks		1080/tcp			# socks proxy server | socks		1080/tcp			# socks proxy server | ||||||
|  | @ -392,7 +392,7 @@ afs3-vlserver	7003/tcp			# volume location database | ||||||
| afs3-vlserver	7003/udp | afs3-vlserver	7003/udp | ||||||
| afs3-kaserver	7004/tcp			# AFS/Kerberos authentication | afs3-kaserver	7004/tcp			# AFS/Kerberos authentication | ||||||
| afs3-kaserver	7004/udp | afs3-kaserver	7004/udp | ||||||
| afs3-volser	7005/tcp			# volume managment server | afs3-volser	7005/tcp			# volume management server | ||||||
| afs3-volser	7005/udp | afs3-volser	7005/udp | ||||||
| afs3-errors	7006/tcp			# error interpretation service | afs3-errors	7006/tcp			# error interpretation service | ||||||
| afs3-errors	7006/udp | afs3-errors	7006/udp | ||||||
|  |  | ||||||
|  | @ -5,4 +5,4 @@ ViewMode=Icon | ||||||
| Left=150 | Left=150 | ||||||
| Top=75 | Top=75 | ||||||
| Width=640 | Width=640 | ||||||
| Heigth=480 | Height=480 | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
|    /* picture setup */ |    /* picture setup */ | ||||||
|    #top { margin: 100em 3em 0; padding: 2em 0 0 .5em; text-align: left; font: 2em/24px sans-serif; color: navy; white-space: pre; } /* "Hello World!" text */ |    #top { margin: 100em 3em 0; padding: 2em 0 0 .5em; text-align: left; font: 2em/24px sans-serif; color: navy; white-space: pre; } /* "Hello World!" text */ | ||||||
|    .picture { position: relative; border: 1em solid transparent; margin: 0 0 100em 3em; } /* containing block for face */ |    .picture { position: relative; border: 1em solid transparent; margin: 0 0 100em 3em; } /* containing block for face */ | ||||||
|    .picture { background: red; } /* overriden by preferred stylesheet below */ |    .picture { background: red; } /* overridden by preferred stylesheet below */ | ||||||
| 
 | 
 | ||||||
|    /* top line of face (scalp): fixed positioning and min/max height/width */ |    /* top line of face (scalp): fixed positioning and min/max height/width */ | ||||||
|    .picture p { position: fixed; margin: 0; padding: 0; border: 0; top: 9em; left: 11em; width: 140%; max-width: 4em; height: 8px; min-height: 1em; max-height: 2mm; /* min-height overrides max-height, see 10.7 */ background: black; border-bottom: 0.5em yellow solid; } |    .picture p { position: fixed; margin: 0; padding: 0; border: 0; top: 9em; left: 11em; width: 140%; max-width: 4em; height: 8px; min-height: 1em; max-height: 2mm; /* min-height overrides max-height, see 10.7 */ background: black; border-bottom: 0.5em yellow solid; } | ||||||
|  |  | ||||||
|  | @ -51,7 +51,7 @@ div + div { | ||||||
| #three-px-solid-blue { | #three-px-solid-blue { | ||||||
| 	border: 3px solid blue; | 	border: 3px solid blue; | ||||||
| } | } | ||||||
| #foo-but-actually-resetted { | #foo-but-actually-reset { | ||||||
|     border-top-color: red; |     border-top-color: red; | ||||||
|     border-right-color: lime; |     border-right-color: lime; | ||||||
|     border-bottom-color: blue; |     border-bottom-color: blue; | ||||||
|  | @ -132,7 +132,7 @@ div + div { | ||||||
| <div id="resetting">resetting</div> | <div id="resetting">resetting</div> | ||||||
| <div id="three-px-solid-blue-separate">three px solid blue separate</div> | <div id="three-px-solid-blue-separate">three px solid blue separate</div> | ||||||
| <div id="three-px-solid-blue">three px solid blue</div> | <div id="three-px-solid-blue">three px solid blue</div> | ||||||
| <div id="foo-but-actually-resetted">foo but actually resetted</div> | <div id="foo-but-actually-reset">foo but actually reset</div> | ||||||
| <div id="double-width">double width</div> | <div id="double-width">double width</div> | ||||||
| <div id="double-style">double style</div> | <div id="double-style">double style</div> | ||||||
| <div id="double-color">double color</div> | <div id="double-color">double color</div> | ||||||
|  |  | ||||||
|  | @ -440,7 +440,7 @@ reduce.__documentation = JSON.stringify({ | ||||||
|         "to the `accumulator`\n The `reduction function` should be a function of arity 2, taking " + |         "to the `accumulator`\n The `reduction function` should be a function of arity 2, taking " + | ||||||
|         "first the accumulator, then the current value, and returning the new accumulator value\n\n" + |         "first the accumulator, then the current value, and returning the new accumulator value\n\n" + | ||||||
|         "Please keep in mind that this function respects the cell type, and can yield non-numeric " + |         "Please keep in mind that this function respects the cell type, and can yield non-numeric " + | ||||||
|         "values to the `curent value`.", |         "values to the `current value`.", | ||||||
|     examples: { |     examples: { | ||||||
|         'reduce((acc, x) => acc * x, 1, range("A0", "A5"))': |         'reduce((acc, x) => acc * x, 1, range("A0", "A5"))': | ||||||
|             "Calculate the product of all values in the range A0:A5", |             "Calculate the product of all values in the range A0:A5", | ||||||
|  |  | ||||||
|  | @ -67,9 +67,9 @@ The expression can take any of the following forms: | ||||||
| 
 | 
 | ||||||
| ### File permission checks | ### File permission checks | ||||||
| 
 | 
 | ||||||
| * `-r <file>` whether the curent user has read access to the file | * `-r <file>` whether the current user has read access to the file | ||||||
| * `-w <file>` whether the curent user has write access to the file | * `-w <file>` whether the current user has write access to the file | ||||||
| * `-x <file>` whether the curent user has execute access to the file | * `-x <file>` whether the current user has execute access to the file | ||||||
| * `-e <file>` whether the file exists | * `-e <file>` whether the file exists | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ $ xargs [options...] [command [initial-arguments...]] | ||||||
| 
 | 
 | ||||||
| `xargs` reads items from a stream, delimited by some blank character (`delimiter`), and executes the `command` as many times as there are items, with any processed `initial-arguments`, possibly followed by a number of items read from the input. | `xargs` reads items from a stream, delimited by some blank character (`delimiter`), and executes the `command` as many times as there are items, with any processed `initial-arguments`, possibly followed by a number of items read from the input. | ||||||
| 
 | 
 | ||||||
| If a `placeholder` is explicitly specified, the `max-lines` limit is set to 1, and each argument in `initial-arguments` is processed by replacing any occurence of the `placeholder` with the input item, and treating the entire resulting value as _one_ argument. | If a `placeholder` is explicitly specified, the `max-lines` limit is set to 1, and each argument in `initial-arguments` is processed by replacing any occurrence of the `placeholder` with the input item, and treating the entire resulting value as _one_ argument. | ||||||
| 
 | 
 | ||||||
| It is to be noted that `command` is also subject to substitution in this mode. | It is to be noted that `command` is also subject to substitution in this mode. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -45,7 +45,7 @@ mounted file system. | ||||||
| 
 | 
 | ||||||
| If `MS_BIND` is specified in `flags`, `fs_type` is ignored and a bind mount is | If `MS_BIND` is specified in `flags`, `fs_type` is ignored and a bind mount is | ||||||
| performed instead. In this case, the file or directory specified by `source_fd` | performed instead. In this case, the file or directory specified by `source_fd` | ||||||
| is overlayed over `target` — the target appears to be replaced by a copy of the | is overlaid over `target` — the target appears to be replaced by a copy of the | ||||||
| source. This can be used as an alternative to symlinks or hardlinks. | source. This can be used as an alternative to symlinks or hardlinks. | ||||||
| 
 | 
 | ||||||
| Each bind mount has its own set of flags, independent of the others or the | Each bind mount has its own set of flags, independent of the others or the | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ writes some data to the pipe which the parent reads: | ||||||
| ```c++ | ```c++ | ||||||
| #include <AK/Assertions.h> | #include <AK/Assertions.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #incldue <unistd.h> | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| int main() | int main() | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ Any sequence of _Double Quoted String Part_ tokens: | ||||||
| * Escaped sequences | * Escaped sequences | ||||||
| 
 | 
 | ||||||
| ##### Variable Reference | ##### Variable Reference | ||||||
| Any sequence of _Identifier_ characters, or a _Special Variable_ follwing a `$` | Any sequence of _Identifier_ characters, or a _Special Variable_ following a `$` | ||||||
| 
 | 
 | ||||||
| ##### Evaluate expression | ##### Evaluate expression | ||||||
| Any expression following a `$` that is not a variable reference: | Any expression following a `$` that is not a variable reference: | ||||||
|  | @ -331,7 +331,7 @@ list_expression :: ' '* expression (' '+ list_expression)? | ||||||
| 
 | 
 | ||||||
| expression :: evaluate expression? | expression :: evaluate expression? | ||||||
|             | string_composite expression? |             | string_composite expression? | ||||||
|             | comment expession? |             | comment expression? | ||||||
|             | '(' list_expression ')' expression? |             | '(' list_expression ')' expression? | ||||||
| 
 | 
 | ||||||
| evaluate :: '$' '(' pipe_sequence ')' | evaluate :: '$' '(' pipe_sequence ')' | ||||||
|  |  | ||||||
|  | @ -36,7 +36,7 @@ This program must be run as root. | ||||||
| ## Files | ## Files | ||||||
| 
 | 
 | ||||||
| * `/etc/passwd` - new user information (such as UID and GID) is appended to this file. | * `/etc/passwd` - new user information (such as UID and GID) is appended to this file. | ||||||
| * `/home/` - user home directroy is created here if the `-m` flag is specified. | * `/home/` - user home directory is created here if the `-m` flag is specified. | ||||||
| 
 | 
 | ||||||
| ## Examples | ## Examples | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ This program must be run as root. | ||||||
| ## Files | ## Files | ||||||
| 
 | 
 | ||||||
| * `/etc/passwd` - user information (such as UID and GID) in this file is deleted. | * `/etc/passwd` - user information (such as UID and GID) in this file is deleted. | ||||||
| * `/home/` - user home directroy is deleted if the `-r` flag is specified. | * `/home/` - user home directory is deleted if the `-r` flag is specified. | ||||||
| 
 | 
 | ||||||
| ## Examples | ## Examples | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -89,7 +89,7 @@ int main(int argc, char** argv, char** envp) | ||||||
| 
 | 
 | ||||||
|     printf("I think I called my lib function!\n"); |     printf("I think I called my lib function!\n"); | ||||||
| 
 | 
 | ||||||
|     // Test getting a method that takes and returns arugments now
 |     // Test getting a method that takes and returns arguments now
 | ||||||
|     const char* (*other_func)(int) = (const char* (*)(int))dlsym(handle, "other_lib_function"); |     const char* (*other_func)(int) = (const char* (*)(int))dlsym(handle, "other_lib_function"); | ||||||
| 
 | 
 | ||||||
|     printf("Found other lib function address %p\n", other_func); |     printf("Found other lib function address %p\n", other_func); | ||||||
|  |  | ||||||
|  | @ -80,7 +80,7 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC | ||||||
|     if (!address.has_value()) { |     if (!address.has_value()) { | ||||||
|         dbg() << "Warning: couldn't get instruction address from source"; |         dbg() << "Warning: couldn't get instruction address from source"; | ||||||
|         // TODO: Currently, the GUI will indicate that a breakpoint was inserted/removed at this line,
 |         // TODO: Currently, the GUI will indicate that a breakpoint was inserted/removed at this line,
 | ||||||
|         // regardless of whether we actually succeeded to insert it. (For example a breakpoint on a comment, or an include statemanet).
 |         // regardless of whether we actually succeeded to insert it. (For example a breakpoint on a comment, or an include statement).
 | ||||||
|         // We should indicate failure via a return value from this function, and not update the breakpoint GUI if we fail.
 |         // We should indicate failure via a return value from this function, and not update the breakpoint GUI if we fail.
 | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|  | @ -180,7 +180,7 @@ int Debugger::debugger_loop() | ||||||
|             do_step_over(regs); |             do_step_over(regs); | ||||||
|             return Debug::DebugSession::DebugDecision::Continue; |             return Debug::DebugSession::DebugDecision::Continue; | ||||||
|         case DebuggerAction::Exit: |         case DebuggerAction::Exit: | ||||||
|             // NOTE: Is detaching from the debugee the best thing to do here?
 |             // NOTE: Is detaching from the debuggee the best thing to do here?
 | ||||||
|             // We could display a dialog in the UI, remind the user that there is
 |             // We could display a dialog in the UI, remind the user that there is
 | ||||||
|             // a live debugged process, and ask whether they want to terminate/detach.
 |             // a live debugged process, and ask whether they want to terminate/detach.
 | ||||||
|             dbg() << "Debugger exiting"; |             dbg() << "Debugger exiting"; | ||||||
|  |  | ||||||
|  | @ -188,7 +188,7 @@ void DiffViewer::setup_properties() | ||||||
| 
 | 
 | ||||||
| Vector<String> DiffViewer::split_to_lines(const String& text) | Vector<String> DiffViewer::split_to_lines(const String& text) | ||||||
| { | { | ||||||
|     // NOTE: This is slightly different thatn text.split('\n')
 |     // NOTE: This is slightly different than text.split('\n')
 | ||||||
|     Vector<String> lines; |     Vector<String> lines; | ||||||
|     size_t next_line_start_index = 0; |     size_t next_line_start_index = 0; | ||||||
|     for (size_t i = 0; i < text.length(); ++i) { |     for (size_t i = 0; i < text.length(); ++i) { | ||||||
|  |  | ||||||
|  | @ -79,7 +79,7 @@ GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI:: | ||||||
|             if (data.is_array()) |             if (data.is_array()) | ||||||
|                 return String::format("<Array with %d element%s", data.as_array().size(), data.as_array().size() == 1 ? ">" : "s>"); |                 return String::format("<Array with %d element%s", data.as_array().size(), data.as_array().size() == 1 ? ">" : "s>"); | ||||||
|             if (data.is_object()) |             if (data.is_object()) | ||||||
|                 return String::format("<Object with %d entrie%s", data.as_object().size(), data.as_object().size() == 1 ? ">" : "s>"); |                 return String::format("<Object with %d entr%s", data.as_object().size(), data.as_object().size() == 1 ? "y>" : "ies>"); | ||||||
|             return data; |             return data; | ||||||
|         } |         } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -1255,7 +1255,7 @@ void signal_trampoline_dummy(void) | ||||||
|     // then calls the signal handler. We do this because, when interrupting a
 |     // then calls the signal handler. We do this because, when interrupting a
 | ||||||
|     // blocking syscall, that syscall may return some special error code in eax;
 |     // blocking syscall, that syscall may return some special error code in eax;
 | ||||||
|     // This error code would likely be overwritten by the signal handler, so it's
 |     // This error code would likely be overwritten by the signal handler, so it's
 | ||||||
|     // neccessary to preserve it here.
 |     // necessary to preserve it here.
 | ||||||
|     asm( |     asm( | ||||||
|         ".intel_syntax noprefix\n" |         ".intel_syntax noprefix\n" | ||||||
|         "asm_signal_trampoline:\n" |         "asm_signal_trampoline:\n" | ||||||
|  |  | ||||||
|  | @ -493,7 +493,7 @@ UniqueObject& my_unique_object(); // Free function. | ||||||
| 
 | 
 | ||||||
| ### Comments | ### Comments | ||||||
| 
 | 
 | ||||||
| [](#comments-sentences) Make comments look like sentences by starting with a capital letter and ending with a period (punctation). One exception may be end of line comments like this `if (x == y) // false for NaN`. | [](#comments-sentences) Make comments look like sentences by starting with a capital letter and ending with a period (punctuation). One exception may be end of line comments like this `if (x == y) // false for NaN`. | ||||||
| 
 | 
 | ||||||
| [](#comments-fixme) Use FIXME: (without attribution) to denote items that need to be addressed in the future. | [](#comments-fixme) Use FIXME: (without attribution) to denote items that need to be addressed in the future. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -69,7 +69,7 @@ To run SerenityOS in a WHPX-enabled QEMU VM: | ||||||
| WSL2 filesystem performance for IO heavy tasks (such as compiling a large C++ project) on the host Windows filesystem is terrible. | WSL2 filesystem performance for IO heavy tasks (such as compiling a large C++ project) on the host Windows filesystem is terrible. | ||||||
| This is because WSL2 runs as a Hyper-V virtual machine and uses the 9P file system protocol to access host windows files, over Hyper-V sockets. | This is because WSL2 runs as a Hyper-V virtual machine and uses the 9P file system protocol to access host windows files, over Hyper-V sockets. | ||||||
| 
 | 
 | ||||||
| For a more in depth explaination of the technical limitations of their approach, see [this issue on the WSL github](https://github.com/microsoft/WSL/issues/4197#issuecomment-604592340) | For a more in depth explanation of the technical limitations of their approach, see [this issue on the WSL github](https://github.com/microsoft/WSL/issues/4197#issuecomment-604592340) | ||||||
| 
 | 
 | ||||||
| The recommendation from the Microsoft team on that issue is: | The recommendation from the Microsoft team on that issue is: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -161,18 +161,18 @@ void ChessWidget::mouseup_event(GUI::MouseEvent& event) | ||||||
|             case Chess::Board::Result::SeventyFiveMoveRule: |             case Chess::Board::Result::SeventyFiveMoveRule: | ||||||
|                 msg = "Draw by 75 move rule."; |                 msg = "Draw by 75 move rule."; | ||||||
|                 break; |                 break; | ||||||
|             case Chess::Board::Result::ThreeFoldRepitition: |             case Chess::Board::Result::ThreeFoldRepetition: | ||||||
|                 update(); |                 update(); | ||||||
|                 if (GUI::MessageBox::show(window(), "The same board state has repeated three times. Claim Draw?", "Claim Draw?", |                 if (GUI::MessageBox::show(window(), "The same board state has repeated three times. Claim Draw?", "Claim Draw?", | ||||||
|                         GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::YesNo) |                         GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::YesNo) | ||||||
|                     == GUI::Dialog::ExecYes) { |                     == GUI::Dialog::ExecYes) { | ||||||
|                     msg = "Draw by threefold repitition."; |                     msg = "Draw by threefold repetition."; | ||||||
|                 } else { |                 } else { | ||||||
|                     over = false; |                     over = false; | ||||||
|                 } |                 } | ||||||
|                 break; |                 break; | ||||||
|             case Chess::Board::Result::FiveFoldRepitition: |             case Chess::Board::Result::FiveFoldRepetition: | ||||||
|                 msg = "Draw by fivefold repitition."; |                 msg = "Draw by fivefold repetition."; | ||||||
|                 break; |                 break; | ||||||
|             case Chess::Board::Result::InsufficientMaterial: |             case Chess::Board::Result::InsufficientMaterial: | ||||||
|                 msg = "Draw by insufficient material."; |                 msg = "Draw by insufficient material."; | ||||||
|  |  | ||||||
|  | @ -330,7 +330,7 @@ struct SC_setkeymap_params { | ||||||
| struct SC_create_thread_params { | struct SC_create_thread_params { | ||||||
|     unsigned int m_detach_state = 0; // JOINABLE or DETACHED
 |     unsigned int m_detach_state = 0; // JOINABLE or DETACHED
 | ||||||
|     int m_schedule_priority = 30;    // THREAD_PRIORITY_NORMAL
 |     int m_schedule_priority = 30;    // THREAD_PRIORITY_NORMAL
 | ||||||
|     // FIXME: Implment guard pages in create_thread (unreadable pages at "overflow" end of stack)
 |     // FIXME: Implement guard pages in create_thread (unreadable pages at "overflow" end of stack)
 | ||||||
|     // "If an implementation rounds up the value of guardsize to a multiple of {PAGESIZE},
 |     // "If an implementation rounds up the value of guardsize to a multiple of {PAGESIZE},
 | ||||||
|     // a call to pthread_attr_getguardsize() specifying attr shall store in the guardsize
 |     // a call to pthread_attr_getguardsize() specifying attr shall store in the guardsize
 | ||||||
|     // parameter the guard size specified by the previous pthread_attr_setguardsize() function call"
 |     // parameter the guard size specified by the previous pthread_attr_setguardsize() function call"
 | ||||||
|  |  | ||||||
|  | @ -1590,7 +1590,7 @@ void Processor::initialize_context_switching(Thread& initial_thread) | ||||||
|     m_scheduler_initialized = true; |     m_scheduler_initialized = true; | ||||||
| 
 | 
 | ||||||
|     asm volatile( |     asm volatile( | ||||||
|         "movl %[new_esp], %%esp \n" // swich to new stack
 |         "movl %[new_esp], %%esp \n" // switch to new stack
 | ||||||
|         "pushl %[from_to_thread] \n" // to_thread
 |         "pushl %[from_to_thread] \n" // to_thread
 | ||||||
|         "pushl %[from_to_thread] \n" // from_thread
 |         "pushl %[from_to_thread] \n" // from_thread
 | ||||||
|         "pushl $" __STRINGIFY(GDT_SELECTOR_CODE0) " \n" |         "pushl $" __STRINGIFY(GDT_SELECTOR_CODE0) " \n" | ||||||
|  |  | ||||||
|  | @ -192,7 +192,7 @@ RefPtr<DiskPartition> EBRPartitionTable::partition(unsigned index) | ||||||
| 
 | 
 | ||||||
|     auto& header = this->header(); |     auto& header = this->header(); | ||||||
|     if (header.mbr_signature != MBR_SIGNATURE) { |     if (header.mbr_signature != MBR_SIGNATURE) { | ||||||
|         klog() << "EBRPartitionTable::initialize: bad MBR signature - not initalized? 0x" << String::format("%x", header.mbr_signature); |         klog() << "EBRPartitionTable::initialize: bad MBR signature - not initialized? 0x" << String::format("%x", header.mbr_signature); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
|     if (index_is_extended_partition(index)) |     if (index_is_extended_partition(index)) | ||||||
|  |  | ||||||
|  | @ -76,7 +76,7 @@ RefPtr<DiskPartition> GPTPartitionTable::partition(unsigned index) | ||||||
|     unsigned lba = header.partition_array_start_lba + (((index - 1) * header.partition_entry_size) / BytesPerSector); |     unsigned lba = header.partition_array_start_lba + (((index - 1) * header.partition_entry_size) / BytesPerSector); | ||||||
| 
 | 
 | ||||||
|     if (header.sig[0] != GPT_SIGNATURE) { |     if (header.sig[0] != GPT_SIGNATURE) { | ||||||
|         klog() << "GPTPartitionTable::initialize: bad gpt signature - not initalized? 0x" << String::format("%x", header.sig); |         klog() << "GPTPartitionTable::initialize: bad gpt signature - not initialized? 0x" << String::format("%x", header.sig); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -90,7 +90,7 @@ RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index) | ||||||
|     auto& entry = header.entry[index - 1]; |     auto& entry = header.entry[index - 1]; | ||||||
| 
 | 
 | ||||||
|     if (header.mbr_signature != MBR_SIGNATURE) { |     if (header.mbr_signature != MBR_SIGNATURE) { | ||||||
|         klog() << "MBRPartitionTable::initialize: bad mbr signature - not initalized? 0x" << String::format("%x", header.mbr_signature); |         klog() << "MBRPartitionTable::initialize: bad mbr signature - not initialized? 0x" << String::format("%x", header.mbr_signature); | ||||||
|         return nullptr; |         return nullptr; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -181,7 +181,7 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBu | ||||||
|         if (m_content.has_value() && m_content.value().capacity() >= (size_t)new_size) { |         if (m_content.has_value() && m_content.value().capacity() >= (size_t)new_size) { | ||||||
|             m_content.value().set_size(new_size); |             m_content.value().set_size(new_size); | ||||||
|         } else { |         } else { | ||||||
|             // Grow the content buffer 2x the new sizeto accomodate repeating write() calls.
 |             // Grow the content buffer 2x the new sizeto accommodate repeating write() calls.
 | ||||||
|             // Note that we're not actually committing physical memory to the buffer
 |             // Note that we're not actually committing physical memory to the buffer
 | ||||||
|             // until it's needed. We only grow VM here.
 |             // until it's needed. We only grow VM here.
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -359,7 +359,7 @@ void RTL8139NetworkAdapter::receive() | ||||||
| 
 | 
 | ||||||
|     // we never have to worry about the packet wrapping around the buffer,
 |     // we never have to worry about the packet wrapping around the buffer,
 | ||||||
|     // since we set RXCFG_WRAP_INHIBIT, which allows the rtl8139 to write data
 |     // since we set RXCFG_WRAP_INHIBIT, which allows the rtl8139 to write data
 | ||||||
|     // past the end of the alloted space.
 |     // past the end of the allotted space.
 | ||||||
|     memcpy(m_packet_buffer->vaddr().as_ptr(), (const u8*)(start_of_packet + 4), length - 4); |     memcpy(m_packet_buffer->vaddr().as_ptr(), (const u8*)(start_of_packet + 4), length - 4); | ||||||
|     // let the card know that we've read this data
 |     // let the card know that we've read this data
 | ||||||
|     m_rx_buffer_offset = ((m_rx_buffer_offset + length + 4 + 3) & ~3) % RX_BUFFER_SIZE; |     m_rx_buffer_offset = ((m_rx_buffer_offset + length + 4 + 3) & ~3) % RX_BUFFER_SIZE; | ||||||
|  |  | ||||||
|  | @ -397,7 +397,7 @@ void signal_trampoline_dummy(void) | ||||||
|     // then calls the signal handler. We do this because, when interrupting a
 |     // then calls the signal handler. We do this because, when interrupting a
 | ||||||
|     // blocking syscall, that syscall may return some special error code in eax;
 |     // blocking syscall, that syscall may return some special error code in eax;
 | ||||||
|     // This error code would likely be overwritten by the signal handler, so it's
 |     // This error code would likely be overwritten by the signal handler, so it's
 | ||||||
|     // neccessary to preserve it here.
 |     // necessary to preserve it here.
 | ||||||
|     asm( |     asm( | ||||||
|         ".intel_syntax noprefix\n" |         ".intel_syntax noprefix\n" | ||||||
|         "asm_signal_trampoline:\n" |         "asm_signal_trampoline:\n" | ||||||
|  |  | ||||||
|  | @ -699,7 +699,7 @@ void Scheduler::enter_current(Thread& prev_thread) | ||||||
| 
 | 
 | ||||||
| void Scheduler::leave_on_first_switch(u32 flags) | void Scheduler::leave_on_first_switch(u32 flags) | ||||||
| { | { | ||||||
|     // This is called when a thread is swiched into for the first time.
 |     // This is called when a thread is switched into for the first time.
 | ||||||
|     // At this point, enter_current has already be called, but because
 |     // At this point, enter_current has already be called, but because
 | ||||||
|     // Scheduler::context_switch is not in the call stack we need to
 |     // Scheduler::context_switch is not in the call stack we need to
 | ||||||
|     // clean up and release locks manually here
 |     // clean up and release locks manually here
 | ||||||
|  |  | ||||||
|  | @ -104,8 +104,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve | ||||||
|     InodeMetadata loader_metadata; |     InodeMetadata loader_metadata; | ||||||
| 
 | 
 | ||||||
|     // FIXME: Hoooo boy this is a hack if I ever saw one.
 |     // FIXME: Hoooo boy this is a hack if I ever saw one.
 | ||||||
|     //      This is the 'random' offset we're giving to our ET_DYN exectuables to start as.
 |     //      This is the 'random' offset we're giving to our ET_DYN executables to start as.
 | ||||||
|     //      It also happens to be the static Virtual Addresss offset every static exectuable gets :)
 |     //      It also happens to be the static Virtual Address offset every static executable gets :)
 | ||||||
|     //      Without this, some assumptions by the ELF loading hooks below are severely broken.
 |     //      Without this, some assumptions by the ELF loading hooks below are severely broken.
 | ||||||
|     //      0x08000000 is a verified random number chosen by random dice roll https://xkcd.com/221/
 |     //      0x08000000 is a verified random number chosen by random dice roll https://xkcd.com/221/
 | ||||||
|     m_load_offset = interpreter_description ? 0x08000000 : 0; |     m_load_offset = interpreter_description ? 0x08000000 : 0; | ||||||
|  | @ -113,7 +113,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve | ||||||
|     // FIXME: We should be able to load both the PT_INTERP interpreter and the main program... once the RTLD is smart enough
 |     // FIXME: We should be able to load both the PT_INTERP interpreter and the main program... once the RTLD is smart enough
 | ||||||
|     if (interpreter_description) { |     if (interpreter_description) { | ||||||
|         loader_metadata = interpreter_description->metadata(); |         loader_metadata = interpreter_description->metadata(); | ||||||
|         // we don't need the interpreter file desciption after we've loaded (or not) it into memory
 |         // we don't need the interpreter file description after we've loaded (or not) it into memory
 | ||||||
|         interpreter_description = nullptr; |         interpreter_description = nullptr; | ||||||
|     } else { |     } else { | ||||||
|         loader_metadata = main_program_description->metadata(); |         loader_metadata = main_program_description->metadata(); | ||||||
|  | @ -176,10 +176,10 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve | ||||||
| 
 | 
 | ||||||
|         // FIXME: Move TLS region allocation to userspace: LibC and the dynamic loader.
 |         // FIXME: Move TLS region allocation to userspace: LibC and the dynamic loader.
 | ||||||
|         //     LibC if we end up with a statically linked executable, and the
 |         //     LibC if we end up with a statically linked executable, and the
 | ||||||
|         //     dynamic loader so that it can create new TLS blocks for each shared libarary
 |         //     dynamic loader so that it can create new TLS blocks for each shared library
 | ||||||
|         //     that gets loaded as part of DT_NEEDED processing, and via dlopen()
 |         //     that gets loaded as part of DT_NEEDED processing, and via dlopen()
 | ||||||
|         //     If that doesn't happen quickly, at least pass the location of the TLS region
 |         //     If that doesn't happen quickly, at least pass the location of the TLS region
 | ||||||
|         //     some ELF Auxilliary Vector so the loader can use it/create new ones as necessary.
 |         //     some ELF Auxiliary Vector so the loader can use it/create new ones as necessary.
 | ||||||
|         loader->tls_section_hook = [&](size_t size, size_t alignment) { |         loader->tls_section_hook = [&](size_t size, size_t alignment) { | ||||||
|             ASSERT(size); |             ASSERT(size); | ||||||
|             master_tls_region = allocate_region({}, size, String(), PROT_READ | PROT_WRITE); |             master_tls_region = allocate_region({}, size, String(), PROT_READ | PROT_WRITE); | ||||||
|  | @ -195,7 +195,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve | ||||||
|         } |         } | ||||||
|         // FIXME: Validate that this virtual address is within executable region,
 |         // FIXME: Validate that this virtual address is within executable region,
 | ||||||
|         //     instead of just non-null. You could totally have a DSO with entry point of
 |         //     instead of just non-null. You could totally have a DSO with entry point of
 | ||||||
|         //     the beginning of the text segement.
 |         //     the beginning of the text segment.
 | ||||||
|         if (!loader->entry().offset(m_load_offset).get()) { |         if (!loader->entry().offset(m_load_offset).get()) { | ||||||
|             klog() << "do_exec: Failure loading " << path.characters() << ", entry pointer is invalid! (" << loader->entry().offset(m_load_offset) << ")"; |             klog() << "do_exec: Failure loading " << path.characters() << ", entry pointer is invalid! (" << loader->entry().offset(m_load_offset) << ")"; | ||||||
|             return -ENOEXEC; |             return -ENOEXEC; | ||||||
|  |  | ||||||
|  | @ -55,7 +55,7 @@ void TTY::set_default_termios() | ||||||
| KResultOr<size_t> TTY::read(FileDescription&, size_t, UserOrKernelBuffer& buffer, size_t size) | KResultOr<size_t> TTY::read(FileDescription&, size_t, UserOrKernelBuffer& buffer, size_t size) | ||||||
| { | { | ||||||
|     if (Process::current()->pgid() != pgid()) { |     if (Process::current()->pgid() != pgid()) { | ||||||
|         // FIXME: Should we propigate this error path somehow?
 |         // FIXME: Should we propagate this error path somehow?
 | ||||||
|         (void)Process::current()->send_signal(SIGTTIN, nullptr); |         (void)Process::current()->send_signal(SIGTTIN, nullptr); | ||||||
|         return KResult(-EINTR); |         return KResult(-EINTR); | ||||||
|     } |     } | ||||||
|  | @ -204,7 +204,7 @@ void TTY::emit(u8 ch) | ||||||
| bool TTY::can_do_backspace() const | bool TTY::can_do_backspace() const | ||||||
| { | { | ||||||
|     // can't do back space if we're empty. Plus, we don't want to
 |     // can't do back space if we're empty. Plus, we don't want to
 | ||||||
|     //removing any lines "commited" by newlines or ^D.
 |     // remove any lines "committed" by newlines or ^D.
 | ||||||
|     if (!m_input_buffer.is_empty() && !is_eol(m_input_buffer.last()) && m_input_buffer.last() != '\0') { |     if (!m_input_buffer.is_empty() && !is_eol(m_input_buffer.last()) && m_input_buffer.last() != '\0') { | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -231,7 +231,7 @@ void Thread::relock_process(bool did_unlock) | ||||||
|         process().big_lock().lock(); |         process().big_lock().lock(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // NOTE: We may be on a differenct CPU now!
 |     // NOTE: We may be on a different CPU now!
 | ||||||
|     Processor::current().restore_critical(prev_crit, prev_flags); |     Processor::current().restore_critical(prev_crit, prev_flags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -65,7 +65,7 @@ void RealTimeClock::reset_to_default_ticks_per_second() | ||||||
|     ASSERT(success); |     ASSERT(success); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // FIXME: This is a quick & dirty log base 2 with a paramater. Please provide something better in the future.
 | // FIXME: This is a quick & dirty log base 2 with a parameter. Please provide something better in the future.
 | ||||||
| static int quick_log2(size_t number) | static int quick_log2(size_t number) | ||||||
| { | { | ||||||
|     int count = 0; |     int count = 0; | ||||||
|  |  | ||||||
|  | @ -536,9 +536,9 @@ Board::Result Board::game_result() const | ||||||
|         auto repeats = m_previous_states.get(*this); |         auto repeats = m_previous_states.get(*this); | ||||||
|         if (repeats.has_value()) { |         if (repeats.has_value()) { | ||||||
|             if (repeats.value() == 3) |             if (repeats.value() == 3) | ||||||
|                 return Result::ThreeFoldRepitition; |                 return Result::ThreeFoldRepetition; | ||||||
|             if (repeats.value() >= 5) |             if (repeats.value() >= 5) | ||||||
|                 return Result::FiveFoldRepitition; |                 return Result::FiveFoldRepetition; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return Result::NotFinished; |         return Result::NotFinished; | ||||||
|  |  | ||||||
|  | @ -137,8 +137,8 @@ public: | ||||||
|         StaleMate, |         StaleMate, | ||||||
|         FiftyMoveRule, |         FiftyMoveRule, | ||||||
|         SeventyFiveMoveRule, |         SeventyFiveMoveRule, | ||||||
|         ThreeFoldRepitition, |         ThreeFoldRepetition, | ||||||
|         FiveFoldRepitition, |         FiveFoldRepetition, | ||||||
|         InsufficientMaterial, |         InsufficientMaterial, | ||||||
|         NotFinished, |         NotFinished, | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ | ||||||
| namespace Debug { | namespace Debug { | ||||||
| 
 | 
 | ||||||
| DebugSession::DebugSession(int pid) | DebugSession::DebugSession(int pid) | ||||||
|     : m_debugee_pid(pid) |     : m_debuggee_pid(pid) | ||||||
|     , m_executable(initialize_executable_mapped_file(pid)) |     , m_executable(initialize_executable_mapped_file(pid)) | ||||||
|     , m_elf(ELF::Loader::create(reinterpret_cast<const u8*>(m_executable->data()), m_executable->size())) |     , m_elf(ELF::Loader::create(reinterpret_cast<const u8*>(m_executable->data()), m_executable->size())) | ||||||
|     , m_debug_info(m_elf) |     , m_debug_info(m_elf) | ||||||
|  | @ -47,7 +47,7 @@ NonnullOwnPtr<const MappedFile> DebugSession::initialize_executable_mapped_file( | ||||||
| 
 | 
 | ||||||
| DebugSession::~DebugSession() | DebugSession::~DebugSession() | ||||||
| { | { | ||||||
|     if (m_is_debugee_dead) |     if (m_is_debuggee_dead) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     for (const auto& bp : m_breakpoints) { |     for (const auto& bp : m_breakpoints) { | ||||||
|  | @ -55,7 +55,7 @@ DebugSession::~DebugSession() | ||||||
|     } |     } | ||||||
|     m_breakpoints.clear(); |     m_breakpoints.clear(); | ||||||
| 
 | 
 | ||||||
|     if (ptrace(PT_DETACH, m_debugee_pid, 0, 0) < 0) { |     if (ptrace(PT_DETACH, m_debuggee_pid, 0, 0) < 0) { | ||||||
|         perror("PT_DETACH"); |         perror("PT_DETACH"); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -118,7 +118,7 @@ OwnPtr<DebugSession> DebugSession::exec_and_attach(const String& command) | ||||||
| 
 | 
 | ||||||
| bool DebugSession::poke(u32* address, u32 data) | bool DebugSession::poke(u32* address, u32 data) | ||||||
| { | { | ||||||
|     if (ptrace(PT_POKE, m_debugee_pid, (void*)address, data) < 0) { |     if (ptrace(PT_POKE, m_debuggee_pid, (void*)address, data) < 0) { | ||||||
|         perror("PT_POKE"); |         perror("PT_POKE"); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|  | @ -128,7 +128,7 @@ bool DebugSession::poke(u32* address, u32 data) | ||||||
| Optional<u32> DebugSession::peek(u32* address) const | Optional<u32> DebugSession::peek(u32* address) const | ||||||
| { | { | ||||||
|     Optional<u32> result; |     Optional<u32> result; | ||||||
|     int rc = ptrace(PT_PEEK, m_debugee_pid, (void*)address, 0); |     int rc = ptrace(PT_PEEK, m_debuggee_pid, (void*)address, 0); | ||||||
|     if (errno == 0) |     if (errno == 0) | ||||||
|         result = static_cast<u32>(rc); |         result = static_cast<u32>(rc); | ||||||
|     return result; |     return result; | ||||||
|  | @ -205,7 +205,7 @@ bool DebugSession::breakpoint_exists(void* address) const | ||||||
| PtraceRegisters DebugSession::get_registers() const | PtraceRegisters DebugSession::get_registers() const | ||||||
| { | { | ||||||
|     PtraceRegisters regs; |     PtraceRegisters regs; | ||||||
|     if (ptrace(PT_GETREGS, m_debugee_pid, ®s, 0) < 0) { |     if (ptrace(PT_GETREGS, m_debuggee_pid, ®s, 0) < 0) { | ||||||
|         perror("PT_GETREGS"); |         perror("PT_GETREGS"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  | @ -214,26 +214,26 @@ PtraceRegisters DebugSession::get_registers() const | ||||||
| 
 | 
 | ||||||
| void DebugSession::set_registers(const PtraceRegisters& regs) | void DebugSession::set_registers(const PtraceRegisters& regs) | ||||||
| { | { | ||||||
|     if (ptrace(PT_SETREGS, m_debugee_pid, reinterpret_cast<void*>(&const_cast<PtraceRegisters&>(regs)), 0) < 0) { |     if (ptrace(PT_SETREGS, m_debuggee_pid, reinterpret_cast<void*>(&const_cast<PtraceRegisters&>(regs)), 0) < 0) { | ||||||
|         perror("PT_SETREGS"); |         perror("PT_SETREGS"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void DebugSession::continue_debugee(ContinueType type) | void DebugSession::continue_debuggee(ContinueType type) | ||||||
| { | { | ||||||
|     int command = (type == ContinueType::FreeRun) ? PT_CONTINUE : PT_SYSCALL; |     int command = (type == ContinueType::FreeRun) ? PT_CONTINUE : PT_SYSCALL; | ||||||
|     if (ptrace(command, m_debugee_pid, 0, 0) < 0) { |     if (ptrace(command, m_debuggee_pid, 0, 0) < 0) { | ||||||
|         perror("continue"); |         perror("continue"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| int DebugSession::continue_debugee_and_wait(ContinueType type) | int DebugSession::continue_debuggee_and_wait(ContinueType type) | ||||||
| { | { | ||||||
|     continue_debugee(type); |     continue_debuggee(type); | ||||||
|     int wstatus = 0; |     int wstatus = 0; | ||||||
|     if (waitpid(m_debugee_pid, &wstatus, WSTOPPED | WEXITED) != m_debugee_pid) { |     if (waitpid(m_debuggee_pid, &wstatus, WSTOPPED | WEXITED) != m_debuggee_pid) { | ||||||
|         perror("waitpid"); |         perror("waitpid"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  | @ -245,17 +245,17 @@ void* DebugSession::single_step() | ||||||
|     // Single stepping works by setting the x86 TRAP flag bit in the eflags register.
 |     // Single stepping works by setting the x86 TRAP flag bit in the eflags register.
 | ||||||
|     // This flag causes the cpu to enter single-stepping mode, which causes
 |     // This flag causes the cpu to enter single-stepping mode, which causes
 | ||||||
|     // Interrupt 1 (debug interrupt) to be emitted after every instruction.
 |     // Interrupt 1 (debug interrupt) to be emitted after every instruction.
 | ||||||
|     // To single step the program, we set the TRAP flag and continue the debugee.
 |     // To single step the program, we set the TRAP flag and continue the debuggee.
 | ||||||
|     // After the debugee has stopped, we clear the TRAP flag.
 |     // After the debuggee has stopped, we clear the TRAP flag.
 | ||||||
| 
 | 
 | ||||||
|     auto regs = get_registers(); |     auto regs = get_registers(); | ||||||
|     constexpr u32 TRAP_FLAG = 0x100; |     constexpr u32 TRAP_FLAG = 0x100; | ||||||
|     regs.eflags |= TRAP_FLAG; |     regs.eflags |= TRAP_FLAG; | ||||||
|     set_registers(regs); |     set_registers(regs); | ||||||
| 
 | 
 | ||||||
|     continue_debugee(); |     continue_debuggee(); | ||||||
| 
 | 
 | ||||||
|     if (waitpid(m_debugee_pid, 0, WSTOPPED) != m_debugee_pid) { |     if (waitpid(m_debuggee_pid, 0, WSTOPPED) != m_debuggee_pid) { | ||||||
|         perror("waitpid"); |         perror("waitpid"); | ||||||
|         ASSERT_NOT_REACHED(); |         ASSERT_NOT_REACHED(); | ||||||
|     } |     } | ||||||
|  | @ -271,7 +271,7 @@ void DebugSession::detach() | ||||||
|     for (auto& breakpoint : m_breakpoints.keys()) { |     for (auto& breakpoint : m_breakpoints.keys()) { | ||||||
|         remove_breakpoint(breakpoint); |         remove_breakpoint(breakpoint); | ||||||
|     } |     } | ||||||
|     continue_debugee(); |     continue_debuggee(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ public: | ||||||
|     DebugSession(int pid); |     DebugSession(int pid); | ||||||
|     ~DebugSession(); |     ~DebugSession(); | ||||||
| 
 | 
 | ||||||
|     int pid() const { return m_debugee_pid; } |     int pid() const { return m_debuggee_pid; } | ||||||
| 
 | 
 | ||||||
|     bool poke(u32* address, u32 data); |     bool poke(u32* address, u32 data); | ||||||
|     Optional<u32> peek(u32* address) const; |     Optional<u32> peek(u32* address) const; | ||||||
|  | @ -88,10 +88,10 @@ public: | ||||||
|         FreeRun, |         FreeRun, | ||||||
|         Syscall, |         Syscall, | ||||||
|     }; |     }; | ||||||
|     void continue_debugee(ContinueType type = ContinueType::FreeRun); |     void continue_debuggee(ContinueType type = ContinueType::FreeRun); | ||||||
| 
 | 
 | ||||||
|     // Returns the wstatus result of waitpid()
 |     // Returns the wstatus result of waitpid()
 | ||||||
|     int continue_debugee_and_wait(ContinueType type = ContinueType::FreeRun); |     int continue_debuggee_and_wait(ContinueType type = ContinueType::FreeRun); | ||||||
| 
 | 
 | ||||||
|     // Returns the new eip
 |     // Returns the new eip
 | ||||||
|     void* single_step(); |     void* single_step(); | ||||||
|  | @ -126,8 +126,8 @@ private: | ||||||
| 
 | 
 | ||||||
|     static NonnullOwnPtr<const MappedFile> initialize_executable_mapped_file(int pid); |     static NonnullOwnPtr<const MappedFile> initialize_executable_mapped_file(int pid); | ||||||
| 
 | 
 | ||||||
|     int m_debugee_pid { -1 }; |     int m_debuggee_pid { -1 }; | ||||||
|     bool m_is_debugee_dead { false }; |     bool m_is_debuggee_dead { false }; | ||||||
| 
 | 
 | ||||||
|     NonnullOwnPtr<const MappedFile> m_executable; |     NonnullOwnPtr<const MappedFile> m_executable; | ||||||
|     NonnullRefPtr<const ELF::Loader> m_elf; |     NonnullRefPtr<const ELF::Loader> m_elf; | ||||||
|  | @ -150,13 +150,13 @@ void DebugSession::run(Callback callback) | ||||||
|     State state { State::FreeRun }; |     State state { State::FreeRun }; | ||||||
| 
 | 
 | ||||||
|     auto do_continue_and_wait = [&]() { |     auto do_continue_and_wait = [&]() { | ||||||
|         int wstatus = continue_debugee_and_wait((state == State::FreeRun) ? ContinueType::FreeRun : ContinueType::Syscall); |         int wstatus = continue_debuggee_and_wait((state == State::FreeRun) ? ContinueType::FreeRun : ContinueType::Syscall); | ||||||
| 
 | 
 | ||||||
|         // FIXME: This check actually only checks whether the debugee
 |         // FIXME: This check actually only checks whether the debuggee
 | ||||||
|         // stopped because it hit a breakpoint/syscall/is in single stepping mode or not
 |         // stopped because it hit a breakpoint/syscall/is in single stepping mode or not
 | ||||||
|         if (WSTOPSIG(wstatus) != SIGTRAP) { |         if (WSTOPSIG(wstatus) != SIGTRAP) { | ||||||
|             callback(DebugBreakReason::Exited, Optional<PtraceRegisters>()); |             callback(DebugBreakReason::Exited, Optional<PtraceRegisters>()); | ||||||
|             m_is_debugee_dead = true; |             m_is_debuggee_dead = true; | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|         return false; |         return false; | ||||||
|  |  | ||||||
|  | @ -618,7 +618,7 @@ typedef struct { | ||||||
|  *	NT_OPENBSD_PROCINFO |  *	NT_OPENBSD_PROCINFO | ||||||
|  *		Note is a "elfcore_procinfo" structure. |  *		Note is a "elfcore_procinfo" structure. | ||||||
|  *	NT_OPENBSD_AUXV |  *	NT_OPENBSD_AUXV | ||||||
|  *		Note is a a bunch of Auxilliary Vectors, terminated by |  *		Note is a a bunch of Auxiliary Vectors, terminated by | ||||||
|  *		an AT_NULL entry. |  *		an AT_NULL entry. | ||||||
|  *	NT_OPENBSD_REGS |  *	NT_OPENBSD_REGS | ||||||
|  *		Note is a "reg" structure. |  *		Note is a "reg" structure. | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) | ||||||
| cd "$script_path/.." || exit 1 | cd "$script_path/.." || exit 1 | ||||||
| 
 | 
 | ||||||
| # The __cxa_guard_* calls are generated for (non trivial) initialzation of local static objects. | # The __cxa_guard_* calls are generated for (non trivial) initialization of local static objects. | ||||||
| # These symbols are OK to use within serenity code, but they are problematic in LibC because their | # These symbols are OK to use within serenity code, but they are problematic in LibC because their | ||||||
| # existence breaks ports (the implementation of these symbols resides in libstdc++.a which we do not link against in ports). | # existence breaks ports (the implementation of these symbols resides in libstdc++.a which we do not link against in ports). | ||||||
| # To eliminate the need for these symbols, avoid doing non-trivial construction of local statics in LibC. | # To eliminate the need for these symbols, avoid doing non-trivial construction of local statics in LibC. | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ ERRORS=() | ||||||
| while IFS= read -r f; do | while IFS= read -r f; do | ||||||
|     if file "$f" | grep --quiet shell; then |     if file "$f" | grep --quiet shell; then | ||||||
|         { |         { | ||||||
|             shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: sucessfully linted $f" |             shellcheck "$f" && echo -e "[\033[0;32mOK\033[0m]: successfully linted $f" | ||||||
|         } || { |         } || { | ||||||
|             ERRORS+=("$f") |             ERRORS+=("$f") | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -41,7 +41,7 @@ GeminiDownload::GeminiDownload(ClientConnection& client, NonnullRefPtr<Gemini::G | ||||||
|                 HashMap<String, String, CaseInsensitiveStringTraits> headers; |                 HashMap<String, String, CaseInsensitiveStringTraits> headers; | ||||||
|                 headers.set("meta", response->meta()); |                 headers.set("meta", response->meta()); | ||||||
|                 // Note: We're setting content-type to meta only on status==SUCCESS
 |                 // Note: We're setting content-type to meta only on status==SUCCESS
 | ||||||
|                 //       we should prehaps have a better mechanism for this, since we
 |                 //       we should perhaps have a better mechanism for this, since we
 | ||||||
|                 //       are already shoehorning the concept of "headers" here
 |                 //       are already shoehorning the concept of "headers" here
 | ||||||
|                 if (response->status() >= 20 && response->status() < 30) { |                 if (response->status() >= 20 && response->status() < 30) { | ||||||
|                     headers.set("content-type", response->meta()); |                     headers.set("content-type", response->meta()); | ||||||
|  |  | ||||||
|  | @ -99,7 +99,7 @@ void Client::handle_command(const Command& command) | ||||||
|         // them can be disabled (or re-enabled) after connecting.
 |         // them can be disabled (or re-enabled) after connecting.
 | ||||||
|         break; |         break; | ||||||
|     case CMD_DONT: |     case CMD_DONT: | ||||||
|         // no response - we only "support" two options (echo and suppres
 |         // no response - we only "support" two options (echo and suppress
 | ||||||
|         // go-ahead), and both of them are always enabled.
 |         // go-ahead), and both of them are always enabled.
 | ||||||
|         break; |         break; | ||||||
|     case CMD_WILL: |     case CMD_WILL: | ||||||
|  |  | ||||||
|  | @ -207,7 +207,7 @@ OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(con | ||||||
|         auto icon_buffer = SharedBuffer::create_from_shbuf_id(message.icon_buffer_id()); |         auto icon_buffer = SharedBuffer::create_from_shbuf_id(message.icon_buffer_id()); | ||||||
|         if (!icon_buffer) |         if (!icon_buffer) | ||||||
|             return nullptr; |             return nullptr; | ||||||
|         // FIXME: Verify that the icon buffer can accomodate a 16x16 bitmap view.
 |         // FIXME: Verify that the icon buffer can accommodate a 16x16 bitmap view.
 | ||||||
|         auto shared_icon = Gfx::Bitmap::create_with_shared_buffer(Gfx::BitmapFormat::RGBA32, icon_buffer.release_nonnull(), { 16, 16 }); |         auto shared_icon = Gfx::Bitmap::create_with_shared_buffer(Gfx::BitmapFormat::RGBA32, icon_buffer.release_nonnull(), { 16, 16 }); | ||||||
|         menu_item->set_icon(shared_icon); |         menu_item->set_icon(shared_icon); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -476,10 +476,10 @@ bool Menu::activate_default() | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| MenuItem* Menu::item_with_identifier(unsigned identifer) | MenuItem* Menu::item_with_identifier(unsigned identifier) | ||||||
| { | { | ||||||
|     for (auto& item : m_items) { |     for (auto& item : m_items) { | ||||||
|         if (item.identifier() == identifer) |         if (item.identifier() == identifier) | ||||||
|             return &item; |             return &item; | ||||||
|     } |     } | ||||||
|     return nullptr; |     return nullptr; | ||||||
|  |  | ||||||
|  | @ -1282,7 +1282,7 @@ RefPtr<AST::Node> Parser::parse_bareword() | ||||||
|             text = create<AST::BarewordLiteral>(move(string)); |             text = create<AST::BarewordLiteral>(move(string)); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return create<AST::Juxtaposition>(tilde.release_nonnull(), text.release_nonnull()); // Juxtaposition Varible Bareword
 |         return create<AST::Juxtaposition>(tilde.release_nonnull(), text.release_nonnull()); // Juxtaposition Variable Bareword
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (string.starts_with("\\~")) { |     if (string.starts_with("\\~")) { | ||||||
|  |  | ||||||
|  | @ -194,7 +194,7 @@ list_expression :: ' '* expression (' '+ list_expression)? | ||||||
| 
 | 
 | ||||||
| expression :: evaluate expression? | expression :: evaluate expression? | ||||||
|             | string_composite expression? |             | string_composite expression? | ||||||
|             | comment expession? |             | comment expression? | ||||||
|             | '(' list_expression ')' expression? |             | '(' list_expression ')' expression? | ||||||
| 
 | 
 | ||||||
| evaluate :: '$' '(' pipe_sequence ')' | evaluate :: '$' '(' pipe_sequence ')' | ||||||
|  |  | ||||||
|  | @ -62,7 +62,7 @@ | ||||||
|  * - Time 6: PB1 forks into PB2 |  * - Time 6: PB1 forks into PB2 | ||||||
|  * - Time 7: PB1 dies (PGB now has no leader) |  * - Time 7: PB1 dies (PGB now has no leader) | ||||||
|  * - Time 8: PB2 calls pgrp(0, PGA) |  * - Time 8: PB2 calls pgrp(0, PGA) | ||||||
|  *     Note: PB2 writes "1" (exploit successfull) or "0" (bug is fixed) to a pipe |  *     Note: PB2 writes "1" (exploit successful) or "0" (bug is fixed) to a pipe | ||||||
|  * - Time 9: If PX hasn't received any message yet through the pipe, it declares the test as failed (for lack of knowledge). Otherwise, it outputs accordingly. |  * - Time 9: If PX hasn't received any message yet through the pipe, it declares the test as failed (for lack of knowledge). Otherwise, it outputs accordingly. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | @ -246,7 +246,7 @@ static void run_pb2(void* pipe_fd_ptr) | ||||||
|     sleep_steps(2); |     sleep_steps(2); | ||||||
| 
 | 
 | ||||||
|     // Time 8: PB2 calls pgrp(0, PGA)
 |     // Time 8: PB2 calls pgrp(0, PGA)
 | ||||||
|     //   Note: PB2 writes "1" (exploit successfull) or "0" (bug is fixed) to a pipe
 |     //   Note: PB2 writes "1" (exploit successful) or "0" (bug is fixed) to a pipe
 | ||||||
|     dbg() << "PB2 starts with SID=" << getsid(0) << ", PGID=" << getpgid(0) << ", PID=" << getpid() << "."; |     dbg() << "PB2 starts with SID=" << getsid(0) << ", PGID=" << getpgid(0) << ", PID=" << getpid() << "."; | ||||||
|     dbg() << "PB2 calls pgrp(0, PGA)"; |     dbg() << "PB2 calls pgrp(0, PGA)"; | ||||||
|     int pga = getpid() - 3; |     int pga = getpid() - 3; | ||||||
|  |  | ||||||
|  | @ -48,7 +48,7 @@ | ||||||
| class Mask { | class Mask { | ||||||
| private: | private: | ||||||
|     mode_t removal_mask;  // the bits that will be removed
 |     mode_t removal_mask;  // the bits that will be removed
 | ||||||
|     mode_t applying_mask; //the bits that will be setted
 |     mode_t applying_mask; // the bits that will be set
 | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     Mask() |     Mask() | ||||||
|  | @ -129,7 +129,7 @@ int main(int argc, char** argv) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /* set the mask for each files' permissions */ |     /* set the mask for each file's permissions */ | ||||||
|     struct stat current_access; |     struct stat current_access; | ||||||
|     int i = 2; |     int i = 2; | ||||||
|     while (i < argc) { |     while (i < argc) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh