posix module provides functions of or related to POSIX. This module consists of posix.jar and libposix_jni.so (On Mac, libposix_jni.jnilib).
readlink("/etc/grub.conf") ==> "../boot/grub/grub.conf"
stat("/etc/rc") ==> {st_nlink=1, st_rdev=0, st_blocks=8, st_ctime=1079703239,
st_atime=1080106262, st_mode=33261, st_blksize=4096,
st_ino=467319, st_gid=0, st_size=2338, st_dev=773, st_uid=0,
st_mtime=1045604048}
access("/etc/rc", R_OK) ==> 0
symlink("/etc/rc", "/tmp/rc")
chmod(".profile", 0600)
utimes("/etc/rc", null) // touch
getenv("CLASSPATH")
getcwd()
geterrno() is the only function that is not defined in POSIX spec. It returns errno.
chdir("/tmp")
getpwuid(getuid()) == > {pw_uid=21231, pw_shell=/bin/bash, pw_passwd=x,
pw_dir=/home/tomatsu, pw_gecos=Toyokazu Tomatsu,
pw_gid=1600, pw_name=tomatsu}
uname() ==> {release=2.4.20-8, sysname=Linux, machine=i686,
version=#1 Thu Mar 13 17:54:28 EST 2003, nodename=tr2b}
strerror(EACCES) ==> "Permission denied"
openlog("test", LOG_CONS, LOG_USER)
syslog(6, "hogehoge")
closelog()
The names of the the constants used with the functions in this module are available, e.g. EACCES in "errno.h".
| Category | Permission |
|---|---|
| Getting System-wide Information | permission org.pnuts.posix.PosixPermission "system.read"; |
| Modifying System-wide Information | permission org.pnuts.posix.PosixPermission "system.write"; |
| Getting Process Specific Information | permission org.pnuts.posix.PosixPermission "process.read"; |
| Modifying Process Specific Information | permission org.pnuts.posix.PosixPermission "process.write"; |
| Reading Files | permission org.pnuts.posix.PosixPermission "file.read", path; |
| Writing Files | permission org.pnuts.posix.PosixPermission "file.write", path"; |