File Systems and I/O



unix:uread stream [buffer] [size] [function]

reads size bytes from stream. stream may either be a stream object or an integer representing fd. If buffer is given, the input is stored there. Otherwise, input goes to the buffer-string in stream. Therefore, if stream is fd, buffer must be given. unix:uread never allocates a new string buffer. unix:uread returns the byte count actually read.


unix:write stream string &optional size [function]

writes size bytes of string to stream. If size is omitted, the full length of string is output.


unix:fcntl stream command argument [function]



unix:ioctl stream command buffer [function]


unix:ioctl_ stream command1 command2 [function]


unix:ioctl_R stream command1 command2 buffer [size] [function]


unix:ioctl_W stream command1 command2 buffer [size] [function]


unix:ioctl_WR stream command1 command2 buffer [size] [function]


unix:close fd [function]
close a file specifying its file descriptor fd.


unix:dup fd [function]
returns the duplicated file descriptor for fd.


unix:pipe [function]
creates a pipe. An io-stream for this pipe is returned.


unix:lseek stream position [whence 0] [function]
sets the file pointer for stream at position counted from whence.


unix:link path1 path2 [function]

makes a hard link.


unix:unlink path [function]

removes a hard link to the file specified by path. If no reference to the file lefts, it is deleted.


unix:mknod path mode [function]

makes inode in a file system. path must be a string, not a pathname object.


unix:access path mode [function]
checks the access rights to path.


unix:stat path [function]
gets inode information of path and returns a list of integers described below.


  st_ctime	; file last status change time
  st_mtime	; file last modify time
  st_atime	; file last access time
  st_size	; total size of file, in bytes
  st_gid	; group ID of owne
  st_uid	; user ID of owner
  st_nlink	; number of hard links to the file
  st_rdev	; the device identifier (special files only)
  st_dev	; device file resides on
  st_ino	; the file serial number
  st_mode	; file mode
unix:chdir path [function]
changes the current working directory to path.


unix:getwd [function]
gets current working directory.


unix:chmod path integer [function]

changes access mode (permission) for path.


unix:chown path integer [function]
changes the owner of the file path.


unix:isatty (stream $\vert$ fd) [function]

returns T if stream is connected to a tty-type device (a serial port or a pseudo tty) .


unix:msgget key mode [function]

creates or allocates a message queue which is addressed by key.


unix:msgsnd qid buf [mtype [flag]] [function]


unix:msgrcv qid buf [size [mtype [flag]]] [function]


unix:socket domain type &optional proto [function]

creates a socket whose name is defined in domain and whose abstract type is type. type should be one of 1 (SOCK_STREAM), 2 (SOCK_DGRAM), 3 (SOCK_RAW), 4 (SOCK_RDM) and 5 (SOCK_SEQPACKET).


unix:bind socket name [function]
associates name to socket. name should be a unix path-name if the socket is defined in unix-domain.


unix:connect socket addr [function]
connects socket to another socket specified by addr.


unix:listen socket &optional backlog [function]
begins to accept connection request on socket. backlog specifies the length of the queue waiting for the establishment of connection.


unix:accept socket [function]
accepts the connection request on socket and returns a file-descriptor on which messages can be exchanged bidirectionally.


unix:recvfrom socket &optional mesg from flag [function]
receives a datagram message from socket. The socket must be assigned a name by unix:bind. mesg is a string in which the incoming message will be stored. If mesg is given, recvfrom returns the number of bytes received. If it is omitted, a new string is created for the storage of the message and returned.


unix:sendto socket addr mesg &optional len flag [function]
sends a datagram message to another socket specified by addr. Socket must be a datagram-type socket which has no name assigned. Mesg is a string to be sent and len is the length of the message counting from the beginning of the string. If omitted, whole string is sent.


unix:getservbyname servicename [function]

returns the service number (integer) for servicename registered in /etc/services or in NIS database.


unix:gethostbyname hostname [function]

returns the list of ip address of hostname and its address type (currently always AF_INET==2).


unix:syserrlist errno [function]

returns a string describing the error information for the error code errno.


k-okada 2013-05-21