bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Windows Build: feature branch, src/exithandle.c,


From: Conrad T. Pino
Subject: RE: Windows Build: feature branch, src/exithandle.c,
Date: Sat, 15 May 2004 15:58:55 -0700

Hi Larry,

> From: Larry Jones [mailto:address@hidden
> 
> That just silences the warning, it doesn't fix the problem.  As I said
> before, the problem is that signal handlers take one argument and exit
> handlers take no arguments, but we're trying to use the same functions
> for both -- you can't do that because the two different function types
> could have completely different calling conventions.  The only way to
> fix the problem is to have two separate functions (although one could
> just be a wrapper for the other), but it's not clear that it's worth it
> since the problem is purely theoretical -- there are no known
> implementations where the current code actually fails.

This is a distributed wrapper solution where prior solution used
a central wrapper solution with management overhead.

IMO a distributed approach has simplicity in it's favor.

Conrad

Index: src/cvs.h
===================================================================
RCS file: /cvs/ccvs/src/cvs.h,v
retrieving revision 1.292
diff -u -p -r1.292 cvs.h
--- src/cvs.h   9 May 2004 04:01:20 -0000       1.292
+++ src/cvs.h   15 May 2004 22:47:43 -0000
@@ -546,6 +546,7 @@ int expand_at_signs (const char *, off_t
 int Reader_Lock (char *xrepository);
 void Simple_Lock_Cleanup (void);
 void Lock_Cleanup (void);
+int Lock_Cleanup_Sig (int);
 
 /* Writelock an entire subtree, well the part specified by ARGC, ARGV, LOCAL,
    and AFLAG, anyway.  */
@@ -606,8 +607,11 @@ int cvs_casecmp (const char *, const cha
 #endif
 
 /* exithandle.c */
-void signals_register (RETSIGTYPE (*handler)(int));
-void cleanup_register (void (*handler) (void));
+typedef RETSIGTYPE (*signals_handler_t) (int);
+typedef void (*cleanup_handler_t) (void);
+
+void signals_register (signals_handler_t handler);
+void cleanup_register (cleanup_handler_t handler);
 
 void strip_trailing_slashes (char *path);
 void update_delproc (Node * p);

Index: src/exithandle.c
===================================================================
RCS file: /cvs/ccvs/src/exithandle.c,v
retrieving revision 1.1
diff -u -p -r1.1 exithandle.c
--- src/exithandle.c    5 Oct 2003 03:32:45 -0000       1.1
+++ src/exithandle.c    15 May 2004 22:47:43 -0000
@@ -14,7 +14,7 @@
  * Register a handler for all signals.
  */
 void
-signals_register (RETSIGTYPE (*handler)(int))
+signals_register (signals_handler_t handler)
 {
 #ifndef DONT_USE_SIGNALS
 #ifdef SIGABRT
@@ -42,8 +42,7 @@ signals_register (RETSIGTYPE (*handler)(
  * Register a handler for all signals and exit.
  */
 void
-cleanup_register (void (*handler) (void))
+cleanup_register (cleanup_handler_t handler)
 {
-    signals_register (handler);
     atexit (handler);
 }

Index: src/lock.c
===================================================================
RCS file: /cvs/ccvs/src/lock.c,v
retrieving revision 1.102
diff -u -p -r1.102 lock.c
--- src/lock.c  28 Apr 2004 04:13:24 -0000      1.102
+++ src/lock.c  15 May 2004 22:47:44 -0000
@@ -428,6 +428,12 @@ Lock_Cleanup (void)
     SIG_endCrSect();
 }
 
+int
+Lock_Cleanup_Sig (int signal)
+{
+       Lock_Cleanup ();
+       return 0;
+}
 
 
 /*

Index: src/main.c
===================================================================
RCS file: /cvs/ccvs/src/main.c,v
retrieving revision 1.208
diff -u -p -r1.208 main.c
--- src/main.c  28 Apr 2004 04:20:33 -0000      1.208
+++ src/main.c  15 May 2004 22:47:44 -0000
@@ -457,6 +457,12 @@ main (int argc, char **argv)
        cleanup_register (SYSTEM_CLEANUP);
 #endif
 
+#ifdef SYSTEM_CLEANUP_SIG
+       /* Hook for OS-specific behavior, for example socket subsystems on
+          NT and OS2 or dealing with windows and arguments on Mac.  */
+       signals_register (SYSTEM_CLEANUP_SIG);
+#endif
+
 #ifdef HAVE_TZSET
     /* On systems that have tzset (which is almost all the ones I know
        of), it's a good idea to call it.  */
@@ -780,6 +786,7 @@ cause intermittent sandbox corruption.")
               it is worth the trouble.  */
            CurDir = xstrdup ("<remote>");
            cleanup_register (server_cleanup);
+           signals_register (server_cleanup_sig);
        }
        else
 #endif
@@ -1047,6 +1054,7 @@ cause intermittent sandbox corruption.")
            {
                /* Set up to clean up any locks we might create on exit.  */
                cleanup_register (Lock_Cleanup);
+               signals_register (Lock_Cleanup_Sig);
                lock_cleanup_setup = 1;
            }
 
Index: src/rcs.c
===================================================================
RCS file: /cvs/ccvs/src/rcs.c,v
retrieving revision 1.308
diff -u -p -r1.308 rcs.c
--- src/rcs.c   11 May 2004 17:33:52 -0000      1.308
+++ src/rcs.c   15 May 2004 22:47:49 -0000
@@ -8112,6 +8112,13 @@ rcs_cleanup (void)
     SIG_endCrSect();
 }
 
+static int
+rcs_cleanup_sig (int signal)
+{
+       rcs_cleanup ();
+       return 0;
+}
+
 
 
 /* RCS_internal_lockfile and RCS_internal_unlockfile perform RCS-style
@@ -8153,6 +8160,7 @@ rcs_internal_lockfile (char *rcsfile)
        first_call = 0;
        /* Clean up if we get a signal or exit.  */
        cleanup_register (rcs_cleanup);
+       signals_register (rcs_cleanup_sig);
     }
 
     /* Get the lock file name: `,file,' for RCS file `file,v'. */

Index: src/server.c
===================================================================
RCS file: /cvs/ccvs/src/server.c,v
retrieving revision 1.358
diff -u -p -r1.358 server.c
--- src/server.c        8 May 2004 23:19:05 -0000       1.358
+++ src/server.c        15 May 2004 22:47:53 -0000
@@ -4968,6 +4968,13 @@ server_cleanup (void)
     server_active = 0;
 }
 
+int
+server_cleanup_sig (int signal)
+{
+       server_cleanup ();
+       return 0;
+}
+
 int server_active = 0;
 
 int

Index: src/server.h
===================================================================
RCS file: /cvs/ccvs/src/server.h,v
retrieving revision 1.35
diff -u -p -r1.35 server.h
--- src/server.h        3 Apr 2004 21:12:13 -0000       1.35
+++ src/server.h        15 May 2004 22:47:54 -0000
@@ -142,6 +142,7 @@ void server_update_entries (const char *
 extern char *server_dir;
 
 void server_cleanup (void);
+int server_cleanup_sig (int);
 
 #ifdef SERVER_FLOWCONTROL
 /* Pause if it's convenient to avoid memory blowout */

Index: windows-NT/config.h
===================================================================
RCS file: /cvs/ccvs/windows-NT/config.h,v
retrieving revision 1.75
diff -u -p -r1.75 config.h
--- windows-NT/config.h 12 May 2004 18:21:16 -0000      1.75
+++ windows-NT/config.h 15 May 2004 22:47:55 -0000
@@ -345,6 +345,8 @@ extern void wnt_shutdown_server (int fd)
 extern void init_winsock();
 #define SYSTEM_CLEANUP wnt_cleanup
 extern void wnt_cleanup (void);
+#define SYSTEM_CLEANUP_SIG wnt_cleanup_sig
+extern int wnt_cleanup_sig (int);
 
 #define HAVE_WINSOCK_H
 
Index: windows-NT/woe32.c
===================================================================
RCS file: /cvs/ccvs/windows-NT/woe32.c,v
retrieving revision 1.5
diff -u -p -r1.5 woe32.c
--- windows-NT/woe32.c  14 May 2004 19:07:32 -0000      1.5
+++ windows-NT/woe32.c  15 May 2004 22:47:55 -0000
@@ -49,6 +49,12 @@ wnt_cleanup (void)
     }
 }
 
+int
+wnt_cleanup_sig (int signal)
+{
+       wnt_cleanup ();
+       return 0;
+}
 
 
 unsigned sleep(unsigned seconds)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]