Here is a patch against 2.6.7 + the current Debian patch. The first hunk, against h/linux.h, makes the code use sigprocmask instead of sigblock. The sigprocmask interface has been available since Linux kernel version 2.2 (current version is 2.6). The sigblock interface is currently deprecated.
The second hunk, against o/run_process.c, does two things. First, it uses dup2 instead of dup. There's no particular problem here, it just makes me nervous not to ask for the file descriptor we assume we got later. Second, it closes the fdin and fdout file descriptors, which are no longer needed. The next two hunks, against o/unixfsys.c, fixes a problem I am having on Fedora 9, where at high optimization levels, the glibc headers specify inline versions of some functions. I'm getting calls made to getwd() somehow, even though getcwd() is available. I don't understand it, but this part of the patch fixes the problem for me. Also note that the getcwd prototype (in the #ifndef _WIN32 block) is unnecessary, since getcwd is declared in unistd.h, which this file #includes. The last hunk, also against o/unixfsys.c, gets rid of a shell invocation and a context switch just to change the name of a file. Regards, -- Jerry James http://loganjerry.googlepages.com/
diff -dur gcl-2.6.7.ORIG/h/linux.h gcl-2.6.7/h/linux.h --- gcl-2.6.7.ORIG/h/linux.h 2008-11-03 16:58:16.000000000 -0700 +++ gcl-2.6.7/h/linux.h 2008-11-04 14:53:56.000000000 -0700 @@ -85,13 +85,7 @@ #define SV_ONSTACK 0 #endif -/* unblock signals m and n, and set val to signal_mask(m) | signal_mask(n) - if they were set */ -#define SIG_UNBLOCK_SIGNALS(val,m,n) \ - current_mask = sigblock(0); \ - sigsetmask(~(sigmask(m)) & ~(sigmask(n)) & current_mask); \ - result = (current_mask & sigmask(m) ? signal_mask(m) : 0) \ - | (current_mask & sigmask(n) ? signal_mask(n) : 0); +#define HAVE_SIGPROCMASK #define RUN_PROCESS diff -dur gcl-2.6.7.ORIG/o/run_process.c gcl-2.6.7/o/run_process.c --- gcl-2.6.7.ORIG/o/run_process.c 2008-11-03 16:58:56.000000000 -0700 +++ gcl-2.6.7/o/run_process.c 2008-11-04 12:04:47.000000000 -0700 @@ -527,9 +527,11 @@ if (fork() == 0) { /* the child --- replace standard in and out with descriptors given */ close(0); - dup(fdin); + dup2(fdin, 0); close(1); - dup(fdout); + dup2(fdout, 1); + close(fdin); + close(fdout); fprintf(stderr, "\n***** Spawning process %s ", pname); if (execvp(pname, argv) == -1) { diff -dur gcl-2.6.7.ORIG/o/unixfsys.c gcl-2.6.7/o/unixfsys.c --- gcl-2.6.7.ORIG/o/unixfsys.c 2008-11-03 16:58:56.000000000 -0700 +++ gcl-2.6.7/o/unixfsys.c 2008-11-04 14:54:41.000000000 -0700 @@ -150,17 +150,6 @@ #endif -#ifdef HAVE_GETCWD -char * -getwd(char *buffer) -{ -#ifndef _WIN32 - char *getcwd(char *, size_t); -#endif - return(getcwd(buffer, MAXPATHLEN)); -} -#endif - #ifdef DGUX @@ -278,6 +267,8 @@ if ( 0 == current_directory_length ) { FEerror ( "truename could not determine the current directory.", 1, "" ); } +#elif defined(HAVE_GETCWD) + getcwd(current_directory, MAXPATHLEN); #else getwd(current_directory); #endif @@ -361,6 +352,8 @@ FEerror ( "truename could not determine the current directory.", 1, "" ); } p = directory; +#elif defined(HAVE_GETCWD) + p = getcwd(directory, MAXPATHLEN); #else p = getwd(directory); #endif @@ -448,11 +441,9 @@ backup_fopen(char *filename, char *option) { char backupfilename[MAXPATHLEN]; - char command[MAXPATHLEN * 2]; strcat(strcpy(backupfilename, filename), ".BAK"); - sprintf(command, "mv %s %s", filename, backupfilename); - system(command); + rename(filename, backupfilename); return(fopen(filename, option)); }
_______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org http://lists.gnu.org/mailman/listinfo/gcl-devel