lib/czmq-ffi-gen/czmq/ffi/zsys.rb in czmq-ffi-gen-0.15.0 vs lib/czmq-ffi-gen/czmq/ffi/zsys.rb in czmq-ffi-gen-0.16.0
- old
+ new
@@ -186,11 +186,11 @@
result
end
# Set default interrupt handler, so Ctrl-C or SIGTERM will set
# zsys_interrupted. Idempotent; safe to call multiple times.
- # Can be supressed by ZSYS_SIGHANDLER=false
+ # Can be suppressed by ZSYS_SIGHANDLER=false
# *** This is for CZMQ internal use only and may change arbitrarily ***
#
# @return [void]
def self.catch_interrupts()
result = ::CZMQ::FFI.zsys_catch_interrupts()
@@ -324,10 +324,26 @@
result
end
# Format a string using printf formatting, returning a freshly allocated
# buffer. If there was insufficient memory, returns NULL. Free the returned
+ # string using zstr_free(). The hinted version allows to optimize by using
+ # a larger starting buffer size (known to/assumed by the developer) and so
+ # avoid reallocations.
+ #
+ # @param hint [Integer, #to_int, #to_i]
+ # @param format [String, #to_s, nil]
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
+ # @return [::FFI::Pointer]
+ def self.sprintf_hint(hint, format, *args)
+ hint = Integer(hint)
+ result = ::CZMQ::FFI.zsys_sprintf_hint(hint, format, *args)
+ result
+ end
+
+ # Format a string using printf formatting, returning a freshly allocated
+ # buffer. If there was insufficient memory, returns NULL. Free the returned
# string using zstr_free().
#
# @param format [String, #to_s, nil]
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
# @return [::FFI::Pointer]
@@ -501,10 +517,56 @@
priority = Integer(priority)
result = ::CZMQ::FFI.zsys_set_thread_priority(priority)
result
end
+ # Configure the numeric prefix to each thread created for the internal
+ # context's thread pool. This option is only supported on Linux.
+ # If the environment variable ZSYS_THREAD_NAME_PREFIX is defined, that
+ # provides the default.
+ # Note that this method is valid only before any socket is created.
+ #
+ # @param prefix [Integer, #to_int, #to_i]
+ # @return [void]
+ def self.set_thread_name_prefix(prefix)
+ prefix = Integer(prefix)
+ result = ::CZMQ::FFI.zsys_set_thread_name_prefix(prefix)
+ result
+ end
+
+ # Return thread name prefix.
+ #
+ # @return [Integer]
+ def self.thread_name_prefix()
+ result = ::CZMQ::FFI.zsys_thread_name_prefix()
+ result
+ end
+
+ # Adds a specific CPU to the affinity list of the ZMQ context thread pool.
+ # This option is only supported on Linux.
+ # Note that this method is valid only before any socket is created.
+ #
+ # @param cpu [Integer, #to_int, #to_i]
+ # @return [void]
+ def self.thread_affinity_cpu_add(cpu)
+ cpu = Integer(cpu)
+ result = ::CZMQ::FFI.zsys_thread_affinity_cpu_add(cpu)
+ result
+ end
+
+ # Removes a specific CPU to the affinity list of the ZMQ context thread pool.
+ # This option is only supported on Linux.
+ # Note that this method is valid only before any socket is created.
+ #
+ # @param cpu [Integer, #to_int, #to_i]
+ # @return [void]
+ def self.thread_affinity_cpu_remove(cpu)
+ cpu = Integer(cpu)
+ result = ::CZMQ::FFI.zsys_thread_affinity_cpu_remove(cpu)
+ result
+ end
+
# Configure the number of sockets that ZeroMQ will allow. The default
# is 1024. The actual limit depends on the system, and you can query it
# by using zsys_socket_limit (). A value of zero means "maximum".
# Note that this method is valid only before any socket is created.
#
@@ -541,10 +603,30 @@
def self.max_msgsz()
result = ::CZMQ::FFI.zsys_max_msgsz()
result
end
+ # Configure whether to use zero copy strategy in libzmq. If the environment
+ # variable ZSYS_ZERO_COPY_RECV is defined, that provides the default.
+ # Otherwise the default is 1.
+ #
+ # @param zero_copy [Integer, #to_int, #to_i]
+ # @return [void]
+ def self.set_zero_copy_recv(zero_copy)
+ zero_copy = Integer(zero_copy)
+ result = ::CZMQ::FFI.zsys_set_zero_copy_recv(zero_copy)
+ result
+ end
+
+ # Return ZMQ_ZERO_COPY_RECV option.
+ #
+ # @return [Integer]
+ def self.zero_copy_recv()
+ result = ::CZMQ::FFI.zsys_zero_copy_recv()
+ result
+ end
+
# Configure the threshold value of filesystem object age per st_mtime
# that should elapse until we consider that object "stable" at the
# current zclock_time() moment.
# The default is S_DEFAULT_ZSYS_FILE_STABLE_AGE_MSEC defined in zsys.c
# which generally depends on host OS, with fallback value of 5000.
@@ -734,9 +816,73 @@
# Return use of automatic pre-allocated FDs for zsock instances.
#
# @return [Integer]
def self.auto_use_fd()
result = ::CZMQ::FFI.zsys_auto_use_fd()
+ result
+ end
+
+ # Print formatted string. Format is specified by variable names
+ # in Python-like format style
+ #
+ # "%(KEY)s=%(VALUE)s", KEY=key, VALUE=value
+ # become
+ # "key=value"
+ #
+ # Returns freshly allocated string or NULL in a case of error.
+ # Not enough memory, invalid format specifier, name not in args
+ #
+ # @param format [String, #to_s, nil]
+ # @param args [Zhash, #__ptr]
+ # @return [::FFI::AutoPointer]
+ def self.zprintf(format, args)
+ args = args.__ptr if args
+ result = ::CZMQ::FFI.zsys_zprintf(format, args)
+ result = ::FFI::AutoPointer.new(result, LibC.method(:free))
+ result
+ end
+
+ # Return error string for given format/args combination.
+ #
+ # @param format [String, #to_s, nil]
+ # @param args [Zhash, #__ptr]
+ # @return [::FFI::AutoPointer]
+ def self.zprintf_error(format, args)
+ args = args.__ptr if args
+ result = ::CZMQ::FFI.zsys_zprintf_error(format, args)
+ result = ::FFI::AutoPointer.new(result, LibC.method(:free))
+ result
+ end
+
+ # Print formatted string. Format is specified by variable names
+ # in Python-like format style
+ #
+ # "%(KEY)s=%(VALUE)s", KEY=key, VALUE=value
+ # become
+ # "key=value"
+ #
+ # Returns freshly allocated string or NULL in a case of error.
+ # Not enough memory, invalid format specifier, name not in args
+ #
+ # @param format [String, #to_s, nil]
+ # @param args [Zconfig, #__ptr]
+ # @return [::FFI::AutoPointer]
+ def self.zplprintf(format, args)
+ args = args.__ptr if args
+ result = ::CZMQ::FFI.zsys_zplprintf(format, args)
+ result = ::FFI::AutoPointer.new(result, LibC.method(:free))
+ result
+ end
+
+ # Return error string for given format/args combination.
+ #
+ # @param format [String, #to_s, nil]
+ # @param args [Zconfig, #__ptr]
+ # @return [::FFI::AutoPointer]
+ def self.zplprintf_error(format, args)
+ args = args.__ptr if args
+ result = ::CZMQ::FFI.zsys_zplprintf_error(format, args)
+ result = ::FFI::AutoPointer.new(result, LibC.method(:free))
result
end
# Set log identity, which is a string that prefixes all log messages sent
# by this process. The log identity defaults to the environment variable