Mailing List Archive

POSIX patches
This is the list of changes I made to POSIX.pm and POSIX.xs while I was
fumbling through trying to document it. These patches apply over 5.002beta1.

I'll follow this with the current copy of mkposixman.

Dean


-------
Chopped the POD out of the PM.

Changed all "$filehandle->" to "FileHandle::" in redef() calls.

Removed usage-args from redef() calls. This was forcing usage information to
be kept in two separate places.

Removed phantom functions when unimpl() is called (i.e. exec*).

Added times() to XS; removed it from PM.

Changed PM's time() to use the builtin time(). Changed unimpl() to usage().

Changed unimpl() for bsearch().

Changed redef() for fclose().

Removed setuid,setgid from XS -- they are already in the PM.
-------


*** ext/POSIX/POSIX.xs Wed Nov 15 13:56:22 1995
--- ../patches/POSIX.xs Wed Nov 29 12:12:56 1995
***************
*** 2890,2899 ****
}

SysRet
- setgid(gid)
- Gid_t gid
-
- SysRet
setpgid(pid, pgid)
pid_t pid
pid_t pgid
--- 2890,2895 ----
***************
*** 2901,2910 ****
pid_t
setsid()

- SysRet
- setuid(uid)
- Uid_t uid
-
pid_t
tcgetpgrp(fd)
int fd
--- 2897,2902 ----
***************
*** 3063,3068 ****
--- 3055,3073 ----
char *
ctime(time)
Time_t &time
+
+ void
+ times()
+ PPCODE:
+ struct tms tms;
+ clock_t realtime;
+ realtime = times( &tms );
+ EXTEND(sp,5);
+ PUSHs( sv_2mortal( newSVnv( realtime ) ) );
+ PUSHs( sv_2mortal( newSVnv( tms.tms_utime ) ) );
+ PUSHs( sv_2mortal( newSVnv( tms.tms_stime ) ) );
+ PUSHs( sv_2mortal( newSVnv( tms.tms_cutime ) ) );
+ PUSHs( sv_2mortal( newSVnv( tms.tms_cstime ) ) );

double
difftime(time1, time2)
*** ext/POSIX/POSIX.pm Wed Nov 15 13:54:09 1995
--- ../patches/POSIX.pm Wed Nov 29 14:48:42 1995
***************
*** 1,61 ****
package POSIX;

- =head1 NAME
-
- POSIX - Perl interface to IEEE 1003.1 namespace
-
- =head1 SYNOPSIS
-
- use POSIX;
- use POSIX 'strftime';
-
- =head1 DESCRIPTION
-
- The POSIX module permits you to access all (or nearly all) the standard
- POSIX 1003.1 identifiers. Things which are C<#defines> in C, like EINTR
- or O_NDELAY, are automatically exported into your namespace. All
- functions are only exported if you ask for them explicitly. Most likely
- people will prefer to use the fully-qualified function names.
-
- To get a list of all the possible identifiers available to you--and
- their semantics--you should pick up a 1003.1 spec, or look in the
- F<POSIX.pm> module.
-
- =head1 EXAMPLES
-
- printf "EINTR is %d\n", EINTR;
-
- POSIX::setsid(0);
-
- $fd = POSIX::open($path, O_CREAT|O_EXCL|O_WRONLY, 0644);
- # note: that's a filedescriptor, *NOT* a filehandle
-
- =head1 NOTE
-
- The POSIX module is probably the most complex Perl module supplied with
- the standard distribution. It incorporates autoloading, namespace games,
- and dynamic loading of code that's in Perl, C, or both. It's a great
- source of wisdom.
-
- =head1 CAVEATS
-
- A few functions are not implemented because they are C specific. If you
- attempt to call these, they will print a message telling you that they
- aren't implemented, and suggest using the Perl equivalent should one
- exist. For example, trying to access the setjmp() call will elicit the
- message "setjmp() is C-specific: use eval {} instead".
-
- Furthermore, some evil vendors will claim 1003.1 compliance, but in fact
- are not so: they will not pass the PCTS (POSIX Compliance Test Suites).
- For example, one vendor may not define EDEADLK, or the semantics of the
- errno values set by open(2) might not be quite right. Perl does not
- attempt to verify POSIX compliance. That means you can currently
- successfully say "use POSIX", and then later in your program you find
- that your vendor has been lax and there's no usable ICANON macro after
- all. This could be construed to be a bug.
-
- =cut
-
use Carp;
require Exporter;
use AutoLoader;
--- 1,5 ----
***************
*** 513,547 ****
}

