GithubHelp home page GithubHelp logo

tnodir / luasys Goto Github PK

View Code? Open in Web Editor NEW
69.0 69.0 24.0 832 KB

LuaSys is a portable Lua library providing access to system and networking functions. Also includes: event notification mechanism, win32 specifics (registry, service), serial communication, signals, threading and much more.

Home Page: http://luaforge.net/projects/luasys

License: Other

Makefile 0.54% C 87.92% Shell 0.01% Lua 11.32% Batchfile 0.21%

luasys's People

Contributors

dilshod avatar fedepell avatar tnodir 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  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  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luasys's Issues

Win32 API - TransmitFileMap problem

There seems to be an issue with the TransmitFileMap function that implements sendfile on win32.

The variable 'n' is set to zero by:

if (n == 0 || n > (DWORD)size)
n = (DWORD)size;
}

If reading in a file, the initial variable size is zero(0) from SetFilePointer or cursor operations on the file handle therefore meaning that when you set wsa_buf.len = n; then the length is zero also , meaning that WSASend will write 0 bytes to the buffer.

Please confirm this issue and fix the algorithm.

Thanks.

android / NACL hacks

I've been looking at hacking around the code enough to get the bits that can work to work under android and nacl.

Mostly this is just removing functions/sections for the android or nacl build.

If I clean up / test / etc are you interested in a patch for these platforms?

My hacks live at https://bitbucket.org/xixs/lua/src/tip/lua_sys/

Missing License information

Would it be possible to add to the project the licensing information (ie. usual LICENSE / COPYRIGHT file) so as to make it easier / cleaner ( / more legal :-) ) to integrate into other projects? (ie. I', trying to integrate your module into a Yocto based system)

Many thanks!
F.

scheduler:wait_xxx doesn't increase nevents evq refcount

Hi,

In the test:

test/thread/sched/test_evq.lua

If I remove the signal handler from evq at the bottom
--assert(evq:add_signal("INT", evq.stop)))

then the test hangs and the sched:wait_timer and sched:wait_socket handers don't get run.

I find this a bit surprising... is this so by design, or a bug? It seems a bit of a hack to require a signal watcher to be present for the loop to work.

Looking at the code, it seems that sched_add events delays the call to levq_add_xxx via a sync_call which is delayed until it can be executed inside the event loop, so the loop's nevents is not incremented until the loop actually starts, but it can't start, because the nevents is zero :/

Can this be fixed?

Thanks,
Richard

[patch] allow thread.runvm to handle string args with embedded "\0"

Hi Nodir,

here's a patch which allows one to pass arbitrary buffers as arguments to runvm (it just uses lua_pushlstring instead):


diff --git a/src/thread/sys_thread.c b/src/thread/sys_thread.c
index 5f83b6d..4b35c18 100644
--- a/src/thread/sys_thread.c
+++ b/src/thread/sys_thread.c
@@ -777,8 +777,12 @@ thread_runvm (lua_State *L)

        for (i = ARG_LAST + 1; i <= top; ++i) {
            switch (lua_type(L, i)) {
-           case LUA_TSTRING:
-               lua_pushstring(NL, lua_tostring(L, i));
+           case LUA_TSTRING: {
+                    size_t len;
+                    const char * str;
+                    str = lua_tolstring(L, i, &len);
+                    lua_pushlstring(NL, str, len);
+                }
                break;
            case LUA_TNUMBER:
                lua_pushnumber(NL, lua_tonumber(L, i));

test_evq.lua

the directory watching test doesn't seem to work for me.
It just hangs when loop is called.
Please can you help me debug.

idle tasks

Hi Nodir,

I think luasys needs to have an idle task more than an idle event. You basically want to finish running your all active tasks before servicing I/O.

The echosrvr_co.lua test shows this issue. You only call the scheduler when the event loop is idle. A server under load would starve tasks which are created to process the data. I think this is the wrong way. Instead you want to call the event loop when the scheduler is idle.

What do you think?

Cheers,
Richard

Application stop working if encounter thread error

Hi,

As shown in screen-shot below of testing the script stdin.lua, if the thread encounters an error, the program will stop working and pop-up a Windows dialog. This may not be a good ways, at least the dialog is not expected.
sshot-1

For file "stdin.lua", I simply change sys.stdout:write("Worker:\tInput: ", line) as "os.execute(line)", because I may need luasys to do the similar functions in my progam.

My platform is Win7 64bit. Thank you.

membuf read not advancing properly

I encountered a problem with reading memory buffers:

buf = sys.mem.pointer():alloc()
buf:write("1234567")
print(buf:read(3), buf:read(3), buf:read(3))

prints "123 234 3" instead of the expected "123 456 7"

I believe this line: https://github.com/tnodir/luasys/blob/master/src/mem/membuf.c#L222 should read if (n) memmove(p, p + l, n); instead of if (n) memmove(p, p + 1, n); (numeral one should be lowercase letter L)

Another issue I encountered browsing through the source is that a mixture of spaces and tabs are used for indentation, which makes it very hard to read at a different tab setting. Running the code through something like GNU indent or https://code.google.com/p/tabfix/ would fix this.

So far, I've been very impressed with luasys ... the only the missing is some documentation.

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.