This commit is contained in:
2026-02-10 16:37:28 +01:00
parent 67291f7f19
commit dd352266dc
13 changed files with 175 additions and 0 deletions

BIN
user/app2/build/app Executable file

Binary file not shown.

BIN
user/app2/build/app.img Executable file

Binary file not shown.

2
user/app2/build/kappl.d Normal file
View File

@@ -0,0 +1,2 @@
build/kappl.o: kappl.cc ../../libsys/../libsys/stub.h \
../../libsys/../libsys/types.h ../../libsys/../libsys/string.h

BIN
user/app2/build/kappl.o Normal file

Binary file not shown.

37
user/app2/kappl.cc Normal file
View File

@@ -0,0 +1,37 @@
// vim: set noet ts=4 sw=4:
#include "../libsys/stub.h"
#include "../libsys/string.h"
//#include "../libsys/string.h"
extern "C" void main() {
char cmd_buff[100];
uint8_t bufferpos = 0;
while(1){
char msg[11];
int len;
len = read(0, msg, 1);
if(len){
write(0, msg, len);
memcpy(&cmd_buff[bufferpos], msg, len);
bufferpos+=len;
for(uint8_t i=0; i<len; i++)
if(msg[i] == '\n'){
bufferpos = 0;
if(strncmp(cmd_buff, "kill ", 5) == 0){
int pid = cmd_buff[5]-0x30;
char r[] = "killing X\n";
r[8] = pid+0x30;
write(0, r, 9);
sys_kill(pid);
}
if(strncmp(cmd_buff, "killall", 7) == 0){
for(uint8_t i = 0; i<10; i++){
sys_kill(i);
}
}
}
}
}
}

26
user/app2/kappl.h Normal file
View File

@@ -0,0 +1,26 @@
// vim: set noet ts=4 sw=4:
/*! \file
* \brief Enthält die Klasse KeyboardApplication
*/
#pragma once
#include "../../thread/thread.h"
#include "../../types.h"
/*! \brief Keyboard Application
*
*/
class KeyboardApplication : public Thread {
// Prevent copies and assignments
KeyboardApplication(const KeyboardApplication&) = delete;
KeyboardApplication& operator=(const KeyboardApplication&) = delete;
public:
KeyboardApplication() {}
/*! \brief Contains the application code.
*
*/
void action() override;
};