sub clearerr {
! redef "$filehandle->clearerr(filehandle)";
}

sub fclose {
! redef "$filehandle->fclose(filehandle)";
}

sub fdopen {
! redef "FileHandle->new_from_fd(fd,mode)";
}

sub feof {
! redef "$filehandle->eof()";
}

sub fgetc {
! redef "$filehandle->getc()";
}

sub fgets {
! redef "$filehandle->gets()";
}

sub fileno {
! redef "$filehandle->fileno()";
}

sub fopen {
! redef "FileHandle->open()";
}

sub fprintf {
--- 457,491 ----
}

sub clearerr {
! redef "FileHandle::clearerr()";
}

sub fclose {
! redef "FileHandle::close()";
}

sub fdopen {
! redef "FileHandle::new_from_fd()";
}

sub feof {
! redef "FileHandle::eof()";
}

sub fgetc {
! redef "FileHandle::getc()";
}

sub fgets {
! redef "FileHandle::gets()";
}

sub fileno {
! redef "FileHandle::fileno()";
}

sub fopen {
! redef "FileHandle::open()";
}

sub fprintf {
***************
*** 569,595 ****
}

sub fseek {
! redef "$filehandle->seek(pos,whence)";
}

sub ferror {
! redef "$filehandle->error()";
}

sub fflush {
! redef "$filehandle->flush()";
}

sub fgetpos {
! redef "$filehandle->getpos()";
}

sub fsetpos {
! redef "$filehandle->setpos(pos)";
}

sub ftell {
! redef "$filehandle->tell()";
}

sub fwrite {
--- 513,539 ----
}

sub fseek {
! redef "FileHandle::seek()";
}

sub ferror {
! redef "FileHandle::error()";
}

sub fflush {
! redef "FileHandle::flush()";
}

sub fgetpos {
! redef "FileHandle::getpos()";
}

sub fsetpos {
! redef "FileHandle::setpos()";
}

sub ftell {
! redef "FileHandle::tell()";
}

sub fwrite {
***************
*** 662,672 ****
}

sub tmpfile {
! redef "FileHandle->new_tmpfile()";
}

sub ungetc {
! redef "$filehandle->ungetc(char)";
}

sub vfprintf {
--- 606,616 ----
}

sub tmpfile {
! redef "FileHandle::new_tmpfile()";
}

sub ungetc {
! redef "FileHandle::ungetc()";
}

sub vfprintf {
***************
*** 703,710 ****
}

sub bsearch {
! unimpl "bsearch(xxx)" if @_ != 123;
! bsearch($_[0]);
}

sub calloc {
--- 647,653 ----
}

sub bsearch {
! unimpl "bsearch() not supplied";
}

sub calloc {
***************
*** 722,728 ****

sub free {
unimpl "free() is C-specific, stopped";
- free($_[0]);
}

sub getenv {
--- 665,670 ----
***************
*** 785,791 ****

sub memcpy {
unimpl "memcpy() is C-specific, use = instead";
! memcpy($_[0]);

sub memmove {
unimpl "memmove() is C-specific, use = instead";
--- 727,733 ----

sub memcpy {
unimpl "memcpy() is C-specific, use = instead";
! }

sub memmove {
unimpl "memmove() is C-specific, use = instead";
***************
*** 887,897 ****
umask($_[0]);
}

- sub times {
- usage "times()" if @_ != 0;
- times();
- }
-
sub wait {
usage "wait(statusvariable)" if @_ != 1;
local $result = wait();
--- 829,834 ----
***************
*** 917,923 ****
}

sub time {
! unimpl "time()" if @_ != 0;
time;
}

--- 854,860 ----
}

sub time {
! usage "time()" if @_ != 0;
time;
}

***************
*** 938,969 ****

sub execl {
unimpl "execl() is C-specific, stopped";
- execl($_[0]);
}

sub execle {
unimpl "execle() is C-specific, stopped";
- execle($_[0]);
}

sub execlp {
unimpl "execlp() is C-specific, stopped";
- execlp($_[0]);
}

sub execv {
unimpl "execv() is C-specific, stopped";
- execv($_[0]);
}

sub execve {
unimpl "execve() is C-specific, stopped";
- execve($_[0]);
}

sub execvp {
unimpl "execvp() is C-specific, stopped";
- execvp($_[0]);
}

sub fork {
--- 875,900 ----