summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-05-18 09:40:58 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-05-18 09:40:58 +0000
commit3666098248b43282bda1153dae2f4c1e4af38d09 (patch)
tree9c69a323f89cdd81b231dc630b0eaf134225da7a /ext
parent9e6b2b00f0190751b970ece3db7033405cb08ca5 (diff)
parentd2719217c9b7910115cef7ea0c16d68e6b286cf7 (diff)
downloadperl-3666098248b43282bda1153dae2f4c1e4af38d09.tar.gz
[asperl] integrate mainline changes (untested)
p4raw-id: //depot/asperl@1010
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B/CC.pm4
-rw-r--r--ext/B/byteperl.c8
-rw-r--r--ext/DynaLoader/DynaLoader.pm.PL (renamed from ext/DynaLoader/DynaLoader.pm)54
-rw-r--r--ext/DynaLoader/Makefile.PL7
-rw-r--r--ext/DynaLoader/dl_aix.xs14
-rw-r--r--ext/DynaLoader/dl_hpux.xs7
-rw-r--r--ext/Fcntl/Fcntl.pm7
-rw-r--r--ext/GDBM_File/GDBM_File.pm2
-rw-r--r--ext/IO/IO.pm2
-rw-r--r--ext/IO/lib/IO/Socket.pm2
-rw-r--r--ext/NDBM_File/NDBM_File.pm3
-rw-r--r--ext/Opcode/Opcode.pm4
-rw-r--r--ext/POSIX/Makefile.PL2
-rw-r--r--ext/POSIX/POSIX.pm9
-rw-r--r--ext/POSIX/POSIX.pod12
-rw-r--r--ext/POSIX/POSIX.xs75
-rw-r--r--ext/POSIX/hints/bsdos.pl3
-rw-r--r--ext/POSIX/hints/freebsd.pl3
-rw-r--r--ext/POSIX/hints/linux.pl2
-rw-r--r--ext/POSIX/hints/netbsd.pl3
-rw-r--r--ext/POSIX/hints/openbsd.pl3
-rw-r--r--ext/SDBM_File/sdbm/Makefile.PL6
-rw-r--r--ext/Socket/Socket.xs5
-rw-r--r--ext/Thread/Thread.pm127
24 files changed, 307 insertions, 57 deletions
diff --git a/ext/B/B/CC.pm b/ext/B/B/CC.pm
index fc7cf6dad2..4c877d9c5b 100644
--- a/ext/B/B/CC.pm
+++ b/ext/B/B/CC.pm
@@ -788,7 +788,7 @@ BEGIN {
my $divide_op = infix_op("/");
my $modulo_op = infix_op("%");
my $lshift_op = infix_op("<<");
- my $rshift_op = infix_op("<<");
+ my $rshift_op = infix_op(">>");
my $ncmp_op = sub { "($_[0] > $_[1] ? 1 : ($_[0] < $_[1]) ? -1 : 0)" };
my $scmp_op = prefix_op("sv_cmp");
my $seq_op = prefix_op("sv_eq");
@@ -1438,7 +1438,7 @@ sub compile {
last OPTION;
} elsif ($opt eq "o") {
$arg ||= shift @options;
- open(STDOUT, ">$arg") or return "$arg: $!\n";
+ open(STDOUT, ">$arg") or return "open '>$arg': $!\n";
} elsif ($opt eq "n") {
$arg ||= shift @options;
$module_name = $arg;
diff --git a/ext/B/byteperl.c b/ext/B/byteperl.c
index a42edfb8d5..323d63a809 100644
--- a/ext/B/byteperl.c
+++ b/ext/B/byteperl.c
@@ -37,7 +37,11 @@ main(int argc, char **argv, char **env)
if (!do_undump) {
my_perl = perl_alloc();
if (!my_perl)
+#ifdef VMS
+ exit(vaxc$errno);
+#else
exit(1);
+#endif
perl_construct( my_perl );
}
@@ -56,7 +60,11 @@ main(int argc, char **argv, char **env)
#endif
if (!fp) {
perror(argv[1]);
+#ifdef VMS
+ exit(vaxc$errno);
+#else
exit(1);
+#endif
}
argv++;
argc--;
diff --git a/ext/DynaLoader/DynaLoader.pm b/ext/DynaLoader/DynaLoader.pm.PL
index 712d575e38..4c4155985d 100644
--- a/ext/DynaLoader/DynaLoader.pm
+++ b/ext/DynaLoader/DynaLoader.pm.PL
@@ -1,3 +1,19 @@
+
+use Config;
+
+sub to_string {
+ my ($value) = @_;
+ $value =~ s/\\/\\\\'/g;
+ $value =~ s/'/\\'/g;
+ return "'$value'";
+}
+
+unlink "DynaLoader.pm" if -f "DynaLoader.pm";
+open OUT, ">DynaLoader.pm" or die $!;
+print OUT <<'EOT';
+
+# Generated from DynaLoader.pm.PL (resolved %Config::Config values)
+
package DynaLoader;
# And Gandalf said: 'Many folk like to know beforehand what is to
@@ -14,8 +30,6 @@ package DynaLoader;
$VERSION = $VERSION = "1.03"; # avoid typo warning
-require Config;
-
require AutoLoader;
*AUTOLOAD = \&AutoLoader::AUTOLOAD;
@@ -43,10 +57,15 @@ $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
sub dl_load_flags { 0x00 }
-#
+# ($dl_dlext, $dlsrc)
+# = @Config::Config{'dlext', 'dlsrc'};
+EOT
+
+print OUT " (\$dl_dlext, \$dlsrc) = (",
+ to_string($Config::Config{'dlext'}), ",",
+ to_string($Config::Config{'dlsrc'}), ")\n;" ;
-($dl_dlext, $dlsrc)
- = @Config::Config{'dlext', 'dlsrc'};
+print OUT <<'EOT';
# Some systems need special handling to expand file specifications
# (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>)
@@ -65,7 +84,14 @@ $do_expand = $Is_VMS = $^O eq 'VMS';
# Initialise @dl_library_path with the 'standard' library path
# for this platform as determined by Configure
-push(@dl_library_path, split(' ',$Config::Config{'libpth'}));
+
+# push(@dl_library_path, split(' ', $Config::Config{'libpth'});
+EOT
+
+print OUT "push(\@dl_library_path, split(' ', ",
+ to_string($Config::Config{'libpth'}), "));\n";
+
+print OUT <<'EOT';
# Add to @dl_library_path any extra directories we can gather from
# environment variables. So far LD_LIBRARY_PATH is the only known
@@ -205,8 +231,14 @@ sub dl_findfile {
my (@args) = @_;
my (@dirs, $dir); # which directories to search
my (@found); # full paths to real files we have found
- my $dl_ext= $Config::Config{'dlext'}; # suffix for perl extensions
- my $dl_so = $Config::Config{'so'}; # suffix for shared libraries
+EOT
+
+print OUT ' my $dl_ext= ' . to_string($Config::Config{'dlext'}) .
+ "; # \$Config::Config{'dlext'} suffix for perl extensions\n";
+print OUT ' my $dl_so = ' . to_string($Config::Config{'so'}) .
+ "; # \$Config::Config{'so'} suffix for shared libraries\n";
+
+print OUT <<'EOT';
print STDERR "dl_findfile(@args)\n" if $dl_debug;
@@ -350,7 +382,7 @@ etc and also allow pseudo-dynamic linking (using C<ld -A> at runtime).
It must be stressed that the DynaLoader, by itself, is practically
useless for accessing non-Perl libraries because it provides almost no
Perl-to-C 'glue'. There is, for example, no mechanism for calling a C
-library function or supplying arguments. A ExtUtils::DynaLib module
+library function or supplying arguments. A C::DynaLib module
is available from CPAN sites which performs that function for some
common system types.
@@ -691,3 +723,7 @@ Solaris global loading added by Nick Ing-Simmons with design/coding
assistance from Tim Bunce, January 1996.
=cut
+EOT
+
+close OUT or die $!;
+
diff --git a/ext/DynaLoader/Makefile.PL b/ext/DynaLoader/Makefile.PL
index 9323935880..2c86abfc41 100644
--- a/ext/DynaLoader/Makefile.PL
+++ b/ext/DynaLoader/Makefile.PL
@@ -7,11 +7,12 @@ WriteMakefile(
MAN3PODS => ' ', # Pods will be built by installman.
SKIP => [qw(dynamic dynamic_lib dynamic_bs)],
XSPROTOARG => '-noprototypes', # XXX remove later?
- VERSION_FROM => 'DynaLoader.pm',
- clean => {FILES => 'DynaLoader.c DynaLoader.xs'},
+ VERSION_FROM => 'DynaLoader.pm.PL',
+ PL_FILES => {'DynaLoader.pm.PL'=>'DynaLoader.pm'},
+ PM => {'DynaLoader.pm' => '$(INST_LIBDIR)/DynaLoader.pm'},
+ clean => {FILES => 'DynaLoader.c DynaLoader.xs DynaLoader.pm'},
);
-
sub MY::postamble {
'
DynaLoader.xs: $(DLSRC)
diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs
index 4e865edd3b..ea5040857d 100644
--- a/ext/DynaLoader/dl_aix.xs
+++ b/ext/DynaLoader/dl_aix.xs
@@ -29,6 +29,20 @@
#include <a.out.h>
#include <ldfcn.h>
+/*
+ * AIX 4.3 does remove some useful definitions from ldfcn.h. Define
+ * these here to compensate for that lossage.
+ */
+#ifndef BEGINNING
+# define BEGINNING SEEK_SET
+#endif
+#ifndef FSEEK
+# define FSEEK(ldptr,o,p) fseek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr) +o):o,p)
+#endif
+#ifndef FREAD
+# define FREAD(p,s,n,ldptr) fread(p,s,n,IOPTR(ldptr))
+#endif
+
/* If using PerlIO, redefine these macros from <ldfcn.h> */
#ifdef USE_PERLIO
#define FSEEK(ldptr,o,p) PerlIO_seek(IOPTR(ldptr),(p==BEGINNING)?(OFFSET(ldptr)+o):o,p)
diff --git a/ext/DynaLoader/dl_hpux.xs b/ext/DynaLoader/dl_hpux.xs
index 51d464e6de..a82e0eac11 100644
--- a/ext/DynaLoader/dl_hpux.xs
+++ b/ext/DynaLoader/dl_hpux.xs
@@ -65,6 +65,9 @@ dl_load_file(filename, flags=0)
* unresolved references in situations like this. */
/* bind_type = BIND_IMMEDIATE|BIND_NONFATAL; */
}
+ /* BIND_NOSTART removed from bind_type because it causes the shared library's */
+ /* initialisers not to be run. This causes problems with all of the static objects */
+ /* in the library. */
#ifdef DEBUGGING
if (dl_debug)
bind_type |= BIND_VERBOSE;
@@ -74,14 +77,14 @@ dl_load_file(filename, flags=0)
for (i = 0; i <= max; i++) {
char *sym = SvPVX(*av_fetch(dl_resolve_using, i, 0));
DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s) (dependent)\n", sym));
- obj = shl_load(sym, bind_type | BIND_NOSTART, 0L);
+ obj = shl_load(sym, bind_type, 0L);
if (obj == NULL) {
goto end;
}
}
DLDEBUG(1,PerlIO_printf(PerlIO_stderr(), "dl_load_file(%s): ", filename));
- obj = shl_load(filename, bind_type | BIND_NOSTART, 0L);
+ obj = shl_load(filename, bind_type, 0L);
DLDEBUG(2,PerlIO_printf(PerlIO_stderr(), " libref=%x\n", obj));
end:
diff --git a/ext/Fcntl/Fcntl.pm b/ext/Fcntl/Fcntl.pm
index 74de3dfc65..ab19670af7 100644
--- a/ext/Fcntl/Fcntl.pm
+++ b/ext/Fcntl/Fcntl.pm
@@ -76,9 +76,8 @@ $VERSION = "1.03";
);
sub AUTOLOAD {
- my($constname);
- ($constname = $AUTOLOAD) =~ s/.*:://;
- my $val = constant($constname, (@_ && (caller(0))[4]) ? $_[0] : 0);
+ (my $constname = $AUTOLOAD) =~ s/.*:://;
+ my $val = constant($constname, 0);
if ($! != 0) {
if ($! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
@@ -90,7 +89,7 @@ sub AUTOLOAD {
";
}
}
- eval "sub $AUTOLOAD { $val }";
+ *$AUTOLOAD = sub { $val };
goto &$AUTOLOAD;
}
diff --git a/ext/GDBM_File/GDBM_File.pm b/ext/GDBM_File/GDBM_File.pm
index 9c7ae066b7..09df4373fb 100644
--- a/ext/GDBM_File/GDBM_File.pm
+++ b/ext/GDBM_File/GDBM_File.pm
@@ -7,7 +7,7 @@ GDBM_File - Perl5 access to the gdbm library.
=head1 SYNOPSIS
use GDBM_File ;
- tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640);
+ tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640;
# Use the %hash array.
untie %hash ;
diff --git a/ext/IO/IO.pm b/ext/IO/IO.pm
index 1ba05ca916..4d4c81ce40 100644
--- a/ext/IO/IO.pm
+++ b/ext/IO/IO.pm
@@ -12,7 +12,7 @@ IO - load various IO modules
=head1 DESCRIPTION
-C<IO> provides a simple mechanism to load all of the IO modules at one go.
+C<IO> provides a simple mechanism to load some of the IO modules at one go.
Currently this includes:
IO::Handle
diff --git a/ext/IO/lib/IO/Socket.pm b/ext/IO/lib/IO/Socket.pm
index aadb502f19..406f74d2ff 100644
--- a/ext/IO/lib/IO/Socket.pm
+++ b/ext/IO/lib/IO/Socket.pm
@@ -186,7 +186,7 @@ sub socketpair {
my $fh1 = $class->new();
my $fh2 = $class->new();
- socketpair($fh1,$fh1,$domain,$type,$protocol) or
+ socketpair($fh1,$fh2,$domain,$type,$protocol) or
return ();
${*$fh1}{'io_socket_type'} = ${*$fh2}{'io_socket_type'} = $type;
diff --git a/ext/NDBM_File/NDBM_File.pm b/ext/NDBM_File/NDBM_File.pm
index 47b1f5aa3c..ed4fe2b36f 100644
--- a/ext/NDBM_File/NDBM_File.pm
+++ b/ext/NDBM_File/NDBM_File.pm
@@ -12,7 +12,7 @@ require DynaLoader;
@ISA = qw(Tie::Hash DynaLoader);
-$VERSION = "1.00";
+$VERSION = "1.01";
bootstrap NDBM_File $VERSION;
@@ -27,6 +27,7 @@ NDBM_File - Tied access to ndbm files
=head1 SYNOPSIS
use NDBM_File;
+ use Fcntl; # for O_ constants
tie(%h, 'NDBM_File', 'Op.dbmx', O_RDWR|O_CREAT, 0640);
diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm
index b71e8b43cf..717b97ff84 100644
--- a/ext/Opcode/Opcode.pm
+++ b/ext/Opcode/Opcode.pm
@@ -152,7 +152,7 @@ like gv2cv, i_ncmp and ftsvtx.
=item an operator tag name (optag)
Operator tags can be used to refer to groups (or sets) of operators.
-Tag names always being with a colon. The Opcode module defines several
+Tag names always begin with a colon. The Opcode module defines several
optags and the user can define others using the define_optag function.
=item a negated opname or optag
@@ -569,7 +569,7 @@ Originally designed and implemented by Malcolm Beattie,
mbeattie@sable.ox.ac.uk as part of Safe version 1.
Split out from Safe module version 1, named opcode tags and other
-changes added by Tim Bunce E<lt>F<Tim.Bunce@ig.co.uk>E<gt>.
+changes added by Tim Bunce.
=cut
diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL
index 3359d1742c..bc1dda9387 100644
--- a/ext/POSIX/Makefile.PL
+++ b/ext/POSIX/Makefile.PL
@@ -1,7 +1,7 @@
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'POSIX',
- LIBS => ["-lm -lposix -lcposix"],
+ ($^O eq 'MSWin32' ? () : (LIBS => ["-lm -lposix -lcposix"])),
MAN3PODS => ' ', # Pods will be built by installman.
XSPROTOARG => '-noprototypes', # XXX remove later?
VERSION_FROM => 'POSIX.pm',
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm
index 33dc73d8f2..32010d62e0 100644
--- a/ext/POSIX/POSIX.pm
+++ b/ext/POSIX/POSIX.pm
@@ -827,7 +827,14 @@ sub fork {
sub getcwd
{
usage "getcwd()" if @_ != 0;
- chop($cwd = `pwd`);
+ if ($^O eq 'MSWin32') {
+ # this perhaps applies to everyone else also?
+ require Cwd;
+ $cwd = &Cwd::cwd;
+ }
+ else {
+ chop($cwd = `pwd`);
+ }
$cwd;
}
diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod
index c781765a14..4726487b47 100644
--- a/ext/POSIX/POSIX.pod
+++ b/ext/POSIX/POSIX.pod
@@ -1392,7 +1392,9 @@ Tests the SigSet object to see if it contains a specific signal.
=item new
Create a new Termios object. This object will be destroyed automatically
-when it is no longer needed.
+when it is no longer needed. A Termios object corresponds to the termios
+C struct. new() mallocs a new one, getattr() fills it from a file descriptor,
+and setattr() sets a file descriptor's parameters to match Termios' contents.
$termios = POSIX::Termios->new;
@@ -1474,13 +1476,13 @@ array so an index must be specified.
Set the c_cflag field of a termios object.
- $termios->setcflag( &POSIX::CLOCAL );
+ $termios->setcflag( $c_cflag | &POSIX::CLOCAL );
=item setiflag
Set the c_iflag field of a termios object.
- $termios->setiflag( &POSIX::BRKINT );
+ $termios->setiflag( $c_iflag | &POSIX::BRKINT );
=item setispeed
@@ -1494,13 +1496,13 @@ Returns C<undef> on failure.
Set the c_lflag field of a termios object.
- $termios->setlflag( &POSIX::ECHO );
+ $termios->setlflag( $c_lflag | &POSIX::ECHO );
=item setoflag
Set the c_oflag field of a termios object.
- $termios->setoflag( &POSIX::OPOST );
+ $termios->setoflag( $c_oflag | &POSIX::OPOST );
=item setospeed
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 922438dca5..1dba9a61f8 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -1,3 +1,6 @@
+#ifdef WIN32
+#define _POSIX_
+#endif
#include "EXTERN.h"
#define PERLIO_NOT_STDIO 1
#include "perl.h"
@@ -40,7 +43,9 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
+#ifdef I_UNISTD
#include <unistd.h> /* see hints/sunos_4_1.sh */
+#endif
#include <fcntl.h>
#if defined(__VMS) && !defined(__POSIX_SOURCE)
@@ -91,6 +96,28 @@
}
# define times(t) vms_times(t)
#else
+#if defined (WIN32)
+# undef mkfifo /* #defined in perl.h */
+# define mkfifo(a,b) not_here("mkfifo")
+# define ttyname(a) not_here("ttyname")
+# define sigset_t long
+# define pid_t long
+# ifdef __BORLANDC__
+# define tzname _tzname
+# endif
+# ifdef _MSC_VER
+# define mode_t short
+# endif
+# define sigaction(a,b,c) not_here("sigaction")
+# define sigpending(a) not_here("sigpending")
+# define sigprocmask(a,b,c) not_here("sigprocmask")
+# define sigsuspend(a) not_here("sigsuspend")
+# define sigemptyset(a) not_here("sigemptyset")
+# define sigaddset(a,b) not_here("sigaddset")
+# define sigdelset(a,b) not_here("sigdelset")
+# define sigfillset(a) not_here("sigfillset")
+# define sigismember(a,b) not_here("sigismember")
+#else
# include <grp.h>
# include <sys/times.h>
# ifdef HAS_UNAME
@@ -100,7 +127,8 @@
# ifdef I_UTIME
# include <utime.h>
# endif
-#endif
+#endif /* WIN32 */
+#endif /* __VMS */
typedef int SysRet;
typedef long SysRetLong;
@@ -227,11 +255,13 @@ unsigned long strtoul _((const char *, char **, int));
#define localeconv() not_here("localeconv")
#endif
+#ifndef WIN32
#ifdef HAS_TZNAME
extern char *tzname[];
#else
char *tzname[] = { "" , "" };
#endif
+#endif
/* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
* fields for which we don't have Configure support yet:
@@ -2259,55 +2289,55 @@ constant(char *name, int arg)
case '_':
if (strnEQ(name, "_PC_", 4)) {
if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
-#ifdef _PC_CHOWN_RESTRICTED
+#if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
return _PC_CHOWN_RESTRICTED;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_LINK_MAX"))
-#ifdef _PC_LINK_MAX
+#if defined(_PC_LINK_MAX) || HINT_SC_EXIST
return _PC_LINK_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_MAX_CANON"))
-#ifdef _PC_MAX_CANON
+#if defined(_PC_MAX_CANON) || HINT_SC_EXIST
return _PC_MAX_CANON;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_MAX_INPUT"))
-#ifdef _PC_MAX_INPUT
+#if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
return _PC_MAX_INPUT;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_NAME_MAX"))
-#ifdef _PC_NAME_MAX
+#if defined(_PC_NAME_MAX) || HINT_SC_EXIST
return _PC_NAME_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_NO_TRUNC"))
-#ifdef _PC_NO_TRUNC
+#if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
return _PC_NO_TRUNC;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_PATH_MAX"))
-#ifdef _PC_PATH_MAX
+#if defined(_PC_PATH_MAX) || HINT_SC_EXIST
return _PC_PATH_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_PIPE_BUF"))
-#ifdef _PC_PIPE_BUF
+#if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
return _PC_PIPE_BUF;
#else
goto not_there;
#endif
if (strEQ(name, "_PC_VDISABLE"))
-#ifdef _PC_VDISABLE
+#if defined(_PC_VDISABLE) || HINT_SC_EXIST
return _PC_VDISABLE;
#else
goto not_there;
@@ -2433,61 +2463,61 @@ constant(char *name, int arg)
}
if (strnEQ(name, "_SC_", 4)) {
if (strEQ(name, "_SC_ARG_MAX"))
-#ifdef _SC_ARG_MAX
+#if defined(_SC_ARG_MAX) || HINT_SC_EXIST
return _SC_ARG_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_CHILD_MAX"))
-#ifdef _SC_CHILD_MAX
+#if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
return _SC_CHILD_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_CLK_TCK"))
-#ifdef _SC_CLK_TCK
+#if defined(_SC_CLK_TCK) || HINT_SC_EXIST
return _SC_CLK_TCK;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_JOB_CONTROL"))
-#ifdef _SC_JOB_CONTROL
+#if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
return _SC_JOB_CONTROL;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_NGROUPS_MAX"))
-#ifdef _SC_NGROUPS_MAX
+#if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
return _SC_NGROUPS_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_OPEN_MAX"))
-#ifdef _SC_OPEN_MAX
+#if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
return _SC_OPEN_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_SAVED_IDS"))
-#ifdef _SC_SAVED_IDS
+#if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
return _SC_SAVED_IDS;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_STREAM_MAX"))
-#ifdef _SC_STREAM_MAX
+#if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
return _SC_STREAM_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_TZNAME_MAX"))
-#ifdef _SC_TZNAME_MAX
+#if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
return _SC_TZNAME_MAX;
#else
goto not_there;
#endif
if (strEQ(name, "_SC_VERSION"))
-#ifdef _SC_VERSION
+#if defined(_SC_VERSION) || HINT_SC_EXIST
return _SC_VERSION;
#else
goto not_there;
@@ -3102,7 +3132,9 @@ sigaction(sig, action, oldaction = 0)
POSIX::SigAction action
POSIX::SigAction oldaction
CODE:
-
+#ifdef WIN32
+ RETVAL = not_here("sigaction");
+#else
# This code is really grody because we're trying to make the signal
# interface look beautiful, which is hard.
@@ -3181,6 +3213,7 @@ sigaction(sig, action, oldaction = 0)
sv_setiv(*svp, oact.sa_flags);
}
}
+#endif
OUTPUT:
RETVAL
diff --git a/ext/POSIX/hints/bsdos.pl b/ext/POSIX/hints/bsdos.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/bsdos.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/freebsd.pl b/ext/POSIX/hints/freebsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/freebsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/linux.pl b/ext/POSIX/hints/linux.pl
index 7994f24023..f1d19814ae 100644
--- a/ext/POSIX/hints/linux.pl
+++ b/ext/POSIX/hints/linux.pl
@@ -2,4 +2,4 @@
# Thanks to Bart Schuller <schuller@Lunatech.com>
# See Message-ID: <19971009002636.50729@tanglefoot>
# XXX A Configure test is needed.
-$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE -DHINT_SC_EXIST' ;
diff --git a/ext/POSIX/hints/netbsd.pl b/ext/POSIX/hints/netbsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/netbsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/POSIX/hints/openbsd.pl b/ext/POSIX/hints/openbsd.pl
new file mode 100644
index 0000000000..62732ac7b9
--- /dev/null
+++ b/ext/POSIX/hints/openbsd.pl
@@ -0,0 +1,3 @@
+# BSD platforms have extra fields in struct tm that need to be initialized.
+# XXX A Configure test is needed.
+$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE' ;
diff --git a/ext/SDBM_File/sdbm/Makefile.PL b/ext/SDBM_File/sdbm/Makefile.PL
index 24074afb85..6003628247 100644
--- a/ext/SDBM_File/sdbm/Makefile.PL
+++ b/ext/SDBM_File/sdbm/Makefile.PL
@@ -37,5 +37,11 @@ config ::
lint:
lint -abchx $(LIBSRCS)
+
+# This is a workaround, the problem is that our old GNU make exports
+# variables into the environment so $(MYEXTLIB) is set in here to this
+# value which can not be built.
+sdbm/libsdbm.a:
+ true
';
}
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
index 823e704ed8..09b41d3fce 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -757,7 +757,10 @@ pack_sockaddr_un(pathname)
STRLEN len;
Zero( &sun_ad, sizeof sun_ad, char );
sun_ad.sun_family = AF_UNIX;
- strncpy(sun_ad.sun_path, pathname, sizeof sun_ad.sun_path);
+ len = strlen(pathname);
+ if (len > sizeof(sun_ad.sun_path))
+ len = sizeof(sun_ad.sun_path);
+ Copy( pathname, sun_ad.sun_path, len, char );
ST(0) = sv_2mortal(newSVpv((char *)&sun_ad, sizeof sun_ad));
#else
ST(0) = (SV *) not_here("pack_sockaddr_un");
diff --git a/ext/Thread/Thread.pm b/ext/Thread/Thread.pm
index cf7069c45d..c8bca0db71 100644
--- a/ext/Thread/Thread.pm
+++ b/ext/Thread/Thread.pm
@@ -32,7 +32,132 @@ Thread - multithreading
=head1 DESCRIPTION
-The C<Threads> module provides multithreading.
+The C<Thread> module provides multithreading support for perl.
+
+=head1 FUNCTIONS
+
+=over 8
+
+=item new \&start_sub
+
+=item new \&start_sub, LIST
+
+C<new> starts a new thread of execution in the referenced subroutine. The
+optional list is passed as parameters to the subroutine. Execution
+continues in both the subroutine and the code after the C<new> call.
+
+C<new Thread> returns a thread object representing the newly created
+thread.
+
+=item lock VARIABLE
+
+C<lock> places a lock on a variable until the lock goes out of scope. If
+the variable is locked by another thread, the C<lock> call will block until
+it's available. C<lock> is recursive, so multiple calls to C<lock> are
+safe--the variable will remain locked until the outermost lock on the
+variable goes out of scope.
+
+Locks on variables only affect C<lock> calls--they do I<not> affect normal
+access to a variable. (Locks on subs are different, and covered in a bit)
+If you really, I<really> want locks to block access, then go ahead and tie
+them to something and manage this yourself. This is done on purpose. While
+managing access to variables is a good thing, perl doesn't force you out of
+its living room...
+
+If a container object, such as a hash or array, is locked, all the elements
+of that container are not locked. For example, if a thread does a C<lock
+@a>, any other thread doing a C<lock($a[12])> won't block.
+
+You may also C<lock> a sub, using C<lock &sub>. Any calls to that sub from
+another thread will block until the lock is released. This behaviour is not
+equvalent to C<use attrs qw(locked)> in the sub. C<use attrs qw(locked)>
+serializes access to a subroutine, but allows different threads
+non-simultaneous access. C<lock &sub>, on the other hand, will not allow
+I<any> other thread access for the duration of the lock.
+
+Finally, C<lock> will traverse up references exactly I<one> level.
+C<lock(\$a)> is equivalent to C<lock($a)>, while C<lock(\\$a)> is not.
+
+=item async BLOCK;
+
+C<async> creates a thread to execute the block immediately following
+it. This block is treated as an anonymous sub, and so must have a
+semi-colon after the closing brace. Like C<new Thread>, C<async> returns a
+thread object.
+
+=item Thread->self
+
+The C<Thread-E<gt>self> function returns a thread object that represents
+the thread making the C<Thread-E<gt>self> call.
+
+=item Thread->list
+
+C<Thread-E<gt>list> returns a list of thread objects for all running and
+finished but un-C<join>ed threads.
+
+=item cond_wait VARIABLE
+
+The C<cond_wait> function takes a B<locked> variable as a parameter,
+unlocks the variable, and blocks until another thread does a C<cond_signal>
+or C<cond_broadcast> for that same locked variable. The variable that
+C<cond_wait> blocked on is relocked after the C<cond_wait> is satisfied.
+If there are multiple threads C<cond_wait>ing on the same variable, all but
+one will reblock waiting to reaquire the lock on the variable. (So if
+you're only using C<cond_wait> for synchronization, give up the lock as
+soon as possible)
+
+=item cond_signal VARIABLE
+
+The C<cond_signal> function takes a locked variable as a parameter and
+unblocks one thread that's C<cond_wait>ing on that variable. If more than
+one thread is blocked in a C<cond_wait> on that variable, only one (and
+which one is indeterminate) will be unblocked.
+
+If there are no threads blocked in a C<cond_wait> on the variable, the
+signal is discarded.
+
+=item cond_broadcast VARIABLE
+
+The C<cond_broadcast> function works similarly to C<cond_wait>.
+C<cond_broadcast>, though, will unblock B<all> the threads that are blocked
+in a C<cond_wait> on the locked variable, rather than only one.
+
+=back
+
+=head1 METHODS
+
+=over 8
+
+=item join
+
+C<join> waits for a thread to end and returns any values the thread exited
+with. C<join> will block until the thread has ended, though it won't block
+if the thread has already terminated.
+
+If the thread being C<join>ed C<die>d, the error it died with will be
+returned at this time. If you don't want the thread performing the C<join>
+to die as well, you should either wrap the C<join> in an C<eval> or use the
+C<eval> thread method instead of C<join>.
+
+=item eval
+
+The C<eval> method wraps an C<eval> around a C<join>, and so waits for a
+thread to exit, passing along any values the thread might have returned.
+Errors, of course, get placed into C<$@>.
+
+=item tid
+
+The C<tid> method returns the tid of a thread. The tid is a monotonically
+increasing integer assigned when a thread is created. The main thread of a
+program will have a tid of zero, while subsequent threads will have tids
+assigned starting with one.
+
+=head1 LIMITATIONS
+
+The sequence number used to assign tids is a simple integer, and no
+checking is done to make sure the tid isn't currently in use. If a program
+creates more than 2^32 - 1 threads in a single run, threads may be assigned
+duplicate tids. This limitation may be lifted in a future version of Perl.
=head1 SEE ALSO