本文整理了Java中jnr.posix.POSIX.umask()
方法的一些代码示例,展示了POSIX.umask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.umask()
方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:umask
暂无
代码示例来源:origin: org.jruby/jruby-complete
public static int umask(POSIX posix, int newMask) {
int oldMask;
synchronized (_umaskLock) {
oldMask = posix.umask(newMask);
_cachedUmask = newMask;
}
return oldMask;
}
代码示例来源:origin: org.jruby/jruby-core
public static int umask(POSIX posix, int newMask) {
int oldMask;
synchronized (_umaskLock) {
oldMask = posix.umask(newMask);
_cachedUmask = newMask;
}
return oldMask;
}
代码示例来源:origin: org.jruby/jruby-core
/**
* Joy of POSIX, only way to get the umask is to set the umask,
* then set it back. That's unsafe in a threaded program. We
* minimize but may not totally remove this race by caching the
* obtained or previously set (see umask() above) umask and using
* that as the initial set value which, cross fingers, is a
* no-op. The cache access is then synchronized. TODO: Better?
*/
public static int umask(POSIX posix) {
synchronized (_umaskLock) {
final int umask = posix.umask(_cachedUmask);
if (_cachedUmask != umask ) {
posix.umask(umask);
_cachedUmask = umask;
}
return umask;
}
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Joy of POSIX, only way to get the umask is to set the umask,
* then set it back. That's unsafe in a threaded program. We
* minimize but may not totally remove this race by caching the
* obtained or previously set (see umask() above) umask and using
* that as the initial set value which, cross fingers, is a
* no-op. The cache access is then synchronized. TODO: Better?
*/
public static int umask(POSIX posix) {
synchronized (_umaskLock) {
final int umask = posix.umask(_cachedUmask);
if (_cachedUmask != umask ) {
posix.umask(umask);
_cachedUmask = umask;
}
return umask;
}
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int umask(int mask) {
return posix().umask(mask);
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public int umask(int mask) {
try { return posix.umask(mask); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int umask(int mask) {
try { return posix.umask(mask); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: org.python/jython
@Hide(posixImpl = PosixImpl.JAVA)
public static int umask(int mask) {
return posix.umask(mask);
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int umask(int mask) {
return posix().umask(mask);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int umask(int mask) {
return posix().umask(mask);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int umask(int mask) {
try { return posix.umask(mask); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public int umask(int mask) {
return posix().umask(mask);
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int umask(int mask) {
try { return posix.umask(mask); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Joy of POSIX, only way to get the umask is to set the umask,
* then set it back. That's unsafe in a threaded program. We
* minimize but may not totally remove this race by caching the
* obtained or previously set (see umask() above) umask and using
* that as the initial set value which, cross fingers, is a
* no-op. The cache access is then synchronized. TODO: Better?
*/
private static int getUmaskSafe( Ruby runtime ) {
synchronized (_umaskLock) {
final int umask = runtime.getPosix().umask(_cachedUmask);
if (_cachedUmask != umask ) {
runtime.getPosix().umask(umask);
_cachedUmask = umask;
}
return umask;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Joy of POSIX, only way to get the umask is to set the umask,
* then set it back. That's unsafe in a threaded program. We
* minimize but may not totally remove this race by caching the
* obtained or previously set (see umask() above) umask and using
* that as the initial set value which, cross fingers, is a
* no-op. The cache access is then synchronized. TODO: Better?
*/
private static int getUmaskSafe( Ruby runtime ) {
synchronized (_umaskLock) {
final int umask = runtime.getPosix().umask(_cachedUmask);
if (_cachedUmask != umask ) {
runtime.getPosix().umask(umask);
_cachedUmask = umask;
}
return umask;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(meta = true, optional = 1)
public static IRubyObject umask(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.runtime;
int oldMask = 0;
if (args.length == 0) {
oldMask = getUmaskSafe( runtime );
} else if (args.length == 1) {
int newMask = (int) args[0].convertToInteger().getLongValue();
synchronized (_umaskLock) {
oldMask = runtime.getPosix().umask(newMask);
_cachedUmask = newMask;
}
} else {
runtime.newArgumentError("wrong number of arguments");
}
return runtime.newFixnum(oldMask);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(meta = true, optional = 1)
public static IRubyObject umask(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
Ruby runtime = context.runtime;
int oldMask = 0;
if (args.length == 0) {
oldMask = getUmaskSafe( runtime );
} else if (args.length == 1) {
int newMask = (int) args[0].convertToInteger().getLongValue();
synchronized (_umaskLock) {
oldMask = runtime.getPosix().umask(newMask);
_cachedUmask = newMask;
}
} else {
runtime.newArgumentError("wrong number of arguments");
}
return runtime.newFixnum(oldMask);
}
内容来源于网络,如有侵权,请联系作者删除!