view release on metacpan or search on metacpan
# usage: SvREFCNT_inc(\$var) ;
# PPCODE needed since otherwise sv_2mortal is inserted that will kill
# the value.
SV *
SvREFCNT_inc(sv)
SV * sv
PPCODE:
if ( SvROK(sv) ) {
sv = (SV*)SvRV(sv);
RETVAL = SvREFCNT_inc(sv) ;
SvFLAGS(sv) |= SVf_BREAK ;
PUSHs(RETVAL);
}
# usage: SvREFCNT_dec(\$var) ;
# PPCODE needed since by default it is void
SV *
SvREFCNT_dec(sv)
SV * sv
PPCODE:
if ( SvROK(sv) ) {
sv = (SV*)SvRV(sv);
SvREFCNT_dec(sv);
SvFLAGS(sv) |= SVf_BREAK ;
PUSHs(sv);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hash/SharedMem.xs view on Meta::CPAN
OUTPUT:
RETVAL
void
CLEAR(SV *shash)
PPCODE:
arg_check_shash(shash);
croak("can't clear shared hash");
BOOT:
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Hash/Util/Pick.xs view on Meta::CPAN
PROTOTYPES: DISABLED
void
pick(...)
PROTOTYPE: $@
PPCODE:
{
SV **args = &PL_stack_base[ax];
HV *src = SvROK(args[0]) ?
(HV*)SvRV(args[0]) : (HV*)sv_2mortal((SV*)newHV());
lib/Hash/Util/Pick.xs view on Meta::CPAN
}
void
pick_by(...)
PROTOTYPE: $&
PPCODE:
{
dMULTICALL;
GV *gv;
HV *stash;
I32 gimme = G_SCALAR;
lib/Hash/Util/Pick.xs view on Meta::CPAN
}
void
omit(...)
PROTOTYPE: $@
PPCODE:
{
SV **args = &PL_stack_base[ax];
HV *src = SvROK(args[0]) ?
(HV*)SvRV(args[0]) : (HV*)sv_2mortal((SV*)newHV());
lib/Hash/Util/Pick.xs view on Meta::CPAN
}
void
omit_by(...)
PROTOTYPE: $&
PPCODE:
{
dMULTICALL;
GV *gv;
HV *stash;
I32 gimme = G_SCALAR;
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPE: \%\%
PREINIT:
HV *seen;
HE *he;
SV *key;
PPCODE:
if(GIMME_V != G_LIST)
XSRETURN_IV(THX_keys_union_count(aTHX_ x, y));
EXTEND(SP, (SSize_t)HvTOTALKEYS(x) + (SSize_t)HvTOTALKEYS(y));
HV *y
PROTOTYPE: \%\%
PREINIT:
HE *he;
SV *key;
PPCODE:
if(GIMME_V != G_LIST)
XSRETURN_IV(THX_keys_intersection_count(aTHX_ x, y));
if (HvTOTALKEYS(x) > HvTOTALKEYS(y)) {
HV *tmp = x;
HV *y
PROTOTYPE: \%\%
PREINIT:
HE *he;
SV *key;
PPCODE:
if(GIMME_V != G_LIST)
XSRETURN_IV(THX_keys_difference_count(aTHX_ x, y));
EXTEND(SP, (SSize_t)HvTOTALKEYS(x));
HV *y
PROTOTYPE: \%\%
PREINIT:
HE *he;
SV *key;
PPCODE:
if(GIMME_V != G_LIST)
XSRETURN_IV(THX_keys_symmetric_difference_count(aTHX_ x, y));
EXTEND(SP, (SSize_t)HvTOTALKEYS(x) + (SSize_t)HvTOTALKEYS(y));
keys_any(x, ...)
HV *x
PROTOTYPE: \%@
PREINIT:
I32 i;
PPCODE:
for (i = 1; i < items; i++) {
if (hv_exists_ent(x, ST(i), 0))
XSRETURN_YES;
}
XSRETURN_NO;
keys_all(x, ...)
HV *x
PROTOTYPE: \%@
PREINIT:
I32 i;
PPCODE:
for (i = 1; i < items; i++) {
if (!hv_exists_ent(x, ST(i), 0))
XSRETURN_NO;
}
XSRETURN_YES;
keys_none(x, ...)
HV *x
PROTOTYPE: \%@
PREINIT:
I32 i;
PPCODE:
for (i = 1; i < items; i++) {
if (hv_exists_ent(x, ST(i), 0))
XSRETURN_NO;
}
XSRETURN_YES;
PROTOTYPE: \%\%
PREINIT:
AV *only_x, *both, *only_y;
HE *he;
SV *key;
PPCODE:
sv_2mortal((SV *)(only_x = newAV()));
sv_2mortal((SV *)(both = newAV()));
sv_2mortal((SV *)(only_y = newAV()));
view all matches for this distribution
view release on metacpan or search on metacpan
void
extract_upto(obj, upto_key)
SV* obj
SV* upto_key
PPCODE:
if(!SvOK(upto_key)){
croak("Undef supplied as key for extract_upto()");
}
struct fibheap* heap = (struct fibheap*)SvIV(SvRV(obj));
}
void
key_insert(obj, ...)
SV* obj
PPCODE:
struct fibheap* heap;
SV *ret, *elem;
int key;
I32 gimme;
int i;
}
void
insert(obj, ...)
SV* obj
PPCODE:
struct fibheap* heap;
SV *ret, *elem;
I32 gimme;
int i;
view all matches for this distribution
view release on metacpan or search on metacpan
void
extract_top(heap h)
ALIAS:
Heap::Simple::XS::extract_min = 1
Heap::Simple::XS::extract_first = 2
PPCODE:
if (h->used <= 2) {
if (h->used < 2) {
if (ix != 2) croak("Empty heap");
XSRETURN_EMPTY;
}
PUSHs(sv_2mortal(extract_top(aTHX_ h)));
}
void
extract_upto(heap h, SV *border)
PPCODE:
/* special case, avoid uneeded access to border */
if (h->used < 2) return;
if (h->locked) croak("recursive heap change");
SAVEINT(h->locked);
h->locked = 1;
}
if ((h->used+4)*4 < h->allocated) extend(h, 0); /* shrink really */
void
extract_all(heap h)
PPCODE:
if (h->locked) croak("recursive heap change");
SAVEINT(h->locked);
h->locked = 1;
/* Extends one too much. Who cares... */
EXTEND(SP, h->used);
void
top(heap h)
ALIAS:
Heap::Simple::XS::first = 1
PPCODE:
if (h->used < 2) {
if (ix != 1) croak("Empty heap");
XSRETURN_EMPTY;
}
if (h->has_values) PUSHs(sv_2mortal(SvREFCNT_inc(h->values[1])));
void
top_key(heap h)
ALIAS:
Heap::Simple::XS::min_key = 1
Heap::Simple::XS::first_key = 2
PPCODE:
if (h->used < 2) {
if (ix == 2) XSRETURN_EMPTY;
if (!h->infinity || !SvOK(h->infinity)) croak("Empty heap");
PUSHs(sv_2mortal(SvREFCNT_inc(h->infinity)));
} else if (h->fast) {
keys(heap h)
PREINIT:
/* you can actally modify the values through the return */
size_t i;
SV *key;
PPCODE:
/* Extends one too much. Who cares... */
EXTEND(SP, h->used);
EXTEND_MORTAL(h->used);
if (h->fast) {
if (h->order == LESS) for (i=1; i<h->used; i++)
void
values(heap h)
PREINIT:
/* you can actally modify the values through the return */
size_t i;
PPCODE:
/* Extends one too much. Who cares... */
EXTEND(SP, h->used);
EXTEND_MORTAL(h->used);
if (h->has_values) for (i=1; i<h->used; i++)
PUSHs(sv_2mortal(SvREFCNT_inc(h->values[i])));
void
clear(heap h)
PREINIT:
SV *key, *value;
PPCODE:
if (h->locked) croak("recursive heap change");
SAVEINT(h->locked);
h->locked = 1;
if (h->fast || !h->wrapped) {
if (h->has_values)
_absorb(SV * heap1, SV *heap2)
PREINIT:
int copied2, one_by_one;
SV *heap1_ref, *value;
heap h1, h2;
PPCODE:
/* Helper for absorb, puts h1 into h2 */
h1 = C_HEAP(heap1, "heap1");
/* Keep argument alive for the duration */
heap1_ref = SvRV(heap1);
sv_2mortal(SvREFCNT_inc(heap1_ref));
PREINIT:
int copied2;
SV *heap1_ref, *key, *value;
heap h1, h2;
int one_by_one;
PPCODE:
/* Helper for absorb, puts h1 into h2 */
h1 = C_HEAP(heap1, "heap1");
/* Keep arguments alive for the duration */
heap1_ref = SvRV(heap1);
sv_2mortal(SvREFCNT_inc(heap1_ref));
}
}
void
infinity(heap h, SV *new_infinity=0)
PPCODE:
if (GIMME_V != G_VOID)
XPUSHs(h->infinity ?
sv_2mortal(SvREFCNT_inc(h->infinity)) : &PL_sv_undef);
if (new_infinity) {
if (h->infinity) sv_2mortal(h->infinity);
OUTPUT:
RETVAL
void
user_data(heap h, SV *new_user_data=0)
PPCODE:
if (GIMME_V != G_VOID)
PUSHs(h->user_data ? h->user_data : &PL_sv_undef);
if (new_user_data) {
if (h->user_data) sv_2mortal(h->user_data);
h->user_data = newSVsv(new_user_data);
}
void
order(heap h)
PPCODE:
PUSHs(h->order == CODE_ORDER ?
h->order_sv : sv_2mortal(newSVpv(order_name(h), 0)));
void
elements(heap h)
PPCODE:
XPUSHs(sv_2mortal(newSVpv(elements_name(h), 0)));
if (GIMME_V == G_ARRAY) switch(h->elements) {
case SCALAR:
break;
case ARRAY:
croak("Assertion: unhandled element type %s", elements_name(h));
}
void
wrapped(heap h)
PPCODE:
if (h->key_ops) XSRETURN_YES;
if (GIMME_V == G_SCALAR) XSRETURN_NO;
XSRETURN_EMPTY;
void
dirty(heap h)
PPCODE:
if (h->dirty) XSRETURN_YES;
if (GIMME_V == G_SCALAR) XSRETURN_NO;
XSRETURN_EMPTY;
void
can_die(heap h)
PPCODE:
/* ->fast types are wrapped too really */
if (h->can_die) XSRETURN_YES;
if (GIMME_V == G_SCALAR) XSRETURN_NO;
XSRETURN_EMPTY;
void
max_count(heap h)
PPCODE:
if (h->max_count == MAX_SIZE) XSRETURN_NV(INFINITY);
XSRETURN_UV(h->max_count);
void
merge_arrays(heap h, ...)
void
DESTROY(heap h)
PREINIT:
SV *key, *value;
PPCODE:
/* Let's assume the module isn't buggy and it always increases the refcount
on the heap during modification.
That means that the user is explicitely calling DESTROY */
if (h->locked)
croak("Refusing explicit DESTROY call during heap modification");
view all matches for this distribution
view release on metacpan or search on metacpan
void
kadm5_c_get_principals(handle,exp)
shandle_t *handle
char *exp
PPCODE:
{
char **princs;
int num_princs,i;
kadm5_ret_t ret;
}
int
getPrincExpireTime(spp)
sprincipal_t *spp
PPCODE:
{
XPUSHi(spp->principal.princ_expire_time);
}
void
view all matches for this distribution
view release on metacpan or search on metacpan
bcm2835_spi_transfer(uint8_t value)
void
hipi_spi_transfern( tbuf )
SV* tbuf
PPCODE:
SV* rbuf = newSVsv(tbuf);
bcm2835_spi_transfern( SvPVX(rbuf), (uint32_t)SvCUR(rbuf) );
EXTEND(SP, 1);
PUSHs(sv_2mortal(rbuf));
bcm2835_spi_transfern(char* buf, short length(buf))
void
hipi_spi_transfernb( tbuf )
SV* tbuf
PPCODE:
SV* rbuf = newSVsv(tbuf);
bcm2835_spi_transfernb( SvPVX(tbuf), SvPVX(rbuf), (uint32_t)SvCUR(tbuf) );
EXTEND(SP, 1);
PUSHs(sv_2mortal(rbuf));
bcm2835_spi_transfernb(char* tbuf, char* rbuf, short length(tbuf))
void
hipi_spi_writenb( buf )
SV* buf
PPCODE:
SV* rbuf = sv_2mortal(newSVsv(buf));
bcm2835_spi_writenb( SvPVX(rbuf), (uint32_t)SvCUR(rbuf) );
EXTEND(SP, 1);
PUSHs(rbuf);
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: DISABLE
void
_compress_buffer(SV* inputsv)
PPCODE:
unsigned char* outputbuffer;
SV* output = sv_newmortal();
unsigned inputsize = SvCUR(inputsv);
unsigned char* inputbuffer = (unsigned char *)SvPVX(inputsv);
unsigned outputsize = inputsize + (inputsize * 0.1) + 12;
PUSHs(sv_2mortal(newSViv(compressedsize)));
void
_decompress_buffer(SV* inputsv, unsigned outputsize)
PPCODE:
unsigned char* outputbuffer;
SV* output = sv_newmortal();
unsigned inputsize = SvCUR(inputsv);
unsigned char* inputbuffer = (unsigned char *)SvPVX(inputsv);
view all matches for this distribution
view release on metacpan or search on metacpan
MODULE = Hiredis::Raw PACKAGE = Hiredis::Raw PREFIX = redis
PROTOTYPES: DISABLE
void
redisVersion()
PPCODE:
EXTEND(SP, 3);
PUSHs(sv_2mortal(newSViv(HIREDIS_MAJOR)));
PUSHs(sv_2mortal(newSViv(HIREDIS_MINOR)));
PUSHs(sv_2mortal(newSViv(HIREDIS_PATCH)));
void
redisAsyncFree(redisAsyncContext *ac)
void
redisAsyncIsAllocated(SV *self)
PPCODE:
void *ac = xs_object_magic_get_struct(aTHX_ SvRV(self));
EXTEND(SP, 1);
if (ac == NULL)
PUSHs(&PL_sv_no);
else
void
redisAsyncDisconnect(redisAsyncContext *ac)
void
redisAsyncGetFd(redisAsyncContext *ac)
PPCODE:
EXTEND(SP, 1);
PUSHs(sv_2mortal(newSViv(ac->c.fd)));
view all matches for this distribution
view release on metacpan or search on metacpan
int current_item = 0;
DIALOG_LISTITEM *listitems;
int dialog_return_code;
INIT:
items_amount = av_len((AV *)SvRV(items_list)) + 1;
PPCODE:
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) items_amount);
for (i = 0; i < items_amount; i++) {
listitems[i].name = SvPV_nolen(_get_hash_key_sv_from_array(items_list, i, "name"));
listitems[i].text = SvPV_nolen(_get_hash_key_sv_from_array(items_list, i, "text"));
int current_item = 0;
DIALOG_LISTITEM *listitems;
int dialog_return_code;
INIT:
items_amount = av_len((AV *)SvRV(items_menu)) + 1;
PPCODE:
listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) items_amount);
for (i = 0; i < items_amount; i++) {
listitems[i].name = SvPV_nolen(_get_hash_key_sv_from_array(items_menu, i, "name"));
listitems[i].text = SvPV_nolen(_get_hash_key_sv_from_array(items_menu, i, "text"));
# -------- extra --------
void
_dialog_result()
PROTOTYPE:
PPCODE:
mXPUSHs(newSVpv(dialog_vars.input_result, 0));
dlg_clr_result();
void
_dialog_set_backtitle(title)
view all matches for this distribution
view release on metacpan or search on metacpan
PROTOTYPES: ENABLE
void
POST(SV* hook)
PROTOTYPE: &
PPCODE:
{
LEAVE;
SAVEDESTRUCTOR_X(exec_leave,newSVsv(hook));
ENTER;
}
view all matches for this distribution
view release on metacpan or search on metacpan
void
uuid_v4_bulk(count, fmt = HORUS_FMT_STR)
int count
int fmt
PPCODE:
{
int i;
if (count <= 0)
XSRETURN_EMPTY;
void
bulk(self, count)
SV *self
int count
PPCODE:
{
dMY_CXT;
HV *hv;
SV **svp;
int fmt, ver, i;
view all matches for this distribution
view release on metacpan or search on metacpan
DataAccess.xsh view on Meta::CPAN
ll_get_data(object,Specification)
LL_element *object
int Specification
PROTOTYPE: $$
PPCODE:
{
RETVAL=(void *)targ; /* bogus but spresses any unused variable error messages */
/*fprintf(stderr,"\nSPECIFICATION = %d\n",Specification);*/
switch (defs[Specification])
{
view all matches for this distribution
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
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
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