Mailing List Archive

Patch 2 to my Jumbo Configure patch vs. 1m.
# This is patch 2 to my Jumbo Configure patch for perl5.001m.
# See description below.
# Andy Dougherty doughera@lafcol.lafayette.edu
#
exit 0

This patch 2 to my Jumbo Configure patch for perl5.001m of September 27,
1995. Apply with patch -p1 -N.

This adds some missing symbols to the kludge comment in ext/Fcntl.xs.
Basically, in order to support extensions using non-blocking I/O, I
added a comment to Fcntl.xs to fool metaconfig into including the i/o
test. Unfortunately, I forgot to mention *all* the relevant symbols,
so metaconfig didn't include them all in config.h. This patch fixes
that oversight.

Some time ago I had also promised to include a test for HAS_POLL,
which could be used by Term::ReadKey. I did that here too.

I also cleaned up the Configure/signal name stuff quite a bit.
Many thanks to Raphael for his contribution of the basic metaconfig
units (though I've changed them considerably and responsbility for any
errors is mine).

Here's a long & rambling description of what I've done to the signal
stuff:

The problems:
1. Linux keeps moving the signal definitions.
2. Some systems have hard-to-parse signal.h files.
3. Some systems have multiple names for the same signal number.
Previous versions of Configure didn't always pick the one
you wanted. (ABRT vs. IOT is the most prominent example.)
Perl is already equipped to handle the CHLD/CLD signals.
4. Some systems (e.g. Solaris 2.4) have gaps in the signal numbers,
so you can't guess the signal number from the position of the
name in the array.

My solution:
1. Use the C compiler to trace out the effects of #include <signal.h>.
Then use awk on the #included files to generate a list of possible
signal names, generate a C program to test them, then
pass all that through sort -n +1 | uniq. We now have a sorted
list of signal name/number pairs. These get stored in a pair of
arrays sig_name[] and sig_num[]. The signal number corresponding
to sig_name[i] is stored in sig_num[i].
2. Patch mg.c to use the new sig_name[] and sig_num[] arrays.

Please try this out and let me know if it works for you.

Files changed by this patch:

Configure
New tests for signal names.
Now includes test for poll.

INSTALL
Note that the installer can sometimes delete libperl.a

config_h.SH
Now includes VAL_O_NONBLOCK, VAL_EAGAIN, RD_NODATA, EOF_NONBLOCK, and
HAS_POLL defines.

Updated sig_num and sig_name declarations.

global.sym
Added new sig_num array.

ext/Fcntl/Fcntl.xs
New improved comment about the nonblocking and poll symbols.

embed.h
Added new sig_num array.

mg.h
Uses new sig_num and sig_name arrays.

perl.h
Updated to match sig_num and sig_name usage in config_h.SH

Patch and Enjoy,

Andy Dougherty doughera@lafcol.lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042

Index: Configure
Prereq: 3.0.1.8
*** perl5.001m+/Configure Fri Oct 20 11:09:26 1995
--- perl5.001n/Configure Thu Oct 19 10:48:18 1995
***************
*** 20,26 ****

# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
#

cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
--- 20,26 ----

# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
#
! # Generated on Thu Oct 19 10:47:09 EDT 1995 [metaconfig 3.0 PL58]

cat >/tmp/c1$$ <<EOF
ARGGGHHHH!!!!!
***************
*** 315,320 ****
--- 315,321 ----
d_pathconf=''
d_pause=''
d_pipe=''
+ d_poll=''
d_portable=''
d_readdir=''
d_rewinddir=''
***************
*** 534,539 ****
--- 535,542 ----
scriptdirexp=''
selecttype=''
sig_name=''
+ sig_max=''
+ sig_num=''
d_sitelib=''
installsitelib=''
sitelib=''
***************
*** 5417,5422 ****
--- 5420,5644 ----
set dup2 d_dup2
eval $inlibc

