Class: CZMQ::FFI::Zsys

Inherits:
Object
  • Object
show all
Defined in:
lib/czmq-ffi-gen/czmq/ffi/zsys.rb

Overview

Note:

This class is 100% generated using zproject.

Defined Under Namespace

Classes: DestroyedError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr, finalize = true) ⇒ Zsys

Attaches the pointer ptr to this instance and defines a finalizer for it if necessary.

Parameters:

  • ptr (::FFI::Pointer)
  • finalize (Boolean) (defaults to: true)


24
25
26
27
28
29
30
31
32
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 24

def initialize(ptr, finalize = true)
  @ptr = ptr
  if @ptr.null?
    @ptr = nil # Remove null pointers so we don't have to test for them.
  elsif finalize
    @finalizer = self.class.create_finalizer_for @ptr
    ObjectSpace.define_finalizer self, @finalizer
  end
end

Class Method Details

.auto_use_fdInteger

Return use of automatic pre-allocated FDs for zsock instances.

Returns:

  • (Integer)


890
891
892
893
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 890

def self.auto_use_fd()
  result = ::CZMQ::FFI.zsys_auto_use_fd()
  result
end

.catch_interruptsvoid

This method returns an undefined value.

Set default interrupt handler, so Ctrl-C or SIGTERM will set zsys_interrupted. Idempotent; safe to call multiple times. Can be suppressed by ZSYS_SIGHANDLER=false *** This is for CZMQ internal use only and may change arbitrarily ***



195
196
197
198
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 195

def self.catch_interrupts()
  result = ::CZMQ::FFI.zsys_catch_interrupts()
  result
end

.close(handle, filename, line_nbr) ⇒ Integer

