From: andrey100100100@gmail.com
To: 9fans@9fans.net
Subject: Re: [9fans] syscall silently kill processes
Date: Sat, 18 Jun 2022 09:40:20 +0300 [thread overview]
Message-ID: <ce3150abca894e4da04f5a8a3d09ba53ae01f965.camel@gmail.com> (raw)
In-Reply-To: <3889a52-3fe4-c28-1c3b-a73412a489@SDF.ORG>
В Пт, 17/06/2022 в 21:15 +0000, adr пишет:
> On Fri, 17 Jun 2022, andrey100100100@gmail.com wrote:
> > Seems like noted() call not needed in user code.
>
> noted() is only needed when using the syscall notify, when using
> atnotify() (or threadnotify) you don't need it, as it is said in
> notify(2) and you did correctly in your first example. threadnotify
> doesn't kill your process if there is no space free in onnote[],
> onnotepid[], the handler is not registered, that's all. alarm()
> should send the note to the process and the first handler registered
> with the note "alarm" should be executed. Your handler checked for
> the note and returned non zero, the process should continue. When
> read is interrupted, it should return an error, the process should
> not be killed. Here is the issue. Comment the read statement and
> there will be the same number of "end"s as "start"s.
>
Мore clear example, which demonstrate crux of the problem:
---------------------------------------------
#include <u.h>
#include <libc.h>
#include <thread.h>
static int
handler_alarm(void *, char *msg)
{
if(strstr(msg, "alarm")){
return 1;
}
return 0;
}
static void
proc_func(void *)
{
if(threadnotify(handler_alarm, 1) == 0){
fprint(1, "handler not registred\n");
}
alarm(2000);
fprint(1, "start\n");
sleep(10000);
fprint(1, "end\n");
alarm(0);
threadexits(nil);
}
int mainstacksize = 5242880;
void
threadmain(int argc, char *argv[])
{
for(int i = 0; i < 80; i++){
proccreate(proc_func, nil, 10240);
}
sleep(5000);
threadexitsall(nil);
}
---------------------------------------------
cpu% 6.out | grep end | wc -l
33
Problem in unregistered handlers.
> Note that you could register the handler in threadmain and avoid
> completely this issue, but as I said before, something seems wrong
> to me here.
>
I'm don't understand how handler in threadmain would solve the problem.
I need in 'alarm' on per process basis.
Regards,
Andrej
------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-M2bf5df4e0184bdff80c9eee9
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
next prev parent reply other threads:[~2022-06-18 6:40 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 9:37 andrey100100100
2022-06-17 13:46 ` Thaddeus Woskowiak
2022-06-17 14:11 ` Jacob Moody
2022-06-17 14:39 ` Thaddeus Woskowiak
2022-06-17 15:06 ` andrey100100100
2022-06-17 16:08 ` Skip Tavakkolian
2022-06-17 16:11 ` Skip Tavakkolian
2022-06-17 16:16 ` Skip Tavakkolian
2022-06-17 17:42 ` adr
2022-06-17 16:11 ` Jacob Moody
2022-06-17 18:48 ` andrey100100100
2022-06-17 19:28 ` Jacob Moody
2022-06-17 21:15 ` adr
2022-06-18 6:40 ` andrey100100100 [this message]
2022-06-18 8:37 ` adr
2022-06-18 9:22 ` adr
2022-06-18 12:53 ` Jacob Moody
2022-06-18 22:03 ` andrey100100100
2022-06-19 5:54 ` adr
2022-06-19 6:13 ` Jacob Moody
2022-06-18 22:22 ` andrey100100100
2022-06-18 16:57 ` andrey100100100
2022-06-19 2:40 ` adr
2022-06-19 5:01 ` adr
2022-06-19 8:52 ` andrey100100100
2022-06-19 10:32 ` adr
2022-06-19 11:40 ` andrey100100100
2022-06-19 12:01 ` andrey100100100
2022-06-19 15:10 ` andrey100100100
2022-06-19 16:41 ` adr
2022-06-19 21:22 ` andrey100100100
2022-06-19 21:26 ` andrey100100100
2022-06-20 4:41 ` adr
2022-06-20 5:39 ` andrey100100100
2022-06-20 5:59 ` adr
2022-06-20 15:56 ` andrey100100100
2022-06-20 22:29 ` Skip Tavakkolian
2022-06-21 7:07 ` andrey100100100
2022-06-21 11:26 ` adr
2022-06-21 13:03 ` andrey100100100
2022-06-21 13:22 ` adr
2022-06-28 15:28 ` adr
2022-06-28 16:43 ` ori
2022-06-28 18:19 ` adr
2022-06-28 18:28 ` adr
2022-06-28 19:09 ` andrey100100100
2022-06-28 19:42 ` adr
2022-06-29 13:14 ` adr
2022-06-21 13:47 ` andrey100100100
2022-06-21 7:22 ` adr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce3150abca894e4da04f5a8a3d09ba53ae01f965.camel@gmail.com \
--to=andrey100100100@gmail.com \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).