+ : Locate the flags for 'open()'
+ echo " "
+ $cat >open3.c <<'EOCP'
+ #include <sys/types.h>
+ #ifdef I_FCNTL
+ #include <fcntl.h>
+ #endif
+ #ifdef I_SYS_FILE
+ #include <sys/file.h>
+ #endif
+ main() {
+ if(O_RDONLY);
+ #ifdef O_TRUNC
+ exit(0);
+ #else
+ exit(1);
+ #endif
+ }
+ EOCP
+ : check sys/file.h first to get FREAD on Sun
+ if $test `./findhdr sys/file.h` && \
+ $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
+ h_sysfile=true;
+ echo "<sys/file.h> defines the O_* constants..." >&4
+ if ./open3; then
+ echo "and you have the 3 argument form of open()." >&4
+ val="$define"
+ else
+ echo "but not the 3 argument form of open(). Oh, well." >&4
+ val="$undef"
+ fi
+ elif $test `./findhdr fcntl.h` && \
+ $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
+ h_fcntl=true;
+ echo "<fcntl.h> defines the O_* constants..." >&4
+ if ./open3; then
+ echo "and you have the 3 argument form of open()." >&4
+ val="$define"
+ else
+ echo "but not the 3 argument form of open(). Oh, well." >&4
+ val="$undef"
+ fi
+ else
+ val="$undef"
+ echo "I can't find the O_* constant definitions! You got problems." >&4
+ fi
+ set d_open3
+ eval $setvar
+ $rm -f open3*
+
+ : check for non-blocking I/O stuff
+ case "$h_sysfile" in
+ true) echo "#include <sys/file.h>" > head.c;;
+ *)
+ case "$h_fcntl" in
+ true) echo "#include <fcntl.h>" > head.c;;
+ *) echo "#include <sys/fcntl.h>" > head.c;;
+ esac
+ ;;
+ esac
+ echo " "
+ echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
+ case "$o_nonblock" in
+ '')
+ $cat head.c > try.c
+ $cat >>try.c <<'EOCP'
+ main() {
+ #ifdef O_NONBLOCK
+ printf("O_NONBLOCK\n");
+ exit(0);
+ #endif
+ #ifdef O_NDELAY
+ printf("O_NDELAY\n");
+ exit(0);
+ #endif
+ #ifdef FNDELAY
+ printf("FNDELAY\n");
+ exit(0);
+ #endif
+ exit(0);
+ }
+ EOCP
+ if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
+ o_nonblock=`./try`
+ case "$o_nonblock" in
+ '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
+ *) echo "Seems like we can use $o_nonblock.";;
+ esac
+ else
+ echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
+ fi
+ ;;
+ *) echo "Using $hint value $o_nonblock.";;
+ esac
+ $rm -f try try.* .out core
+
+ echo " "
+ echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
+ case "$eagain" in
+ '')
+ $cat head.c > try.c
+ $cat >>try.c <<EOCP
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <signal.h>
+ extern int errno;
+ $signal_t blech(x) int x; { exit(3); }
+ main()
+ {
+ int pd[2];
+ int pu[2];
+ char buf[1];
+ char string[100];
+
+ pipe(pd); /* Down: child -> parent */
+ pipe(pu); /* Up: parent -> child */
+ if (0 != fork()) {
+ int ret;
+ close(pd[1]); /* Parent reads from pd[0] */
+ close(pu[0]); /* Parent writes (blocking) to pu[1] */
+ if (-1 == fcntl(pd[0], F_SETFL, $o_nonblock))
+ exit(1);
+ signal(SIGALRM, blech);
+ alarm(5);
+ if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
+ exit(2);
+ sprintf(string, "%d\n", ret);
+ write(2, string, strlen(string));
+ alarm(0);
+ #ifdef EAGAIN
+ if (errno == EAGAIN) {
+ printf("EAGAIN\n");
+ goto ok;
+ }
+ #endif
+ #ifdef EWOULDBLOCK
+ if (errno == EWOULDBLOCK)
+ printf("EWOULDBLOCK\n");
+ #endif
+ ok:
+ write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
+ sleep(2); /* Give it time to close our pipe */
+ alarm(5);
+ ret = read(pd[0], buf, 1); /* Should read EOF */
+ alarm(0);
+ sprintf(string, "%d\n", ret);
+ write(3, string, strlen(string));
+ exit(0);
+ }
+
+ close(pd[0]); /* We write to pd[1] */
+ close(pu[1]); /* We read from pu[0] */
+ read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
+ close(pd[1]); /* Pipe pd is now fully closed! */
+ exit(0); /* Bye bye, thank you for playing! */
+ }
+ EOCP
+ if $cc $ccflags $ldflags try.c -o try >/dev/null; 2>&1; then
+ echo "./try >try.out 2>try.ret 3>try.err || exit 4" >mtry
+ chmod +x mtry
+ ./mtry >/dev/null 2>&1
+ case $? in
+ 0) eagain=`$cat try.out`;;
+ 1) echo "Could not perform non-blocking setting!";;
+ 2) echo "I did a successful read() for something that was not there!";;
+ 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
+ *) echo "Something terribly wrong happened during testing.";;
+ esac
+ rd_nodata=`$cat try.ret`
+ echo "A read() system call with no data present returns $rd_nodata."
+ case "$rd_nodata" in
+ 0|-1) ;;
+ *)
+ echo "(That's peculiar, fixing that to be -1.)"
+ rd_nodata=-1
+ ;;
+ esac
+ case "$eagain" in
+ '')
+ echo "Forcing errno EAGAIN on read() with no data available."
+ eagain=EAGAIN
+ ;;
+ *)
+ echo "Your read() sets errno to $eagain when no data is available."
+ ;;
+ esac
+ status=`$cat try.err`
+ case "$status" in
+ 0) echo "And it correctly returns 0 to signal EOF.";;
+ -1) echo "But it also returns -1 to signal EOF, so be careful!";;
+ *) echo "However, your read() returns '$status' on EOF??";;
+ esac
+ val="$define"
+ if test "$status" -eq "$rd_nodata"; then
+ echo "WARNING: you can't distinguish between EOF and no data!"
+ val="$undef"
+ fi
+ else
+ echo "I can't compile the test program--assuming errno EAGAIN will do."
+ eagain=EAGAIN
+ fi
+ set d_eofnblk
+ eval $setvar
+ ;;
+ *)
+ echo "Using $hint value $eagain."
+ echo "Your read() returns $rd_nodata when no data is present."
+ case "$d_eofnblk" in
+ "$define") echo "And you can see EOF because read() returns 0.";;
+ "$undef") echo "But you can't see EOF status from read() returned value.";;
+ *)
+ echo "(Assuming you can't see EOF status from read anyway.)"
+ d_eofnblk=$undef
+ ;;
+ esac
+ ;;
+ esac
+ $rm -f try try.* .out core head.c mtry
+
: see if fchmod exists
set fchmod d_fchmod
eval $inlibc
***************
*** 5776,5831 ****
set nice d_nice
eval $inlibc

