Package com.sun.jna.platform.unix
Schnittstelle LibCAPI
Note: we are using this "intermediate" API in order to allow
Linux-like O/S-es to implement the same API, but maybe using a different
library name
- Autor:
- Lyor Goldstein
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypSchnittstelleBeschreibungstatic classThis is an unsigned integer type used to represent the sizes of objects.static classThis is a signed integer type used for a count of bytes or an error indication.Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen com.sun.jna.platform.unix.Resource
Resource.Rlimit -
Feldübersicht
FelderVon Schnittstelle geerbte Felder com.sun.jna.platform.unix.Reboot
RB_AUTOBOOT, RB_DISABLE_CAD, RB_ENABLE_CAD, RB_HALT_SYSTEM, RB_KEXEC, RB_POWER_OFF, RB_SW_SUSPENDVon Schnittstelle geerbte Felder com.sun.jna.platform.unix.Resource
RLIMIT_AS, RLIMIT_CORE, RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_LOCKS, RLIMIT_MEMLOCK, RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_NLIMITS, RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_RTPRIO, RLIMIT_RTTIME, RLIMIT_SIGPENDING, RLIMIT_STACK -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintclose(int fd) Closes a file descriptor, so that it no longer refers to any file and may be reused.intgetdomainname(byte[] name, int len) intgetegid()intgeteuid()intgetgid()intgethostname(byte[] name, int len) intgetloadavg(double[] loadavg, int nelem) The getloadavg() function returns the number of processes in the system run queue averaged over various periods of time.intgetuid()intmsync(Pointer addr, LibCAPI.size_t length, int flags) Flushes changes made to the in-core copy of a file that was mapped into memory usingLibCUtil.mmap(Pointer, long, int, int, int, long)back to the filesystem.intmunmap(Pointer addr, LibCAPI.size_t length) Deletes the mappings for the specified address range, and causes further references to addresses within the range to generate invalid memory references.intsetdomainname(String name, int len) intsetegid(int gid) intUpdate or add a variable in the environment of the calling process.intseteuid(int uid) intsetgid(int gid) intsethostname(String name, int len) intsetuid(int uid) int
-
Felddetails
-
HOST_NAME_MAX
static final int HOST_NAME_MAX- Siehe auch:
-
-
Methodendetails
-
getuid
int getuid() -
geteuid
int geteuid() -
getgid
int getgid() -
getegid
int getegid() -
setuid
int setuid(int uid) -
seteuid
int seteuid(int uid) -
setgid
int setgid(int gid) -
setegid
int setegid(int gid) -
gethostname
int gethostname(byte[] name, int len) -
sethostname
-
getdomainname
int getdomainname(byte[] name, int len) -
setdomainname
-
getenv
- Parameter:
name- Environment variable name- Gibt zurück:
- Returns the value in the environment, or
nullif there is no match for the name - Siehe auch:
-
setenv
Update or add a variable in the environment of the calling process.- Parameter:
name- Environment variable namevalue- Required valueoverwrite- If the environment variable already exists and the value ofoverwriteis non-zero, the function shall return success and the environment shall be updated. If the environment variable already exists and the value ofoverwriteis zero, the function shall return success and the environment shall remain unchanged.- Gibt zurück:
- Upon successful completion, zero shall be returned. Otherwise,
-1 shall be returned,
errnoset to indicate the error, and the environment shall be unchanged - Siehe auch:
-
unsetenv
- Parameter:
name- Environment variable name - If the named variable does not exist in the current environment, the environment shall be unchanged and the function is considered to have completed successfully.- Gibt zurück:
- Upon successful completion, zero shall be returned. Otherwise,
-1 shall be returned,
errnoset to indicate the error, and the environment shall be unchanged - Siehe auch:
-
getloadavg
int getloadavg(double[] loadavg, int nelem) The getloadavg() function returns the number of processes in the system run queue averaged over various periods of time. Up to nelem samples are retrieved and assigned to successive elements of loadavg[]. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively.- Parameter:
loadavg- An array of doubles which will be filled with the resultsnelem- Number of samples to return- Gibt zurück:
- If the load average was unobtainable, -1 is returned; otherwise, the number of samples actually retrieved is returned.
- Siehe auch:
-
close
int close(int fd) Closes a file descriptor, so that it no longer refers to any file and may be reused. Any record locks held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock).If
fdis the last file descriptor referring to the underlying open file description, the resources associated with the open file description are freed; if the file descriptor was the last reference to a file which has been removed usingunlink, the file is deleted.- Parameter:
fd- a file descriptor- Gibt zurück:
- returns zero on success. On error, -1 is returned, and
errnois set appropriately.close()should not be retried after an error.
-
msync
Flushes changes made to the in-core copy of a file that was mapped into memory usingLibCUtil.mmap(Pointer, long, int, int, int, long)back to the filesystem. Without use of this call, there is no guarantee that changes are written back beforemunmap(Pointer, size_t)is called. To be more precise, the part of the file that corresponds to the memory area starting ataddrand having lengthlengthis updated.- Parameter:
addr- The start of the memory area to sync to the filesystem.length- The length of the memory area to sync to the filesystem.flags- The flags argument should specify exactly one ofMS_ASYNCandMS_SYNC, and may additionally include theMS_INVALIDATEbit.- Gibt zurück:
- On success, zero is returned. On error, -1 is returned, and
errnois set appropriately.
-
munmap
Deletes the mappings for the specified address range, and causes further references to addresses within the range to generate invalid memory references. The region is also automatically unmapped when the process is terminated. On the other hand, closing the file descriptor does not unmap the region.It is not an error if the indicated range does not contain any mapped pages.
- Parameter:
addr- The base address from which to delete mappings. The address addr must be a multiple of the page size (but length need not be).length- The length from the base address to delete mappings. All pages containing a part of the indicated range are unmapped, and subsequent references to these pages will generateSIGSEGV.- Gibt zurück:
- On success, returns 0. On failure, it returns -1, and
errnois set to indicate the cause of the error (probably toEINVAL).
-