Linux-UserXAttr
view release on metacpan or search on metacpan
UserXAttr.xs view on Meta::CPAN
MODULE = Linux::UserXAttr PACKAGE = Linux::UserXAttr
PROTOTYPES: DISABLE
void
setxattr(handle, name, value, flags=0)
SV* handle
char *name
SV *value
int flags
PPCODE:
{
STRLEN vlen;
int fd=handle2fd(handle);
char *vcp;
vcp=SvPV(value, vlen);
if( fd>=0 ) { /* file handle */
if( !fsetxattr(fd, name, vcp, vlen, flags) ) {
mPUSHi(1);
}
UserXAttr.xs view on Meta::CPAN
if( !setxattr(path, name, vcp, vlen, flags) ) {
mPUSHi(1);
}
}
}
void
getxattr(handle, name)
SV* handle
char *name
PPCODE:
{
int fd=handle2fd(handle);
char buf[4096];
ssize_t rc;
errno=0;
if( fd>=0 ) {
if( (rc=fgetxattr(fd, name, buf, sizeof(buf)))>=0 ) {
if(errno==ERANGE && rc>sizeof(buf)) {
char buf2[rc+1];
UserXAttr.xs view on Meta::CPAN
} else {
mPUSHs(newSVpvn(buf, rc));
}
}
}
}
void
listxattr(handle)
SV* handle
PPCODE:
{
int fd=handle2fd(handle);
char buf[4096];
ssize_t rc;
errno=0;
if( fd>=0 ) {
if( (rc=flistxattr(fd, buf, sizeof(buf)))>=0 ) {
if(errno==ERANGE && rc>sizeof(buf)) {
char buf2[rc];
UserXAttr.xs view on Meta::CPAN
}
}
}
}
}
void
removexattr(handle, name)
SV* handle
char *name
PPCODE:
{
int fd=handle2fd(handle);
if( fd>=0 ) {
if( !fremovexattr(fd, name) ) {
mPUSHi(1);
}
} else { /* file name */
STRLEN len;
char *cp=SvPV(handle, len);
UserXAttr.xs view on Meta::CPAN
}
}
}
void
lsetxattr(path, name, value, flags=0)
char *path
char *name
SV *value
int flags
PPCODE:
{
STRLEN len;
char *cp=SvPV(value, len);
if( !lsetxattr(path, name, cp, len, flags) ) {
mPUSHi(1);
}
}
void
lgetxattr(path, name)
char *path
char *name
PPCODE:
{
char buf[4096];
ssize_t rc;
errno=0;
if( (rc=lgetxattr(path, name, buf, sizeof(buf)))>=0 ) {
if(errno==ERANGE && rc>sizeof(buf)) {
char buf2[rc+1];
if( (rc=lgetxattr(path, name, buf2, rc))>=0 ) {
mPUSHs(newSVpvn(buf2, rc));
UserXAttr.xs view on Meta::CPAN
} else {
mPUSHs(newSVpvn(buf, rc));
}
}
}
void
lremovexattr(path, name)
char *path
char *name
PPCODE:
{
if( !lremovexattr(path, name) ) {
mPUSHi(1);
}
}
void
llistxattr(path)
char *path
PPCODE:
{
char buf[4096];
ssize_t rc;
errno=0;
if( (rc=llistxattr(path, buf, sizeof(buf)))>=0 ) {
if(errno==ERANGE && rc>sizeof(buf)) {
char buf2[rc];
if( (rc=llistxattr(path, buf2, rc))>=0 ) {
char *cp=buf2;
( run in 2.056 seconds using v1.01-cache-2.11-cpan-5511b514fd6 )