Destroy/close a ZMQ socket. You should call this for every socket you create using zsys_socket(). *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • handle (::FFI::Pointer, #to_ptr)
  • filename (String, #to_s, nil)
  • line_nbr (Integer, #to_int, #to_i)

Returns:

  • (Integer)


139
140
141
142
143
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 139

def self.close(handle, filename, line_nbr)
  line_nbr = Integer(line_nbr)
  result = ::CZMQ::FFI.zsys_close(handle, filename, line_nbr)
  result
end

.create_finalizer_for(ptr) ⇒ Proc

Returns:

  • (Proc)


34
35
36
37
38
39
40
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 34

def self.create_finalizer_for(ptr)
  Proc.new do
    "WARNING: "\
    "Objects of type #{self} cannot be destroyed implicitly. "\
    "Please call the correct destroy method with the relevant arguments."
  end
end

.create_pipe(backend_p) ⇒ Zsock

Create a pipe, which consists of two PAIR sockets connected over inproc. The pipe is configured to use the zsys_pipehwm setting. Returns the frontend socket successful, NULL if failed.

Parameters:

Returns:



162
163
164
165
166
167
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 162

def self.create_pipe(backend_p)
  backend_p = backend_p.__ptr_give_ref
  result = ::CZMQ::FFI.zsys_create_pipe(backend_p)
  result = Zsock.__new result, false
  result
end

.daemonize(workdir) ⇒ Integer

Move the current process into the background. The precise effect depends on the operating system. On POSIX boxes, moves to a specified working directory (if specified), closes all file handles, reopens stdin, stdout, and stderr to the null device, and sets the process to ignore SIGHUP. On Windows, does nothing. Returns 0 if OK, -1 if there was an error.

Parameters:

  • workdir (String, #to_s, nil)

Returns:

  • (Integer)


451
452
453
454
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 451

def self.daemonize(workdir)
  result = ::CZMQ::FFI.zsys_daemonize(workdir)
  result
end

.debug(format, *args) ⇒ void

This method returns an undefined value.

Log debug-level message - lowest priority

Parameters:



1052
1053
1054
1055
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1052

def self.debug(format, *args)
  result = ::CZMQ::FFI.zsys_debug(format, *args)
  result
end

.dir_change(pathname) ⇒ Integer

Move to a specified working directory. Returns 0 if OK, -1 if this failed.

Parameters:

  • pathname (String, #to_s, nil)

Returns:

  • (Integer)


292
293
294
295
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 292

def self.dir_change(pathname)
  result = ::CZMQ::FFI.zsys_dir_change(pathname)
  result
end

.dir_create(pathname, *args) ⇒ Integer

Create a file path if it doesn’t exist. The file path is treated as printf format.

Parameters:

Returns:

  • (Integer)


273
274
275
276
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 273

def self.dir_create(pathname, *args)
  result = ::CZMQ::FFI.zsys_dir_create(pathname, *args)
  result
end

.dir_delete(pathname, *args) ⇒ Integer

Remove a file path if empty; the pathname is treated as printf format.

Parameters:

Returns:

  • (Integer)


283
284
285
286
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 283

def self.dir_delete(pathname, *args)
  result = ::CZMQ::FFI.zsys_dir_delete(pathname, *args)
  result
end

.error(format, *args) ⇒ void

This method returns an undefined value.

Log error condition - highest priority

Parameters:



1012
1013
1014
1015
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1012

def self.error(format, *args)
  result = ::CZMQ::FFI.zsys_error(format, *args)
  result
end

.file_delete(filename) ⇒ Integer

Delete file. Does not complain if the file is absent

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Integer)


253
254
255
256
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 253

def self.file_delete(filename)
  result = ::CZMQ::FFI.zsys_file_delete(filename)
  result
end

.file_exists(filename) ⇒ Boolean

Return 1 if file exists, else zero

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Boolean)


224
225
226
227
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 224

def self.file_exists(filename)
  result = ::CZMQ::FFI.zsys_file_exists(filename)
  result
end

.file_mode(filename) ⇒ Integer

Return file mode; provides at least support for the POSIX S_ISREG(m) and S_ISDIR(m) macros and the S_IRUSR and S_IWUSR bits, on all boxes. Returns a mode_t cast to int, or -1 in case of error.

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Integer)


244
245
246
247
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 244

def self.file_mode(filename)
  result = ::CZMQ::FFI.zsys_file_mode(filename)
  result
end

.file_mode_defaultvoid

This method returns an undefined value.

Reset default file creation mode; all files created from here will use process file mode defaults.



310
311
312
313
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 310

def self.file_mode_default()
  result = ::CZMQ::FFI.zsys_file_mode_default()
  result
end

.file_mode_privatevoid

This method returns an undefined value.

Set private file creation mode; all files created from here will be readable/writable by the owner only.



301
302
303
304
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 301

def self.file_mode_private()
  result = ::CZMQ::FFI.zsys_file_mode_private()
  result
end

.file_modified(filename) ⇒ ::FFI::Pointer

Return file modification time. Returns 0 if the file does not exist.

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (::FFI::Pointer)


233
234
235
236
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 233

def self.file_modified(filename)
  result = ::CZMQ::FFI.zsys_file_modified(filename)
  result
end

.file_stable(filename) ⇒ Boolean

Check if file is ‘stable’

Parameters:

  • filename (String, #to_s, nil)

Returns:

  • (Boolean)


262
263
264
265
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 262

def self.file_stable(filename)
  result = ::CZMQ::FFI.zsys_file_stable(filename)
  result
end

.file_stable_age_msec::FFI::Pointer

Return current threshold value of file stable age in msec. This can be used in code that chooses to wait for this timeout before testing if a filesystem object is “stable” or not.

Returns:

  • (::FFI::Pointer)


667
668
669
670
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 667

def self.file_stable_age_msec()
  result = ::CZMQ::FFI.zsys_file_stable_age_msec()
  result
end

.handler_fnObject

Note:

WARNING: If your Ruby code doesn’t retain a reference to the FFI::Function object after passing it to a C function call, it may be garbage collected while C still holds the pointer, potentially resulting in a segmentation fault.

Create a new callback of the following type: Callback for interrupt signal handler

typedef void (zsys_handler_fn) (
    int signal_value);


84
85
86
87
88
89
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 84

def self.handler_fn
  ::FFI::Function.new :void, [:int], blocking: true do |signal_value|
    result = yield signal_value
    result
  end
end

.handler_resetvoid

This method returns an undefined value.

Reset interrupt handler, call this at exit if needed



184
185
186
187
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 184

def self.handler_reset()
  result = ::CZMQ::FFI.zsys_handler_reset()
  result
end

.handler_set(handler_fn) ⇒ void

This method returns an undefined value.

Set interrupt handler; this saves the default handlers so that a zsys_handler_reset () can restore them. If you call this multiple times then the last handler will take affect. If handler_fn is NULL, disables default SIGINT/SIGTERM handling in CZMQ.

Parameters:

  • handler_fn (::FFI::Pointer, #to_ptr)


176
177
178
179
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 176

def self.handler_set(handler_fn)
  result = ::CZMQ::FFI.zsys_handler_set(handler_fn)
  result
end

.has_curveBoolean

Returns true if the underlying libzmq supports CURVE security. Uses a heuristic probe according to the version of libzmq being used.

Returns:

  • (Boolean)


475
476
477
478
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 475

def self.has_curve()
  result = ::CZMQ::FFI.zsys_has_curve()
  result
end

.hostname::FFI::Pointer

Return current host name, for use in public tcp:// endpoints. Caller gets a freshly allocated string, should free it using zstr_free(). If the host name is not resolvable, returns NULL.

Returns:

  • (::FFI::Pointer)


438
439
440
441
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 438

def self.hostname()
  result = ::CZMQ::FFI.zsys_hostname()
  result
end

.info(format, *args) ⇒ void

This method returns an undefined value.

Log informational message - low priority

Parameters:



1042
1043
1044
1045
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1042

def self.info(format, *args)
  result = ::CZMQ::FFI.zsys_info(format, *args)
  result
end

.init::FFI::Pointer

Initialize CZMQ zsys layer; this happens automatically when you create a socket or an actor; however this call lets you force initialization earlier, so e.g. logging is properly set-up before you start working. Not threadsafe, so call only from main thread. Safe to call multiple times. Returns global CZMQ context.

Returns:

  • (::FFI::Pointer)


98
99
100
101
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 98

def self.init()
  result = ::CZMQ::FFI.zsys_init()
  result
end

.interfaceString

Return network interface to use for broadcasts, or “” if none was set.

Returns:

  • (String)


786
787
788
789
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 786

def self.interface()
  result = ::CZMQ::FFI.zsys_interface()
  result
end

.ipv4_mcast_addressString

Return IPv4 multicast address to use for sending zbeacon, or NULL if none was set.

Returns:

  • (String)


849
850
851
852
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 849

def self.ipv4_mcast_address()
  result = ::CZMQ::FFI.zsys_ipv4_mcast_address()
  result
end

.ipv6Integer

Return use of IPv6 for zsock instances.

Returns:

  • (Integer)


754
755
756
757
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 754

def self.ipv6()
  result = ::CZMQ::FFI.zsys_ipv6()
  result
end

.ipv6_addressString

Return IPv6 address to use for zbeacon reception, or “” if none was set.

Returns:

  • (String)


806
807
808
809
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 806

def self.ipv6_address()
  result = ::CZMQ::FFI.zsys_ipv6_address()
  result
end

.ipv6_availableBoolean

Test if ipv6 is available on the system. Return true if available. The only way to reliably check is to actually open a socket and try to bind it. (ported from libzmq)

Returns:

  • (Boolean)


764
765
766
767
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 764

def self.ipv6_available()
  result = ::CZMQ::FFI.zsys_ipv6_available()
  result
end

.ipv6_mcast_addressString

Return IPv6 multicast address to use for sending zbeacon, or “” if none was set.

Returns:

  • (String)


827
828
829
830
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 827

def self.ipv6_mcast_address()
  result = ::CZMQ::FFI.zsys_ipv6_mcast_address()
  result
end

.is_interruptedBoolean

Check if default interrupt handler of Ctrl-C or SIGTERM was called. Does not work if ZSYS_SIGHANDLER is false and code does not call set interrupted on signal.

Returns:

  • (Boolean)


205
206
207
208
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 205

def self.is_interrupted()
  result = ::CZMQ::FFI.zsys_is_interrupted()
  result
end

.max_msgszInteger

Return maximum message size.

Returns:

  • (Integer)


624
625
626
627
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 624

def self.max_msgsz()
  result = ::CZMQ::FFI.zsys_max_msgsz()
  result
end

.mcast_ttlInteger

Get multicast TTL

Returns:

  • (Integer)


867
868
869
870
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 867

def self.mcast_ttl()
  result = ::CZMQ::FFI.zsys_mcast_ttl()
  result
end

.notice(format, *args) ⇒ void

This method returns an undefined value.

Log normal, but significant, condition - normal priority

Parameters:



1032
1033
1034
1035
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1032

def self.notice(format, *args)
  result = ::CZMQ::FFI.zsys_notice(format, *args)
  result
end

.pipehwmInteger

Return the HWM for zactor internal pipes.

Returns:

  • (Integer)


731
732
733
734
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 731

def self.pipehwm()
  result = ::CZMQ::FFI.zsys_pipehwm()
  result
end

.run_as(lockfile, group, user) ⇒ Integer

Drop the process ID into the lockfile, with exclusive lock, and switch the process to the specified group and/or user. Any of the arguments may be null, indicating a no-op. Returns 0 on success, -1 on failure. Note if you combine this with zsys_daemonize, run after, not before that method, or the lockfile will hold the wrong process ID.

Parameters:

  • lockfile (String, #to_s, nil)
  • group (String, #to_s, nil)
  • user (String, #to_s, nil)

Returns:

  • (Integer)


466
467
468
469
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 466

def self.run_as(lockfile, group, user)
  result = ::CZMQ::FFI.zsys_run_as(lockfile, group, user)
  result
end

.set_auto_use_fd(auto_use_fd) ⇒ void

This method returns an undefined value.

Configure the automatic use of pre-allocated FDs when creating new sockets. If 0 (default), nothing will happen. Else, when a new socket is bound, the system API will be used to check if an existing pre-allocated FD with a matching port (if TCP) or path (if IPC) exists, and if it does it will be set via the ZMQ_USE_FD socket option so that the library will use it instead of creating a new socket.

Parameters:

  • auto_use_fd (Integer, #to_int, #to_i)


881
882
883
884
885
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 881

def self.set_auto_use_fd(auto_use_fd)
  auto_use_fd = Integer(auto_use_fd)
  result = ::CZMQ::FFI.zsys_set_auto_use_fd(auto_use_fd)
  result
end

.set_file_stable_age_msec(file_stable_age_msec) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • file_stable_age_msec (::FFI::Pointer, #to_ptr)


657
658
659
660
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 657

def self.set_file_stable_age_msec(file_stable_age_msec)
  result = ::CZMQ::FFI.zsys_set_file_stable_age_msec(file_stable_age_msec)
  result
end

.set_interface(value) ⇒ void

This method returns an undefined value.

Set network interface name to use for broadcasts, particularly zbeacon. This lets the interface be configured for test environments where required. For example, on Mac OS X, zbeacon cannot bind to 255.255.255.255 which is the default when there is no specified interface. If the environment variable ZSYS_INTERFACE is set, use that as the default interface name. Setting the interface to “*” means “use all available interfaces”.

Parameters:

  • value (String, #to_s, nil)


778
779
780
781
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 778

def self.set_interface(value)
  result = ::CZMQ::FFI.zsys_set_interface(value)
  result
end

.set_interruptedvoid

This method returns an undefined value.

Set interrupted flag. This is done by default signal handler, however this can be handy for language bindings or cases without default signal handler.



215
216
217
218
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 215

def self.set_interrupted()
  result = ::CZMQ::FFI.zsys_set_interrupted()
  result
end

.set_io_threads(io_threads) ⇒ void

This method returns an undefined value.

Configure the number of I/O threads that ZeroMQ will use. A good rule of thumb is one thread per gigabit of traffic in or out. The default is 1, sufficient for most applications. If the environment variable ZSYS_IO_THREADS is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • io_threads (Integer, #to_int, #to_i)


488
489
490
491
492
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 488

def self.set_io_threads(io_threads)
  io_threads = Integer(io_threads)
  result = ::CZMQ::FFI.zsys_set_io_threads(io_threads)
  result
end

.set_ipv4_mcast_address(value) ⇒ void

This method returns an undefined value.

Set IPv4 multicast address to use for sending zbeacon messages. By default IPv4 multicast is NOT used. If the environment variable ZSYS_IPV4_MCAST_ADDRESS is set, use that as the default IPv4 multicast address. Calling this function or setting ZSYS_IPV4_MCAST_ADDRESS will enable IPv4 zbeacon messages.

Parameters:

  • value (String, #to_s, nil)


840
841
842
843
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 840

def self.set_ipv4_mcast_address(value)
  result = ::CZMQ::FFI.zsys_set_ipv4_mcast_address(value)
  result
end

.set_ipv6(ipv6) ⇒ void

This method returns an undefined value.

Configure use of IPv6 for new zsock instances. By default sockets accept and make only IPv4 connections. When you enable IPv6, sockets will accept and connect to both IPv4 and IPv6 peers. You can override the setting on each zsock_t instance. The default is IPv4 only (ipv6 set to 0). If the environment variable ZSYS_IPV6 is defined (as 1 or 0), this provides the default. Note: has no effect on ZMQ v2.

Parameters:

  • ipv6 (Integer, #to_int, #to_i)


745
746
747
748
749
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 745

def self.set_ipv6(ipv6)
  ipv6 = Integer(ipv6)
  result = ::CZMQ::FFI.zsys_set_ipv6(ipv6)
  result
end

.set_ipv6_address(value) ⇒ void

This method returns an undefined value.

Set IPv6 address to use zbeacon socket, particularly for receiving zbeacon. This needs to be set IPv6 is enabled as IPv6 can have multiple addresses on a given interface. If the environment variable ZSYS_IPV6_ADDRESS is set, use that as the default IPv6 address.

Parameters:

  • value (String, #to_s, nil)


798
799
800
801
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 798

def self.set_ipv6_address(value)
  result = ::CZMQ::FFI.zsys_set_ipv6_address(value)
  result
end

.set_ipv6_mcast_address(value) ⇒ void

This method returns an undefined value.

Set IPv6 milticast address to use for sending zbeacon messages. This needs to be set if IPv6 is enabled. If the environment variable ZSYS_IPV6_MCAST_ADDRESS is set, use that as the default IPv6 multicast address.

Parameters:

  • value (String, #to_s, nil)


818
819
820
821
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 818

def self.set_ipv6_mcast_address(value)
  result = ::CZMQ::FFI.zsys_set_ipv6_mcast_address(value)
  result
end

.set_linger(linger) ⇒ void

This method returns an undefined value.

Configure the default linger timeout in msecs for new zsock instances. You can also set this separately on each zsock_t instance. The default linger time is zero, i.e. any pending messages will be dropped. If the environment variable ZSYS_LINGER is defined, that provides the default. Note that process exit will typically be delayed by the linger time.

Parameters:

  • linger (Integer, #to_int, #to_i)


680
681
682
683
684
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 680

def self.set_linger(linger)
  linger = Integer(linger)
  result = ::CZMQ::FFI.zsys_set_linger(linger)
  result
end

.set_logident(value) ⇒ void

This method returns an undefined value.

Set log identity, which is a string that prefixes all log messages sent by this process. The log identity defaults to the environment variable ZSYS_LOGIDENT, if that is set.

Parameters:

  • value (String, #to_s, nil)


965
966
967
968
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 965

def self.set_logident(value)
  result = ::CZMQ::FFI.zsys_set_logident(value)
  result
end

.set_logsender(endpoint) ⇒ void

This method returns an undefined value.

Sends log output to a PUB socket bound to the specified endpoint. To collect such log output, create a SUB socket, subscribe to the traffic you care about, and connect to the endpoint. Log traffic is sent as a single string frame, in the same format as when sent to stdout. The log system supports a single sender; multiple calls to this method will bind the same sender to multiple endpoints. To disable the sender, call this method with a null argument.

Parameters:

  • endpoint (String, #to_s, nil)


991
992
993
994
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 991

def self.set_logsender(endpoint)
  result = ::CZMQ::FFI.zsys_set_logsender(endpoint)
  result
end

.set_logstream(stream) ⇒ void

This method returns an undefined value.

Set stream to receive log traffic. By default, log traffic is sent to stdout. If you set the stream to NULL, no stream will receive the log traffic (it may still be sent to the system facility).

Parameters:

  • stream (::FFI::Pointer, #to_ptr)


976
977
978
979
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 976

def self.set_logstream(stream)
  result = ::CZMQ::FFI.zsys_set_logstream(stream)
  result
end

.set_logsystem(logsystem) ⇒ void

This method returns an undefined value.

Enable or disable logging to the system facility (syslog on POSIX boxes, event log on Windows). By default this is disabled.

Parameters:

  • logsystem (Boolean)


1001
1002
1003
1004
1005
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1001

def self.set_logsystem(logsystem)
  logsystem = !(0==logsystem||!logsystem) # boolean
  result = ::CZMQ::FFI.zsys_set_logsystem(logsystem)
  result
end

.set_max_msgsz(max_msgsz) ⇒ void

This method returns an undefined value.

Configure the maximum allowed size of a message sent. The default is INT_MAX.

Parameters:

  • max_msgsz (Integer, #to_int, #to_i)


615
616
617
618
619
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 615

def self.set_max_msgsz(max_msgsz)
  max_msgsz = Integer(max_msgsz)
  result = ::CZMQ::FFI.zsys_set_max_msgsz(max_msgsz)
  result
end

.set_max_sockets(max_sockets) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • max_sockets (Integer, #to_int, #to_i)


596
597
598
599
600
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 596

def self.set_max_sockets(max_sockets)
  max_sockets = Integer(max_sockets)
  result = ::CZMQ::FFI.zsys_set_max_sockets(max_sockets)
  result
end

.set_mcast_ttl(value) ⇒ void

This method returns an undefined value.

Set multicast TTL default is 1

Parameters:

  • value (Integer, #to_int, #to_i)


858
859
860
861
862
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 858

def self.set_mcast_ttl(value)
  value = Integer(value)
  result = ::CZMQ::FFI.zsys_set_mcast_ttl(value)
  result
end

.set_pipehwm(pipehwm) ⇒ void

This method returns an undefined value.

Configure the default HWM for zactor internal pipes; this is set on both ends of the pipe, for outgoing messages only (sndhwm). The default HWM is 1,000, on all versions of ZeroMQ. If the environment var ZSYS_ACTORHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • pipehwm (Integer, #to_int, #to_i)


722
723
724
725
726
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 722

def self.set_pipehwm(pipehwm)
  pipehwm = Integer(pipehwm)
  result = ::CZMQ::FFI.zsys_set_pipehwm(pipehwm)
  result
end

.set_rcvhwm(rcvhwm) ⇒ void

This method returns an undefined value.

Configure the default incoming pipe limit (HWM) for new zsock instances. You can also set this separately on each zsock_t instance. The default HWM is 1,000, on all versions of ZeroMQ. If the environment variable ZSYS_RCVHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • rcvhwm (Integer, #to_int, #to_i)


708
709
710
711
712
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 708

def self.set_rcvhwm(rcvhwm)
  rcvhwm = Integer(rcvhwm)
  result = ::CZMQ::FFI.zsys_set_rcvhwm(rcvhwm)
  result
end

.set_sndhwm(sndhwm) ⇒ void

This method returns an undefined value.

Configure the default outgoing pipe limit (HWM) for new zsock instances. You can also set this separately on each zsock_t instance. The default HWM is 1,000, on all versions of ZeroMQ. If the environment variable ZSYS_SNDHWM is defined, that provides the default. Note that a value of zero means no limit, i.e. infinite memory consumption.

Parameters:

  • sndhwm (Integer, #to_int, #to_i)


694
695
696
697
698
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 694

def self.set_sndhwm(sndhwm)
  sndhwm = Integer(sndhwm)
  result = ::CZMQ::FFI.zsys_set_sndhwm(sndhwm)
  result
end

.set_thread_name_prefix(prefix) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • prefix (Integer, #to_int, #to_i)


530
531
532
533
534
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 530

def self.set_thread_name_prefix(prefix)
  prefix = Integer(prefix)
  result = ::CZMQ::FFI.zsys_set_thread_name_prefix(prefix)
  result
end

.set_thread_name_prefix_str(prefix) ⇒ void

This method returns an undefined value.

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_STR is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • prefix (String, #to_s, nil)


552
553
554
555
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 552

def self.set_thread_name_prefix_str(prefix)
  result = ::CZMQ::FFI.zsys_set_thread_name_prefix_str(prefix)
  result
end

.set_thread_priority(priority) ⇒ void

This method returns an undefined value.

Configure the scheduling priority of the ZMQ context thread pool. Not available on Windows. See the sched_setscheduler man page or sched.h for more information. If the environment variable ZSYS_THREAD_PRIORITY is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • priority (Integer, #to_int, #to_i)


516
517
518
519
520
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 516

def self.set_thread_priority(priority)
  priority = Integer(priority)
  result = ::CZMQ::FFI.zsys_set_thread_priority(priority)
  result
end

.set_thread_sched_policy(policy) ⇒ void

This method returns an undefined value.

Configure the scheduling policy of the ZMQ context thread pool. Not available on Windows. See the sched_setscheduler man page or sched.h for more information. If the environment variable ZSYS_THREAD_SCHED_POLICY is defined, that provides the default. Note that this method is valid only before any socket is created.

Parameters:

  • policy (Integer, #to_int, #to_i)


502
503
504
505
506
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 502

def self.set_thread_sched_policy(policy)
  policy = Integer(policy)
  result = ::CZMQ::FFI.zsys_set_thread_sched_policy(policy)
  result
end

.set_zero_copy_recv(zero_copy) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • zero_copy (Integer, #to_int, #to_i)


635
636
637
638
639
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 635

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

.shutdownvoid

This method returns an undefined value.

Optionally shut down the CZMQ zsys layer; this normally happens automatically when the process exits; however this call lets you force a shutdown earlier, avoiding any potential problems with atexit() ordering, especially with Windows dlls.



109
110
111
112
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 109

def self.shutdown()
  result = ::CZMQ::FFI.zsys_shutdown()
  result
end

.socket(type, filename, line_nbr) ⇒ ::FFI::Pointer

Get a new ZMQ socket, automagically creating a ZMQ context if this is the first time. Caller is responsible for destroying the ZMQ socket before process exits, to avoid a ZMQ deadlock. Note: you should not use this method in CZMQ apps, use zsock_new() instead. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • type (Integer, #to_int, #to_i)
  • filename (String, #to_s, nil)
  • line_nbr (Integer, #to_int, #to_i)

Returns:

  • (::FFI::Pointer)


124
125
126
127
128
129
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 124

def self.socket(type, filename, line_nbr)
  type = Integer(type)
  line_nbr = Integer(line_nbr)
  result = ::CZMQ::FFI.zsys_socket(type, filename, line_nbr)
  result
end

.socket_error(reason) ⇒ void

This method returns an undefined value.

Handle an I/O error on some socket operation; will report and die on fatal errors, and continue silently on “try again” errors. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • reason (String, #to_s, nil)


428
429
430
431
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 428

def self.socket_error(reason)
  result = ::CZMQ::FFI.zsys_socket_error(reason)
  result
end

.socket_limitInteger

Return maximum number of ZeroMQ sockets that the system will support.

Returns:

  • (Integer)


605
606
607
608
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 605

def self.socket_limit()
  result = ::CZMQ::FFI.zsys_socket_limit()
  result
end

.sockname(socktype) ⇒ ::FFI::Pointer

Return ZMQ socket name for socket type *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • socktype (Integer, #to_int, #to_i)

Returns:

  • (::FFI::Pointer)


150
151
152
153
154
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 150

def self.sockname(socktype)
  socktype = Integer(socktype)
  result = ::CZMQ::FFI.zsys_sockname(socktype)
  result
end

.sprintf(format, *args) ⇒ ::FFI::Pointer

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().

Parameters:

Returns:

  • (::FFI::Pointer)


350
351
352
353
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 350

def self.sprintf(format, *args)
  result = ::CZMQ::FFI.zsys_sprintf(format, *args)
  result
end

.sprintf_hint(hint, format, *args) ⇒ ::FFI::Pointer

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 one to optimize by using a larger starting buffer size (known to/assumed by the developer) and so avoid reallocations.

Parameters:

Returns:

  • (::FFI::Pointer)


337
338
339
340
341
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 337

def self.sprintf_hint(hint, format, *args)
  hint = Integer(hint)
  result = ::CZMQ::FFI.zsys_sprintf_hint(hint, format, *args)
  result
end

.test(verbose) ⇒ void

This method returns an undefined value.

Self test of this class.

Parameters:

  • verbose (Boolean)


1061
1062
1063
1064
1065
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1061

def self.test(verbose)
  verbose = !(0==verbose||!verbose) # boolean
  result = ::CZMQ::FFI.zsys_test(verbose)
  result
end

.thread_affinity_cpu_add(cpu) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • cpu (Integer, #to_int, #to_i)


571
572
573
574
575
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 571

def self.thread_affinity_cpu_add(cpu)
  cpu = Integer(cpu)
  result = ::CZMQ::FFI.zsys_thread_affinity_cpu_add(cpu)
  result
end

.thread_affinity_cpu_remove(cpu) ⇒ void

This method returns an undefined value.

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.

Parameters:

  • cpu (Integer, #to_int, #to_i)


583
584
585
586
587
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 583

def self.thread_affinity_cpu_remove(cpu)
  cpu = Integer(cpu)
  result = ::CZMQ::FFI.zsys_thread_affinity_cpu_remove(cpu)
  result
end

.thread_name_prefixInteger

Return thread name prefix.

Returns:

  • (Integer)


539
540
541
542
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 539

def self.thread_name_prefix()
  result = ::CZMQ::FFI.zsys_thread_name_prefix()
  result
end

.thread_name_prefix_strString

Return thread name prefix.

Returns:

  • (String)


560
561
562
563
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 560

def self.thread_name_prefix_str()
  result = ::CZMQ::FFI.zsys_thread_name_prefix_str()
  result
end

.udp_close(handle) ⇒ Integer

Close a UDP socket *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • handle (Integer or FFI::Pointer)

Returns:

  • (Integer)


385
386
387
388
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 385

def self.udp_close(handle)
  result = ::CZMQ::FFI.zsys_udp_close(handle)
  result
end

.udp_new(routable) ⇒ Integer or FFI::Pointer

Create UDP beacon socket; if the routable option is true, uses multicast (not yet implemented), else uses broadcast. This method and related ones might eventually be moved to a zudp class. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • routable (Boolean)

Returns:

  • (Integer or FFI::Pointer)


374
375
376
377
378
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 374

def self.udp_new(routable)
  routable = !(0==routable||!routable) # boolean
  result = ::CZMQ::FFI.zsys_udp_new(routable)
  result
end

.udp_recv(udpsock, peername, peerlen) ⇒ Zframe

Receive zframe from UDP socket, and set address of peer that sent it The peername must be a char [INET_ADDRSTRLEN] array if IPv6 is disabled or NI_MAXHOST if it’s enabled. Returns NULL when failing to get peer address. *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • udpsock (Integer or FFI::Pointer)
  • peername (::FFI::Pointer, #to_ptr)
  • peerlen (Integer, #to_int, #to_i)

Returns:



415
416
417
418
419
420
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 415

def self.udp_recv(udpsock, peername, peerlen)
  peerlen = Integer(peerlen)
  result = ::CZMQ::FFI.zsys_udp_recv(udpsock, peername, peerlen)
  result = Zframe.__new result, false
  result
end

.udp_send(udpsock, frame, address, addrlen) ⇒ Integer

Send zframe to UDP socket, return -1 if sending failed due to interface having disappeared (happens easily with WiFi) *** This is for CZMQ internal use only and may change arbitrarily ***

Parameters:

  • udpsock (Integer or FFI::Pointer)
  • frame (Zframe, #__ptr)
  • address (::FFI::Pointer, #to_ptr)
  • addrlen (Integer, #to_int, #to_i)

Returns:

  • (Integer)


399
400
401
402
403
404
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 399

def self.udp_send(udpsock, frame, address, addrlen)
  frame = frame.__ptr if frame
  addrlen = Integer(addrlen)
  result = ::CZMQ::FFI.zsys_udp_send(udpsock, frame, address, addrlen)
  result
end

.version(major, minor, patch) ⇒ void

This method returns an undefined value.

Return the CZMQ version for run-time API detection; returns version number into provided fields, providing reference isn’t null in each case.

Parameters:

  • major (::FFI::Pointer, #to_ptr)
  • minor (::FFI::Pointer, #to_ptr)
  • patch (::FFI::Pointer, #to_ptr)


322
323
324
325
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 322

def self.version(major, minor, patch)
  result = ::CZMQ::FFI.zsys_version(major, minor, patch)
  result
end

.vprintf(format, argptr) ⇒ ::FFI::Pointer

Format a string with a va_list argument, returning a freshly allocated buffer. If there was insufficient memory, returns NULL. Free the returned string using zstr_free().

Parameters:

  • format (String, #to_s, nil)
  • argptr (::FFI::Pointer, #to_ptr)

Returns:

  • (::FFI::Pointer)


362
363
364
365
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 362

def self.vprintf(format, argptr)
  result = ::CZMQ::FFI.zsys_vprintf(format, argptr)
  result
end

.warning(format, *args) ⇒ void

This method returns an undefined value.

Log warning condition - high priority

Parameters:



1022
1023
1024
1025
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 1022

def self.warning(format, *args)
  result = ::CZMQ::FFI.zsys_warning(format, *args)
  result
end

.zero_copy_recvInteger

Return ZMQ_ZERO_COPY_RECV option.

Returns:

  • (Integer)


644
645
646
647
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 644

def self.zero_copy_recv()
  result = ::CZMQ::FFI.zsys_zero_copy_recv()
  result
end

.zplprintf(format, args) ⇒ ::FFI::AutoPointer

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

Parameters:

Returns:

  • (::FFI::AutoPointer)


940
941
942
943
944
945
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 940

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

.zplprintf_error(format, args) ⇒ ::FFI::AutoPointer

Return error string for given format/args combination.

Parameters:

Returns:

  • (::FFI::AutoPointer)


952
953
954
955
956
957
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 952

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

.zprintf(format, args) ⇒ ::FFI::AutoPointer

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

Parameters:

  • format (String, #to_s, nil)
  • args (Zhash, #__ptr)

Returns:

  • (::FFI::AutoPointer)


908
909
910
911
912
913
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 908

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

.zprintf_error(format, args) ⇒ ::FFI::AutoPointer

Return error string for given format/args combination.

Parameters:

  • format (String, #to_s, nil)
  • args (Zhash, #__ptr)

Returns:

  • (::FFI::AutoPointer)


920
921
922
923
924
925
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 920

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

Instance Method Details

#__ptr::FFI::Pointer Also known as: to_ptr

Return internal pointer

Returns:

  • (::FFI::Pointer)

Raises:



47
48
49
50
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 47

def __ptr
  raise DestroyedError unless @ptr
  @ptr
end

#__ptr_give_ref::FFI::MemoryPointer

Note:

This detaches the current instance from the native object and thus makes it unusable.

Nullify internal pointer and return pointer pointer.

Returns:

  • (::FFI::MemoryPointer)

    the pointer pointing to a pointer pointing to the native object

Raises:



58
59
60
61
62
63
64
65
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 58

def __ptr_give_ref
  raise DestroyedError unless @ptr
  ptr_ptr = ::FFI::MemoryPointer.new :pointer
  ptr_ptr.write_pointer @ptr
  __undef_finalizer if @finalizer
  @ptr = nil
  ptr_ptr
end

#__undef_finalizervoid

Note:

Only use this if you need to and can guarantee that the native object will be freed by other means.

This method returns an undefined value.

Undefines the finalizer for this object.



70
71
72
73
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 70

def __undef_finalizer
  ObjectSpace.undefine_finalizer self
  @finalizer = nil
end

#null?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/czmq-ffi-gen/czmq/ffi/zsys.rb', line 42

def null?
  !@ptr or @ptr.null?
end