9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kernel Panic <cinap_lenrek@gmx.de>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] several things
Date: Tue, 14 Oct 2008 16:07:54 +0200	[thread overview]
Message-ID: <48F4A7BA.5080300@gmx.de> (raw)
In-Reply-To: <675fc0ac9205932e0a0fa591a097ae8c@quanstro.net>

erik quanstrom wrote:
>>> Are these limitations listed in some document?
>>>
>> I don't believe they are.
>>
>> It might bve nice to think there are no arbitary limits in plan9
>> as the GNU mantra, however there are not many and personally,
>> working with remote servers with very long paths, I have never
>> (knowingly) hit this limit.
>>
>> Having said this we could probably afford to up the size of pwd's
>> buffer to, say, 8k to be sixteen times as sure.
>>
>
> if you're going to all that trouble, why not make sure?
> (i don't think this is worth it, personally, but if you do ...)
>
> #include <u.h>
> #include <libc.h>
>
> void
> main(void)
> {
> 	char *p;
> 	int n, s;
>
> 	for(s = 128; ; s <<= 1){
> 		p = malloc(s);
> 		if(p == nil)
> 			sysfatal("malloc");
> 		p[s-1] = 1;
> 		if((getwd(p, s)) == 0)
> 			sysfatal("pwd: %r");
> 		if(p[s-1] == 1)
> 			break;
> 	}
> 	print("%s\n", p);
> 	exits(0);
> }
>
> - erik
>
>
AAArgg!!!1111 We leak for a fraction of micro seconds! we should
do realloc() here of course and free() the memory before exits()
just to make it even more complex ;-)

cinap




  reply	other threads:[~2008-10-14 14:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-14 13:03 erik quanstrom
2008-10-14 14:07 ` Kernel Panic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-10-14  3:07 erik quanstrom
2008-10-13 21:35 Rudolf Sykora
2008-10-13 22:35 ` erik quanstrom
2008-10-14  8:10   ` Rudolf Sykora
2008-10-14  9:30     ` Steve Simon
2008-10-14 12:22     ` Yaroslav
2008-10-14 13:15       ` Charles Forsyth
2008-10-14 21:44         ` Derek Fawcus
2008-10-14 22:28           ` Charles Forsyth
2008-10-15  9:42   ` Roman V. Shaposhnik
2008-10-15 12:17     ` erik quanstrom
2008-10-18  7:26       ` Roman V. Shaposhnik
2008-10-20 14:09         ` Yaroslav
2008-10-20 17:21           ` Roman V. Shaposhnik
2008-10-13 22:51 ` Pietro Gagliardi

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=48F4A7BA.5080300@gmx.de \
    --to=cinap_lenrek@gmx.de \
    --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).