Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
aix

# Conflicts:
#	CHANGES.md
  • Loading branch information
dbwiddis committed Jul 15, 2020
2 parents a495f5a + d8ce23e commit a6183d9
Show file tree
Hide file tree
Showing 49 changed files with 1,386 additions and 167 deletions.
17 changes: 16 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ NOTE: as of JNA 4.0, JNA is now dual-licensed under LGPL and AL 2.0 (see LICENSE

NOTE: JNI native support is typically incompatible between minor versions, and almost always incompatible between major versions.

Next Release (5.6.0)
Next Release (5.7.0)
====================

Features
--------
* [#1231](https://github.com/java-native-access/jna/pull/1231): The test suite can now be executed on Windows using either ANSI or UNICODE win32 API by passing `-Dw32.ascii=true/false` to ant. Previously, UNICODE was always used. - [@T-Svensson](https://github.com/T-Svensson/)

Bug Fixes
---------


Release 5.6.0
=============

Features
--------
* [#1160](https://github.com/java-native-access/jna/issues/1160): Make FileUtils#moveToTrash a varargs method - [@matthiasblaesing](https://github.com/matthiasblaesing).
Expand All @@ -17,12 +28,16 @@ Features
* [#1194](https://github.com/java-native-access/jna/pull/1194): Add `GetConsoleScreenBufferInfo`, `ReadConsoleInput` and `WriteConsole` with associated structures to `c.s.j.p.win32.Wincon` - [@rednoah](https://github.com/rednoah).
* [#1198](https://github.com/java-native-access/jna/pull/1198): Add `NetSessionEnum` to `c.s.j.p.win32.Netapi32` and `WTSEnumerateSessions`, `WTSQuerySessionInformation`, and `WTSFreeMemory` to `c.s.j.p.win32.Wtsapi32` - [@dbwiddis](https://github.com/dbwiddis).
* [#1200](https://github.com/java-native-access/jna/pull/1200): Add mappings for `libudev` to `c.s.j.p.linux.Udev` - [@dbwiddis](https://github.com/dbwiddis).
* [#1202](https://github.com/java-native-access/jna/pull/1202): Add mappings supporting shared memory including `c.s.j.p.unix.LibCAPI` types `size_t` and `ssize_t`, `c.s.j.p.linux.LibC` methods `munmap()`, `msync()`, and `close()`, `c.s.j.p.unix.LibCUtil` mapping `mmap()` and `ftruncate()`, and `c.s.j.p.linux.LibRT` methods `shm_open()` and `shm_unlink()` - [@dbwiddis](https://github.com/dbwiddis).
* [#1209](https://github.com/java-native-access/jna/pull/1209): Add mappings for `Thread32First` and `Thread32Next` to `c.s.j.p.win32.Kernel32` - [@dbwiddis](https://github.com/dbwiddis).
* [#1214](https://github.com/java-native-access/jna/pull/1214): Add mapping for EnumProcesses to `c.s.j.p.win32.Psapi` and `c.s.j.p.win32.PsapiUtil` - [@T-Svensson](https://github.com/T-Svensson/).

Bug Fixes
---------
* [#1183](https://github.com/java-native-access/jna/pull/1183): `c.s.j.p.win32.WinDef.CHARByReference#getValue` should only read one byte - [@dbwiddis](https://github.com/dbwiddis).
* [#1184](https://github.com/java-native-access/jna/pull/1184): `c.s.j.p.win32.WinDef.ULONGLONG` should always be 8 bytes - [@dbwiddis](https://github.com/dbwiddis).
* [#1196](https://github.com/java-native-access/jna/pull/1196): `c.s.j.p.win32.WinNT.LARGE_INTEGER` needs to populate both union fields - [@dbwiddis](https://github.com/dbwiddis).
* [#1216](https://github.com/java-native-access/jna/pull/1216): Failure loading frameworks on macOS 11 - [@dkocher](https://github.com/dkocher).

Release 5.5.0
=============
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Java Native Access (JNA)
========================

The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.5.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.5.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.6.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.6.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).

JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.

Expand Down Expand Up @@ -60,20 +60,20 @@ Pre-built platform support may be found [here](https://github.com/java-native-ac
Download
========

Version 5.5.0
Version 5.6.0

JNA
---

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.5.0/jar) [jna-5.5.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.5.0/jna-5.5.0.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.6.0/jar) [jna-5.6.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.jar)

This is the core artifact of JNA and contains only the binding library and the
core helper classes.

JNA Platform
------------

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.5.0/jar) [jna-platform-5.5.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.5.0/jna-platform-5.5.0.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.6.0/jar) [jna-platform-5.6.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.jar)

This artifact holds cross-platform mappings and mappings for a number of commonly used platform
functions, including a large number of Win32 mappings as well as a set of utility classes
Expand Down Expand Up @@ -141,12 +141,12 @@ Using the Library
* [Platform Library](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md)
* [Direct Method Mapping](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md) (Optimization)
* [Frequently Asked Questions (FAQ)](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.5.0/javadoc/overview-summary.html#crash-protection)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.6.0/javadoc/overview-summary.html#crash-protection)

Primary Documentation (JavaDoc)
===============================

The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.5.0/javadoc/).
The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.6.0/javadoc/).

Developers
==========
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

<!-- JNA library release version - android versionCode is derived from mjar/minor/revision -->
<property name="jna.major" value="5"/>
<property name="jna.minor" value="6"/>
<property name="jna.minor" value="7"/>
<property name="jna.revision" value="0"/>
<property name="jna.build" value="0"/> <!--${build.number}-->
<condition property="version.suffix" value="" else="-SNAPSHOT">
Expand Down
5 changes: 5 additions & 0 deletions contrib/platform/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,18 @@ com.sun.jna.platform.wince;version=${osgi.version}
<echo>tests.platform.windows=${tests.platform.windows}</echo>
<echo>tests.platform.linux=${tests.platform.linux}</echo>
<echo>tests.platform.unix=${tests.platform.unix}</echo>
<propertyset id="native.api.windows">
<propertyref name="w32.ascii"/>
</propertyset>
<junit fork="${test.fork}" failureproperty="testfailure" tempdir="${build.dir}">
<!-- optionally run headless -->
<syspropertyset refid="headless"/>
<!-- avoid VM conflicts with JNA protected mode -->
<env key="${ld.preload.name}" file="${libjsig}"/>
<!-- Ignore any system install of JNA -->
<sysproperty key="jna.builddir" file="${file.reference.jna.build}"/>
<!-- Optionally force native API on Windows -->
<syspropertyset refid="native.api.windows"/>
<jvmarg value="${vmopt.arch}"/>
<classpath><path path="${run.test.classpath}"/><path path="${file.reference.jna.build}/test-classes"/></classpath>
<formatter type="brief" usefile="false"/>
Expand Down
162 changes: 162 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/linux/ErrNo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
/* Copyright (c) 2020 Daniel Widdis, All Rights Reserved
*
* The contents of this file is dual-licensed under 2
* alternative Open Source/Free licenses: LGPL 2.1 or later and
* Apache License 2.0. (starting with JNA version 4.0.0).
*
* You can freely decide which license you want to apply to
* the project.
*
* You may obtain a copy of the LGPL License at:
*
* http://www.gnu.org/licenses/licenses.html
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "LGPL2.1".
*
* You may obtain a copy of the Apache License at:
*
* http://www.apache.org/licenses/
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "AL2.0".
*/
package com.sun.jna.platform.linux;

import com.sun.jna.Native;

/**
* System error codes set in {@code errno} and retrieved by
* {@link Native#getLastError()}
*/
public interface ErrNo {
int EPERM = 1; // Operation not permitted
int ENOENT = 2; // No such file or directory
int ESRCH = 3; // No such process
int EINTR = 4; // Interrupted system call
int EIO = 5; // I/O error
int ENXIO = 6; // No such device or address
int E2BIG = 7; // Argument list too long
int ENOEXEC = 8; // Exec format error
int EBADF = 9; // Bad file number
int ECHILD = 10; // No child processes
int EAGAIN = 11; // Try again
int ENOMEM = 12; // Out of memory
int EACCES = 13; // Permission denied
int EFAULT = 14; // Bad address
int ENOTBLK = 15; // Block device required
int EBUSY = 16; // Device or resource busy
int EEXIST = 17; // File exists
int EXDEV = 18; // Cross-device link
int ENODEV = 19; // No such device
int ENOTDIR = 20; // Not a directory
int EISDIR = 21; // Is a directory
int EINVAL = 22; // Invalid argument
int ENFILE = 23; // File table overflow
int EMFILE = 24; // Too many open files
int ENOTTY = 25; // Not a typewriter
int ETXTBSY = 26; // Text file busy
int EFBIG = 27; // File too large
int ENOSPC = 28; // No space left on device
int ESPIPE = 29; // Illegal seek
int EROFS = 30; // Read-only file system
int EMLINK = 31; // Too many links
int EPIPE = 32; // Broken pipe
int EDOM = 33; // Math argument out of domain of func
int ERANGE = 34; // Math result not representable
int EDEADLK = 35; // Resource deadlock would occur
int ENAMETOOLONG = 36; // File name too long
int ENOLCK = 37; // No record locks available
int ENOSYS = 38; // Function not implemented
int ENOTEMPTY = 39; // Directory not empty
int ELOOP = 40; // Too many symbolic links encountered
int ENOMSG = 42; // No message of desired type
int EIDRM = 43; // Identifier removed
int ECHRNG = 44; // Channel number out of range
int EL2NSYNC = 45; // Level 2 not synchronized
int EL3HLT = 46; // Level 3 halted
int EL3RST = 47; // Level 3 reset
int ELNRNG = 48; // Link number out of range
int EUNATCH = 49; // Protocol driver not attached
int ENOCSI = 50; // No CSI structure available
int EL2HLT = 51; // Level 2 halted
int EBADE = 52; // Invalid exchange
int EBADR = 53; // Invalid request descriptor
int EXFULL = 54; // Exchange full
int ENOANO = 55; // No anode
int EBADRQC = 56; // Invalid request code
int EBADSLT = 57; // Invalid slot
int EBFONT = 59; // Bad font file format
int ENOSTR = 60; // Device not a stream
int ENODATA = 61; // No data available
int ETIME = 62; // Timer expired
int ENOSR = 63; // Out of streams resources
int ENONET = 64; // Machine is not on the network
int ENOPKG = 65; // Package not installed
int EREMOTE = 66; // Object is remote
int ENOLINK = 67; // Link has been severed
int EADV = 68; // Advertise error
int ESRMNT = 69; // Srmount error
int ECOMM = 70; // Communication error on send
int EPROTO = 71; // Protocol error
int EMULTIHOP = 72; // Multihop attempted
int EDOTDOT = 73; // RFS specific error
int EBADMSG = 74; // Not a data message
int EOVERFLOW = 75; // Value too large for defined data type
int ENOTUNIQ = 76; // Name not unique on network
int EBADFD = 77; // File descriptor in bad state
int EREMCHG = 78; // Remote address changed
int ELIBACC = 79; // Can not access a needed shared library
int ELIBBAD = 80; // Accessing a corrupted shared library
int ELIBSCN = 81; // .lib section in a.out corrupted
int ELIBMAX = 82; // Attempting to link in too many shared libraries
int ELIBEXEC = 83; // Cannot exec a shared library directly
int EILSEQ = 84; // Illegal byte sequence
int ERESTART = 85; // Interrupted system call should be restarted
int ESTRPIPE = 86; // Streams pipe error
int EUSERS = 87; // Too many users
int ENOTSOCK = 88; // Socket operation on non-socket
int EDESTADDRREQ = 89; // Destination address required
int EMSGSIZE = 90; // Message too long
int EPROTOTYPE = 91; // Protocol wrong type for socket
int ENOPROTOOPT = 92; // Protocol not available
int EPROTONOSUPPORT = 93; // Protocol not supported
int ESOCKTNOSUPPORT = 94; // Socket type not supported
int EOPNOTSUPP = 95; // Operation not supported on transport endpoint
int EPFNOSUPPORT = 96; // Protocol family not supported
int EAFNOSUPPORT = 97; // Address family not supported by protocol
int EADDRINUSE = 98; // Address already in use
int EADDRNOTAVAIL = 99; // Cannot assign requested address
int ENETDOWN = 100; // Network is down
int ENETUNREACH = 101; // Network is unreachable
int ENETRESET = 102; // Network dropped connection because of reset
int ECONNABORTED = 103; // Software caused connection abort
int ECONNRESET = 104; // Connection reset by peer
int ENOBUFS = 105; // No buffer space available
int EISCONN = 106; // Transport endpoint is already connected
int ENOTCONN = 107; // Transport endpoint is not connected
int ESHUTDOWN = 108; // Cannot send after transport endpoint shutdown
int ETOOMANYREFS = 109; // Too many references: cannot splice
int ETIMEDOUT = 110; // Connection timed out
int ECONNREFUSED = 111; // Connection refused
int EHOSTDOWN = 112; // Host is down
int EHOSTUNREACH = 113; // No route to host
int EALREADY = 114; // Operation already in progress
int EINPROGRESS = 115; // Operation now in progress
int ESTALE = 116; // Stale NFS file handle
int EUCLEAN = 117; // Structure needs cleaning
int ENOTNAM = 118; // Not a XENIX named type file
int ENAVAIL = 119; // No XENIX semaphores available
int EISNAM = 120; // Is a named type file
int EREMOTEIO = 121; // Remote I/O error
int EDQUOT = 122; // Quota exceeded
int ENOMEDIUM = 123; // No medium found
int EMEDIUMTYPE = 124; // Wrong medium type
int ECANCELED = 125; // Operation Canceled
int ENOKEY = 126; // Required key not available
int EKEYEXPIRED = 127; // Key has expired
int EKEYREVOKED = 128; // Key has been revoked
int EKEYREJECTED = 129; // Key was rejected by service
int EOWNERDEAD = 130; // Owner died
int ENOTRECOVERABLE = 131; // State not recoverable
}
64 changes: 64 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/linux/Fcntl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* Copyright (c) 2020 Daniel Widdis, All Rights Reserved
*
* The contents of this file is dual-licensed under 2
* alternative Open Source/Free licenses: LGPL 2.1 or later and
* Apache License 2.0. (starting with JNA version 4.0.0).
*
* You can freely decide which license you want to apply to
* the project.
*
* You may obtain a copy of the LGPL License at:
*
* http://www.gnu.org/licenses/licenses.html
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "LGPL2.1".
*
* You may obtain a copy of the Apache License at:
*
* http://www.apache.org/licenses/
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "AL2.0".
*/
package com.sun.jna.platform.linux;

/**
* POSIX Standard: 6.5 File Control Operations from {@code fcntl.h}
*/
public interface Fcntl {
/*
* File access modes for `open' and `fcntl'
*/
int O_RDONLY = 00; // Open read-only.
int O_WRONLY = 01; // Open write-only.
int O_RDWR = 02; // Open read/write.

/*
* Bits OR'd into the second argument to open. Note these are defined
* differently on linux than unix fcntl header
*/
int O_CREAT = 0100; // Create file if it doesn't exist.
int O_EXCL = 0200; // Fail if file already exists.
int O_TRUNC = 01000; // Truncate file to zero length.

/* Protection bits. */
int S_IRUSR = 00400; // Read by owner.
int S_IWUSR = 00200; // Write by owner.
int S_IXUSR = 00100; // Execute by owner.
int S_IRWXU = S_IRUSR | S_IWUSR | S_IXUSR;

int S_IRGRP = 00040; // Read by group.
int S_IWGRP = 00020; // Write by group.
int S_IXGRP = 00010; // Execute by group.
int S_IRWXG = S_IRGRP | S_IWGRP | S_IXGRP;

int S_IROTH = 00004; // Read by others.
int S_IWOTH = 00002; // Write by others.
int S_IXOTH = 00001; // Execute by others.
int S_IRWXO = S_IROTH | S_IWOTH | S_IXOTH;

int S_ISUID = 04000; // set-user-ID bit
int S_ISGID = 02000; // set-group-ID bit (see inode(7)).
int S_ISVTX = 01000; // sticky bit (see inode(7)).
}
Loading

0 comments on commit a6183d9

Please sign in to comment.