Class PosixModule

java.lang.Object
org.python.modules.posix.PosixModule
All Implemented Interfaces:
ClassDictInit

public class PosixModule extends Object implements ClassDictInit
The posix/nt module, depending on the platform.
  • Field Details

    • __doc__

      public static final PyString __doc__
    • __doc___exit

      public static PyString __doc___exit
    • __doc__access

      public static PyString __doc__access
    • __doc__chdir

      public static PyString __doc__chdir
    • __doc__chmod

      public static PyString __doc__chmod
    • __doc__chown

      public static PyString __doc__chown
    • __doc__close

      public static PyString __doc__close
    • __doc__fdopen

      public static PyString __doc__fdopen
    • __doc__fdatasync

      public static PyString __doc__fdatasync
    • __doc__fsync

      public static PyString __doc__fsync
    • __doc__ftruncate

      public static PyString __doc__ftruncate
    • __doc__getcwd

      public static PyString __doc__getcwd
    • __doc__getcwdu

      public static PyString __doc__getcwdu
    • __doc__getegid

      public static PyString __doc__getegid
    • __doc__geteuid

      public static PyString __doc__geteuid
    • __doc__getgid

      public static PyString __doc__getgid
    • __doc__getlogin

      public static PyString __doc__getlogin
    • __doc__getppid

      public static PyString __doc__getppid
    • __doc__getuid

      public static PyString __doc__getuid
    • __doc__getpid

      public static PyString __doc__getpid
    • __doc__getpgrp

      public static PyString __doc__getpgrp
    • __doc__isatty

      public static PyString __doc__isatty
    • __doc__kill

      public static PyString __doc__kill
    • __doc__lchmod

      public static PyString __doc__lchmod
    • __doc__lchown

      public static PyString __doc__lchown
    • __doc__listdir

      public static PyString __doc__listdir
    • __doc__lseek

      public static PyString __doc__lseek
    • __doc__mkdir

      public static PyString __doc__mkdir
    • __doc__open

      public static PyString __doc__open
    • __doc__pipe

      public static PyString __doc__pipe
    • __doc__popen

      public static PyString __doc__popen
    • __doc__putenv

      public static PyString __doc__putenv
    • __doc__read

      public static PyString __doc__read
    • __doc__remove

      public static PyString __doc__remove
    • __doc__rename

      public static PyString __doc__rename
    • __doc__rmdir

      public static PyString __doc__rmdir
    • __doc__setpgrp

      public static PyString __doc__setpgrp
    • __doc__setsid

      public static PyString __doc__setsid
    • __doc__strerror

      public static PyString __doc__strerror
    • __doc__times

      public static PyString __doc__times
    • __doc__umask

      public static PyString __doc__umask
    • __doc__uname

      public static PyString __doc__uname
    • __doc__utime

      public static PyString __doc__utime
    • __doc__wait

      public static PyString __doc__wait
    • __doc__waitpid

      public static PyString __doc__waitpid
    • __doc__write

      public static PyString __doc__write
    • __doc__unsetenv

      public static PyString __doc__unsetenv
    • __doc__urandom

      public static PyString __doc__urandom
  • Constructor Details

    • PosixModule

      public PosixModule()
  • Method Details

    • classDictInit

      public static void classDictInit(PyObject dict)
    • _exit

      public static void _exit()
    • _exit

      public static void _exit(int status)
    • access

      public static boolean access(PyObject path, int mode)
    • chdir

      public static void chdir(PyObject path)
    • chmod

      public static void chmod(PyObject path, int mode)
    • chown

      public static void chown(PyObject path, int uid, int gid)
    • close

      public static void close(PyObject fd)
    • closerange

      public static void closerange(PyObject fd_lowObj, PyObject fd_highObj)
    • fdopen

      public static PyObject fdopen(PyObject fd)
    • fdopen

      public static PyObject fdopen(PyObject fd, String mode)
    • fdopen

      public static PyObject fdopen(PyObject fd, String mode, int bufsize)
    • fdatasync

      public static void fdatasync(PyObject fd)
    • fsync

      public static void fsync(PyObject fd)
    • ftruncate

      public static void ftruncate(PyObject fd, long length)
    • getcwd

      public static PyObject getcwd()
    • getcwdu

      public static PyObject getcwdu()
    • getegid

      public static int getegid()
    • geteuid

      public static int geteuid()
    • getgid

      public static int getgid()
    • getlogin

      public static PyObject getlogin()
    • getppid

      public static int getppid()
    • getuid

      public static int getuid()
    • getpid

      public static int getpid()
    • getpgrp

      public static int getpgrp()
    • isatty

      public static boolean isatty(PyObject fdObj)
    • kill

      public static void kill(int pid, int sig)
    • lchmod

      public static void lchmod(PyObject path, int mode)
    • lchown

      public static void lchown(PyObject path, int uid, int gid)
    • link

      public static void link(PyObject src, PyObject dst)
    • listdir

      public static PyList listdir(PyObject path)
    • lseek

      public static long lseek(PyObject fd, long pos, int how)
    • mkdir

      public static void mkdir(PyObject path)
    • mkdir

      public static void mkdir(PyObject path, int mode)
    • open

      public static FileIO open(PyObject path, int flag)
    • open

      public static FileIO open(PyObject path, int flag, int mode)
    • pipe

      public static PyTuple pipe()
    • popen

      public static PyObject popen(PyObject[] args, String[] kwds)
    • putenv

      public static void putenv(String key, String value)
    • read

      public static PyObject read(PyObject fd, int buffersize)
    • readlink

      public static PyString readlink(PyObject path)
    • remove

      public static void remove(PyObject path)
    • rename

      public static void rename(PyObject oldpath, PyObject newpath)
    • rmdir

      public static void rmdir(PyObject path)
    • setpgrp

      public static void setpgrp()
    • setsid

      public static void setsid()
    • strerror

      public static PyObject strerror(int code)
    • symlink

      public static void symlink(PyObject src, PyObject dst)
    • times

      public static PyTuple times()
    • umask

      public static int umask(int mask)
    • uname

      public static PyTuple uname()
      Resembles CPython's uname with the addition that we also attempt a Windows-equivalent variant on win-systems. Implementation overview:

      Original/CPython (POSIX only):
      (uname -s, uname -n, uname -r, uname -v, uname -m)

      This version (non-Windows):
      (property os.name, InetAddress.getLocalHost().getHostName(), property os.version, uname -v, uname -m)

      Adjustments on OSX:
      Normalize "Mac OS X" to "Darwin",
      uname -r instead of property os.version

      Fallbacks:
      nodename/uname -n: exec uname -n
      version/uname -v: ""
      machine/uname -m: property os.arch

      This version (Windows):
      (reproduces platform.uname behavior on Windows)
      ("Windows", InetAddress.getLocalHost().getHostName(), property os.name: part after "Windows", cmd.exe /C ver: part after "Version", env PROCESSOR_ARCHITECTURE)

      Fallback for nodename/uname -n on Windows:
      - env USERDOMAIN
      - exec hostname

      For machine-entry on Windows this is a simplified description. It is actually mapped to typical uname -m values as follows (pseudo-code):

      PROCESSOR_ARCHITECTURE = x86 and PROCESSOR_ARCHITEW6432 undefined: "x86"
      else if PROCESSOR_ARCHITECTURE = x86: PROCESSOR_ARCHITEW6432 else: PROCESSOR_ARCHITECTURE

      Potential flaws:
      - could be a 32-bit machine, but actually not i686
      - user might need to discriminate AMD64 from EM64T

      In the rare case that your application is sensitive to one of these flaws you shouldn't be using our uname-hack for Windows, but directly look at PROCESSOR_ARCHITECTURE and friends.
      Returns:
      PyTuple containing sysname, nodename, release, version, machine
    • unlink

      public static void unlink(PyObject path)
    • utime

      public static void utime(PyObject path, PyObject times)
    • wait$

      public static PyObject wait$()
    • waitpid

      public static PyObject waitpid(int pid, int options)
    • write

      public static int write(PyObject fd, PyObject bytes)
    • unsetenv

      public static void unsetenv(String key)
    • urandom

      public static PyObject urandom(int n)
    • _get_shell_commands

      public static PyObject _get_shell_commands()
      Helper function for the subprocess module, returns the potential shell commands for this OS.
      Returns:
      a tuple of lists of command line arguments. E.g. (['/bin/sh', '-c'])
    • getPOSIX

      public static jnr.posix.POSIX getPOSIX()
    • getOSName

      public static String getOSName()