view release on metacpan or search on metacpan
- added function 'zeros' to 'xs_arrays.c' and 'xs_arrays.h'.
- modified functions ICC::Support::Lapack::nPINT_vec_trans, ICC::Support::Lapack::nPINT_mat_trans and ICC::Support::Lapack::jacobian to use 'zeros' function.
- modified ICC::Support::Lapack::normal to use standard CODE structure, rather than PPCODE.
- modified function 'pack_2D' in 'xs_arrays.c' to verify outer array is not empty (caused SEG fault).
2012-01-02
view all matches for this distribution
view release on metacpan or search on metacpan
CODE:
max_outstanding = maxreqs;
void
aio_wd (SV8 *pathname, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_WD_OPEN;
req_set_path1 (req, pathname);
REQ_SEND;
}
void
aio_open (SV8 *pathname, int flags, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_OPEN;
req_set_path1 (req, pathname);
aio_fsync (SV *fh, SV *callback = &PL_sv_undef)
ALIAS:
aio_fsync = EIO_FSYNC
aio_fdatasync = EIO_FDATASYNC
aio_syncfs = EIO_SYNCFS
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = ix;
REQ_SEND;
}
void
aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_SYNC_FILE_RANGE;
REQ_SEND;
}
void
aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_FALLOCATE;
REQ_SEND;
}
void
aio_close (SV *fh, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
#if 0
/* partially duplicate logic in s_fileno */
REQ_SEND;
}
void
aio_seek (SV *fh, SV *offset, int whence, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_SEEK;
void
aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback = &PL_sv_undef)
ALIAS:
aio_read = EIO_READ
aio_write = EIO_WRITE
PPCODE:
{
STRLEN svlen;
int fd = s_fileno_croak (fh, ix == EIO_WRITE);
char *svptr = SvPVbyte (data, svlen);
UV len = SvUV (length);
void
aio_ioctl (SV *fh, unsigned long request, SV8 *arg, SV *callback = &PL_sv_undef)
ALIAS:
aio_ioctl = EIO_IOCTL
aio_fcntl = EIO_FCNTL
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
char *svptr;
if (SvPOK (arg) || !SvNIOK (arg))
void
aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef)
ALIAS:
aio_readlink = EIO_READLINK
aio_realpath = EIO_REALPATH
PPCODE:
{
dREQ;
req->type = ix;
req_set_path1 (req, pathname);
REQ_SEND;
}
void
aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback = &PL_sv_undef)
PPCODE:
{
int ifd = s_fileno_croak (in_fh , 0);
int ofd = s_fileno_croak (out_fh, 1);
dREQ;
REQ_SEND;
}
void
aio_readahead (SV *fh, off_t offset, size_t length, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_READAHEAD;
aio_stat (SV8 *fh_or_path, SV *callback = &PL_sv_undef)
ALIAS:
aio_stat = EIO_STAT
aio_lstat = EIO_LSTAT
aio_statvfs = EIO_STATVFS
PPCODE:
{
dREQ;
req_set_fh_or_path (req, ix, ix == EIO_STATVFS ? EIO_FSTATVFS : EIO_FSTAT, fh_or_path);
st_atime = 0x01
st_mtime = 0x02
st_ctime = 0x04
st_btime = 0x08
st_xtime = 0x0f
PPCODE:
EXTEND (SP, 4);
if (ix & 0x01) PUSHs (newSVnv (PL_statcache.st_atime + 1e-9 * ATIMENSEC));
if (ix & 0x02) PUSHs (newSVnv (PL_statcache.st_mtime + 1e-9 * MTIMENSEC));
if (ix & 0x04) PUSHs (newSVnv (PL_statcache.st_ctime + 1e-9 * CTIMENSEC));
if (ix & 0x08) PUSHs (newSVnv (BTIMESEC + 1e-9 * BTIMENSEC));
st_ctimensec = 0x04
st_btimensec = 0x08
st_xtimensec = 0x0f
st_btimesec = 0x10
st_gen = 0x20
PPCODE:
EXTEND (SP, 4);
if (ix & 0x01) PUSHs (newSViv (ATIMENSEC));
if (ix & 0x02) PUSHs (newSViv (MTIMENSEC));
if (ix & 0x04) PUSHs (newSViv (CTIMENSEC));
if (ix & 0x08) PUSHs (newSViv (BTIMENSEC));
OUTPUT:
RETVAL
void
aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->nv1 = SvOK (atime) ? SvNV (atime) : -1.;
req->nv2 = SvOK (mtime) ? SvNV (mtime) : -1.;
REQ_SEND;
}
void
aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->offs = SvOK (offset) ? SvVAL64 (offset) : -1;
req_set_fh_or_path (req, EIO_TRUNCATE, EIO_FTRUNCATE, fh_or_path);
REQ_SEND;
}
void
aio_chmod (SV8 *fh_or_path, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->int2 = mode;
req_set_fh_or_path (req, EIO_CHMOD, EIO_FCHMOD, fh_or_path);
REQ_SEND;
}
void
aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->int2 = SvOK (uid) ? SvIV (uid) : -1;
req->int3 = SvOK (gid) ? SvIV (gid) : -1;
REQ_SEND;
}
void
aio_readdirx (SV8 *pathname, IV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_READDIR;
req->int1 = flags | EIO_READDIR_DENTS | EIO_READDIR_CUSTOM1;
REQ_SEND;
}
void
aio_mkdir (SV8 *pathname, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_MKDIR;
req->int2 = mode;
aio_unlink (SV8 *pathname, SV *callback = &PL_sv_undef)
ALIAS:
aio_unlink = EIO_UNLINK
aio_rmdir = EIO_RMDIR
aio_readdir = EIO_READDIR
PPCODE:
{
dREQ;
req->type = ix;
req_set_path1 (req, pathname);
aio_link (SV8 *oldpath, SV8 *newpath, SV *callback = &PL_sv_undef)
ALIAS:
aio_link = EIO_LINK
aio_symlink = EIO_SYMLINK
aio_rename = EIO_RENAME
PPCODE:
{
eio_wd wd2 = 0;
dREQ;
req->type = ix;
REQ_SEND;
}
void
aio_rename2 (SV8 *oldpath, SV8 *newpath, int flags = 0, SV *callback = &PL_sv_undef)
PPCODE:
{
eio_wd wd2 = 0;
dREQ;
req->type = EIO_RENAME;
REQ_SEND;
}
void
aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_MKNOD;
req->int2 = (mode_t)mode;
void
aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = -1, SV *callback = &PL_sv_undef)
ALIAS:
aio_mtouch = EIO_MTOUCH
aio_msync = EIO_MSYNC
PPCODE:
{
STRLEN svlen;
char *svptr = SvPVbyte (data, svlen);
UV len = SvUV (length);
}
}
void
aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback = &PL_sv_undef)
PPCODE:
{
STRLEN svlen;
char *svptr = SvPVbyte (data, svlen);
UV len = SvUV (length);
}
}
void
aio_mlockall (IV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_MLOCKALL;
req->int1 = flags;
REQ_SEND;
}
void
aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_CUSTOM;
REQ_SEND;
}
void
aio_slurp (SV *pathname, off_t offset, UV length, SV8 *data, SV *callback = &PL_sv_undef)
PPCODE:
{
char *svptr = 0;
sv_clear_foreign (data);
}
}
void
aio_busy (double delay, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_BUSY;
req->nv1 = delay < 0. ? 0. : delay;
REQ_SEND;
}
void
aio_group (SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
req->type = EIO_GROUP;
void
aio_nop (SV *callback = &PL_sv_undef)
ALIAS:
aio_nop = EIO_NOP
aio_sync = EIO_SYNC
PPCODE:
{
dREQ;
req->type = ix;
OUTPUT:
RETVAL
void
mmap (SV *scalar, STRLEN length, int prot, int flags, SV *fh = &PL_sv_undef, off_t offset = 0)
PPCODE:
sv_clear_foreign (scalar);
{
int fd = SvOK (fh) ? s_fileno_croak (fh, flags & PROT_WRITE) : -1;
void *addr = (void *)mmap (0, length, prot, flags, fd, offset);
if (addr == (void *)-1)
OUTPUT:
RETVAL
void
accept4 (aio_rfd rfh, SV *sockaddr, int salen, int flags)
PPCODE:
{
SV *retval;
#if HAVE_ACCEPT4
socklen_t salen_ = salen ? salen + 1 : 0;
RETVAL
void
pipe2 (int flags = 0)
PROTOTYPE: ;$
PPCODE:
{
int fd[2];
int res;
if (flags)
}
}
void
pidfd_open (int pid, unsigned int flags = 0)
PPCODE:
{
/*GENDEF0_SYSCALL(pidfd_open,434)*/
int fd = syscall (SYS_pidfd_open, pid, flags);
XPUSHs (newmortalFH (fd, O_RDWR));
}
int
pidfd_send_signal (SV *pidfh, int sig, SV *siginfo = &PL_sv_undef, unsigned int flags = 0)
PPCODE:
{
int res;
#if HAVE_SIGINFO_T
siginfo_t si = { 0 };
XPUSHs (sv_2mortal (newSViv (res)));
}
void
pidfd_getfd (SV *pidfh, int targetfd, unsigned int flags = 0)
PPCODE:
{
/*GENDEF0_SYSCALL(pidfd_getfd,438)*/
int fd = syscall (SYS_pidfd_getfd, s_fileno_croak (pidfh, 0), targetfd, flags);
XPUSHs (newmortalFH (fd, O_RDWR));
}
void
eventfd (unsigned int initval = 0, int flags = 0)
PPCODE:
{
int fd;
#if HAVE_EVENTFD
fd = eventfd (initval, flags);
#else
XPUSHs (newmortalFH (fd, O_RDWR));
}
void
timerfd_create (int clockid, int flags = 0)
PPCODE:
{
int fd;
#if HAVE_TIMERFD
fd = timerfd_create (clockid, flags);
#else
XPUSHs (newmortalFH (fd, O_RDWR));
}
void
timerfd_settime (SV *fh, int flags, NV interval, NV value)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
#if HAVE_TIMERFD
int res;
struct itimerspec its, ots;
#endif
}
void
timerfd_gettime (SV *fh)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
#if HAVE_TIMERFD
int res;
struct itimerspec ots;
#endif
}
void
memfd_create (octet_string pathname, int flags = 0)
PPCODE:
{
int fd;
#if HAVE_MEMFD_CREATE
fd = memfd_create (pathname, flags);
#else
CODE:
eio_cancel (req);
void
cb (aio_req_ornot req, SV *callback = NO_INIT)
PPCODE:
{
if (GIMME_V != G_VOID)
XPUSHs (req->callback ? sv_2mortal (newRV_inc (req->callback)) : &PL_sv_undef);
if (items > 1)
MODULE = IO::AIO PACKAGE = IO::AIO::GRP
void
add (aio_req grp, ...)
PPCODE:
{
int i;
if (grp->int1 == 2)
croak ("cannot add requests to IO::AIO::GRP after the group finished");
view all matches for this distribution
view release on metacpan or search on metacpan
SV *
readdirent(dirp)
DIR *dirp;
PROTOTYPE: *
PPCODE:
Direntry_t *dent;
while ((dent = (Direntry_t *)readdir(dirp))) {
HV *hdent;
hdent = (HV *)sv_2mortal((SV *)newHV());
#ifdef DIRNAMLEN /* from perl's config.h */
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IO/EventMux/Socket/MsgHdr.xs view on Meta::CPAN
SV* cmsv;
INIT:
struct msghdr dummy;
struct cmsghdr *cm;
STRLEN len;
PPCODE:
dummy.msg_control = (struct cmsghdr *) SvPV(cmsv, len);
dummy.msg_controllen = len;
if (!len)
XSRETURN_EMPTY;
view all matches for this distribution
view release on metacpan or search on metacpan
xs-include/mkfifoat.pl view on Meta::CPAN
PREINIT:
int f;
int mode=0666; //Default if not provided
PPCODE:
if(SvOK(fd) &&SvIOK(fd)){
if(items >=3){
mode=SvIV(ST(2));
}
f=mkfifoat(SvIV(fd), path, mode);
view all matches for this distribution
view release on metacpan or search on metacpan
FDpassData.xs view on Meta::CPAN
int sock
int len
PREINIT:
int fd, size;
unsigned char * buf = malloc(len);
PPCODE:
size = _fd_recvdata(sock, buf, len, &fd);
if (size < 0) { // ERROR
free(buf);
XSRETURN_EMPTY;
}
view all matches for this distribution
view release on metacpan or search on metacpan
void
smh_peercred(s)
PerlIO* s;
PROTOTYPE: $
PPCODE:
{
# ifdef SO_PEERCRED
struct ucred uc;
socklen_t uc_len=sizeof(uc);
void
smh_issock(s)
PerlIO* s;
PROTOTYPE: $
PPCODE:
{
if( fdtype(PerlIO_fileno(s))==S_IFSOCK ) {
XSRETURN_YES;
} else {
XSRETURN_UNDEF;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IO/Interface.xs view on Meta::CPAN
struct ifconf ifc;
struct ifreq *ifr;
int lastlen,len;
char *buf,*ptr;
#endif
PPCODE:
#ifdef USE_GETIFADDRS
if (getifaddrs(&ifa_start) < 0)
XSRETURN_EMPTY;
for (ifa = ifa_start ; ifa ; ifa = ifa->ifa_next)
view all matches for this distribution
view release on metacpan or search on metacpan
intptr_t data
SV * udata
PREINIT:
struct kevent ke;
int i;
PPCODE:
memset(&ke, 0, sizeof(struct kevent));
if (udata)
SvREFCNT_inc(udata);
else
udata = &PL_sv_undef;
int num_events, i;
struct timespec t;
struct kevent *ke = NULL;
struct timespec *tbuf = (struct timespec *)0;
I32 max_events = SvIV(get_sv("IO::KQueue::MAX_EVENTS", FALSE));
PPCODE:
Newxz(ke, max_events, struct kevent);
if (ke == NULL) {
croak("malloc failed");
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IO/Ppoll.xs view on Meta::CPAN
SV *fds
int nfds
INIT:
int i;
struct pollfd *fds_real;
PPCODE:
fds_real = (struct pollfd *)SvPV_nolen(fds);
EXTEND(SP, nfds);
for(i = 0; i < nfds; i++) {
int fd = fds_real[i].fd;
mPUSHi(fd);
lib/IO/Ppoll.xs view on Meta::CPAN
int nfds
int events
INIT:
int i;
struct pollfd *fds_real;
PPCODE:
fds_real = (struct pollfd *)SvPV_nolen(fds);
EXTEND(SP, nfds);
for(i = 0; i < nfds; i++) {
int fd;
if((fds_real[i].revents & events) == 0)
view all matches for this distribution
view release on metacpan or search on metacpan
Multicast.xs view on Meta::CPAN
char* interface_addr
PROTOTYPE: $$;$
PREINIT:
int fd;
struct ip_mreq mreq;
PPCODE:
{
fd = PerlIO_fileno(sock);
if (!inet_aton(mcast_group,&mreq.imr_multiaddr))
croak("Invalid address used for mcast group");
if ((strlen(interface_addr) > 0)) {
Multicast.xs view on Meta::CPAN
char* interface_addr
PROTOTYPE: $$;$
PREINIT:
int fd;
struct ip_mreq mreq;
PPCODE:
{
fd = PerlIO_fileno(sock);
if (!inet_aton(mcast_group,&mreq.imr_multiaddr))
croak("Invalid address used for mcast group");
if ((strlen(interface_addr) > 0)) {
Multicast.xs view on Meta::CPAN
int fd,len;
STRLEN slen;
char* addr;
struct in_addr ifaddr;
struct ip_mreq mreq;
PPCODE:
{
fd = PerlIO_fileno(sock);
if (items > 1) { /* setting interface */
addr = SvPV(ST(1),slen);
if (inet_aton(addr,&ifaddr) == 0 )
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
SocketAlarm.xs view on Meta::CPAN
int eventmask= EVENT_DEFAULTS;
struct stat statbuf;
struct socketalarm *sa;
SV **action_list= NULL;
SSize_t n_actions= 0;
PPCODE:
if (!sv_isobject(self))
croak("Not an object");
if ((sa= get_magic_socketalarm(self, 0)))
croak("Already initialized");
if (!(sock_fd >= 0 && fstat(sock_fd, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)))
SocketAlarm.xs view on Meta::CPAN
RETVAL
void
actions(alarm)
struct socketalarm *alarm
PPCODE:
if (!alarm->actions_av);
socketalarm__build_actions(alarm);
ST(0)= sv_2mortal(newRV_inc((SV*) alarm->actions_av));
XSRETURN(1);
SocketAlarm.xs view on Meta::CPAN
OUTPUT:
RETVAL
void
_terminate_all()
PPCODE:
shutdown_watch_thread();
MODULE = IO::SocketAlarm PACKAGE = IO::SocketAlarm::Util
struct socketalarm *
SocketAlarm.xs view on Meta::CPAN
SV *events;
int timeout;
INIT:
int ret;
struct pollfd pollbuf;
PPCODE:
pollbuf.fd= fd;
pollbuf.events= SvIV(events);
pollbuf.revents= 0;
ret= poll(&pollbuf, 1, timeout);
EXTEND(SP, 2);
view all matches for this distribution
view release on metacpan or search on metacpan
int amaster ;
int aslave ;
int rc ;
struct winsize win ;
PPCODE:
win.ws_row = rows ;
win.ws_col = cols ;
rc = openpty(&amaster, &aslave, NULL, NULL, &win) ;
if (rc == -1){
XPUSHs(&PL_sv_undef) ;
# int login_tty(int fd);
void _login_tty(fd)
int fd
PPCODE:
XPUSHs(sv_2mortal(newSVnv(login_tty(fd)))) ;
view all matches for this distribution
view release on metacpan or search on metacpan
char name[256];
#ifdef PTY_DEBUG
SV *debug;
#endif
PPCODE:
#ifdef PTY_DEBUG
debug = get_sv("IO::Tty::DEBUG", FALSE);
if (SvTRUE(debug))
print_debug = 1;
#endif
void
unpack_winsize(winsize)
SV *winsize;
INIT:
struct winsize ws;
PPCODE:
if(SvCUR(winsize) != sizeof(ws))
croak("IO::Tty::unpack_winsize(): Bad arg length - got %zd, expected %zd",
SvCUR(winsize), sizeof(ws));
Copy(SvPV_nolen(winsize), &ws, sizeof(ws), char);
EXTEND(SP, 4);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/IO/Uring.xs view on Meta::CPAN
IV CLONE_SKIP(sv)
void run_once(IO::Uring self, unsigned min_events = 1, Time::Spec timeout = NULL, sigset_t* sigmask = NULL)
PPCODE:
struct io_uring_cqe *cqe;
int result = io_uring_submit_and_wait_timeout(&self->uring, &cqe, min_events, timeout, sigmask);
if (result == -1 && errno == EINTR)
PERL_ASYNC_CHECK();
view all matches for this distribution
view release on metacpan or search on metacpan
MODULE = IO PACKAGE = IO::Poll
void
_poll(timeout,...)
int timeout;
PPCODE:
{
#ifdef HAS_POLL
const int nfd = (items - 1) / 2;
SV *tmpsv = sv_2mortal(NEWSV(999,nfd * sizeof(struct pollfd)));
/* We should pass _some_ valid pointer even if nfd is zero, but it
IO::Handle::gets = 2
INIT:
UNOP myop;
SV *io;
OP *was = PL_op;
PPCODE:
if (items != 1)
Perl_croak(aTHX_ "usage: $io->%s()", ix ? "getline" : "getlines");
if (!ix && GIMME_V != G_LIST)
Perl_croak(aTHX_ "Can't call $io->getlines in a scalar context, use $io->getline");
Zero(&myop, 1, UNOP);
view all matches for this distribution
view release on metacpan or search on metacpan
MMDB_entry_data_list_s *list;
SV *data = &PL_sv_undef;
int wants_prefix_length = 0;
uint16_t prefix_length = 0;
U8 gimme = GIMME_V;
PPCODE:
ip_address = NULL;
if (items > 1) {
ip_address = SvPVbyte_nolen(ST(1));
}
if (NULL == ip_address || '\0' == *ip_address) {
view all matches for this distribution
view release on metacpan or search on metacpan
char * class = SvPV(sv_class, PL_na);
int fd;
struct stat stat;
door_info_t info;
SV * sv;
PPCODE:
if ((fd = open(path, O_RDONLY)) < 0) {
WARN(("open() failed: %s\n", strerror(errno)));
XSRETURN_UNDEF;
}
if (fstat(fd, &stat) < 0) {
view all matches for this distribution
view release on metacpan or search on metacpan
mm_unlock(mm)
MM *mm
void
mm_alloc_size ()
PPCODE:
if (GIMME_V == G_ARRAY) {
EXTEND(SP, 6);
XPUSHs(sv_2mortal(newSVuv((UV)mma_alloc_mask()+1)));
XPUSHs(sv_2mortal(newSVuv((UV)mma_alloc_base())));
XPUSHs(sv_2mortal(newSVuv((UV)sizeof(void *))));
ALIAS:
mma_array_status=1
PREINIT:
IV statArray[4];
int i=0;
PPCODE:
mm_array_status (array, statArray, ix);
if (GIMME_V == G_ARRAY) {
if (statArray[0] >= 0) {
EXTEND(SP, 4);
while (i < 4) XPUSHs (sv_2mortal (newSViv(statArray[i++])));
UV del_count = SvOK(length) ? SvUV(length) : array->entries - index;
SV *delSVs[del_count];
UV add_count = items>3 ? items-3 : 0;
SV *addSVs[add_count];
int i;
PPCODE:
for (i=0; i<add_count; i++) addSVs[i] = ST(i+3);
if (!mm_array_splice (array,index,del_count,delSVs,add_count,addSVs,ix&1)) {
if (PL_dowarn && mm_error()) warn ("IPC::MMA: %s", mm_error());
del_count = 0;
}
IV index
ALIAS:
mma_hash_get_entry=1
PREINIT:
SV* ret[2];
PPCODE:
mm_hash_get_entry(hash, index, ix, ret);
if (GIMME_V == G_ARRAY) {
if (SvOK(ret[0])) {
EXTEND(SP, 2);
XPUSHs (sv_2mortal (ret[0]));
view all matches for this distribution
view release on metacpan or search on metacpan
size_t maxlen
int off
SV * var
size_t len
PROTOTYPE: $$$$$
PPCODE:
UV tmp = SvUV(addr);
caddr_t lcladdr = INT2PTR(caddr_t, (tmp + off));
if (len > maxlen - off)
len = maxlen - off;
int maxlen
int off
SV * var
int len
PROTOTYPE: $$$$$
PPCODE:
UV tmp = SvUV(addr);
caddr_t lcladdr = INT2PTR(caddr_t, (tmp + off));
STRLEN varlen;
char * ptr;
_mmap_anon(len, prot, flags)
size_t len
int prot
int flags
PROTOTYPE: $$$
PPCODE:
int fd;
void * addr;
int slop;
/* struct stat st; */
size_t len
int prot
int flags
FILE * fh
PROTOTYPE: $$$*
PPCODE:
int fd;
void * addr;
int slop;
struct stat st;
void
_munmap(addr, len)
void * addr
size_t len
PROTOTYPE: $$
PPCODE:
#
# XXX refrain from dumping core if this
# var wasnt previously mmap'd
#
# printf("_munmap: addr %p len %i\n", addr, len);
view all matches for this distribution
view release on metacpan or search on metacpan
ScoreBoard.xs view on Meta::CPAN
UV slot
PROTOTYPE: $$
INIT:
UV sz, i;
vIV *slotptr=get_slot(sb, slot, &sz);
PPCODE:
EXTEND(SP, sz);
for( i=0; i<sz; i++ ) {
mPUSHi(slotptr[i]);
}
void
sum_all(sb)
SV* sb
PROTOTYPE: $
PPCODE:
if( expect_true((sb && SvROK(sb))) ) {
struct hdr *hdr=(struct hdr *)SvPV_nolen(SvRV(sb));
vIV *data=(vIV*)(sizeof(*hdr)+(char*)hdr);
UV i, j;
EXTEND(SP, hdr->slotsize);
ScoreBoard.xs view on Meta::CPAN
SV* sb
PROTOTYPE: $
INIT:
UV sz, i;
vIV *slotptr=get_extra(sb, &sz);
PPCODE:
EXTEND(SP, sz);
for( i=0; i<sz; i++ ) {
mPUSHi(slotptr[i]);
}
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: ENABLE
void
pack(obj)
SV * obj
PPCODE:
{
#ifdef HAS_MSG
AV *list = (AV*) SvRV(obj);
struct msqid_ds ds;
assert_sv_isa(obj, s_pkg_msg, "pack");
void
unpack(obj, ds)
SV * obj
SV * ds
PPCODE:
{
#ifdef HAS_MSG
AV *list = (AV*) SvRV(obj);
STRLEN len;
const struct msqid_ds *data = (struct msqid_ds *) SvPV_const(ds, len);
PROTOTYPES: ENABLE
void
pack(obj)
SV * obj
PPCODE:
{
#ifdef HAS_SEM
AV *list = (AV*) SvRV(obj);
struct semid_ds ds;
assert_sv_isa(obj, s_pkg_sem, "pack");
void
unpack(obj, ds)
SV * obj
SV * ds
PPCODE:
{
#ifdef HAS_SEM
AV *list = (AV*) SvRV(obj);
STRLEN len;
const struct semid_ds *data = (struct semid_ds *) SvPV_const(ds, len);
PROTOTYPES: ENABLE
void
pack(obj)
SV * obj
PPCODE:
{
#ifdef HAS_SHM
AV *list = (AV*) SvRV(obj);
struct shmid_ds ds;
assert_sv_isa(obj, s_pkg_shm, "pack");
void
unpack(obj, ds)
SV * obj
SV * ds
PPCODE:
{
#ifdef HAS_SHM
AV *list = (AV*) SvRV(obj);
STRLEN len;
const struct shmid_ds *data = (struct shmid_ds *) SvPV_const(ds, len);
view all matches for this distribution
view release on metacpan or search on metacpan
size_t *lens;
char **names;
char **messages;
int i;
int ns;
PPCODE:
/* allocate return arrays */
New( 0, bufs, max_servers, char *);
New( 0, lens, max_servers, size_t);
New( 0, names, max_servers, char *);
New( 0, messages, max_servers, char *);
char **names;
char **messages;
int i;
int ns;
int n = 1;
PPCODE:
/* allocate return arrays */
New( 0, names, max_servers, char *);
New( 0, messages, max_servers, char *);
/* send request to server */
ns = XPASet(xpa, xtemplate, paramlist, mode, buf, len,
PREINIT:
char **names;
char **messages;
int i;
int ns;
PPCODE:
/* allocate return arrays */
New( 0, names, max_servers, char *);
New( 0, messages, max_servers, char *);
/* send request to server */
ns = XPAInfo(xpa, xtemplate, paramlist, mode,
char **names;
char **methods;
char **infos;
int i;
int ns;
PPCODE:
ns = XPANSLookup( xpa, tname, ttype, &xclasses, &names,
&methods, &infos );
/* convert result into something Perlish */
EXTEND(SP, ns);
for ( i = 0 ; i < ns ; i++ )
PREINIT:
char **names;
char **messages;
int i;
int ns;
PPCODE:
/* allocate return arrays */
New( 0, names, max_servers, char *);
New( 0, messages, max_servers, char *);
/* send request to server */
ns = XPAAccess(xpa, xtemplate, paramlist, mode,
view all matches for this distribution
view release on metacpan or search on metacpan
void
t_chk4pid(path)
char * path
PREINIT:
SV * out;
PPCODE:
path = chk4pid(path);
if (path == NULL) {
ST(0) = &PL_sv_undef;
}
else {
void
t_pidpath()
PREINIT:
SV * out;
PPCODE:
out = sv_newmortal();
out = newSVpv(pidpath(),0);
ST(0) = out;
XSRETURN(1);
set_signals();
void
t_inirand(test)
int test
PPCODE:
XPUSHs(sv_2mortal(newSVnv(sizeof(rarry) / 4)));
XPUSHs(sv_2mortal(newSVnv(initRandGen(test))));
void
t_fillrand()
PREINIT:
unsigned long * rptr;
int i;
PPCODE:
rptr = fillrandom();
for (i=0; i< sizeof(rarry) / 4;i++)
{
XPUSHs(sv_2mortal(newSVnv(rptr[i])));
}
dbtp_put(&dbtp,DBarchive,(void *)addr,sizeof(void *),×tamp,sizeof(timestamp));
void
t_dberror(err)
int err
PPCODE:
XPUSHs(sv_2mortal(newSVpv(dbtp_strerror(err),0)));
XSRETURN(1);
int
t_statn(name)
char * home
char * name
char * message
int ofg
int Ofg
PPCODE:
if (items >5) { /* is there a file descriptor */
fifofd = SvIV(ST(6));
}
else
fifofd = 0;
close(fifofd);
fifofd = 0;
void
t_errors()
PPCODE:
EXTEND(SP,7);
PUSHs(sv_2mortal(newSViv(EPIPE)));
PUSHs(sv_2mortal(newSViv(ENOSPC)));
PUSHs(sv_2mortal(newSViv(EEXIST)));
PUSHs(sv_2mortal(newSViv(ENOENT)));
PREINIT:
STRLEN len;
void * adp;
int rv;
SV * val;
PPCODE:
adp = (void *)SvPV(addr,len);
/* rv = dbtp_get(&dbtp,ai,adp,len); */
rv = dbtp_readOne(&dbtp,0,ai,adp,0);
if (rv == DB_NOTFOUND)
U32 cursor
int notstring
PREINIT:
int rv;
SV * val;
PPCODE:
# rv = dbtp_getrecno(&dbtp,ai,cursor);
rv = dbtp_readOne(&dbtp,1,ai,&cursor,0);
if (rv) {
if (GIMME == G_ARRAY)
XSRETURN_EMPTY;
int ai
PREINIT:
int major, minor, patch;
int zero[] = {0,0};
SV * stats;
PPCODE:
(void) dbtp_readOne(&dbtp,1,ai,(void *)&zero,0);
major = (int)*(u_char *)(dbtp.keydbt.data + 1);
minor = (int)*(u_char *)(dbtp.keydbt.data + 2);
patch = (int)*(u_char *)(dbtp.keydbt.data + 3);
stats = newSViv(*(U32 *)dbtp.mgdbt.data);
view all matches for this distribution
view release on metacpan or search on metacpan
IPTables::IPv4::Table self
PREINIT:
char * chain;
SV * sv;
int count = 0;
PPCODE:
sv = ST(0);
chain = (char *)iptc_first_chain(self);
while(chain) {
count++;
if (GIMME_V == G_ARRAY)
IPTables::IPv4::Table self
ipt_chainlabel chain
PREINIT:
SV * sv;
int count = 0;
PPCODE:
sv = ST(0);
if(iptc_is_chain(chain, *self)) {
struct ipt_entry *entry =
(struct ipt_entry *)iptc_first_rule(chain, self);
while(entry) {
PREINIT:
struct ipt_counters counter;
SV * sv;
char * target;
char * temp;
PPCODE:
sv = ST(0);
if((target = (char *)iptc_get_policy(chain, &counter, self))) {
XPUSHs(sv_2mortal(newSVpv(target, 0)));
asprintf(&temp, "%llu", counter.pcnt);
XPUSHs(sv_2mortal(newSVpv(temp, 0)));
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
IPTables.xs view on Meta::CPAN
const char * chain;
iptc_handle_t * handle;
PREINIT:
struct ipt_counters count;
char buf[64];
PPCODE:
if (!iptc_builtin(chain, *handle))
XSRETURN_UNDEF;
XPUSHs(sv_2mortal(newSVpv(iptc_get_policy(chain, &count, handle), 0)));
sprintf(buf, "%lu", count.pcnt);
XPUSHs(sv_2mortal(newSVpv(buf, strlen(buf))));
IPTables.xs view on Meta::CPAN
char * name;
PREINIT:
struct iptables_match *m;
unsigned int moo;
PPCODE:
m = find_match(name, TRY_LOAD);
if (m != NULL)
{
for (moo = 0; m->extra_opts[moo].name ; moo++)
IPTables.xs view on Meta::CPAN
char * name;
PREINIT:
struct iptables_match *m;
unsigned int moo;
PPCODE:
m = find_match(name, TRY_LOAD);
if (m != NULL)
{
m->help();
IPTables.xs view on Meta::CPAN
char * name;
PREINIT:
struct iptables_target *m;
unsigned int moo;
PPCODE:
m = find_target(name, TRY_LOAD);
if (m != NULL)
{
for (moo = 0; m->extra_opts[moo].name ; moo++)
IPTables.xs view on Meta::CPAN
char * name;
PREINIT:
struct iptables_target *m;
unsigned int moo;
PPCODE:
m = find_target(name, TRY_LOAD);
if (m != NULL)
{
m->help();
view all matches for this distribution
view release on metacpan or search on metacpan
char *
irc_encrypt_message_to_address(addr, nick, message)
char * addr
char * nick
char * message
PPCODE:
char * ret;
ret = irc_encrypt_message_to_address(addr,nick,message);
if(ret)
{
XPUSHs(sv_2mortal(newSVpv(ret, 0)));
char *
irc_encrypt_message_with_key(key, nick, message)
char * key
char * nick
char * message
PPCODE:
char * ret;
ret = irc_encrypt_message_with_key(key,nick,message);
if(ret)
{
XPUSHs(sv_2mortal(newSVpv(ret, 0)));
XSRETURN(0);
void
irc_decrypt_message(msg)
char * msg
PPCODE:
char *rmsg;
char *rnick;
unsigned int tdiff = 0;
int ret;
view all matches for this distribution