- : Locate the flags for 'open()'
- echo " "
- $cat >open3.c <<'EOCP'
- #include <sys/types.h>
- #ifdef I_FCNTL
- #include <fcntl.h>
- #endif
- #ifdef I_SYS_FILE
- #include <sys/file.h>
- #endif
- main() {
- if(O_RDONLY);
- #ifdef O_TRUNC
- exit(0);
- #else
- exit(1);
- #endif
- }
- EOCP
- : check sys/file.h first to get FREAD on Sun
- if $test `./findhdr sys/file.h` && \
- $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
- h_sysfile=true;
- echo "<sys/file.h> defines the O_* constants..." >&4
- if ./open3; then
- echo "and you have the 3 argument form of open()." >&4
- val="$define"
- else
- echo "but not the 3 argument form of open(). Oh, well." >&4
- val="$undef"
- fi
- elif $test `./findhdr fcntl.h` && \
- $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
- h_fcntl=true;
- echo "<fcntl.h> defines the O_* constants..." >&4
- if ./open3; then
- echo "and you have the 3 argument form of open()." >&4
- val="$define"
- else
- echo "but not the 3 argument form of open(). Oh, well." >&4
- val="$undef"
- fi
- else
- val="$undef"
- echo "I can't find the O_* constant definitions! You got problems." >&4
- fi
- set d_open3
- eval $setvar
- $rm -f open3*
-
: see if pause exists
set pause d_pause
eval $inlibc
--- 5998,6003 ----
***************
*** 5834,5839 ****
--- 6006,6015 ----
set pipe d_pipe
eval $inlibc

+ : see if poll exists
+ set poll d_poll
+ eval $inlibc
+
: see if this is a pwd.h system
set pwd.h i_pwd
eval $inhdr
***************
*** 7302,7476 ****
. ./myread
modetype="$ans"

