Update skipped files in previous commit

git-svn-id: svn://kolibrios.org@9766 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat
2022-04-15 09:11:49 +00:00
parent cde4fa851d
commit 99922e4c2c
51 changed files with 1967 additions and 2487 deletions

View File

@@ -1,22 +1,23 @@
/*
* This is an example program for sending a message through a "pipe".
* This is an example program for sending a message through a "pipe".
* Created by turbocat (Maxim Logaev) 2022.
*/
*/
#include <sys/ksys.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <sys/ksys.h>
#define TH_STACK_SIZE 1024
#define MESSAGE_SIZE 12
#define MESSAGE_SIZE 12
ksys_colors_table_t sys_colors;
int pipefd[2];
char *send_message = "HELLO PIPE!";
char* send_message = "HELLO PIPE!";
void tmain() {
void tmain()
{
char recv_message[MESSAGE_SIZE];
_ksys_posix_read(pipefd[0], recv_message, MESSAGE_SIZE);
printf("RECV: %s\n", recv_message);
@@ -25,14 +26,15 @@ void tmain() {
exit(0);
}
void create_thread(void){
unsigned tid; // New thread ID
void *th_stack = malloc(TH_STACK_SIZE); // Allocate memory for thread stack
void create_thread(void)
{
unsigned tid; // New thread ID
void* th_stack = malloc(TH_STACK_SIZE); // Allocate memory for thread stack
if (!th_stack) {
puts("Memory allocation error for thread!");
return;
}
tid = _ksys_create_thread(tmain, th_stack+TH_STACK_SIZE); // Create new thread with entry "main"
tid = _ksys_create_thread(tmain, th_stack + TH_STACK_SIZE); // Create new thread with entry "main"
if (tid == -1) {
puts("Unable to create a new thread!");
return;
@@ -40,7 +42,8 @@ void create_thread(void){
printf("New thread created (TID=%u)\n", tid);
}
void main() {
void main()
{
if (_ksys_posix_pipe2(pipefd, 0)) {
puts("Pipe creation error!");
return;