This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/native/java/io/io_util.c#l145 | |
*/ | |
void | |
writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, | |
jint off, jint len, jboolean append, jfieldID fid) | |
{ | |
jint n; | |
char stackBuf[BUF_SIZE]; | |
char *buf = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/java/io/io_util_md.h#l71 | |
*/ | |
#define IO_Write handleWrite | |
#define IO_Append handleWrite | |
// ... | |
/* | |
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/java/io/io_util_md.c#l160 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c#l111 | |
*/ | |
Java_sun_nio_ch_FileDispatcherImpl_pwrite0(JNIEnv *env, jclass clazz, jobject fdo, | |
jlong address, jint len, jlong offset) | |
{ | |
jint fd = fdval(env, fdo); | |
void *buf = (void *)jlong_to_ptr(address); | |
return convertReturnVal(env, pwrite64(fd, buf, len, offset), JNI_FALSE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
From http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/nio/channels/FileChannel.java#l778 | |
*/ | |
public abstract int write(ByteBuffer src, long position) throws IOException; | |
// ... | |
/* | |
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/sun/nio/ch/FileChannelImpl.java#l703 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos) | |
{ | |
struct iovec iov = { .iov_base = buf, .iov_len = len }; | |
struct kiocb kiocb; | |
struct iov_iter iter; | |
ssize_t ret; | |
init_sync_kiocb(&kiocb, filp); | |
kiocb.ki_pos = *ppos; | |
kiocb.ki_nbytes = len; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xfs_file_read_iter( | |
struct kiocb *iocb, | |
struct iov_iter *to) | |
{ | |
... | |
xfs_rw_ilock(ip, XFS_IOLOCK_SHARED); | |
... | |
ret = generic_file_read_iter(iocb, to); | |
... | |
xfs_rw_iunlock(ip, XFS_IOLOCK_SHARED); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xfs_file_buffered_aio_write( | |
struct kiocb *iocb, | |
struct iov_iter *from) | |
{ | |
... | |
int iolock = XFS_IOLOCK_EXCL; | |
... | |
xfs_rw_ilock(ip, iolock); | |
... | |
ret = generic_perform_write(file, from, pos); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final class Unicorn | |
{ | |
private static int mainMethodLineOfLastPatInvocation = 0; | |
private static boolean pat() | |
{ | |
boolean result = false; | |
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); | |
final StackTraceElement mainMethodInvocationPoint = stackTrace[3]; | |
if(mainMethodInvocationPoint.getLineNumber() != mainMethodLineOfLastPatInvocation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static final class Unicorn | |
{ | |
private static int mainMethodLineOfLastPatInvocation = 0; | |
private static boolean pat() | |
{ | |
boolean result = false; | |
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); | |
final StackTraceElement mainMethodInvocationPoint = stackTrace[3]; | |
if(mainMethodInvocationPoint.getLineNumber() != mainMethodLineOfLastPatInvocation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final class Unicorn | |
{ | |
private static int mainMethodLineOfLastPatInvocation = 0; | |
private static boolean pat() | |
{ | |
boolean result = false; | |
final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); | |
final StackTraceElement mainMethodInvocationPoint = stackTrace[3]; | |
if(mainMethodInvocationPoint.getLineNumber() != mainMethodLineOfLastPatInvocation) |