- : check for non-blocking I/O stuff
- case "$h_sysfile" in
- true) echo "#include <sys/file.h>" > head.c;;
- *)
- case "$h_fcntl" in
- true) echo "#include <fcntl.h>" > head.c;;
- *) echo "#include <sys/fcntl.h>" > head.c;;
- esac
- ;;
- esac
- echo " "
- echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
- case "$o_nonblock" in
- '')
- $cat head.c > try.c
- $cat >>try.c <<'EOCP'
- main() {
- #ifdef O_NONBLOCK
- printf("O_NONBLOCK\n");
- exit(0);
- #endif
- #ifdef O_NDELAY
- printf("O_NDELAY\n");
- exit(0);
- #endif
- #ifdef FNDELAY
- printf("FNDELAY\n");
- exit(0);
- #endif
- exit(0);
- }
- EOCP
- if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
- o_nonblock=`./try`
- case "$o_nonblock" in
- '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
- *) echo "Seems like we can use $o_nonblock.";;
- esac
- else
- echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
- fi
- ;;
- *) echo "Using $hint value $o_nonblock.";;
- esac
- $rm -f try try.* .out core
-
- echo " "
- echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
- case "$eagain" in
- '')
- $cat head.c > try.c
- $cat >>try.c <<EOCP
- #include <errno.h>
- #include <sys/types.h>
- #include <signal.h>
- extern int errno;
- $signal_t blech(x) int x; { exit(3); }
- main()
- {
- int pd[2];
- int pu[2];
- char buf[1];
- char string[100];
-
- pipe(pd); /* Down: child -> parent */
- pipe(pu); /* Up: parent -> child */
- if (0 != fork()) {
- int ret;
- close(pd[1]); /* Parent reads from pd[0] */
- close(pu[0]); /* Parent writes (blocking) to pu[1] */
- if (-1 == fcntl(pd[0], F_SETFL, $o_nonblock))
- exit(1);
- signal(SIGALRM, blech);
- alarm(5);
- if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */
- exit(2);
- sprintf(string, "%d\n", ret);
- write(2, string, strlen(string));
- alarm(0);
- #ifdef EAGAIN
- if (errno == EAGAIN) {
- printf("EAGAIN\n");
- goto ok;
- }
- #endif
- #ifdef EWOULDBLOCK
- if (errno == EWOULDBLOCK)
- printf("EWOULDBLOCK\n");
- #endif
- ok:
- write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */
- sleep(2); /* Give it time to close our pipe */
- alarm(5);
- ret = read(pd[0], buf, 1); /* Should read EOF */
- alarm(0);
- sprintf(string, "%d\n", ret);
- write(3, string, strlen(string));
- exit(0);
- }
-
- close(pd[0]); /* We write to pd[1] */
- close(pu[1]); /* We read from pu[0] */
- read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */
- close(pd[1]); /* Pipe pd is now fully closed! */
- exit(0); /* Bye bye, thank you for playing! */
- }
- EOCP
- if $cc $ccflags $ldflags try.c -o try >/dev/null; 2>&1; then
- echo "./try >try.out 2>try.ret 3>try.err || exit 4" >mtry
- chmod +x mtry
- ./mtry >/dev/null 2>&1
- case $? in
- 0) eagain=`$cat try.out`;;
- 1) echo "Could not perform non-blocking setting!";;
- 2) echo "I did a successful read() for something that was not there!";;
- 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
- *) echo "Something terribly wrong happened during testing.";;
- esac
- rd_nodata=`$cat try.ret`
- echo "A read() system call with no data present returns $rd_nodata."
- case "$rd_nodata" in
- 0|-1) ;;
- *)
- echo "(That's peculiar, fixing that to be -1.)"
- rd_nodata=-1
- ;;
- esac
- case "$eagain" in
- '')
- echo "Forcing errno EAGAIN on read() with no data available."
- eagain=EAGAIN
- ;;
- *)
- echo "Your read() sets errno to $eagain when no data is available."
- ;;
- esac
- status=`$cat try.err`
- case "$status" in
- 0) echo "And it correctly returns 0 to signal EOF.";;
- -1) echo "But it also returns -1 to signal EOF, so be careful!";;
- *) echo "However, your read() returns '$status' on EOF??";;
- esac
- val="$define"
- if test "$status" -eq "$rd_nodata"; then
- echo "WARNING: you can't distinguish between EOF and no data!"
- val="$undef"
- fi
- else
- echo "I can't compile the test program--assuming errno EAGAIN will do."
- eagain=EAGAIN
- fi
- set d_eofnblk
- eval $setvar
- ;;
- *)
- echo "Using $hint value $eagain."
- echo "Your read() returns $rd_nodata when no data is present."
- case "$d_eofnblk" in
- "$define") echo "And you can see EOF because read() returns 0.";;
- "$undef") echo "But you can't see EOF status from read() returned value.";;
- *)
- echo "(Assuming you can't see EOF status from read anyway.)"
- d_eofnblk=$undef
- ;;
- esac
- ;;
- esac
- $rm -f try try.* .out core head.c mtry
-
: set the base revision
baserev=5.0

--- 7478,7483 ----
***************
*** 7813,7866 ****
;;
esac

