VSL - The system.posix.unistd Structure

# Copyright 2011  Petter Urkedal
#
# This file is part of the Viz Standard Library <http://www.vizlang.org/>.
#
# The Viz Standard Library (VSL) is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# The VSL is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the VSL.  If not, see <http://www.gnu.org/licenses/>.


# Z.  POSIX Functions from "unistd.h"

open prelude.ubiquitous
open data
open effect
open:c "unistd.h"

use cabi.stub_prefix "cviz_posix_"

val access : string  int  io bool

val:c chdir : string  io int

val:c chown : string  int  int  io int

val:c close : int  io int
val:c dup : int  io int
val:c dup2 : int  int  io int

val:c fchown : int  int  int  io int
val:c fchdir : int  io int
val:c fdatasync : int  io int
val:c fsync : int  io int

val:c getegid : io int
val:c geteuid : io int
val:c getgid : io int

val:c getlogin : io string

val:c gethostid : io int32

val:c getpid : io int
val:c getppid : io int

val:c getuid : io int

val:c isatty : int  io bool

val:c lchown : string  int  int  io int

val:c link : string  string  io int

val:c nice : int  io int

val:c rmdir : string  io int

val:c setegid : int  io int

val:c seteuid : int  io int

val:c setgid : int  io int

val:c setregid : int  int  io int

val:c setreuid : int  int  io int

val:c setuid : int  io int

val:c sleep : int  io int

val:c symlink : string  string  io int

val:c sync : io unit

val:c unlink : string  io int

val:c usleep : int  io int


### Implementation Details

val:c _access : string  int  io int := "access"
let access p m be _access p m >>= return  (0  true; _  false)