HP3000-L Archives

February 1997, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Mark Bixby <[log in to unmask]>
Reply To:
Date:
Thu, 6 Feb 1997 09:09:59 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (55 lines)
Jim Alton writes:
>  I've done a bunch of CGI development on the 3000 using C.  I've let
> my programs live in the Posix environment and have had little trouble
> making journies into the MPE side.

POSIX (i.e. C, Perl, sh) CGIs seem to work fine.

But I receive feedback from people trying to do non-POSIX (i.e. Pascal,
Cobol, etc) CGIs who are running into trouble.  The underlying problem seems
to be the way file descriptors are passed (or not passed) when a POSIX program
(Apache written in C) exec()s a non-POSIX program (Pascal, Cobol, etc).

How Apache runs a CGI program:

1) Three pipe()s are created.

2) Apache forks itself.

3) The resulting child process dup2()'s the pipe endpoints on top of the
file descriptors for stdin, stdout, and stderr.

4) The child sets up the CGI environment variables, then calls exec() to launch
the target CGI program.

5) The target CGI replaces the forked child and is supposed to inherit its
file descriptors for stdin,stdout,stderr which are really pipe() endpoints as
created by 3).

6) The Apache parent writes any POST data down the stdin pipe to be read by
the target CGI.  The Apache parent reads from the stdout and stderr pipes for
output written by the target CGI.

All of this works fine when the target CGI is a POSIX program.  MPE programs
run into different troubles depending on whether you're at 5.0 or 5.5.  The
5.0 users report that their MPE CGI output winds up in the Apache job $stdlist,
which tells me that the pipe() descriptor isn't being passed at all by exec().
5.5 users should be able to use the PRINT intrinsic to send output through the
pipe, but so far I haven't figured out how a new HPFOPEN can acquire the
pipe endpoint.  My HPFOPEN test even produces a somewhat scary error message:

A system error has occurred and was backed out with no system damage.  (FILEOPEN ERROR -460)

So at the present time, POSIX exec()s MPE is (choose one or more) broken,
not fully implemented, not clearly documented.  Plus the way file descriptors
are handled was definitely changed between 5.0 and 5.5 according to an HP
person.

I'm still investigating and will report back when I have more info.
--
Mark Bixby                      E-mail: [log in to unmask]
Coast Community College Dist.   Web: http://www.cccd.edu/~markb/
District Information Services   1370 Adams Ave, Costa Mesa, CA, USA 92626-5429
Technical Support               +1 714 438-4647
"You can tune a file system, but you can't tune a fish." - tunefs(1M)

ATOM RSS1 RSS2