Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1261 → Rev 1262

/programs/system/launch/trunk/gpl2.txt
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property
/programs/system/launch/trunk/config.inc
0,0 → 1,0
__CPU_type fix p5
/programs/system/launch/trunk/history.txt
1,4 → 1,6
==================== ãá᪨© ====================
0.1.80 (0.2 beta) - vkos
+ Ž¯®¢¥é¥­¨¥ ¢á¥å § ¨­â¥à¥á®¢ ­­ëå (¢å®¤ïé¨å ¢ £à㯯ã launch_reactive) ¯à¨«®¦¥­¨© ç¥à¥§ Kobra
0.1.5 - 25.10.2009 - vkos
* ˆá¯®«ì§®¢ ­¨¥ ä㭪樨 get_option_str ¨§ libini (¯®á«¥¤­¥© ॢ¨§¨¨) ¢¬¥áâ® á ¬®áâ®ï⥫쭮£® à §¡®à 
* ¥à¥å®¤ ­  ­®¢ë¥ ¨¬¥­  ¯à¨ ¨¬¯®à⥠(ᮢ¬¥á⨬®áâì á ¡¨¡«¨®â¥ª ¬¨)
17,6 → 19,8
+ ¥ «¨§®¢ ­® ç⥭¨¥ ª®­ä¨£ãà æ¨¨ ¨ § ¯ã᪠¯à®£à ¬¬ë (¡¥§  à£ã¬¥­â®¢)
 
==================== English ====================
0.1.80 (0.2 beta) - vkos
+ notification all intrested (members of launch_reactive group) applications via Kobra
0.1.5 - 25.10.2009 - vkos
* Using function get_option_str from libini (last revision) instead of independent parsing
* New import names (compatibility with libraries)
/programs/system/launch/trunk/ipc.inc
0,0 → 1,32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
;; This program is free software: you can redistribute it and/or modify it under the terms of ;;
;; the GNU General Public License as published by the Free Software Foundation, either version 3 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; ;;
;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ;;
;; the GNU General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU General Public License along with this program. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is set of functions to work with IPC in KolibriOS ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
IPC_init:
push eax
mov eax, dword [IPC_area]
mov dword [eax], 1
mov dword [eax+4], 8
stdcall event_add_mask, 0x40
pop eax
ret
 
IPC_area:
dd 0
/programs/system/launch/trunk/kobra.inc
0,0 → 1,96
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
;; Kobra is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; General Public License as published by the Free Software Foundation, either version 3 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; Kobra is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
;; General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU General Public License along with Kobra. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is set of functions to work with Kobra daemon ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
define KOBRA_MESSAGE_MAX_LEN 0x100
 
define KOBRA_CMD_REGISTER 'R'
define KOBRA_CMD_JOIN 'J'
define KOBRA_CMD_UNJOIN 'U'
define KOBRA_CMD_SEND 'S'
 
define KOBRA_MESSAGE_LAUNCH_STATE 1
 
kobra_register:
mov eax, kobra_message_area
mov byte [eax], KOBRA_CMD_REGISTER
stdcall thread_find_by_name, kobra_thread_name
test eax, eax
je .error
mov dword [kobra_tid], eax ;; Save tid
mov ecx, eax
mcall 60, 2, , kobra_message_area, 1
test eax, eax
je .return
.error:
inc eax
.return:
ret
 
;; void kobra_send_message(char *group, void *message, int length);
kobra_send_message:
push ebp
mov ebp, esp
cld
mov edi, kobra_message_area
mov al, KOBRA_CMD_SEND
stosb
mov esi, dword [ebp+8]
.copy_group_cycle:
mov al, byte [esi]
test al, al
jz .copy_group_end
movsb
jmp .copy_group_cycle
.copy_group_end:
; xor al, al
stosb
mov esi, dword [ebp+12]
mov ecx, dword [ebp+16]
rep movsb
lea eax, [edi-kobra_message_area]
mcall 60, 2, dword [kobra_tid], kobra_message_area, eax
leave
ret 12
 
