Skip to content
Snippets Groups Projects
Commit 38ac577c authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

flock fix + more debug

Rev: src/modules/files/file.c:1.97
Rev: src/modules/files/file_functions.h:1.2
parent c337d9fd
Branches
Tags
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\*/ \*/
#include "global.h" #include "global.h"
RCSID("$Id: file.c,v 1.96 1998/05/12 16:26:40 grubba Exp $"); RCSID("$Id: file.c,v 1.97 1998/05/19 20:35:39 hubbe Exp $");
#include "fdlib.h" #include "fdlib.h"
#include "interpret.h" #include "interpret.h"
#include "svalue.h" #include "svalue.h"
...@@ -2055,8 +2055,6 @@ static void init_file_locking(void) ...@@ -2055,8 +2055,6 @@ static void init_file_locking(void)
set_exit_callback(exit_file_lock_key); set_exit_callback(exit_file_lock_key);
file_lock_key_program=end_program(); file_lock_key_program=end_program();
file_lock_key_program->flags |= PROGRAM_DESTRUCT_IMMEDIATE; file_lock_key_program->flags |= PROGRAM_DESTRUCT_IMMEDIATE;
add_function("lock",file_lock,"function(void|int:object)",0);
add_function("trylock",file_trylock,"function(void|int:object)",0);
} }
static void exit_file_locking(void) static void exit_file_locking(void)
{ {
...@@ -2108,6 +2106,20 @@ void PIKE_CONCAT(Y,_ref) (INT32 args) {\ ...@@ -2108,6 +2106,20 @@ void PIKE_CONCAT(Y,_ref) (INT32 args) {\
#include "file_functions.h" #include "file_functions.h"
#ifdef DEBUG
void check_static_file_data(struct callback *a, void *b, void *c)
{
if(file_program)
{
#define FILE_FUNC(X,Y,Z) \
if(PIKE_CONCAT(Y,_function_number)<0 || PIKE_CONCAT(Y,_function_number)>file_program->num_identifier_references) \
fatal(#Y "_function_number is incorrect: %d\n",PIKE_CONCAT(Y,_function_number));
#include "file_functions.h"
}
}
#endif
void pike_module_init(void) void pike_module_init(void)
{ {
struct object *o; struct object *o;
...@@ -2174,6 +2186,12 @@ void pike_module_init(void) ...@@ -2174,6 +2186,12 @@ void pike_module_init(void)
#ifdef HAVE_OOB #ifdef HAVE_OOB
add_integer_constant("__HAVE_OOB__",1,0); add_integer_constant("__HAVE_OOB__",1,0);
#endif #endif
#ifdef DEBUG
add_to_callback(&do_debug_callbacks,
check_static_file_data,
0,
0);
#endif
} }
/* Used from backend */ /* Used from backend */
......
...@@ -44,4 +44,9 @@ ...@@ -44,4 +44,9 @@
FILE_FUNC("proxy",file_proxy,"function(object:void)") FILE_FUNC("proxy",file_proxy,"function(object:void)")
#endif #endif
#ifdef HAVE_FD_FLOCK
FILE_FUNC("lock",file_lock,"function(void|int:object)")
FILE_FUNC("trylock",file_trylock,"function(void|int:object)")
#endif
#undef FILE_FUNC #undef FILE_FUNC
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment