Home / File/ netty_unix_filedescriptor.c — netty Source File

netty_unix_filedescriptor.c — netty Source File

Architecture documentation for netty_unix_filedescriptor.c, a c file in the netty codebase. 12 imports, 0 dependents.

File c NativeTransport 12 imports

Entity Profile

Dependency Diagram

graph LR
  f6d32bf1_70b8_bf34_2f66_0f64bd206740["netty_unix_filedescriptor.c"]
  a4533dad_6113_0c5b_b279_28eaf7391fc5["netty_unix_errors.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> a4533dad_6113_0c5b_b279_28eaf7391fc5
  469adda3_4d23_dbb4_d12b_7439f748d1fd["netty_unix_filedescriptor.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 469adda3_4d23_dbb4_d12b_7439f748d1fd
  a7d65015_0594_5090_5390_74fe05dfdd3e["netty_unix_jni.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> a7d65015_0594_5090_5390_74fe05dfdd3e
  e811edce_3305_6244_830c_daac1b109259["netty_unix_util.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> e811edce_3305_6244_830c_daac1b109259
  89cfd132_669d_bc14_f916_80a38e3da8a5["netty_jni_util.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 89cfd132_669d_bc14_f916_80a38e3da8a5
  71c52c20_b4aa_1551_58db_42e42fa27aa6["errno.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 71c52c20_b4aa_1551_58db_42e42fa27aa6
  d74a6009_ec80_1e86_97f9_4d3451c5416a["fcntl.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> d74a6009_ec80_1e86_97f9_4d3451c5416a
  617ed4cf_d595_a5c7_1593_810f21ce0712["stdint.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 617ed4cf_d595_a5c7_1593_810f21ce0712
  d822c438_bcda_8ebc_05f9_1007c55018be["stdlib.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> d822c438_bcda_8ebc_05f9_1007c55018be
  6f8e9f3d_28f0_b3bb_e5f8_505aa6fd30ef["unistd.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 6f8e9f3d_28f0_b3bb_e5f8_505aa6fd30ef
  4094ef75_9fba_3a58_2273_1277324b0041["uio.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 4094ef75_9fba_3a58_2273_1277324b0041
  8219beeb_c6fa_4d38_8fd5_18354def785a["limits.h"]
  f6d32bf1_70b8_bf34_2f66_0f64bd206740 --> 8219beeb_c6fa_4d38_8fd5_18354def785a
  style f6d32bf1_70b8_bf34_2f66_0f64bd206740 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/*
 * Copyright 2015 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 <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/uio.h>
#include <limits.h>

#include "netty_unix_errors.h"
#include "netty_unix_filedescriptor.h"
#include "netty_unix_jni.h"
#include "netty_unix_util.h"
#include "netty_jni_util.h"

#define FILEDESCRIPTOR_CLASSNAME "io/netty/channel/unix/FileDescriptor"

static jmethodID posId = NULL;
static jmethodID limitId = NULL;
static jfieldID posFieldId = NULL;
static jfieldID limitFieldId = NULL;

// Optional external methods
extern int pipe2(int pipefd[2], int flags) __attribute__((weak)) __attribute__((weak_import));

static jint _write(JNIEnv* env, jclass clazz, jint fd, void* buffer, jint pos, jint limit) {
    ssize_t res;
    int err;
    do {
       res = write(fd, buffer + pos, (size_t) (limit - pos));
       // keep on writing if it was interrupted
    } while (res == -1 && ((err = errno) == EINTR));

    if (res < 0) {
        return -err;
    }
    return (jint) res;
}

static jlong _writev(JNIEnv* env, jclass clazz, jint fd, struct iovec* iov, jint length) {
    ssize_t res;
    int err;
    do {
        res = writev(fd, iov, length);
        // keep on writing if it was interrupted
    } while (res == -1 && ((err = errno) == EINTR));
// ... (264 more lines)

Dependencies

Frequently Asked Questions

What does netty_unix_filedescriptor.c do?
netty_unix_filedescriptor.c is a source file in the netty codebase, written in c. It belongs to the NativeTransport domain.
What does netty_unix_filedescriptor.c depend on?
netty_unix_filedescriptor.c imports 12 module(s): errno.h, fcntl.h, limits.h, netty_jni_util.h, netty_unix_errors.h, netty_unix_filedescriptor.h, netty_unix_jni.h, netty_unix_util.h, and 4 more.
Where is netty_unix_filedescriptor.c in the architecture?
netty_unix_filedescriptor.c is located at transport-native-unix-common/src/main/c/netty_unix_filedescriptor.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