! : generate list of signal names
! echo " "
! case "$sig_name" in
! '')
! echo "Generating a list of signal names..." >&4
! xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
! xxx="$xxx "`./findhdr linux/signal.h`" "`./findhdr asm/signal.h`
! set X `cat $xxx 2>&1 | $awk '
! $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
! sig[$3] = substr($2,4,20)
! if (max < $3 && $3 < 60) {
! max = $3
! }
}
! $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $4 ~ /^[1-9][0-9]*$/ {
! print $3, $4
! sig[$4] = substr($3,4,20)
! if (max < $4 && $4 < 60) {
! max = $4
! }
}
-
END {
! for (i = 1; i <= max; i++) {
! if (sig[i] == "")
! printf "%d", i
! else
! printf "%s", sig[i]
! if (i < max)
! printf " "
! }
! printf "\n"
}
! '`
shift
! case $# in
! 0)
! echo 'kill -l' >/tmp/foo$$
! set X `csh -f </tmp/foo$$`
! $rm -f /tmp/foo$$
! shift
! case $# in
! 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
! ;;
! esac
! ;;
esac
! sig_name="ZERO $*"
;;
esac
echo "The following signals are available:"
--- 7820,7900 ----
;;
esac

! : Trace out the files included by signal.h, then look for SIGxxx names.
! : Remove SIGARRAYSIZE used by HPUX.
! xxx=`echo '#include <signal.h>' |
! $cppstdin $cppminus $cppflags 2>/dev/null |
! $grep '^[ ]*#.*include' |
! $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
! : Check this list of files to be sure we have parsed the cpp output ok.
! : This will also avoid potentially non-existent files, such
! : as ../foo/bar.h
! xxxfiles=''
! for xx in $xxx /dev/null ; do
! $test -f "$xx" && xxxfiles="$xxxfiles $xx"
! done
! : If we have found no files, at least try signal.h
! case "$xxxfiles" in
! '') xxxfiles=`./findhdr signal.h` ;;
! esac
! xxx=`awk '
! $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ {
! print substr($2, 4, 20)
! }
! $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ {
! print substr($3, 4, 20)
! }' $xxxfiles`
! : Append some common names just in case the awk scan failed.
! xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
! xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
! xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
! xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
! : generate a few handy files for later
! echo $xxx | $tr ' ' '\012' | $awk '
! BEGIN {
! printf "#include <signal.h>\n";
! printf "main() {\n";
}
! {
! printf "#ifdef SIG"; printf $1; printf "\n"
! printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
! printf $1; printf ");\n"
! printf "#endif\n"
}
END {
! printf "}\n";
}
! ' >signal.c
! $cat >signal.cmd <<EOS
! $startsh
! $test -s signal.lst && exit 0
! if $cc $ccflags signal.c -o signal $ldflags >/dev/null 2>&1; then
! ./signal | $sort -n +1 | $uniq >signal.lst
! else
! echo "(I can't seem be able to compile the test program -- Guessing)"
! echo 'kill -l' >signal
! set X \`csh -f <signal\`
! $rm -f signal
shift
! case \$# in
! 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
esac
! echo \$@ | $tr ' ' '\012' | \
! $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
! fi
! $rm -f signal.c signal signal.o
! EOS
! chmod a+x signal.cmd
! $eunicefix signal.cmd
!
! : generate list of signal names
! echo " "
! case "$sig_name" in
! '')
! echo "Generating a list of signal names..." >&4
! ./signal.cmd
! sig_name=`$awk '{printf "%s ", $1}' signal.lst`
! sig_name="ZERO $sig_name"
;;
esac
echo "The following signals are available:"
***************
*** 7868,7874 ****
echo $sig_name | $awk \
'BEGIN { linelen = 0 }
{
! for (i = 1; i < NF; i++) {
name = "SIG" $i " "
linelen = linelen + length(name)
if (linelen > 70) {
--- 7902,7908 ----
echo $sig_name | $awk \
'BEGIN { linelen = 0 }
{
! for (i = 1; i <= NF; i++) {
name = "SIG" $i " "
linelen = linelen + length(name)
if (linelen > 70) {
***************
*** 7877,7884 ****
}
printf "%s", name
}
! }
! END { printf "\n"}'

: see what type is used for size_t
set size_t sizetype 'unsigned int' stdio.h sys/types.h
--- 7911,7933 ----
}
printf "%s", name
}
! printf "\n"
! }'
!
! : generate list of signal numbers
! echo " "
! case "$sig_num" in
! '')
! echo "Generating a list of signal numbers..." >&4
! ./signal.cmd
! sig_num=`$awk '{printf "%d ", $2}' signal.lst`
! sig_num="0 $sig_num"
! ;;
! esac
! case "$sig_max" in
! '') sig_max=`$tail -1 signal.lst | $awk '{print $2}'` ;;
! esac
! echo "The maximum signal number defined is $sig_max."

: see what type is used for size_t
set size_t sizetype 'unsigned int' stdio.h sys/types.h
***************
*** 8603,8608 ****
--- 8652,8658 ----
d_pause='$d_pause'
d_phostname='$d_phostname'
d_pipe='$d_pipe'
+ d_poll='$d_poll'
d_portable='$d_portable'
d_pwage='$d_pwage'
d_pwchange='$d_pwchange'
***************
*** 8861,8867 ****
--- 8911,8919 ----
shmattype='$shmattype'
shrpdir='$shrpdir'
shsharp='$shsharp'
+ sig_max='$sig_max'
sig_name='$sig_name'
+ sig_num='$sig_num'
signal_t='$signal_t'
sitelib='$sitelib'
sitelibexp='$sitelibexp'
Index: INSTALL
*** perl5.001m+/INSTALL Fri Oct 20 11:09:27 1995
--- perl5.001n/INSTALL Wed Oct 18 15:35:35 1995
***************
*** 433,441 ****
pod/*.pod in $privlib/pod/.

Perl's *.h header files and the libperl.a library are also
! installed under $archlib so that you may later build new
extensions even if the Perl source is no longer available.

make install may also offer to install perl in a "standard" location.

Most of the documentation in the pod/ directory is also available
--- 433,446 ----
pod/*.pod in $privlib/pod/.

Perl's *.h header files and the libperl.a library are also
! installed under $archlib so that any user may later build new
extensions even if the Perl source is no longer available.

+ The libperl.a library is only needed for building new
+ extensions and linking them statically into a new perl executable.
+ If you will not be doing that, then you may safely delete
+ $archlib/libperl.a after perl is installed.
+
make install may also offer to install perl in a "standard" location.

Most of the documentation in the pod/ directory is also available
***************
*** 476,479 ****
Andy Dougherty <doughera@lafcol.lafayette.edu>, borrowing I<very> heavily
from the original README by Larry Wall.

! 27 September 1995
--- 481,484 ----
Andy Dougherty <doughera@lafcol.lafayette.edu>, borrowing I<very> heavily
from the original README by Larry Wall.

! 18 October 1995
Index: config_h.SH
Prereq: 3.0.1.3
*** perl5.001m+/config_h.SH Fri Oct 20 11:09:28 1995
--- perl5.001n/config_h.SH Thu Oct 19 10:48:18 1995
***************
*** 515,520 ****
--- 515,526 ----
*/
#$d_pipe HAS_PIPE /**/

+ /* HAS_POLL:
+ * This symbol, if defined, indicates that the poll routine is
+ * available to poll active file descriptors.
+ */
+ #$d_poll HAS_POLL /**/
+
/* HAS_READDIR:
* This symbol, if defined, indicates that the readdir routine is
* available to read directory entries. You may have to include
***************
*** 1273,1279 ****
--- 1279,1303 ----
* alternatively switch between blocking and non-blocking, use the
* ioctl(FIOSNBIO) call instead, but that is not supported by all devices.
*/
+ /* VAL_EAGAIN:
+ * This symbol holds the errno error code set by read() when no data was
+ * present on the non-blocking file descriptor.
+ */
+ /* RD_NODATA:
+ * This symbol holds the return code from read() when no data is present
+ * on the non-blocking file descriptor. Be careful! If EOF_NONBLOCK is
+ * not defined, then you can't distinguish between no data and EOF by
+ * issuing a read(). You'll have to find another way to tell for sure!
+ */
+ /* EOF_NONBLOCK:
+ * This symbol, if defined, indicates to the C program that a read() on
+ * a non-blocking file descriptor will return 0 on EOF, and not the value
+ * held in RD_NODATA (-1 usually, in that case!).
+ */
#define VAL_O_NONBLOCK $o_nonblock
+ #define VAL_EAGAIN $eagain
+ #define RD_NODATA $rd_nodata
+ #$d_eofnblk EOF_NONBLOCK

/* PRIVLIB_EXP:
* This symbol contains the ~name expanded version of PRIVLIB, to be used
***************
*** 1450,1458 ****
* char *sig_name[] = { SIG_NAME };
* The signals in the list are separated with commas, and each signal
* is surrounded by double quotes. There is no leading SIG in the signal
! * name, i.e. SIGQUIT is known as "QUIT".
*/
! #define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`" /**/

