diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index 566b71d99ddb32ddb76074b6d465988c45cee77e..58683e8cc72c58be4ae6eed6a81bb5511781030d 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -5,7 +5,7 @@
 \*/
 
 #include "global.h"
-RCSID("$Id: file.c,v 1.115 1998/07/20 21:12:15 hubbe Exp $");
+RCSID("$Id: file.c,v 1.116 1998/07/26 10:25:45 hubbe Exp $");
 #include "fdlib.h"
 #include "interpret.h"
 #include "svalue.h"
@@ -797,6 +797,46 @@ CBFUNCS(read_oob_callback)
 CBFUNCS(write_oob_callback)
 #endif
 
+static void file__enable_callbacks(INT32 args)
+{
+#define DO_TRIGGER(X) \
+  if(IS_ZERO(& THIS->X )) \
+  {								\
+    PIKE_CONCAT(set_,X)(FD, 0, 0);				\
+    check_internal_reference(THIS);                             \
+  }else{							\
+    PIKE_CONCAT(set_,X)(FD, PIKE_CONCAT(file_,X), THIS);	\
+    SET_INTERNAL_REFERENCE(THIS);                               \
+  }								
+
+DO_TRIGGER(read_callback)
+DO_TRIGGER(write_callback)
+#ifdef WITH_OOB
+DO_TRIGGER(read_oob_callback)
+DO_TRIGGER(write_oob_callback)
+#endif
+  pop_n_elems(args);
+  push_int(0);
+}
+
+static void file__disable_callbacks(INT32 args)
+{
+#define DO_DISABLE(X) \
+  PIKE_CONCAT(set_,X)(FD, 0, 0);  \
+  check_internal_reference(THIS);
+
+
+DO_DISABLE(read_callback)
+DO_DISABLE(write_callback)
+#ifdef WITH_OOB
+DO_DISABLE(read_oob_callback)
+DO_DISABLE(write_oob_callback)
+#endif
+
+  pop_n_elems(args);
+  push_int(0);
+}
+
 
 static void file_write(INT32 args)
 {
diff --git a/src/modules/files/file_functions.h b/src/modules/files/file_functions.h
index ea43e755ad01fef7503273a7f9d471ee28f7c55a..b0b53678616ae6885b4c815056bfa54805147d33 100644
--- a/src/modules/files/file_functions.h
+++ b/src/modules/files/file_functions.h
@@ -28,6 +28,9 @@
   FILE_FUNC("set_write_oob_callback",file_set_write_oob_callback,"function(mixed:void)")
 
 #endif /* WITH_OOB */
+  FILE_FUNC("_enable_callbacks",file__enable_callbacks,"function(:void)");
+  FILE_FUNC("_disable_callbacks",file__disable_callbacks,"function(:void)");
+
   FILE_FUNC("set_blocking",file_set_blocking,"function(:void)")
 
   FILE_FUNC("query_fd",file_query_fd,"function(:int)")