1N/A * Ideally this should be somewhere down in the includes 1N/A * but putting it in other places is giving compiler errors. 1N/A * Also here I am unable to check for HAS_UNAME since it wouldn't have 1N/A * yet come into the file at this stage - sgp 18th Oct 2000 1N/A/* XXX This comment is just to make I_TERMIO and I_SGTTY visible to 1N/A metaconfig for future extension writers. We don't use them in POSIX. 1N/A (This is really sneaky :-) --AD 1N/A#
endif /* __VMS_VER >= 70000000 or Dec C 5.6 */ 1N/A /* The POSIX notion of ttyname() is better served by getname() under VMS */ 1N/A /* The non-POSIX CRTL times() has void return type, so we just get the 1N/A current time directly */ 1N/A /* Get wall time and convert to 10 ms intervals to 1N/A * produce the return value that the POSIX standard expects */ 1N/A /* (Older hw or ccs don't have an atomic 64-bit type, so we 1N/A * juggle 32-bit ints (and a float) to produce a time_t result 1N/A * with minimal loss of information.) */ 1N/A vmstime[
1] &=
0x7fff;
/* prevent overflow in EDIV */ 1N/A /* Fill in the struct tms using the CRTL routine . . .*/ 1N/A#
else /* !( defined OS2 ) */ 1N/A#
endif /* !HAS_MKFIFO */ 1N/A#
endif /* WIN32 || NETWARE */ 1N/A#
else /* Define termios types to int, and call not_here for the functions.*/ 1N/A/* Possibly needed prototypes */ 1N/Aunsigned long strtoul (
const char *,
char **,
int);
1N/A/* If we don't have these functions, then we wouldn't have gotten a typedef 1N/A for wchar_t, the wide character type. Defining wchar_t allows the 1N/A functions referencing it to compile. Its actual type is then meaningless, 1N/A since without the above functions, all sections using it end up calling 1N/A not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */ 1N/A/* Background: in most systems the low byte of the wait status 1N/A * is the signal (the lowest 7 bits) and the coredump flag is 1N/A * the eight bit, and the second lowest byte is the exit status. 1N/A * BeOS bucks the trend and has the bytes in different order. 1N/A * to follow the traditional. However, to make the POSIX 1N/A * wait W*() macros to work in BeOS, we need to unbend the 1N/A * reality back in place. --jhi */ 1N/A#
define WMUNGE(x) (((x) &
0xFF00) >>
8 | ((x) &
0x00FF) <<
8)
1N/A croak(
"POSIX::%s not implemented on this architecture", s);
1N/A#
include "const-c.inc" 1N/A/* These were implemented in the old "constant" subroutine. They are actually 1N/A macros that take an integer argument and return an integer result. */ 1N/A /* Initially switch on the length of the name. */ 1N/A /* This code has been edited from a "constant" function generated by: 1N/Ause ExtUtils::Constant qw (constant_types C_constant XS_constant); 1N/Amy $types = {map {($_, 1)} qw(IV)}; 1N/Amy @names = (qw(S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG WEXITSTATUS WIFEXITED 1N/A WIFSIGNALED WIFSTOPPED WSTOPSIG WTERMSIG)); 1N/Aprint constant_types(); # macro defs 1N/Aforeach (C_constant ("POSIX", 'int_macro_int', 'IV', $types, undef, 5, @names) ) { 1N/A print $_, "\n"; # C constant subs 1N/Aprint "#### XS Section:\n"; 1N/Aprint XS_constant ("POSIX", $types); 1N/A /* Names all of length 7. */ 1N/A /* S_ISBLK S_ISCHR S_ISDIR S_ISREG */ 1N/A /* Offset 5 gives the best switch position. */ 1N/A /* Names all of length 8. */ 1N/A /* S_ISFIFO WSTOPSIG WTERMSIG */ 1N/A /* Offset 3 gives the best switch position. */ 1N/A /* Names all of length 11. */ 1N/A /* WEXITSTATUS WIFSIGNALED */ 1N/A /* Offset 1 gives the best switch position. */ 1N/A /* Fortunately, restoring the signal mask can't fail, because 1N/A * there's nothing we can do about it if it does -- we're not 1N/A * supposed to return -1 from sigaction unless the disposition 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A#
ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */ 1N/A /* Change this to int_macro_int(s, len, &iv, &nv); 1N/A if you need to return both NVs and IVs */ 1N/A /* Return 1 or 2 items. First is error message, or undef if no error. 1N/A Second, if present, is found value */ 1N/A "Your vendor has not defined POSIX macro %s, used", s));
1N/A "Unexpected return type %d while processing POSIX macro %s, used",
1N/A#
endif /* USE_LOCALE_CTYPE */ 1N/A#
endif /* USE_LOCALE_COLLATE */ 1N/A#
endif /* USE_LOCALE_NUMERIC */ 1N/A /* (We already know stack is long enough.) */ 1N/A /* (We already know stack is long enough.) */ 1N/A# interface look beautiful, which is hard. 1N/A POSIX__SigAction action; 1N/A GV *siggv = gv_fetchpv("SIG", TRUE, SVt_PVHV); 1N/A struct sigaction act; 1N/A struct sigaction oact; 1N/A POSIX__SigSet sigset; 1N/A if (sig == 0 && SvPOK(ST(0))) { 1N/A char *s = SvPVX(ST(0)); 1N/A int i = whichsig(s); 1N/A if (i < 0 && memEQ(s, "SIG", 3)) 1N/A i = whichsig(s + 3); 1N/A if (ckWARN(WARN_SIGNAL)) 1N/A Perl_warner(aTHX_ packWARN(WARN_SIGNAL), 1N/A "No such signal: SIG%s", s); 1N/A sigsvp = hv_fetch(GvHVn(siggv), 1N/A strlen(PL_sig_name[sig]), 1N/A /* Check optaction and set action */ 1N/A if(SvTRUE(optaction)) { 1N/A if(sv_isa(optaction, "POSIX::SigAction")) 1N/A action = (HV*)SvRV(optaction); 1N/A croak("action is not of type POSIX::SigAction"); 1N/A /* sigaction() is supposed to look atomic. In particular, any 1N/A * signal handler invoked during a sigaction() call should 1N/A * see either the old or the new disposition, and not something 1N/A * in between. We use sigprocmask() to make it so. 1N/A RETVAL=sigprocmask(SIG_BLOCK, &sset, &osset); 1N/A /* Restore signal mask no matter how we exit this block. */ 1N/A osset_sv = newSVpv((char *)(&osset), sizeof(sigset_t)); 1N/A SAVEFREESV( osset_sv ); 1N/A SAVEDESTRUCTOR_X(restore_sigmask, osset_sv); 1N/A RETVAL=-1; /* In case both oldaction and action are 0. */ 1N/A /* Remember old disposition if desired. */ 1N/A svp = hv_fetch(oldaction, "HANDLER", 7, TRUE); 1N/A if(SvTRUE(*sigsvp)) { /* TBD: what if "0
"? */ 1N/A sv_setsv(*svp, *sigsvp); 1N/A RETVAL = sigaction(sig, (struct sigaction *)0, & oact); 1N/A /* Get back the mask. */ 1N/A svp = hv_fetch(oldaction, "MASK", 4, TRUE); 1N/A IV tmp = SvIV((SV*)SvRV(*svp)); 1N/A sigset = INT2PTR(sigset_t*, tmp); 1N/A New(0, sigset, 1, sigset_t); 1N/A /* Get back the flags. */ 1N/A svp = hv_fetch(oldaction, "FLAGS", 5, TRUE); 1N/A /* Get back whether the old handler used safe signals. */ 1N/A svp = hv_fetch(oldaction, "SAFE", 4, TRUE); 1N/A sv_setiv(*svp, oact.sa_handler == PL_csighandlerp); 1N/A PL_sighandlerp pointer when it's safe to do so. 1N/A svp = hv_fetch(action, "SAFE", 4, FALSE); 1N/A ? PL_csighandlerp : PL_sighandlerp; 1N/A /* Vector new Perl handler through %SIG. 1N/A (The core signal handlers read %SIG to dispatch.) */ 1N/A croak("Can't supply an action without a HANDLER"); 1N/A sv_setsv(*sigsvp, *svp); 1N/A /* This call actually calls sigaction() with almost the 1N/A right settings, including appropriate interpretation 1N/A of DEFAULT and IGNORE. However, why are we doing 1N/A /* Set up any desired mask. */ 1N/A /* Set up any desired flags. */ 1N/A /* Don't worry about cleaning up *sigsvp if this fails, 1N/A * because that means we tried to disposition a 1N/A * nonblockable signal, in which case *sigsvp is 1N/A * essentially meaningless anyway. 1N/A uname((
char *) 0);
/* A stub to call not_here(). */ 1N/A /* yes, the order of arguments is different, 1N/A * but consistent with CORE::chown() */