/* SITELIB_EXP:
* This symbol contains the ~name expanded version of SITELIB, to be used
--- 1474,1501 ----
* char *sig_name[] = { SIG_NAME };
* The signals in the list are separated with commas, and each signal
* is surrounded by double quotes. There is no leading SIG in the signal
! * name, i.e. SIGQUIT is known as "QUIT". Duplicates are allowed.
! * The signal number for sig_name[i] is stored in sig_num[i].
! * The last element is 0 to terminate the list with a NULL. This
! * corresponds to the 0 at the end of the sig_num list.
! * See SIG_NUM and SIG_MAX.
! */
! #define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`",0 /**/
!
! /* SIG_NUM:
! * This symbol contains a list of signal number, in the same order as the
! * SIG_NAME list. It is suitable for static array initialization, as in:
! * int sig_num[] = { SIG_NUM };
! * The signals in the list are separated with commas, and the indices
! * within that list and the SIG_NAME list match, so it's easy to compute
! * the signal name from a number or vice versa at the price of a small
! * dynamic linear lookup. Duplicates are allowed, so you can't assume
! * sig_num[i] == i. Instead, the signal number corresponding to
! * sig_name[i] is sig_number[i].
! * The last element is 0, corresponding to the 0 at the end of
! * the sig_name list.
*/
! #define SIG_NUM `echo $sig_num 0 | sed 's/ /,/g'` /**/