kobra_tid:
dd 0
 
kobra_message_area:
rb KOBRA_MESSAGE_MAX_LEN
 
kobra_thread_name:
db "kobra", 0, 0, 0, 0, 0, 0
/programs/system/launch/trunk/launch.asm
1,7 → 1,7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
;; Launch is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; General Public License as published by the Free Software Foundation, either version 2 ;;
;; General Public License as published by the Free Software Foundation, either version 3 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; Launch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
20,7 → 20,7
format binary
 
APP_NAME fix 'Launch'
APP_VERSION fix '0.1.5'
APP_VERSION fix '0.1.60'
 
use32
org 0x0
43,12 → 43,18
define DEBUG_DEFAULT 0
define BUFF_SIZE 1024
 
include '../../../proc32.inc'
include '../../../macros.inc'
include 'proc32.inc'
include 'macros.inc'
include 'libio.inc'
include 'mem.inc'
include 'dll.inc'
 
purge mov
 
include 'thread.inc'
include 'ipc.inc'
include 'kobra.inc'
 
;;--------------------------------------------------------------------------------------------------
;; Basic initialization
START:
111,7 → 117,7
jmp .con_init
 
.console_err:
mov dword [debug_option], 0
mov byte [debug_option], 0
jmp .ok
 
.con_init:
123,15 → 129,14
.read_level:
invoke ini.get_int, etc_cfg, cfg_debug, cfg_level, 0
invoke ini.get_int, path, cfg_debug, cfg_level, eax
mov dword [debug_level], eax
mov byte [debug_level], al
.ok:
 
; read_ini_kobra:
; invoke ini.get_str, etc_cfg, cfg_kobra, cfg_use, kobra_use, KOBRA_USE_MAX_LEN, KOBRA_USE_DEFAULT
; invoke ini.get_str, path, cfg_kobra, cfg_use, kobra_use, KOBRA_USE_MAX_LEN, kobra_use
;
; ;; Now convert string option to acceptable type
read_ini_kobra:
invoke ini.get_bool, etc_cfg, cfg_kobra, cfg_use, 0
invoke ini.get_bool, path, cfg_kobra, cfg_use, eax
mov byte [kobra_use], al
 
;;--------------------------------------------------------------------------------------------------
;; Parse command line options
182,11 → 187,11
; dec al
test al, al
je .prn_stp
mov eax, dword [debug_level]
or eax, eax
mov al, byte [debug_level]
or al, al
je .prn_stp
dec eax
or eax, eax
dec al
or al, al
je .prn_1
.prn_1:
cinvoke con.printf, message_dbg_not_found, buff
238,14 → 243,14
;;--------------------------------------------------------------------------------------------------
;; Exit
exit:
push eax
mov dword [tid], eax
;; If console is present we should write some info
mov al, byte [debug_option]
cmp al, DEBUG_CONSOLE
jne .close
jne .kobra
 
.write_console:
pop eax
mov eax, dword [tid]
test eax, eax
jz .write_error
.write_launched:
257,6 → 262,32
.wr_end:
invoke con.exit, 0
 
.kobra:
mov al, byte [kobra_use]
test al, al
je .close
.register:
mov dword [IPC_area], buff
call IPC_init
; jnz .close
mov dword [thread_find_buff], another_buff
call kobra_register
test eax, eax
jnz .close
;; Prepare message
mov dword [kobra_message], KOBRA_MESSAGE_LAUNCH_STATE
mov eax, dword [tid]
mov dword [kobra_message+4], eax
.kobra_send:
stdcall kobra_send_message, kobra_group_launch_reactive, kobra_message, 8
 
.close:
mcall -1
 
263,6 → 294,8
;; End of code
;;--------------------------------------------------------------------------------------------------
 
;;--------------------------------------------------------------------------------------------------
;; Imports
align 16
importTable:
 
