# std/kqueue

Dark Mode

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

# Imports

posix

# Types

    KEvent {.importc: "struct kevent", header: """#include <sys/types.h>
                           #include <sys/event.h>
                           #include <sys/time.h>""",
             pure, final.} = object
      ident*: uint               ## identifier for this event  (uintptr_t)
      filter*: cshort            ## filter for event
      flags*: cushort            ## general flags
      fflags*: cuint             ## filter-specific flags
      data*: int                 ## filter-specific data  (intptr_t)
      udata*: pointer            ## opaque user data identifier

  Source Edit

# Consts

    EV_ADD = 0x00000001

  Add event to queue (implies enable). Re-adding an existing element modifies it. Source Edit

    EV_CLEAR = 0x00000020

  Clear event state after reporting. Source Edit

    EV_DELETE = 0x00000002

  Delete event from queue. Source Edit

    EV_DISABLE = 0x00000008

  Disable event (not reported). Source Edit

    EV_DISPATCH = 0x00000080

  Disable event after reporting. Source Edit

    EV_DROP = 0x00001000

  Not should be dropped Source Edit

    EV_ENABLE = 0x00000004

  Enable event. Source Edit

    EV_EOF = 0x00008000

  EOF detected Source Edit

    EV_ERROR = 0x00004000

  Error, data contains errno Source Edit

    EV_FLAG1 = 0x00002000

  Filter-specific flag Source Edit

    EV_NODATA = 0x00001000

  EOF and no more data Source Edit

    EV_ONESHOT = 0x00000010

  Only report one occurrence. Source Edit

    EV_RECEIPT = 0x00000040

  Force EV_ERROR on success, data == 0 Source Edit

    EV_SYSFLAGS = 0x0000F000

  Reserved by system Source Edit

    NOTE_ATTRIB = 0x00000008

  attributes changed Source Edit

    NOTE_CHILD = 0x00000004'u32

  am a child process Source Edit

    NOTE_DELETE = 0x00000001

  vnode was removed Source Edit

    NOTE_EXEC = 0x20000000'u32

  process exec'd Source Edit

    NOTE_EXIT = 0x80000000'u32

  process exited Source Edit

    NOTE_EXTEND = 0x00000004

  size increased Source Edit

    NOTE_FORK = 0x40000000'u32

  process forked Source Edit

    NOTE_LINK = 0x00000010

  link count changed Source Edit

    NOTE_LOWAT = 0x00000001

  low water mark Source Edit

    NOTE_MSECONDS = 0x00000000'u32

  Source Edit

    NOTE_PCTRLMASK = 0xF0000000'u32

  mask for hint bits Source Edit

    NOTE_PDATAMASK = 0x000FFFFF'u32

  mask for pid Source Edit

    NOTE_RENAME = 0x00000020

  vnode was renamed Source Edit

    NOTE_REVOKE = 0x00000040

  vnode access was revoked Source Edit

    NOTE_TRACK = 0x00000001'u32

  follow across forks Source Edit

    NOTE_TRACKERR = 0x00000002'u32

  could not track child Source Edit

    NOTE_WRITE = 0x00000002

  data contents changed Source Edit

# Procs

    proc EV_SET(event: ptr KEvent; ident: uint; filter: cshort; flags: cushort;
                fflags: cuint; data: int; udata: pointer) {.importc: "EV_SET",
        header: "<sys/event.h>", ...raises: [], tags: [].}

  Fills event with given data. Source Edit

    proc kevent(kqFD: cint; changelist: ptr KEvent; nchanges: cint;
                eventlist: ptr KEvent; nevents: cint; timeout: ptr Timespec): cint {.
        importc: "kevent", header: "<sys/event.h>", ...raises: [], tags: [].}

  Manipulates queue for given `kqFD` descriptor. Source Edit

    proc kqueue(): cint {.importc: "kqueue", header: "<sys/event.h>", ...raises: [],
                          tags: [].}

  Creates new queue and returns its descriptor. Source Edit