(fcntl fd F_GETLK ...) from Guile

2007-08-31 Thread Kaloian Doganov
Is there a way to use fcntl's F_GETLK command from Guile?  According
to the docs [1], only the following commands are available:

F_DUPFD
F_GETFD
F_SETFD
F_GETFL
F_SETFL
F_GETOWN
F_SETOWN
FD_CLOEXEC

Neighter F_GETLK nor F_SETLK is there.  Am I missing something?  May
be the file locking mechanism is available elsewhere in the Guile
libs?

[1] 
http://www.gnu.org/software/guile/manual/html_node/Ports-and-File-Descriptors.html#index-fcntl-2899

-- 
Protect your digital freedom and privacy, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm



___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: (fcntl fd F_GETLK ...) from Guile

2007-08-31 Thread dsmich

 Kaloian Doganov <[EMAIL PROTECTED]> wrote: 
> Is there a way to use fcntl's F_GETLK command from Guile?  According
> to the docs [1], only the following commands are available:
> 
> F_DUPFD
> F_GETFD
> F_SETFD
> F_GETFL
> F_SETFL
> F_GETOWN
> F_SETOWN
> FD_CLOEXEC
> 
> Neighter F_GETLK nor F_SETLK is there.  Am I missing something?


Yes, Guile seems to be missing those.  These are just numbers, so you can 
probably just:

  (define F_GETLK 5)
  (define F_SETLK 6)

or whatever the proper values are on your platform.

Here is a patch for libguile/filesys.c to add them.  Untested.

--- filesys.c.old   2006-10-03 23:35:07.0 -0400
+++ filesys.c   2007-08-31 10:14:01.118281135 -0400
@@ -1732,6 +1732,12 @@
 #ifdef F_SETFL  
   scm_c_define ("F_SETFL", scm_from_long (F_SETFL));
 #endif 
+#ifdef F_GETLK
+  scm_c_define ("F_GETLK", scm_from_long (F_GETLK));
+#endif 
+#ifdef F_SETLK
+  scm_c_define ("F_SETLK", scm_from_long (F_SETLK));
+#endif 
 #ifdef F_GETOWN  
   scm_c_define ("F_GETOWN", scm_from_long (F_GETOWN));
 #endif 


--Dale


___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: (fcntl fd F_GETLK ...) from Guile

2007-08-31 Thread Kevin Ryde
Kaloian Doganov <[EMAIL PROTECTED]> writes:
>
> Neighter F_GETLK nor F_SETLK is there.

Yep, not there.  It'd need something for "struct flock" (and "struct
flock64" when available), they're not plain integers like the other
fcntl commands.

There's `flock' already for whole-file, if that's enough.


___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


Re: What is best way to limit memory alloc?

2007-08-31 Thread Kevin Ryde
Roland Orre <[EMAIL PROTECTED]> writes:
>
>> What is the best way to limit the memory allocation in guile?

Perhaps setrlimit would be the most reliable overall.

>> I'm still running 1.7 as I haven't got the time and energy
>> to change the array implementation yet.

I struck a bug lately in 1.8 where the collected cell counts are somehow
botched, leading to it wrongly thinking new heap is needed again and
again.

>> It seems as the memory allocator in guile doesn't care about
>> the physical memory limits and it seems as it prefers to
>> allocate big chunks of more memory instead of performing gc
>> despite very little extra memory should be needed.

It's not supposed to.  The rule is supposed to be to increase the heap
to make 40% of it free, after gc figures what's free and what's not, or
something like that.  In practice it means blocks each 1.6x (or so)
bigger than the one before getting allocated.  (As seen in `gc-stats'.)


___
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user