Re: too many open files?

2012-09-06 Thread Laurent Artaud

Le 05/09/2012 19:20, Alexander Burger a écrit :

On Wed, Sep 05, 2012 at 09:34:10AM +0200, Alexander Burger wrote:

I don't have the time at the moment to investigate it further. I hope I
can fix it this evening.


We need just to insert a call to closedir(). I've uploaded a fix to the
code repository.

As I'm in the process of other changes, I don't want to provide a new
testing release at the moment. If you need a quick fix, please insert a
single line in "src64/main.l" and re-assemble the binary:

2922a2923
>  cc closedir(Z)  # Close directory


I.e. the context is

   do
  cc readdir(Z)  # Find first directory entry
  null A  # OK?
  if z  # No
 cc closedir(Z)  # Close directory  <-- NEW
10   ld E Nil  # Return NIL
 pop Z
 pop X
 ret
  end
  lea E (A D_NAME)  # Pointer to name entry
  cmp X Nil  # flg?
   while eq  # Yes

Cheers,
- Alex



Thanks for the quick fix!

--
Laurent ARTAUD (laurent.art...@free.fr)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: too many open files?

2012-09-06 Thread Laurent Artaud

Le 06/09/2012 08:01, Alexander Burger a écrit :

Hi Laurent,

back to your original mail:


By the way, if anyone know what lib to use for (native) to make a
lstat syscall so I can replace the stat shell call, I'd be very
grateful: I can't find where it is! (contrary to what I thought, it
is NOT in libc...)


It seems the internal symbol is '__xstat'.


From "/usr/include/x86_64-linux-gnu/sys/stat.h":


__extern_inline int
__NTH (stat (__const char *__path, struct stat *__statbuf))
{
  return __xstat (_STAT_VER, __path, __statbuf);
}

That's a pity, because it makes it rather unportable.




So... If I need more speed, I'll have to make a C lib calling lstat, then call 
this one with (native)... I think I'll stay with the shell call ;-)




BTW, instead of using 'line', 'split' and 'pack' in


(de stat (Path)
(mapcar pack
   (split
  (in
 (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
 (line) )
  " " ) ) )


and later parsing it with 'hex' and 'format', you could read it
directly:

(in (list "stat" "-c" "%f %s %u %g %h %i %X %Y %Z" Path)
(make
   (link (hex (till " "))
   (do 8
  (link (read)) ) ) ) )



Thanks for this! I intended to replace the call to (multimap) when I discovered 
that I had only one (hex) to call...


Regards,
--
Laurent ARTAUD (laurent.art...@free.fr)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: too many open files?

2012-09-06 Thread Laurent Artaud

Le 06/09/2012 08:50, José Romero a écrit :


Why not just:

(in (list "stat" "-c" "(`(hex \"%f\") %s %u %g %h %i %X %Y %Z)" Path)
(read) )

:D



Wow!

It took me at least ten minutes to realize WHY it was working!
I can honestly say that I would have NEVER thought to use stat's output 
formating option to this end!


I'm not worthy (yet?)

Thanks for sharing this!

Regards,
--
Laurent ARTAUD (laurent.art...@free.fr)
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: too many open files?

2012-09-06 Thread Alexander Burger
Hi José,

> Why not just:
> 
> (in (list "stat" "-c" "(`(hex \"%f\") %s %u %g %h %i %X %Y %Z)" Path)
>(read) ) 

Nice! Very clever! (PicoLisp-ish ;)

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: GOTO in PicoLisp

2012-09-06 Thread Alexander Burger
Hi José,

> Because the world wasn't weird enough already I took the liberty to

Bravo! That's a valid idea ;)


Let me suggest two small changes:

> (de prog+ "Prg"
>(use ("Thunk" "Ret" "L")
>   (setq "Thunk" "Prg" "Ret" NIL)
>   (while

Did you have any special reason for 'use'? Otherwise I would use 'let':

(de prog+ "Prg"
   (let ("Thunk" "Prg"  "Ret" NIL  "L" NIL)
  (while


The call to 'seek'

>(seek '[(X) (= (car X) "L")] "Prg")

can in this case be replaced by member:

   (member "L" "Prg")

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe