From: Craig A. Berry Date: Tue, 25 Jun 2002 21:46:59 +0000 (-0500) Subject: VMS nits, add getppid(), admit absence of fork() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41cbbefae8dc68445cf3cea5b9db7b7f4a1385db;p=p5sagit%2Fp5-mst-13.2.git VMS nits, add getppid(), admit absence of fork() From: "Craig A. Berry" Message-ID: p4raw-id: //depot/perl@17359 --- diff --git a/configure.com b/configure.com index a4bfbf2..085596d 100644 --- a/configure.com +++ b/configure.com @@ -1540,12 +1540,12 @@ $ WRITE CONFIG " exit(0);" $ WRITE CONFIG "}" $ CLOSE CONFIG $! -$! DEFINE SYS$ERROR _NLA0: -$! DEFINE SYS$OUTPUT _NLA0: +$ SET NOON +$ DEFINE/USER_MODE SYS$ERROR _NLA0: +$ DEFINE/USER_MODE SYS$OUTPUT _NLA0: $ cc/NoObj/list=ccvms.lis ccvms.c $ tmp = $status -$! DEASSIGN SYS$OUTPUT -$! DEASSIGN SYS$ERROR +$ SET ON $ IF (silent) THEN GOSUB Shut_up $ IF tmp.NE.%X10B90001 $ THEN @@ -1565,9 +1565,9 @@ $ IF .NOT.silent $ THEN $ echo "Will try cc/decc..." $ ENDIF +$ SET NOON $ DEFINE/USER_MODE SYS$ERROR NL: $ DEFINE/USER_MODE SYS$OUTPUT NL: -$ SET NOON $ cc/decc/NoObj/list=ccvms.lis ccvms.c $ tmp = $status $ SET ON @@ -1591,10 +1591,12 @@ $! $Gcc_initial_check: $ echo "Checking for gcc" $ OPEN/WRITE CONFIG gccvers.lis +$ SET NOON $ DEFINE/USER_MODE SYS$ERROR CONFIG $ DEFINE/USER_MODE SYS$OUTPUT CONFIG $ 'gcc_symbol'/noobj/version _nla0: $ tmp = $status +$ SET ON $ IF (silent) THEN GOSUB Shut_up $ CLOSE CONFIG $ IF (tmp.NE.%X10000001).and.(tmp.ne.%X00030001) @@ -2337,7 +2339,7 @@ $ echo "" $ bool_dflt = "y" $ if f$type(useithreads) .nes. "" $ then -$ if .not. useithreads .or. useithreads .eqs. "undef" then bool_dflt="n" +$ if useithreads .eqs. "undef" then bool_dflt="n" $ endif $ if f$type(use5005threads) .nes. "" $ then @@ -3374,6 +3376,25 @@ $ tmp = "unistd.h" $ GOSUB inhdr $ i_unistd = tmp $! +$! do we have getppid()? +$! +$ IF i_unistd .EQS. "define" +$ THEN +$ OS +$ WS "#include " +$ WS "#include " +$ WS "int main() {" +$ WS "printf(""%d\n"",getppid());" +$ WS "return(0);" +$ WS "}" +$ CS +$ tmp = "getppid" +$ GOSUB inlibc +$ d_getppid = tmp +$ ELSE +$ d_getppid = "undef" +$ ENDIF +$! $!: see if this is a libutil.h system $! $ tmp = "libutil.h" @@ -5253,7 +5274,7 @@ $ WC "d_getpent='" + d_getpent + "'" $ WC "d_getpgid='undef'" $ WC "d_getpgrp2='undef'" $ WC "d_getpgrp='undef'" -$ WC "d_getppid='undef'" +$ WC "d_getppid='" + d_getppid + "'" $ WC "d_getprior='undef'" $ WC "d_getprotoprotos='" + d_getprotoprotos + "'" $ WC "d_getprpwnam='undef'" diff --git a/pod/perlport.pod b/pod/perlport.pod index 44c79de..8fb3561 100644 --- a/pod/perlport.pod +++ b/pod/perlport.pod @@ -1567,7 +1567,7 @@ Available only on Windows NT (not on Windows 95). (Win32) =item fork -Not implemented. (S, AmigaOS, S, VOS, VM/ESA) +Not implemented. (S, AmigaOS, S, VOS, VM/ESA, VMS) Emulated using multiple interpreters. See L. (Win32) @@ -1584,7 +1584,7 @@ Not implemented. (S, Win32, VMS, S, VOS) =item getppid -Not implemented. (S, Win32, VMS, S) +Not implemented. (S, Win32, S) =item getpriority WHICH,WHO diff --git a/vms/perlvms.pod b/vms/perlvms.pod index 5ba34bb..35c3d84 100644 --- a/vms/perlvms.pod +++ b/vms/perlvms.pod @@ -338,7 +338,7 @@ Perl functions were implemented in the VMS port of Perl caller, chdir, chmod, chown, chomp, chop, chr, close, closedir, cos, crypt*, defined, delete, die, do, dump*, each, endpwent, eof, eval, exec*, - exists, exit, exp, fileno, fork*, getc, getlogin, + exists, exit, exp, fileno, getc, getlogin, getppid, getpwent*, getpwnam*, getpwuid*, glob, gmtime*, goto, grep, hex, import, index, int, join, keys, kill*, last, lc, lcfirst, length, local, localtime, log, m//, @@ -358,8 +358,8 @@ The following functions were not implemented in the VMS port, and calling them produces a fatal error (usually) or undefined behavior (rarely, we hope): - chroot, dbmclose, dbmopen, flock, - getpgrp, getppid, getpriority, getgrent, getgrgid, + chroot, dbmclose, dbmopen, flock, fork*, + getpgrp, getpriority, getgrent, getgrgid, getgrnam, setgrent, endgrent, ioctl, link, lstat, msgctl, msgget, msgsend, msgrcv, readlink, semctl, semget, semop, setpgrp, setpriority, shmctl, shmget, @@ -482,49 +482,30 @@ affected by calling C. =item exec LIST -The C operator behaves in one of two different ways. -If called after a call to C, it will invoke the CRTL -C routine, passing its arguments to the subprocess -created by C for execution. In this case, it is -subject to all limitations that affect C. (In -particular, this usually means that the command executed in -the subprocess must be an image compiled from C source code, -and that your options for passing file descriptors and signal -handlers to the subprocess are limited.) - -If the call to C does not follow a call to C, it -will cause Perl to exit, and to invoke the command given as -an argument to C via C. If the argument -begins with '@' or '$' (other than as part of a filespec), then it -is executed as a DCL command. Otherwise, the first token on -the command line is treated as the filespec of an image to -run, and an attempt is made to invoke it (using F<.Exe> and -the process defaults to expand the filespec) and pass the -rest of C's argument to it as parameters. If the token -has no file type, and matches a file with null type, then an -attempt is made to determine whether the file is an executable -image which should be invoked using C or a text file which -should be passed to DCL as a command procedure. - -You can use C in both ways within the same script, as -long as you call C and C in pairs. Perl -keeps track of how many times C and C have been -called, and will call the CRTL C routine if there have -previously been more calls to C than to C. +A call to C will cause Perl to exit, and to invoke the command +given as an argument to C via C. If the +argument begins with '@' or '$' (other than as part of a filespec), +then it is executed as a DCL command. Otherwise, the first token on +the command line is treated as the filespec of an image to run, and +an attempt is made to invoke it (using F<.Exe> and the process +defaults to expand the filespec) and pass the rest of C's +argument to it as parameters. If the token has no file type, and +matches a file with null type, then an attempt is made to determine +whether the file is an executable image which should be invoked +using C or a text file which should be passed to DCL as a +command procedure. =item fork -The C operator works in the same way as the CRTL -C routine, which is quite different under VMS than -under Unix. Specifically, while C returns 0 after it -is called and the subprocess PID after C is called, in -both cases the thread of execution is within the parent -process, so there is no opportunity to perform operations in -the subprocess before calling C. - -In general, the use of C and C to create -subprocesses is not recommended under VMS; wherever possible, -use the C operator or piped filehandles instead. +While in principle the C operator could be implemented via +(and with the same rather severe limitations as) the CRTL C +routine, and while some internal support to do just that is in +place, the implementation has never been completed, making C +currently unavailable. A true kernel C is expected in a +future version of VMS, and the pseudo-fork based on interpreter +threads may be available in a future version of Perl on VMS (see +L). In the meantime, use C, backticks, or piped +filehandles to create subprocesses. =item getpwent