*BSD uses some different IOCTL-related macros. Set things up in a
cross-platform-friendly fashion so that the ioctl() wrapper implementation
will (in the future) work with *BSD.
Keep in mind this does not work *now*. NetBSD 6 will include PerFUSE, and
use libfuse 2.8.x, so ioctl() *may* work, and Fuse4X has userspace API
support for FUSE 2.8 features (but its kernel extension doesn't yet, the
developer says it's in the works). This is so that when that code hits,
this will work, and for now, it will build cleanly.
+
+# ifndef __linux__
+# define _IOC_SIZE(n) IOCPARM_LEN(n)
+# endif
+
int _PLfuse_ioctl(const char *file, int cmd, void *arg,
struct fuse_file_info *fi, unsigned int flags, void *data) {
int rv;
int _PLfuse_ioctl(const char *file, int cmd, void *arg,
struct fuse_file_info *fi, unsigned int flags, void *data) {
int rv;
* the perl side */
XPUSHs(sv_2mortal(newSVuv((unsigned int)cmd)));
XPUSHs(sv_2mortal(newSViv(flags)));
* the perl side */
XPUSHs(sv_2mortal(newSVuv((unsigned int)cmd)));
XPUSHs(sv_2mortal(newSViv(flags)));
- if (_IOC_DIR(cmd) & _IOC_WRITE)
XPUSHs(sv_2mortal(newSVpvn(data, _IOC_SIZE(cmd))));
else
XPUSHs(&PL_sv_undef);
XPUSHs(sv_2mortal(newSVpvn(data, _IOC_SIZE(cmd))));
else
XPUSHs(&PL_sv_undef);
PUTBACK;
rv = call_sv(MY_CXT.callback[39],G_ARRAY);
SPAGAIN;
PUTBACK;
rv = call_sv(MY_CXT.callback[39],G_ARRAY);
SPAGAIN;
- if ((_IOC_DIR(cmd) & _IOC_READ) && (rv == 2)) {
+ if ((cmd & IOC_OUT) && (rv == 2)) {
- if ((_IOC_DIR(cmd) & _IOC_READ) && !rv) {
+ if ((cmd & IOC_OUT) && !rv) {
if (sv) {
size_t len;
char *rdata = SvPV(sv, len);
if (sv) {
size_t len;
char *rdata = SvPV(sv, len);