mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- only bring in prctl if we're on linux
This commit is contained in:
parent
3683238da2
commit
892e6ec225
1 changed files with 9 additions and 7 deletions
|
@ -8,13 +8,15 @@ module LogStash::Util
|
|||
else; RbConfig::CONFIG["host_os"]
|
||||
end
|
||||
|
||||
module LibC
|
||||
extend FFI::Library
|
||||
if UNAME == "linux"
|
||||
ffi_lib 'c'
|
||||
if UNAME == "linux"
|
||||
module LibC
|
||||
extend FFI::Library
|
||||
if UNAME == "linux"
|
||||
ffi_lib 'c'
|
||||
|
||||
# Ok so the 2nd arg isn't really a string... but whaatever
|
||||
attach_function :prctl, [:int, :string, :long, :long, :long], :int
|
||||
# Ok so the 2nd arg isn't really a string... but whaatever
|
||||
attach_function :prctl, [:int, :string, :long, :long, :long], :int
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -27,7 +29,7 @@ module LogStash::Util
|
|||
|
||||
if UNAME == "linux"
|
||||
# prctl PR_SET_NAME allows up to 16 bytes for a process name
|
||||
# since MRI 1.9 and JRuby use system threads for this.
|
||||
# since MRI 1.9, JRuby, and Rubinius use system threads for this.
|
||||
LibC.prctl(PR_SET_NAME, name[0..16], 0, 0, 0)
|
||||
end
|
||||
end # def set_thread_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue