Home / File/ KQueueEventArray.java — netty Source File

KQueueEventArray.java — netty Source File

Architecture documentation for KQueueEventArray.java, a java file in the netty codebase.

File java Buffer Search 1 classes

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2016 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.channel.kqueue;

import io.netty.channel.unix.Buffer;
import io.netty.util.internal.CleanableDirectBuffer;
import io.netty.util.internal.PlatformDependent;

import java.nio.ByteBuffer;

/**
 * Represents an array of kevent structures, backed by offheap memory.
 *
 * <pre>
 * struct kevent {
 *  uintptr_t ident;
 *  short     keventFilter;
 *  u_short   flags;
 *  u_int     fflags;
 *  intptr_t  data;
 *  void      *udata;
 * };
 * </pre>
 */
final class KQueueEventArray {
    private static final int KQUEUE_EVENT_SIZE = Native.sizeofKEvent();
    private static final int KQUEUE_IDENT_OFFSET = Native.offsetofKEventIdent();
    private static final int KQUEUE_FILTER_OFFSET = Native.offsetofKEventFilter();
    private static final int KQUEUE_FFLAGS_OFFSET = Native.offsetofKEventFFlags();
    private static final int KQUEUE_FLAGS_OFFSET = Native.offsetofKEventFlags();
    private static final int KQUEUE_DATA_OFFSET = Native.offsetofKeventData();
    private static final int KQUEUE_UDATA_OFFSET = Native.offsetofKeventUdata();

    private CleanableDirectBuffer memoryCleanable;
    private ByteBuffer memory;
    private long memoryAddress;
    private int size;
    private int capacity;

    KQueueEventArray(int capacity) {
        if (capacity < 1) {
            throw new IllegalArgumentException("capacity must be >= 1 but was " + capacity);
        }
        memoryCleanable = Buffer.allocateDirectBufferWithNativeOrder(calculateBufferCapacity(capacity));
        memory = memoryCleanable.buffer();
        memoryAddress = Buffer.memoryAddress(memory);
        this.capacity = capacity;
// ... (131 more lines)

Domain

Subdomains

Frequently Asked Questions

What does KQueueEventArray.java do?
KQueueEventArray.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Search subdomain.
Where is KQueueEventArray.java in the architecture?
KQueueEventArray.java is located at transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/KQueueEventArray.java (domain: Buffer, subdomain: Search, directory: transport-classes-kqueue/src/main/java/io/netty/channel/kqueue).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free