Giter VIP home page Giter VIP logo

ubus's Introduction

ubus

libubus wrapper

prerequsites

build

  1. libubus and libubox could be found by default flags

    go build

    CGO_ENABLED is set by default for most goarch and goos, in that case, you can check the default configuration by go env, if CGO_ENABLED is not set, you need build with:

    CGO_ENABLED=1 go build

  2. custom location for libubus and libubox

    CGO_ENABLED=1 CGO_CFLAGS=-I/path/to/header/dir CGO_LDFLAGS=-L/path/to/lib/dir go build

  3. if you need cross compile for other architecture:

    CC=/path/to/compiler ...

    e.g.: to cross compile for openwrt running on MIPS:

    CC=mips-openwrt-linux-gcc CGO_ENABLED=1 \
    CGO_LDFLAGS="-L/opt/packages/lede_repo/lede/staging_dir/target-mips_musl/usr/lib" \
    CGO_CFLAGS="-I/opt/packages/lede_repo/lede/staging_dir/target-mips_musl/usr/include"\
    GOARCH=mips go build
    

ubus's People

Contributors

golangwrt avatar

Stargazers

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

Watchers

 avatar

ubus's Issues

Socket leak

Hi there,

There seems to be a socket leak in this library. I created an example file and just ran the following code in a loop:

raw, err := ubus.Call("uci", "get", params, ubus.DefaultInvokeTimeout)
if err != nil {
    log.Println("ubus.Call err")
    panic(err)
}
        
log.Printf(string(raw))

When I use lsof to check the number of socket connections the Linux system is maintaining, I see that it increases pretty steadily:

...
6082    /root/ubus-test socket:[111485]
6082    /root/ubus-test socket:[111492]
6082    /root/ubus-test socket:[111495]
6082    /root/ubus-test socket:[111496]
6082    /root/ubus-test socket:[111511]
6082    /root/ubus-test socket:[111514]
...

Whereas if I use os.exec to run the same uci get function, the lsof count stays constant.

Please help!

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.