santigimeno / node-ioctl Goto Github PK
View Code? Open in Web Editor NEWnode ioctl wrapper
License: ISC License
node ioctl wrapper
License: ISC License
Whenever I try to read the fb_fix_screeninfo
, node.js crashes and says malloc(): memory corruption
. My fb_fix_screeninfo
structure looks like:
StructType({
id: ArrayType(ref.types.char,16),
smem_start: ref.types.ulong,
smem_len: ref.types.uint,
type: ref.types.uint,
type_aux: ref.types.uint,
visual: ref.types.uint,
xpanstep: ref.types.ushort,
ypanstep: ref.types.ushort,
line_length: ref.types.uint,
mmio_start: ref.types.ulong,
mmio_len: ref.types.uint,
accel: ref.types.uint,
capabilities: ref.types.ushort,
reserved: ArrayType(ref.types.ushort,2)
})
I am using this node-ioctl module on a FreeBSD 64-bit operating system. When using an ioctl with a request value that has the top bit set (i.e. 0x8nnnnnnn), an 'ioctl sign-extension ioctl' warning is emitted from the kernel.
This is due to the request value passed from the node side being assigned to an int data type before being passed to the ioctl. On FreeBSD the request data type is an unsigned long , so sign extension occurs. I appreciate there is some complication here as the datatype of request is int in Linux and unsigned long in FreeBSD.
I would suggest changing the line:
int request = args[1]->Uint32Value();
to
unsigned int request = args[1]->Uint32Value();
though I'm not sure if this would cause compilation issues on Linux?
Currently the ioctl
return value is directly passed node land. This makes usage very hard to debug when a seemingly random negative integer is returned. This could be avoided by using strerror(errno)
on errors.
To delete
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.