Lichen

lib/posix/io.py

601:adcdaeb19307
2017-02-19 Paul Boddie Fixed the context test and set operation to replace the local context with any applicable attribute context. Added a test of method rebinding that requires this fix. method-wrapper-for-context
     1 #!/usr/bin/env python     2      3 """     4 POSIX input/output functions.     5      6 Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>     7      8 This program is free software; you can redistribute it and/or modify it under     9 the terms of the GNU General Public License as published by the Free Software    10 Foundation; either version 3 of the License, or (at your option) any later    11 version.    12     13 This program is distributed in the hope that it will be useful, but WITHOUT    14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    15 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    16 details.    17     18 You should have received a copy of the GNU General Public License along with    19 this program.  If not, see <http://www.gnu.org/licenses/>.    20 """    21     22 from libc.io import close, fdopen, read, write    23     24 def closerange(fd_low, fd_high): pass    25 def dup(fd): pass    26 def dup2(old_fd, new_fd): pass    27 def fchdir(fd): pass    28 def fchmod(fd, mode): pass    29 def fchown(fd, uid, gid): pass    30 def fdatasync(fd): pass    31 def fpathconf(fd, name): pass    32 def fstat(fd): pass    33 def fstatvfs(fd): pass    34 def fsync(fd): pass    35 def ftruncate(fd, length): pass    36 def isatty(fd): pass    37     38 SEEK_CUR = 1    39 SEEK_END = 2    40 SEEK_SET = 0    41     42 def lseek(fd, pos, how): pass    43 def open(filename, flag, mode=0777): pass    44 def openpty(): pass    45 def pipe(): pass    46 def putenv(key, value): pass    47 def times(): pass    48 def ttyname(fd): pass    49 def umask(new_mask): pass    50 def uname(): pass    51 def unsetenv(key): pass    52     53 # Constants.    54     55 O_APPEND = 1024    56 O_ASYNC = 8192    57 O_CREAT = 64    58 O_DIRECT = 16384    59 O_DIRECTORY = 65536    60 O_DSYNC = 4096    61 O_EXCL = 128    62 O_LARGEFILE = 32768    63 O_NDELAY = 2048    64 O_NOATIME = 262144    65 O_NOCTTY = 256    66 O_NOFOLLOW = 131072    67 O_NONBLOCK = 2048    68 O_RDONLY = 0    69 O_RDWR = 2    70 O_RSYNC = 1052672    71 O_SYNC = 1052672    72 O_TRUNC = 512    73 O_WRONLY = 1    74     75 # vim: tabstop=4 expandtab shiftwidth=4