276,7 → 309,8
\; ini.set_int ,'ini_set_int', \
\; ini.get_color ,'ini_get_color', \
\; ini.set_color ,'ini_set_color', \
ini.get_option_str ,'ini_get_option_str';, \
ini.get_option_str ,'ini_get_option_str', \
ini.get_bool ,'ini_get_bool';,\
 
;import libio, \
; file_find_first,'file_find_first', \
302,6 → 336,8
con.printf, 'con_printf' ;,\
; con.write_asciiz, 'con_write_asciiz'
 
;;--------------------------------------------------------------------------------------------------
;; Data
align 16
APP_DATA:
 
317,12 → 353,8
db 'File (%s) not found!', 0
 
message_ok:
db '%s loaded succesfully. PID: %d (0x%X)'
db '%s loaded succesfully. PID: %d (0x%X)', 0
 
;; Empty string
empty_str:
db 0
 
;; Configuration path
etc_cfg:
db '/sys/etc/'
331,7 → 363,7
cfg_ext:
db '.cfg', 0
 
;; String in config file
;; Strings in config file
cfg_main:
db 'main', 0
cfg_path:
340,6 → 372,10
db 'debug', 0
cfg_level:
db 'level', 0
cfg_kobra:
db 'kobra', 0
cfg_use:
db 'use', 0
 
;; List of debug modes for parsing debug option
debug_strings:
352,19 → 388,32
debug_console:
db 'console', 0
 
; modes_nums:
; debug_no_num:
; db 1
;
; debug_console_num:
; db 2
;; Empty string
empty_str:
db 0
 
kobra_group_launch_reactive:
db 'launch_reactive', 0
 
;;--------------------------------------------------------------------------------------------------
;; Configuration options
debug_level:
dd 0
db 0
 
debug_kobra:
; debug_kobra:
; db 0
 
;; debug option (bool)
debug_option:
db 0
 
kobra_use:
db 0
 
;;--------------------------------------------------------------------------------------------------
tid:
dd 0
 
LaunchStruct FileInfoRun
 
args: db 0
380,14 → 429,16
search_path:
rb PATH_MAX_LEN
 
;; debug option as number
debug_option:
dd 0
 
;; Buffer
buff:
rb BUFF_SIZE
 
another_buff:
rb 0x1000
 
kobra_message:
rb 0x100
 
rb 0x1000 ;; 4 Kb stack
APP_STACK:
MEM_END:
/programs/system/launch/trunk/launch.cfg
10,3 → 10,17
 
# level: 0 - show only ok/error messages, 1 - show for each directory
level=1
 
# Debug kobra messages? (only if kobra using is enabled) (this is not working now)
kobra=yes
 
[kobra]
# Register&use Kobra or not
use=yes
 
# Next options aren't used now
# Main group
group=launch
 
# Send messages?
send=yes
/programs/system/launch/trunk/readme.txt
1,26 → 1,33
==================== ãá᪨© ====================
‚¥àá¨ï: 0.1.5
‚¥àá¨ï: 0.1.80 (0.2 beta)
Launch - ¯à®£à ¬¬  ¤«ï § ¯ã᪠ ¯à¨«®¦¥­¨ï ¨§ ¤¨à¥ªâ®à¨© ¯®¨áª .
à¨ § ¯ã᪥ ç¨â ¥â ä ©« launch.cfg ¢ /sys/etc, § â¥¬ ¢ ¤¨à¥ªâ®à¨¨ § ¯ã᪠.
®á«¥ í⮣® ᬮâà¨â ¯ à ¬¥âàë ª®¬ ­¤­®© áâப¨. à¨®à¨â¥â ¯ à ¬¥â஢ - ¯®
¯®à浪ã áç¨â뢠­¨ï.
ˆ§ ¯ à ¬¥â஢ ª®¬ ­¤­®© áâப¨ ¯®ª  ॠ«¨§®¢ ­® ⮫쪮 ¨¬ï ¯à®£à ¬¬ë ¨  à£ã¬¥­âë, ¯¥à¥¤ ¢ ¥¬ë¥ ¥©.
à¨ ¢ª«îçñ­­®¬ ¨á¯®«ì§®¢ ­¨¨ Kobra ¢á¥ § ¨­â¥à¥á®¢ ­­ë¥ (¢å®¤ï騥 ¢ £à㯯ã launch_reactive) ¯à¨«®¦¥­¨ï ®¯®¢¥é îâáï
¢ á«ãç ¥ ãᯥ譮£® § ¯ã᪠ (¯®áë« ¥âáï á®®¡é¥­¨¥ dword 1 dword tid, tid - ¨¤¥­â¨ä¨ª â®à § ¯ã饭­®£® ¯à®æ¥áá ).
 áâனª¨:
main.path - ¯ãâì ª ¤¨à¥ªâ®à¨ï¬ ¯®¨áª 
debug.debug - ®¯æ¨¨ ®â« ¤ª¨ (no - ­¥â ®â« ¤ª¨ ¨«¨ console - ¢ë¢®¤ ç¥à¥§ ª®­á®«ì)
debug.level - ã஢¥­ì ®â« ¤ª¨ (0 - ⮫쪮 á®®¡é¥­¨¥ 㤠筮/­¥ã¤ ç­®, 1 - ¢ë¢®¤¨âì á®®¡é¥­¨¥ ¤«ï ª ¦¤®© ¤¨à¥ªâ®à¨¨)
kobra.use - ¨á¯®«ì§®¢ ­¨¥ Kobra
 
…„“…†„…ˆ…:
¤«ï à ¡®âë ­ã¦­  libini ­¥ áâ à¥¥ ॢ¨§¨¨ #1235.
 
==================== English ====================
Version: 0.1.5
Version: 0.1.80 (0.2 beta)
Launch is a programme that launches applications from search dirictories.
On the start it reads file launch.cfg in /sys/etc and in current dirictory.
Than it reads command line arguments. Priority of arguments is as reading.
Now there are few command line arguments: the name of application and its arguments.
Now there are only few command line arguments: the name of application and its arguments.
If using Kobra is enabled all intrested (members of launch_reactive group) applications are notified if
application is launched (sending message dword 1 dword tid, tid - identifier of launched process).
Configuration:
main.path - path to search dirictories
debug.debug - debug options (no or console)
debug.level - debug level (0 - show only ok/error messages, 1 - show for each directory)
kobra.use - using of Kobra
ATTENTION:
you need libini from at least #1235 revision.
/programs/system/launch/trunk/thread.inc
0,0 → 1,81
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
;; This program is free software: you can redistribute it and/or modify it under the terms of ;;
;; the GNU General Public License as published by the Free Software Foundation, either version 3 ;;
;; of the License, or (at your option) any later version. ;;
;; ;;
;; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; ;;
;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See ;;
;; the GNU General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU General Public License along with this program. ;;
;; If not, see <http://www.gnu.org/licenses/>. ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
thread_find_by_name:
cld
push ebp
mov ebp, esp
push ebx ecx
push 1 ;; initial slot
mov ebx, dword [thread_find_buff]
push 0
 
.cycle:
mcall 9 ;; Get thread info
mov dword [esp], eax ;; number of slots
cmp word [ebx+0x32], 9
je .next
.cmpstr:
mov ecx, 11
mov esi, dword [thread_find_buff]
add esi, 0xA ;; ESI = address of thread name in list
mov edi, dword [ebp+8] ;; EDI = address of thread name to find
repe cmpsb
je .found
.next:
mov ecx, dword [esp+4]
inc ecx
cmp ecx, dword [esp]
jg .not_found
mov dword [esp+4], ecx
jmp .cycle
.found:
mov eax, dword [ebx+30] ;; return TID
jmp .exit
.not_found:
xor eax, eax
.exit:
pop ecx ebx
leave
ret 4
 
thread_find_buff:
dd 0
 
event_add_mask:
xchg eax, dword [esp+4]
or dword [event_mask], eax
mcall 40, dword [event_mask]
xchg eax, dword [esp+4]
ret 4
 
event_mask:
dd 0