Home / File/ netty_unix.c — netty Source File

netty_unix.c — netty Source File

Architecture documentation for netty_unix.c, a c file in the netty codebase. 8 imports, 0 dependents.

File c NativeTransport 8 imports

Entity Profile

Dependency Diagram

graph LR
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf["netty_unix.c"]
  a7d65015_0594_5090_5390_74fe05dfdd3e["netty_unix_jni.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> a7d65015_0594_5090_5390_74fe05dfdd3e
  b2ad96e4_1617_c833_41aa_e18a58968b0f["netty_unix.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> b2ad96e4_1617_c833_41aa_e18a58968b0f
  318c55be_179c_d036_70d8_23ee244d3c83["netty_unix_buffer.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> 318c55be_179c_d036_70d8_23ee244d3c83
  a4533dad_6113_0c5b_b279_28eaf7391fc5["netty_unix_errors.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> a4533dad_6113_0c5b_b279_28eaf7391fc5
  469adda3_4d23_dbb4_d12b_7439f748d1fd["netty_unix_filedescriptor.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> 469adda3_4d23_dbb4_d12b_7439f748d1fd
  a664bf82_f13a_984a_5945_1d9b70e3f74c["netty_unix_limits.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> a664bf82_f13a_984a_5945_1d9b70e3f74c
  ab04c67a_6048_b528_995a_66f7103f89d2["netty_unix_socket.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> ab04c67a_6048_b528_995a_66f7103f89d2
  e811edce_3305_6244_830c_daac1b109259["netty_unix_util.h"]
  b460dd0c_7b1f_bf55_7d35_099b60c3ebbf --> e811edce_3305_6244_830c_daac1b109259
  style b460dd0c_7b1f_bf55_7d35_099b60c3ebbf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/*
 * Copyright 2020 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.
 */
#include "netty_unix_jni.h"
#include "netty_unix.h"
#include "netty_unix_buffer.h"
#include "netty_unix_errors.h"
#include "netty_unix_filedescriptor.h"
#include "netty_unix_limits.h"
#include "netty_unix_socket.h"
#include "netty_unix_util.h"

// IMPORTANT: If you add any NETTY_JNI_UTIL_LOAD_CLASS or NETTY_JNI_UTIL_FIND_CLASS calls you also need to update
//            Unix to reflect that.
jint netty_unix_register(JNIEnv* env, const char* packagePrefix) {
    int limitsOnLoadCalled = 0;
    int errorsOnLoadCalled = 0;
    int filedescriptorOnLoadCalled = 0;
    int socketOnLoadCalled = 0;
    int bufferOnLoadCalled = 0;

    // Load all c modules that we depend upon
    if (netty_unix_limits_JNI_OnLoad(env, packagePrefix) == JNI_ERR) {
        goto error;
    }
    limitsOnLoadCalled = 1;

    if (netty_unix_errors_JNI_OnLoad(env, packagePrefix) == JNI_ERR) {
        goto error;
    }
    errorsOnLoadCalled = 1;

    if (netty_unix_filedescriptor_JNI_OnLoad(env, packagePrefix) == JNI_ERR) {
        goto error;
    }
    filedescriptorOnLoadCalled = 1;

    if (netty_unix_socket_JNI_OnLoad(env, packagePrefix) == JNI_ERR) {
        goto error;
    }
    socketOnLoadCalled = 1;

    if (netty_unix_buffer_JNI_OnLoad(env, packagePrefix) == JNI_ERR) {
        goto error;
    }
    bufferOnLoadCalled = 1;

    return NETTY_JNI_UTIL_JNI_VERSION;
error:
   if (limitsOnLoadCalled == 1) {
       netty_unix_limits_JNI_OnUnLoad(env, packagePrefix);
   }
   if (errorsOnLoadCalled == 1) {
       netty_unix_errors_JNI_OnUnLoad(env, packagePrefix);
   }
   if (filedescriptorOnLoadCalled == 1) {
       netty_unix_filedescriptor_JNI_OnUnLoad(env, packagePrefix);
   }
   if (socketOnLoadCalled == 1) {
       netty_unix_socket_JNI_OnUnLoad(env, packagePrefix);
   }
   if (bufferOnLoadCalled == 1) {
      netty_unix_buffer_JNI_OnUnLoad(env, packagePrefix);
   }
   return JNI_ERR;
}

void netty_unix_unregister(JNIEnv* env, const char* packagePrefix) {
    netty_unix_limits_JNI_OnUnLoad(env, packagePrefix);
    netty_unix_errors_JNI_OnUnLoad(env, packagePrefix);
    netty_unix_filedescriptor_JNI_OnUnLoad(env, packagePrefix);
    netty_unix_socket_JNI_OnUnLoad(env, packagePrefix);
    netty_unix_buffer_JNI_OnUnLoad(env, packagePrefix);
}

Frequently Asked Questions

What does netty_unix.c do?
netty_unix.c is a source file in the netty codebase, written in c. It belongs to the NativeTransport domain.
What does netty_unix.c depend on?
netty_unix.c imports 8 module(s): netty_unix.h, netty_unix_buffer.h, netty_unix_errors.h, netty_unix_filedescriptor.h, netty_unix_jni.h, netty_unix_limits.h, netty_unix_socket.h, netty_unix_util.h.
Where is netty_unix.c in the architecture?
netty_unix.c is located at transport-native-unix-common/src/main/c/netty_unix.c (domain: NativeTransport, directory: transport-native-unix-common/src/main/c).

Analyze Your Own Codebase

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

Try Supermodel Free