From c81b16b529eb0ff60b6bdbc7c5f9055cbf1564ba Mon Sep 17 00:00:00 2001 From: "Magomed Kostoev (mkostoevr)" Date: Thu, 8 Jul 2021 19:16:00 +0000 Subject: [PATCH] [KERNEL][TASKMAN] Use named constants instead of magic numbers git-svn-id: svn://kolibrios.org@9036 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 5 +++++ kernel/trunk/core/taskman.inc | 6 +++--- kernel/trunk/fs/fs_lfn.inc | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 3636518ae3..b65429e0be 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -17,6 +17,11 @@ cpl3 = 11111010b ; code read dpl3 D32 = 01000000b ; 32bit segment G32 = 10000000b ; page gran +;;;;;;;;;;; task manager errors ;;;;;;;;;; + +ERROR_OUT_OF_MEMORY = 30 ; 0x1E +ERROR_NOT_A_EXECUTABLE = 31 ; 0x1F +ERROR_TOO_MANY_PROCESSES = 32 ; 0x20 ;;;;;;;;;;;;cpu_caps flags;;;;;;;;;;;;;;;; diff --git a/kernel/trunk/core/taskman.inc b/kernel/trunk/core/taskman.inc index cd031a5545..e7c4695688 100644 --- a/kernel/trunk/core/taskman.inc +++ b/kernel/trunk/core/taskman.inc @@ -115,13 +115,13 @@ proc fs_execute mov [file_size], ebx lea ebx, [hdr_cmdline] call test_app_header ; fill our app header data locals with values from header of given program (if its correct) - mov esi, -0x1F + mov esi, -ERROR_NOT_A_EXECUTABLE test eax, eax jz .err_hdr call lock_application_table call alloc_thread_slot ; create a slot for new thread - mov esi, -0x20 ; too many processes + mov esi, -ERROR_TOO_MANY_PROCESSES test eax, eax jz .err_0 @@ -163,7 +163,7 @@ proc fs_execute @@: mov [cmdline_size], eax stdcall create_process, [hdr_emem] ; create a new process - mov esi, -30 ; no memory + mov esi, -ERROR_OUT_OF_MEMORY test eax, eax jz .err_hdr diff --git a/kernel/trunk/fs/fs_lfn.inc b/kernel/trunk/fs/fs_lfn.inc index be38a520d0..78d7a9e829 100644 --- a/kernel/trunk/fs/fs_lfn.inc +++ b/kernel/trunk/fs/fs_lfn.inc @@ -19,7 +19,6 @@ ERROR_DISK_FULL = 8 ERROR_FS_FAIL = 9 ERROR_ACCESS_DENIED = 10 ERROR_DEVICE = 11 -ERROR_OUT_OF_MEMORY = 12 maxPathLength = 1000h