9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Sergey Zhilkin <szhilkin@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Failed 'reject' function?
Date: Fri, 10 Oct 2014 13:24:21 +0400	[thread overview]
Message-ID: <CAOFTvP+SO-GOAo_uyJUVAOJrX2akp3AnAdkiJFzw-KpSoo+HSQ@mail.gmail.com> (raw)
In-Reply-To: <CAGNd-2OiRZgy=H76R1aird8dS87N+nJxd+cXJwFB92aXMdOpyg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3045 bytes --]

Hi Pavel !

It seems, you do it incorrectly :) dial(2) has an exact example if using
announce/listen/accept functions.

2014-10-10 11:48 GMT+04:00 Pavel Klinkovský <pavel.klinkovsky@gmail.com>:

> Hi all,
>
> I tried very simple program on native Plan9:
>
> #include <u.h>
> #include <libc.h>
>
> void
> main(int, char**)
> {
> int afd, lfd;
> char adir[NETPATHLEN], ldir[NETPATHLEN];
>
> afd = announce("tcp!*!20540", adir);
> if (afd < 0)
> sysfatal("listen: %r");
>
> lfd = listen(adir, ldir);
> if (lfd < 0)
> sysfatal("listen: %r");
>
> if (reject(lfd, ldir, "unauthorized") < 0)
> sysfatal("reject: %r");
>
> close(lfd);
> close(afd);
> exits(nil);
> }
>
> I dicovered that the funtion 'reject' fails:
> term% 8.out
> reject: unknown control request
>
> In 'ratrace' listing I can really see the 'reject' function failure:
> 348 8.out Open 33a7 0xdfffe9bc/"/net/cs" 0x2 = 3 "" 1412926762174586973
> 1412926762174841785
> 348 8.out Pwrite 5577 3  0x7880/"tcp!*!20540" 11 -1 = 11 ""
> 1412926762186976342 1412926762187086984
> 348 8.out Seek 3391 0x7ab8 3 0x0 0 = 0 "" 1412926762198637769
> 1412926762198646989
> 348 8.out Pread 557f 3 0xdfffe9bc 255 -1 0xdfffe9bc/"/net/tcp/clone.20540"
> 255 -1 = 20 "" 1412926762200546351 1412926762200619275
> 348 8.out Close 1225 3 = 0 "" 1412926762221784602 1412926762221865069
> 348 8.out Open 33a7 0xdfffebe0/"/net/tcp/clone" 0x2 = 3 ""
> 1412926762223717492 1412926762223849089
> 348 8.out Pread 557f 3 0xdfffede9 246 -1 0xdfffede9/"4" 246 -1 = 1 ""
> 1412926762235853725 1412926762235866298
> 348 8.out Pwrite 5577 3  0xdfffece0/"announce.20540" 14 -1 = 14 ""
> 1412926762247454802 1412926762247479948
> 348 8.out Open 33a7 0xdfffede0/"/net/tcp/4/listen" 0x2 = 4 ""
> 1412926762259028218 1412926771821372908
> 348 8.out Pread 557f 4 0xdfffede9 246 -1 0xdfffede9/"6" 246 -1 = 1 ""
> 1412926771844967723 1412926771844984487
> 348 8.out Pwrite 5577 4  0xdfffedec/"reject.6.unauthorized" 21 -1 = -1
> unknown control request 1412926771854330421 1412926771854347185
> 348 8.out Errstr 5587 0xdfffe914 128"" 128 = 0  1412926771871626615
> 1412926771871632483
> 348 8.out Errstr 5587 0xdfffe914 128"" 128 = 0 unknown control request
> 1412926771887234674 1412926771887239703
> 348 8.out Pwrite 5577 2  0xdfffe980/"reject:.unknown.control.request." 32
> -1reject: unknown control request
>  = 32 "" 1412926771918100040 1412926771932457957
> 348 8.out Open 33a7 0x7538/"#c/pid" 0x0 = 5 "" 1412926771947976329
> 1412926771948085295
> 348 8.out Pread 557f 5 0xdfffeaa0 20 -1 0xdfffeaa0/"........348." 20 -1 =
> 12 "" 1412926771963591547 1412926771963607473
> 348 8.out Close 1225 5 = 0 "" 1412926771979115786 1412926771979128359
> 348 8.out Exits 122d 0xdfffeadc/"reject: unknown control request"
>
> Do you have any explanation?
> Did I make some bug in the program?
>
> Thanks in advance.
>
> Pavel
>
>


-- 
С наилучшими пожеланиями
Жилкин Сергей
With best regards
Zhilkin Sergey

[-- Attachment #2: Type: text/html, Size: 4893 bytes --]

  parent reply	other threads:[~2014-10-10  9:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-10  7:48 Pavel Klinkovský
2014-10-10  9:22 ` Charles Forsyth
2014-10-10  9:23   ` Charles Forsyth
2014-10-10  9:24 ` Sergey Zhilkin [this message]
2014-10-10  9:28   ` Pavel Klinkovský
2014-10-10  9:32     ` Charles Forsyth

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=CAOFTvP+SO-GOAo_uyJUVAOJrX2akp3AnAdkiJFzw-KpSoo+HSQ@mail.gmail.com \
    --to=szhilkin@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).