/* SITELIB_EXP:
* This symbol contains the ~name expanded version of SITELIB, to be used
Index: embed.h
*** perl5.001m+/embed.h Fri Oct 20 11:09:15 1995
--- perl5.001n/embed.h Wed Oct 18 14:37:52 1995
***************
*** 196,201 ****
--- 196,202 ----
#define sge_amg Perl_sge_amg
#define sgt_amg Perl_sgt_amg
#define sig_name Perl_sig_name
+ #define sig_num Perl_sig_num
#define siggv Perl_siggv
#define sighandler Perl_sighandler
#define simple Perl_simple
***************
*** 862,871 ****
#define q Perl_q
#define ref Perl_ref
#define refkids Perl_refkids
! #define regcomp Perl_regcomp
#define regdump Perl_regdump
! #define regexec Perl_regexec
! #define regfree Perl_regfree
#define regnext Perl_regnext
#define regprop Perl_regprop
#define repeatcpy Perl_repeatcpy
--- 863,872 ----
#define q Perl_q
#define ref Perl_ref
#define refkids Perl_refkids
! #define pregcomp Perl_pregcomp
#define regdump Perl_regdump
! #define pregexec Perl_pregexec
! #define pregfree Perl_pregfree
#define regnext Perl_regnext
#define regprop Perl_regprop
#define repeatcpy Perl_repeatcpy
Index: ext/Fcntl/Fcntl.xs
*** perl5.001m+/ext/Fcntl/Fcntl.xs Fri Oct 20 11:09:28 1995
--- perl5.001n/ext/Fcntl/Fcntl.xs Mon Oct 16 10:28:31 1995
***************
*** 4,13 ****

#include <fcntl.h>

! /* This comment is a kludge to get metaconfig to see the
! symbol VAL_O_NONBLOCK and include the appropriate metaconfig unit
so that Configure will test how to turn on non-blocking I/O
! for a file descriptor. --AD 09/28/95.
*/

static int
--- 4,21 ----

#include <fcntl.h>

! /* This comment is a kludge to get metaconfig to see the symbols
! VAL_O_NONBLOCK
! VAL_EAGAIN
! RD_NODATA
! EOF_NONBLOCK
! and include the appropriate metaconfig unit
so that Configure will test how to turn on non-blocking I/O
! for a file descriptor. See config.h for how to use these
! in your extension.
!
! While I'm at it, I'll have metaconfig look for HAS_POLL too.
! --AD October 16, 1995
*/

static int
Index: global.sym
*** perl5.001m+/global.sym Fri Oct 20 11:09:16 1995
--- perl5.001n/global.sym Wed Oct 18 14:37:15 1995
***************
*** 193,198 ****
--- 193,199 ----
sge_amg
sgt_amg
sig_name
+ sig_num
siggv
sighandler
simple
Index: mg.c
*** perl5.001m+/mg.c Mon Mar 6 20:46:39 1995
--- perl5.001n/mg.c Fri Oct 20 11:41:52 1995
***************
*** 21,26 ****
--- 21,28 ----
#endif
*/

+ static char * whichsigname _((int sig));
+
void
mg_magical(sv)
SV* sv;
***************
*** 1227,1233 ****

for (sigv = sig_name+1; *sigv; sigv++)
if (strEQ(sig,*sigv))
! return sigv - sig_name;
#ifdef SIGCLD
if (strEQ(sig,"CHLD"))
return SIGCLD;
--- 1229,1235 ----

for (sigv = sig_name+1; *sigv; sigv++)
if (strEQ(sig,*sigv))
! return sig_num[sigv - sig_name];
#ifdef SIGCLD
if (strEQ(sig,"CHLD"))
return SIGCLD;
***************
*** 1239,1244 ****
--- 1241,1257 ----
return 0;
}

