POSIX-2008
view release on metacpan or search on metacpan
clock();
#endif
#ifdef PSX2008_HAS_CLOCK_GETCPUCLOCKID
void
clock_getcpuclockid(pid_t pid=0);
INIT:
int rv;
clockid_t clock_id;
PPCODE:
rv = clock_getcpuclockid(pid, &clock_id);
if (LIKELY(rv == 0))
PUSH_INT_OR_PV(clock_id);
else {
PUSHs(&PL_sv_undef);
errno = rv;
}
#endif
} STMT_END
#ifdef PSX2008_HAS_CLOCK_GETRES
void
clock_getres(clockid_t clock_id=CLOCK_REALTIME);
ALIAS:
clock_gettime = 1
INIT:
int rv;
struct timespec res;
PPCODE:
rv = (!ix) ? clock_getres(clock_id, &res) : clock_gettime(clock_id, &res);
if (rv == 0)
PUSH_TIMESPEC(res);
#endif
#define LOOKS_LIKE_NV(_sv) \
(SvNOK(_sv) || \
( \
(SvPOK(_sv) || SvPOKp(_sv)) \
} STMT_END
#ifdef PSX2008_HAS_CLOCK_NANOSLEEP
void
clock_nanosleep(clockid_t clock_id, int flags, SV *sec, long nsec=0);
PROTOTYPE: $$@
INIT:
int rv;
struct timespec request;
struct timespec remain = { 0, 0 };
PPCODE:
SvGETMAGIC(sec);
if (items == 3 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV(request, sec);
else
TIMESPEC_FROM_IV(request, sec, nsec);
rv = clock_nanosleep(clock_id, flags, &request, &remain);
if (rv == 0 || ((errno = rv) == EINTR))
PUSH_TIMESPEC(remain);
#endif
#ifdef PSX2008_HAS_CLOCK_SETTIME
void
clock_settime(clockid_t clock_id, SV *sec, long nsec=0);
PROTOTYPE: $@
INIT:
struct timespec tp;
PPCODE:
SvGETMAGIC(sec);
if (items == 2 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV(tp, sec);
else
TIMESPEC_FROM_IV(tp, sec, nsec);
if (clock_settime(clock_id, &tp) == 0)
mPUSHp("0 but true", 10);
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_NANOSLEEP
void
nanosleep(SV *sec, long nsec=0);
PROTOTYPE: @
INIT:
struct timespec request;
struct timespec remain = { 0, 0 };
PPCODE:
SvGETMAGIC(sec);
if (items == 1 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV(request, sec);
else
TIMESPEC_FROM_IV(request, sec, nsec);
if (nanosleep(&request, &remain) == 0 || errno == EINTR)
PUSH_TIMESPEC(remain);
#endif
OUTPUT:
RETVAL
#endif
#ifdef PSX2008_HAS_FNMATCH
void
fnmatch(const char *pattern, const char *string, int flags);
INIT:
int rv;
PPCODE:
rv = fnmatch(pattern, string, flags);
if (LIKELY(rv == 0 || rv == FNM_NOMATCH))
mPUSHi(rv);
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_KILLPG
SysRetTrue
SysRetTrue
raise(int sig);
#endif
#ifdef PSX2008_HAS_GETDATE
void
getdate(const char *string);
INIT:
struct tm *tm = getdate(string);
PPCODE:
if (tm != NULL) {
EXTEND(SP, 9);
mPUSHi(tm->tm_sec);
mPUSHi(tm->tm_min);
mPUSHi(tm->tm_hour);
mPUSHi(tm->tm_mday);
mPUSHi(tm->tm_mon);
mPUSHi(tm->tm_year);
mPUSHi(tm->tm_wday);
mPUSHi(tm->tm_yday);
INIT:
struct tm tm = {
INT_MIN, INT_MIN, INT_MIN,
INT_MIN, INT_MIN, INT_MIN,
INT_MIN, INT_MIN, INT_MIN,
};
char *remainder;
size_t i, tm_count;
AV *tm_av = NULL;
U8 gimme = GIMME_V;
PPCODE:
{
if (items > 2) {
SV *tm_arg = ST(2l);
SvGETMAGIC(tm_arg);
if (SvROK(tm_arg) && SvTYPE(SvRV(tm_arg)) == SVt_PVAV) {
if (items == 3)
tm_av = (AV*)SvRV(tm_arg);
else
croak("%s::strptime: Unexpected argument after %s", PACKNAME, "tm");
}
#ifdef PSX2008_HAS_GETHOSTNAME
void
gethostname();
INIT:
#if !defined(MAXHOSTNAMELEN) || MAXHOSTNAMELEN < 256
char name[256];
#else
char name[MAXHOSTNAMELEN];
#endif
PPCODE:
if (LIKELY(gethostname(name, sizeof(name)) == 0))
mPUSHp(name, strnlen(name, sizeof(name)));
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_GETITIMER
void
getitimer(int which);
INIT:
struct itimerval value;
PPCODE:
if (getitimer(which, &value) == 0) {
EXTEND(SP, 4);
mPUSHi(value.it_interval.tv_sec);
mPUSHi(value.it_interval.tv_usec);
mPUSHi(value.it_value.tv_sec);
mPUSHi(value.it_value.tv_usec);
}
#endif
#ifdef PSX2008_HAS_SETITIMER
void
setitimer(int which, \
time_t int_sec, long int_usec, \
time_t val_sec, long val_usec);
PROTOTYPE: $@
INIT:
struct itimerval value = { {int_sec, int_usec}, {val_sec, val_usec} };
struct itimerval ovalue;
PPCODE:
if (setitimer(which, &value, &ovalue) == 0) {
EXTEND(SP, 4);
mPUSHi(ovalue.it_interval.tv_sec);
mPUSHi(ovalue.it_interval.tv_usec);
mPUSHi(ovalue.it_value.tv_sec);
mPUSHi(ovalue.it_value.tv_usec);
}
#endif
#ifdef PSX2008_HAS_NICE
void
nice(int incr);
PREINIT:
int rv;
PPCODE:
{
SETERRNO(0, 0);
rv = nice(incr);
if (rv != -1 || errno == 0)
mPUSHi(rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_GETPRIORITY
void
getpriority(int which=PRIO_PROCESS, id_t who=0);
PREINIT:
int rv;
PPCODE:
{
SETERRNO(0, 0);
rv = getpriority(which, who);
if (rv != -1 || errno == 0)
mPUSHi(rv);
else
PUSHs(&PL_sv_undef);
}
#endif
void
endutxent();
#endif
#ifdef PSX2008_HAS_GETUTXENT
void
getutxent();
INIT:
struct utmpx *utxent = getutxent();
PPCODE:
RETURN_UTXENT;
#endif
#ifdef PSX2008_HAS_GETUTXID
void
getutxid(short ut_type, char *ut_id=NULL);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {0};
PPCODE:
utxent_req.ut_type = ut_type;
if (ut_id != NULL) {
memcpy(utxent_req.ut_id, ut_id,
strnlen(ut_id, sizeof(utxent_req.ut_id)));
}
utxent = getutxline(&utxent_req);
RETURN_UTXENT;
#endif
#ifdef PSX2008_HAS_GETUTXLINE
void
getutxline(char *ut_line);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {0};
PPCODE:
if (ut_line != NULL) {
memcpy(utxent_req.ut_line, ut_line,
strnlen(ut_line, sizeof(utxent_req.ut_line)));
utxent = getutxline(&utxent_req);
RETURN_UTXENT;
}
#endif
#ifdef PSX2008_HAS_SETUTXENT
drand48();
#endif
#ifdef PSX2008_HAS_ERAND48
void
erand48(unsigned short X0, unsigned short X1, unsigned short X2);
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
double result = erand48(xsubi);
PPCODE:
EXTEND(SP, 4);
mPUSHn(result);
mPUSHu(xsubi[0]);
mPUSHu(xsubi[1]);
mPUSHu(xsubi[2]);
#endif
#ifdef PSX2008_HAS_JRAND48
void
jrand48(unsigned short X0, unsigned short X1, unsigned short X2);
ALIAS:
nrand48 = 1
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
long result = ix == 0 ? jrand48(xsubi) : nrand48(xsubi);
PPCODE:
EXTEND(SP, 4);
mPUSHi(result);
mPUSHu(xsubi[0]);
mPUSHu(xsubi[1]);
mPUSHu(xsubi[2]);
#endif
#ifdef PSX2008_HAS_LRAND48
long
mrand48();
#endif
#ifdef PSX2008_HAS_SEED48
void
seed48(unsigned short seed1, unsigned short seed2, unsigned short seed3);
INIT:
unsigned short seed16v[3] = { seed1, seed2, seed3 };
unsigned short *old = seed48(seed16v);
PPCODE:
EXTEND(SP, 3);
mPUSHu(old[0]);
mPUSHu(old[1]);
mPUSHu(old[2]);
#endif
#ifdef PSX2008_HAS_SRAND48
void
srand48(long seedval);
timer_getoverrun(timer_t timerid);
#endif
#ifdef PSX2008_HAS_TIMER_GETTIME
void
timer_gettime(timer_t timerid);
PREINIT:
struct itimerspec curr_value;
int rv;
PPCODE:
{
rv = timer_gettime(timerid, &curr_value);
if (rv == 0) {
EXTEND(SP, 4);
mPUSHi(curr_value.it_interval.tv_sec);
mPUSHi(curr_value.it_interval.tv_nsec);
mPUSHi(curr_value.it_value.tv_sec);
mPUSHi(curr_value.it_value.tv_nsec);
}
}
#ifdef PSX2008_HAS_TIMER_SETTIME
void
timer_settime(timer_t timerid, int flags, \
time_t interval_sec, long interval_nsec, \
time_t initial_sec=-1, long initial_nsec=-1);
PROTOTYPE: $$@
PREINIT:
struct itimerspec new_value, old_value;
int rv;
PPCODE:
{
new_value.it_interval.tv_sec = interval_sec;
new_value.it_interval.tv_nsec = interval_nsec;
if (initial_sec < 0 || initial_nsec < 0)
new_value.it_value = new_value.it_interval;
else {
new_value.it_value.tv_sec = initial_sec;
new_value.it_value.tv_nsec = initial_nsec;
}
OUTPUT:
RETVAL
#endif
#ifdef PSX2008_HAS_PATHCONF
void
pathconf(SV *what, int name);
INIT:
long rv = -1;
PPCODE:
{
SETERRNO(0, 0);
SvGETMAGIC(what);
if (!SvOK(what))
errno = ENOENT;
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
rv = pathconf(path, name);
}
else {
PUSH_INT_OR_PV(rv);
}
#endif
#ifdef PSX2008_HAS_SYSCONF
void
sysconf(int name);
INIT:
long rv;
PPCODE:
{
SETERRNO(0, 0);
rv = sysconf(name);
if (rv == -1 && errno != 0)
PUSHs(&PL_sv_undef);
else
PUSH_INT_OR_PV(rv);
}
#endif
fsync(psx_fd_t fd);
#endif
#ifdef PSX2008_HAS_STAT
void
stat(SV *what);
INIT:
int rv = -1;
struct stat buf;
PPCODE:
SvGETMAGIC(what);
if (!SvOK(what))
errno = ENOENT;
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
rv = stat(path, &buf);
}
else {
#ifdef PSX2008_HAS_FSTAT
int fd = _psx_fileno(aTHX_ what);
RETURN_STAT_BUF(rv, buf);
#endif
#ifdef PSX2008_HAS_LSTAT
void
lstat(const char *path);
INIT:
int rv;
struct stat buf;
PPCODE:
rv = lstat(path, &buf);
RETURN_STAT_BUF(rv, buf);
#endif
#ifdef PSX2008_HAS_STATVFS
void
statvfs(SV *what);
INIT:
int rv = -1;
struct statvfs buf;
PPCODE:
SvGETMAGIC(what);
if (!SvOK(what))
errno = ENOENT;
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
rv = statvfs(path, &buf);
}
else {
#ifdef PSX2008_HAS_FSTATVFS
int fd = _psx_fileno(aTHX_ what);
#ifdef PSX2008_HAS_MKNOD
SysRetTrue
mknod(const char *path, mode_t mode, dev_t dev);
#endif
#ifdef PSX2008_HAS_MKDTEMP
void
mkdtemp(SV *template);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template, len);
/* Copy the original template to avoid overwriting it. */
SV *tmpsv = newSVpvn_flags(ctmp, len, SVs_TEMP);
char *dtemp = mkdtemp(SvPVX(tmpsv));
PUSHs(dtemp ? tmpsv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_MKSTEMP
void
mkstemp(SV *template);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template, len);
/* Copy the original template to avoid overwriting it. */
SV *tmpsv = newSVpvn_flags(ctmp, len, SVs_TEMP);
int fd = mkstemp(SvPVX(tmpsv));
if (fd >= 0) {
EXTEND(SP, 2);
mPUSHi(fd);
PUSHs(tmpsv);
}
}
#endif
#if defined(PSX2008_HAS_FDOPEN)
void
fdopen(IV fd, const char *mode);
PPCODE:
{
SV *rv = NULL;
if (UNLIKELY(fd < 0 || fd > PERL_INT_MAX))
SETERRNO(EBADF, RMS_IFI);
else if (UNLIKELY(!mode || !*mode))
SETERRNO(EINVAL, LIB_INVARG);
else
rv = _psx_fd_to_handle(aTHX_ fd, mode);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#if defined(PSX2008_HAS_FDOPENDIR)
void
fdopendir(IV fd);
PPCODE:
{
SV *rv = NULL;
if (UNLIKELY(fd < 0 || fd > PERL_INT_MAX))
SETERRNO(EBADF, RMS_IFI);
else
rv = _psx_fd_to_handle(aTHX_ fd, NULL);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
const char *path, uid_t owner, gid_t group, int flags=0);
#endif
#ifdef PSX2008_HAS_FSTATAT
void
fstatat(psx_fd_t dirfd, const char *path, int flags=0);
INIT:
int rv;
struct stat buf;
PPCODE:
rv = fstatat(dirfd, path, &buf, flags);
RETURN_STAT_BUF(rv, buf);
#endif
#ifdef PSX2008_HAS_LINKAT
SysRetTrue
linkat(psx_fd_t olddirfd, const char *oldpath, \
psx_fd_t newdirfd, const char *newpath, int flags=0);
#ifdef PSX2008_HAS_MKNODAT
SysRetTrue
mknodat(psx_fd_t dirfd, const char *path, mode_t mode, dev_t dev);
#endif
#ifdef PSX2008_HAS_OPENAT
void
openat(SV *dirfdsv, const char *path, int flags=O_RDONLY, mode_t mode=0666);
PPCODE:
{
SV *rv = _openat50c(aTHX_ dirfdsv, path, flags, mode, NULL);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_OPENAT2
void
openat2(SV *dirfdsv, const char *path, HV *how);
PPCODE:
{
SV *rv = _openat50c(aTHX_ dirfdsv, path, 0, 0, how);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_READLINK
void
readlink(const char *path);
PPCODE:
{
SV *rv = _readlink50c(aTHX_ path, NULL);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_READLINKAT
void
readlinkat(psx_fd_t dirfd, const char *path);
PPCODE:
{
SV *rv = _readlink50c(aTHX_ path, &dirfd);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_REALPATH
char *
realpath(const char *path);
#endif
#ifdef PSX2008_HAS_READ
void
read(psx_fd_t fd, SV *buf, SV *count);
PREINIT:
SSize_t rv;
STRLEN nbytes;
char *cbuf;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::read: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
nbytes = SvSTRLEN(count);
if ((Size_t)nbytes != nbytes)
nbytes = SSize_t_MAX;
if (UNLIKELY(SvTRULYREADONLY(buf))) {
if (nbytes)
croak("%s::read: Can't modify read-only buf", PACKNAME);
}
#endif
#ifdef PSX2008_HAS_WRITE
void
write(psx_fd_t fd, SV *buf, SV *count=NULL);
PREINIT:
STRLEN cbuflen, nbytes;
SSize_t rv;
PPCODE:
{
const char *cbuf = SvPV_const(buf, cbuflen);
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::write: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
else if (SvUNDEF_purposely(count))
nbytes = cbuflen;
else {
nbytes = SvSTRLEN(count);
if (nbytes > cbuflen)
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_READV
void
readv(psx_fd_t fd, SV *buffers, AV *sizes);
PROTOTYPE: $\[@$]$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, NULL, NULL);
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_PREADV
void
preadv(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=&PL_sv_undef);
PROTOTYPE: $\[@$]$;$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, NULL);
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_PREADV2
void
preadv2(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=&PL_sv_undef, \
SV *flags=&PL_sv_undef);
PROTOTYPE: $\[@$]$;$$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, flags);
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_WRITEV
void
writev(psx_fd_t fd, AV *buffers);
PPCODE:
{
struct iovec *iov;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
ssize_t rv = LIKELY(iovcnt >= 0) ? writev(fd, iov, iovcnt) : -1;
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((size_t)rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_PWRITEV
void
pwritev(psx_fd_t fd, AV *buffers, SV *offset=NULL);
PPCODE:
{
struct iovec *iov;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
Off_t offs = SvUNDEF_purposely(offset) ? 0 : SvOFFt(offset);
ssize_t rv = LIKELY(iovcnt >= 0) ? pwritev(fd, iov, iovcnt, offs) : -1;
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((size_t)rv);
else
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_PWRITEV2
void
pwritev2(psx_fd_t fd, AV *buffers, SV *offset=NULL, SV *flags=NULL);
PPCODE:
{
struct iovec *iov;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
Off_t offs = SvUNDEF_purposely(offset) ? 0 : SvOFFt(offset);
int i_flags = SvUNDEF_purposely(flags) ? 0 : (int)SvIV(flags);
ssize_t rv =
LIKELY(iovcnt >= 0) ? pwritev2(fd, iov, iovcnt, offs, i_flags) : -1;
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((size_t)rv);
else
#endif
#ifdef PSX2008_HAS_PREAD
void
pread(psx_fd_t fd, SV *buf, SV *count, SV *offset=NULL, SV *buf_offset=NULL);
PREINIT:
Off_t f_offset;
char *cbuf;
STRLEN cbuflen, new_len, b_offset, nbytes;
SSize_t rv;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::pread: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
nbytes = SvSTRLEN(count);
if ((Size_t)nbytes != nbytes)
nbytes = SSize_t_MAX;
if (UNLIKELY(SvTRULYREADONLY(buf))) {
#ifdef PSX2008_HAS_PWRITE
void
pwrite(psx_fd_t fd, SV *buf, \
SV *count=NULL, SV *offset=NULL, SV *buf_offset=NULL);
PREINIT:
Off_t f_offset;
const char *cbuf;
STRLEN cbuflen, b_offset, max_nbytes, nbytes;
SSize_t rv;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::pwrite: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
cbuf = SvPV_const(buf, cbuflen);
/* Ensure buf_offset results in a valid string index. This is slightly
* different from pread() because we can't allow offsets beyond the buffer
* at all (zero is okay, though). */
#elif !defined(_WIN32)
#define UNLINK_ISDIR_ERRNO (errno == EISDIR || errno == EPERM)
#else
#define UNLINK_ISDIR_ERRNO (errno == EISDIR || errno == EPERM || errno == EACCES)
#endif
#if !defined(PSX2008_HAS_REMOVE) || (defined(_WIN32) && !defined(__CYGWIN__))
# if defined(PSX2008_HAS_UNLINK) && defined(PSX2008_HAS_RMDIR)
void
remove(const char *path);
PPCODE:
if (unlink(path) == 0 || (UNLINK_ISDIR_ERRNO && rmdir(path) == 0))
mPUSHp("0 but true", 10);
else
PUSHs(&PL_sv_undef);
# else
# endif
#else
SysRetTrue
remove(const char *path);
#endif
#ifdef PSX2008_HAS_UNLINKAT
void
removeat(psx_fd_t dirfd, const char *path);
PPCODE:
if (unlinkat(dirfd, path, 0) == 0
|| (UNLINK_ISDIR_ERRNO && unlinkat(dirfd, path, AT_REMOVEDIR) == 0))
mPUSHp("0 but true", 10);
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_RENAME
SysRetTrue
RETVAL = futimens(fd, times);
OUTPUT:
RETVAL
#endif
#ifdef PSX2008_HAS_EXECVEAT
void
execveat(psx_fd_t dirfd, const char *path, \
AV *args, SV *env=NULL, int flags=0);
PPCODE:
{
_execve50c(aTHX_ dirfd, path, args, env, flags);
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_FEXECVE
void
fexecve(psx_fd_t fd, AV *args, SV *env=NULL);
PPCODE:
{
_execve50c(aTHX_ fd, NULL, args, env, 0);
PUSHs(&PL_sv_undef);
}
#endif
#if defined(PSX2008_HAS_POLL)
void
poll(SV *pollfds, int timeout=-1);
PPCODE:
{
AV *pollfds_av = NULL;
Size_t nfds = 0;
SvGETMAGIC(pollfds);
if (SvOK(pollfds)) {
if (!SvROK(pollfds) || SvTYPE(SvRV(pollfds)) != SVt_PVAV)
croak("%s::poll: pollfds is not an ARRAY reference: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(pollfds));
pollfds_av = (AV*)SvRV(pollfds);
NV
cosh(double x);
#endif
#ifdef PSX2008_DIV
void
div(IV numer, IV denom);
INIT:
PSX2008_DIV_T result;
PPCODE:
result = PSX2008_DIV(numer, denom);
EXTEND(SP, 2);
mPUSHi(result.quot);
mPUSHi(result.rem);
#endif
#ifdef PSX2008_HAS_ERF
NV
erf(double x);
NV
logb(double x);
#endif
#ifdef PSX2008_LROUND
void
lround(double x)
INIT:
PSX2008_LROUND_T ret;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
ret = PSX2008_LROUND(x);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0)
PUSH_INT_OR_PV(ret);
else
PUSHs(&PL_sv_undef);
#endif
NV
nexttoward(double x, NV y);
#endif
#ifdef PSX2008_HAS_REMAINDER
void
remainder(double x, double y);
INIT:
double res;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
res = remainder(x, y);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0)
mPUSHn(res);
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_REMQUO
void
remquo(double x, double y);
INIT:
int quo;
double res;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
res = remquo(x, y, &quo);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0) {
mPUSHn(res);
mPUSHi(quo);
}
#endif
RETVAL
#endif
#ifdef PSX2008_HAS_CONJ
void
conj(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = conj(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CPROJ
NV
cproj(double re, double im);
INIT:
double complex z = re + im * I;
CODE:
RETVAL
#endif
#ifdef PSX2008_HAS_CEXP
void
cexp(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cexp(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CLOG
void
clog(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = clog(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CPOW
void
cpow(double re_x, double im_x, double re_y, double im_y);
INIT:
double complex x = re_x + im_x * I;
double complex y = re_y + im_y * I;
double complex result = cpow(x, y);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSQRT
void
csqrt(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csqrt(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CACOS
void
cacos(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cacos(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CACOSH
void
cacosh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cacosh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CASIN
void
casin(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = casin(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CASINH
void
casinh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = casinh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CATAN
void
catan(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = catan(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CATANH
void
catanh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = catanh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CCOS
void
ccos(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ccos(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CCOSH
void
ccosh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ccosh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSIN
void
csin(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csin(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSINH
void
csinh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csinh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CTAN
void
ctan(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ctan(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CTANH
void
ctanh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ctanh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
## DESTROY is called when a file handle we created (e.g. in openat)
## is cleaned up. This is just a dummy to silence AUTOLOAD. We leave
## it up to Perl to take the necessary steps.
void
DESTROY(...);
PPCODE:
BOOT:
{
}
# vim: set ts=4 sw=4 sts=4 expandtab:
( run in 1.178 second using v1.01-cache-2.11-cpan-5511b514fd6 )