From 64ca3a6502a07a2652bb713108527be0e9066745 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Thu, 1 Jun 2000 13:03:56 +0000 Subject: [PATCH] Signals-be-gone for microperl. p4raw-id: //depot/cfgperl@6193 --- Todo.micro | 8 -------- doop.c | 2 ++ mg.c | 2 ++ perl.c | 4 ++++ perl.h | 4 ++++ pp_sys.c | 6 +++++- util.c | 9 ++++++++- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Todo.micro b/Todo.micro index c813271..76759b1 100644 --- a/Todo.micro +++ b/Todo.micro @@ -2,14 +2,6 @@ - make creating Makefile.micro automatic (by pumpkin) -- clean up compilation warnings as much as possible: - most of them seem to stem from not including enough headers (as planned) - to have enough prototypes, these may be correctible with some simple casts - -- do away with signals? (not very portable outside UNIX lands) - (missing signal API prototypes cause the majority of the compilation - warnings anyway) - - do away with fork/exec/wait? (system, popen should be enough?) - some of the uconfig.sh really needs to be probed (using cc) in buildtime: diff --git a/doop.c b/doop.c index 37f87e6..ebac52f 100644 --- a/doop.c +++ b/doop.c @@ -15,9 +15,11 @@ #define PERL_IN_DOOP_C #include "perl.h" +#ifndef PERL_MICRO #if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) #include #endif +#endif STATIC I32 S_do_trans_CC_simple(pTHX_ SV *sv) diff --git a/mg.c b/mg.c index f8dd89e..b1049c5 100644 --- a/mg.c +++ b/mg.c @@ -950,6 +950,7 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg) return 0; } +#ifndef PERL_MICRO int Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg) { @@ -1066,6 +1067,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) } return 0; } +#endif /* !PERL_MICRO */ int Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) diff --git a/perl.c b/perl.c index 5df462d..8b970a2 100644 --- a/perl.c +++ b/perl.c @@ -1180,6 +1180,7 @@ print \" \\@INC:\\n @INC\\n\";"); validate_suid(validarg, scriptname,fdscript); +#ifndef PERL_MICRO #if defined(SIGCHLD) || defined(SIGCLD) { #ifndef SIGCHLD @@ -1194,6 +1195,7 @@ print \" \\@INC:\\n @INC\\n\";"); } } #endif +#endif #ifdef MACOS_TRADITIONAL if (PL_doextract || gMacPerl_AlwaysExtract) { @@ -1239,9 +1241,11 @@ print \" \\@INC:\\n @INC\\n\";"); if (xsinit) (*xsinit)(aTHXo); /* in case linked C routines want magical variables */ +#ifndef PERL_MICRO #if defined(VMS) || defined(WIN32) || defined(DJGPP) || defined(__CYGWIN__) init_os_extras(); #endif +#endif #ifdef USE_SOCKS SOCKSinit(argv[0]); diff --git a/perl.h b/perl.h index ade2f65..8064d9d 100644 --- a/perl.h +++ b/perl.h @@ -2809,10 +2809,14 @@ EXT MGVTBL PL_vtbl_envelem = {0, MEMBER_TO_FPTR(Perl_magic_setenv), 0, MEMBER_TO_FPTR(Perl_magic_clearenv), 0}; EXT MGVTBL PL_vtbl_sig = {0, 0, 0, 0, 0}; +#ifdef PERL_MICRO +EXT MGVTBL PL_vtbl_sigelem = {0, 0, 0, 0, 0}; +#else EXT MGVTBL PL_vtbl_sigelem = {MEMBER_TO_FPTR(Perl_magic_getsig), MEMBER_TO_FPTR(Perl_magic_setsig), 0, MEMBER_TO_FPTR(Perl_magic_clearsig), 0}; +#endif EXT MGVTBL PL_vtbl_pack = {0, 0, MEMBER_TO_FPTR(Perl_magic_sizepack), MEMBER_TO_FPTR(Perl_magic_wipepack), 0}; EXT MGVTBL PL_vtbl_packelem = {MEMBER_TO_FPTR(Perl_magic_getpack), diff --git a/pp_sys.c b/pp_sys.c index 97cd15b..1ea47cf 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3749,7 +3749,7 @@ PP(pp_system) } } PERL_FLUSHALL_FOR_CHILD; -#if (defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(OS2) && !defined(__CYGWIN__) +#if (defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(OS2) && !defined(__CYGWIN__) || defined(PERL_MICRO) if (PerlProc_pipe(pp) >= 0) did_pipes = 1; while ((childpid = vfork()) == -1) { @@ -3768,13 +3768,17 @@ PP(pp_system) if (childpid > 0) { if (did_pipes) PerlLIO_close(pp[1]); +#ifndef PERL_MICRO rsignal_save(SIGINT, SIG_IGN, &ihand); rsignal_save(SIGQUIT, SIG_IGN, &qhand); +#endif do { result = wait4pid(childpid, &status, 0); } while (result == -1 && errno == EINTR); +#ifndef PERL_MICRO (void)rsignal_restore(SIGINT, &ihand); (void)rsignal_restore(SIGQUIT, &qhand); +#endif STATUS_NATIVE_SET(result == -1 ? -1 : status); do_execfree(); /* free any memory child malloced on vfork */ SP = ORIGMARK; diff --git a/util.c b/util.c index 91ca89a..8962fff 100644 --- a/util.c +++ b/util.c @@ -16,6 +16,7 @@ #define PERL_IN_UTIL_C #include "perl.h" +#ifndef PERL_MICRO #if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) #include #endif @@ -23,6 +24,7 @@ #ifndef SIG_ERR # define SIG_ERR ((Sighandler_t) -1) #endif +#endif /* XXX If this causes problems, set i_unistd=undef in the hint file. */ #ifdef I_UNISTD @@ -2494,7 +2496,7 @@ dup2(int oldfd, int newfd) } #endif - +#ifndef PERL_MICRO #ifdef HAS_SIGACTION Sighandler_t @@ -2597,6 +2599,7 @@ Perl_rsignal_restore(pTHX_ int signo, Sigsave_t *save) } #endif /* !HAS_SIGACTION */ +#endif /* !PERL_MICRO */ /* VMS' my_pclose() is in VMS.c; same with OS/2 */ #if (!defined(DOSISH) || defined(HAS_FORK) || defined(AMIGAOS)) && !defined(VMS) && !defined(__OPEN_VM) && !defined(EPOC) && !defined(MACOS_TRADITIONAL) @@ -2638,15 +2641,19 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) #ifdef UTS if(PerlProc_kill(pid, 0) < 0) { return(pid); } /* HOM 12/23/91 */ #endif +#ifndef PERL_MICRO rsignal_save(SIGHUP, SIG_IGN, &hstat); rsignal_save(SIGINT, SIG_IGN, &istat); rsignal_save(SIGQUIT, SIG_IGN, &qstat); +#endif do { pid2 = wait4pid(pid, &status, 0); } while (pid2 == -1 && errno == EINTR); +#ifndef PERL_MICRO rsignal_restore(SIGHUP, &hstat); rsignal_restore(SIGINT, &istat); rsignal_restore(SIGQUIT, &qstat); +#endif if (close_failed) { SETERRNO(saved_errno, saved_vaxc_errno); return -1; -- 2.7.4