+ static char *
+ whichsigname(sig)
+ int sig;
+ {
+ register int i;
+ for (i = 1; sig_num[i]; i++) /* sig_num[] is a 0-terminated list */
+ if (sig_num[i] == sig)
+ return sig_name[i];
+ return Nullch;
+ }
+
Signal_t
sighandler(sig)
int sig;
***************
*** 1249,1266 ****
SV *sv;
CV *cv;
AV *oldstack;

#ifdef OS2 /* or anybody else who requires SIG_ACK */
signal(sig, SIG_ACK);
#endif

! cv = sv_2cv(*hv_fetch(GvHVn(siggv),sig_name[sig],strlen(sig_name[sig]),
TRUE),
&st, &gv, TRUE);
if (!cv || !CvROOT(cv) &&
! *sig_name[sig] == 'C' && instr(sig_name[sig],"LD")) {

! if (sig_name[sig][1] == 'H')
cv = sv_2cv(*hv_fetch(GvHVn(siggv),"CLD",3,TRUE),
&st, &gv, TRUE);
else
--- 1262,1281 ----
SV *sv;
CV *cv;
AV *oldstack;
+ char *signame;

#ifdef OS2 /* or anybody else who requires SIG_ACK */
signal(sig, SIG_ACK);
#endif

! signame = whichsigname(sig);
! cv = sv_2cv(*hv_fetch(GvHVn(siggv),signame,strlen(signame),
TRUE),
&st, &gv, TRUE);
if (!cv || !CvROOT(cv) &&
! *signame == 'C' && instr(signame,"LD")) {

! if (signame[1] == 'H')
cv = sv_2cv(*hv_fetch(GvHVn(siggv),"CLD",3,TRUE),
&st, &gv, TRUE);
else
***************
*** 1271,1277 ****
if (!cv || !CvROOT(cv)) {
if (dowarn)
warn("SIG%s handler \"%s\" not defined.\n",
! sig_name[sig], GvENAME(gv) );
return;
}

--- 1286,1292 ----
if (!cv || !CvROOT(cv)) {
if (dowarn)
warn("SIG%s handler \"%s\" not defined.\n",
! signame, GvENAME(gv) );
return;
}

***************
*** 1281,1287 ****
SWITCHSTACK(stack, signalstack);

sv = sv_newmortal();
! sv_setpv(sv,sig_name[sig]);
PUSHMARK(sp);
PUSHs(sv);
PUTBACK;
--- 1296,1302 ----
SWITCHSTACK(stack, signalstack);

sv = sv_newmortal();
! sv_setpv(sv,signame);
PUSHMARK(sp);
PUSHs(sv);
PUTBACK;
Index: perl.h
*** perl5.001m+/perl.h Tue Jun 20 10:09:03 1995
--- perl5.001n/perl.h Wed Oct 18 15:17:22 1995
***************
*** 941,951 ****
#endif

#ifdef DOINIT
! EXT char *sig_name[] = {
! SIG_NAME,0
! };
#else
EXT char *sig_name[];
#endif

#ifdef DOINIT
--- 941,951 ----
#endif

#ifdef DOINIT
! EXT char *sig_name[] = { SIG_NAME };
! EXT int sig_num[] = { SIG_NUM };
#else
EXT char *sig_name[];
+ EXT int sig_num[];
#endif

#ifdef DOINIT


End of patch.
Re: Patch 2 to my Jumbo Configure patch vs. 1m. [ In reply to ]
> # This is patch 2 to my Jumbo Configure patch for perl5.001m.

This seemed to work fine on HP-UX 9.05.

Now, Andy, about all these other patches that have popped up since you
last had the pumpkin.... :-)

Jeff
Re: Patch 2 to my Jumbo Configure patch vs. 1m. [ In reply to ]
On Fri, 20 Oct 1995, Andy Dougherty wrote:

> I also cleaned up the Configure/signal name stuff quite a bit.

Of course it would have helped if I fixed POSIX.xs at the same time :-(.

I'll try to get that patch out today.

Andy Dougherty doughera@lafcol.lafayette.edu
--
To subscribe or unsubscribe, send your request (subscribe, unsubscribe)
in the BODY of a message to perl5-porters-request@africa.nicoh.com.
Re: Patch 2 to my Jumbo Configure patch vs. 1m. [ In reply to ]
On Fri, 20 Oct 1995, Jeff Okamoto wrote:

> Now, Andy, about all these other patches that have popped up since you
> last had the pumpkin.... :-)

Yeah, there sure are a lot of them, aren't there :-)

Andy Dougherty doughera@lafcol.lafayette.edu
--
To subscribe or unsubscribe, send your request (subscribe, unsubscribe)
in the BODY of a message to perl5-porters-request@africa.nicoh.com.