Skip to content

Add implementation of FD NOFILE rlimit

Compare
Choose a tag to compare
@nabbar nabbar released this 18 Jun 12:48
· 414 commits to master since this release

The rLimit is not implemented in Go for Windows.
This is beacause strictly rLimit does not exist in Windows.
But security of Windows use similar function to limite File Descriptor I/O
This version add a implementation of C call of the windows function to offer similar functionnalities

For Windows build, please follow this note :

Install required packages

Install package to build C source with GCC (need sometimes to details package x86_64 for win64 and i686 for win32 package)

  • gcc-multilib
  • gcc-mingw-w64
sudo apt-get install gcc-multilib gcc-mingw-w64 

Normally, you will having this binaries

  • i686-w64-mingw32* for 32-bit Windows;
  • x86_64-w64-mingw32* for 64-bit Windows.

Locate you binaries gcc mingw path and note it:

  • win32 : updatedb && locate i686-w64-mingw32-gcc
  • win64 : updatedb && locate x86_64-w64-mingw32-gcc

Rebuild object C if needed

if you have an error in the build, or if the .o object file is not present in golib/njg-ioutils/maxstdio/, run this step

cd golib/njg-ioutils/maxstdio 
gcc -c maxstdio.c

Build you go code with the C dependancies :

We will specify some env var in prefix of launching line of go build.
We recommend to use the -a flag of go build to force system to rebuild all dependancies and do not use precompiled code

For Win32 :

CC=/usr/bin/i686-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=386 go build -a -v ...

For Win64 :

CC=/usr/bin/x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -a -v ...