Coder Social home page Coder Social logo

node-ioctl's People

Contributors

cstruct avatar deepak1556 avatar santigimeno avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-ioctl's Issues

malloc(): memory corruption

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)
	})

Sign extension on 64-bit FreeBSD

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?

Meaningful errors

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.