mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-22 07:09:18 +02:00
Adding file-lock interface to flock(2) to (chibi filesystem).
This commit is contained in:
parent
82752174c2
commit
20aa69033c
2 changed files with 15 additions and 0 deletions
|
@ -29,6 +29,8 @@
|
|||
open/read open/write open/read-write
|
||||
open/create open/exclusive open/truncate
|
||||
open/append open/non-block
|
||||
file-lock
|
||||
lock/shared lock/exclusive lock/non-blocking lock/unlock
|
||||
is-a-tty?)
|
||||
(import (chibi) (chibi string))
|
||||
(include-shared "filesystem")
|
||||
|
|
|
@ -185,6 +185,19 @@
|
|||
;;> File opening modes.
|
||||
;;/
|
||||
|
||||
;;> Applies the specified locking operation using flock(2) to the port
|
||||
;;> or file-descriptor.
|
||||
|
||||
(define-c errno (file-lock "flock") (port-or-fileno int))
|
||||
|
||||
(define-c-const int (lock/shared "LOCK_SH"))
|
||||
(define-c-const int (lock/exclusive "LOCK_EX"))
|
||||
(define-c-const int (lock/non-blocking "LOCK_NB"))
|
||||
(define-c-const int (lock/unlock "LOCK_UN"))
|
||||
|
||||
;;> Locking operations.
|
||||
;;/
|
||||
|
||||
;;> Returns \scheme{#t} if the given port of file descriptor
|
||||
;;> if backed by a TTY object, and \scheme{#f} otherwise.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue