当前位置: 首页>>代码示例>>Java>>正文


Java Constants.FREE_BSD属性代码示例

本文整理汇总了Java中org.apache.lucene.util.Constants.FREE_BSD属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.FREE_BSD属性的具体用法?Java Constants.FREE_BSD怎么用?Java Constants.FREE_BSD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.lucene.util.Constants的用法示例。


在下文中一共展示了Constants.FREE_BSD属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

/**
 * Attempt to drop the capability to execute for the process.
 * <p>
 * This is best effort and OS and architecture dependent. It may throw any Throwable.
 * @return 0 if we can do this for application threads, 1 for the entire process
 */
static int init(Path tmpFile) throws Exception {
    if (Constants.LINUX) {
        return linuxImpl();
    } else if (Constants.MAC_OS_X) {
        // try to enable both mechanisms if possible
        bsdImpl();
        macImpl(tmpFile);
        return 1;
    } else if (Constants.SUN_OS) {
        solarisImpl();
        return 1;
    } else if (Constants.FREE_BSD || OPENBSD) {
        bsdImpl();
        return 1;
    } else if (Constants.WINDOWS) {
        windowsImpl();
        return 1;
    } else {
        throw new UnsupportedOperationException("syscall filtering not supported for OS: '" + Constants.OS_NAME + "'");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:SystemCallFilter.java

示例2: init

/**
 * Attempt to drop the capability to execute for the process.
 * <p>
 * This is best effort and OS and architecture dependent. It may throw any Throwable.
 * @return 0 if we can do this for application threads, 1 for the entire process
 */
static int init(Path tmpFile) throws Throwable {
    if (Constants.LINUX) {
        return linuxImpl();
    } else if (Constants.MAC_OS_X) {
        // try to enable both mechanisms if possible
        bsdImpl();
        macImpl(tmpFile);
        return 1;
    } else if (Constants.SUN_OS) {
        solarisImpl();
        return 1;
    } else if (Constants.FREE_BSD || OPENBSD) {
        bsdImpl();
        return 1;
    } else if (Constants.WINDOWS) {
        windowsImpl();
        return 1;
    } else {
        throw new UnsupportedOperationException("syscall filtering not supported for OS: '" + Constants.OS_NAME + "'");
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:27,代码来源:Seccomp.java

示例3: bsdImpl

static void bsdImpl() {
    boolean supported = Constants.FREE_BSD || OPENBSD || Constants.MAC_OS_X;
    if (supported == false) {
        throw new IllegalStateException("bug: should not be trying to initialize RLIMIT_NPROC for an unsupported OS");
    }

    JNACLibrary.Rlimit limit = new JNACLibrary.Rlimit();
    limit.rlim_cur.setValue(0);
    limit.rlim_max.setValue(0);
    if (JNACLibrary.setrlimit(RLIMIT_NPROC, limit) != 0) {
        throw new UnsupportedOperationException("RLIMIT_NPROC unavailable: " + JNACLibrary.strerror(Native.getLastError()));
    }

    logger.debug("BSD RLIMIT_NPROC initialization successful");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:SystemCallFilter.java

示例4: getMatchingFileStore

/** 
 * Files.getFileStore(Path) useless here!  Don't complain, just try it yourself. 
 */
@SuppressForbidden(reason = "works around the bugs")
static FileStore getMatchingFileStore(Path path, FileStore fileStores[]) throws IOException {       
    if (Constants.WINDOWS) {
        return getFileStoreWindows(path, fileStores);
    }
    
    final FileStore store;
    try {
        store = Files.getFileStore(path);
    } catch (IOException unexpected) {
        // give a better error message if a filestore cannot be retrieved from inside a FreeBSD jail.
        if (Constants.FREE_BSD) {
            throw new IOException("Unable to retrieve mount point data for " + path +
                                  ". If you are running within a jail, set enforce_statfs=1. See jail(8)", unexpected);
        } else {
            throw unexpected;
        }
    }

    try {
        String mount = getMountPointLinux(store);
        FileStore sameMountPoint = null;
        for (FileStore fs : fileStores) {
            if (mount.equals(getMountPointLinux(fs))) {
                if (sameMountPoint == null) {
                    sameMountPoint = fs;
                } else {
                    // more than one filesystem has the same mount point; something is wrong!
                    // fall back to crappy one we got from Files.getFileStore
                    return store;
                }
            }
        }

        if (sameMountPoint != null) {
            // ok, we found only one, use it:
            return sameMountPoint;
        } else {
            // fall back to crappy one we got from Files.getFileStore
            return store;    
        }
    } catch (Exception e) {
        // ignore
    }

    // fall back to crappy one we got from Files.getFileStore
    return store;    
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:51,代码来源:ESFileStore.java


注:本文中的org.apache.lucene.util.Constants.FREE_BSD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。