diff --git a/pom.xml b/pom.xml index dbbe787..eea9407 100644 --- a/pom.xml +++ b/pom.xml @@ -79,7 +79,7 @@ com.github.jnr jnr-ffi - 2.2.10 + 2.2.11-SNAPSHOT com.github.jnr diff --git a/src/main/java/jnr/posix/LibC.java b/src/main/java/jnr/posix/LibC.java index 6df0ffd..fb384e7 100644 --- a/src/main/java/jnr/posix/LibC.java +++ b/src/main/java/jnr/posix/LibC.java @@ -85,10 +85,14 @@ public interface LibC { int dup(int fd); int dup2(int oldFd, int newFd); + @Variadic(fixedCount = 2) int fcntl(int fd, int fnctl, Flock arg); + @Variadic(fixedCount = 2) int fcntl(int fd, int fnctl, Pointer arg); + @Variadic(fixedCount = 2) int fcntl(int fd, int fnctl); - int fcntl(int fd, int fnctl, int arg); + @Variadic(fixedCount = 2) + int fcntl(int fd, int fnctl, @u_int64_t int arg); @Deprecated int fcntl(int fd, int fnctl, int... arg); int access(CharSequence path, int amode); @@ -164,7 +168,8 @@ public interface LibCSignalHandler { int flock(int fd, int mode); int unlink(CharSequence path); - int open(CharSequence path, int flags, int perm); + @Variadic(fixedCount = 2) + int open(CharSequence path, int flags, @u_int32_t int perm); int pipe(@Out int[] fds); int truncate(CharSequence path, long length); int ftruncate(int fd, long offset); diff --git a/src/test/java/jnr/posix/FileTest.java b/src/test/java/jnr/posix/FileTest.java index 98981b3..afadb07 100644 --- a/src/test/java/jnr/posix/FileTest.java +++ b/src/test/java/jnr/posix/FileTest.java @@ -380,6 +380,15 @@ public void openTest() throws Throwable { result = posix.close(fd); assertEquals(-1, result); + + fd = posix.open("jnr-posix-filetest.txt", OpenFlags.O_CREAT.intValue() | OpenFlags.O_RDWR.intValue(), 0600); + + assertEquals(0600, posix.stat("jnr-posix-filetest.txt").mode() & 0777); + + result = posix.close(fd); + assertEquals(0, result); + + new File("jnr-posix-filetest.txt").delete(); } @Test