posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_FILE_LOCKING
Implementation completeness: 100.0%100IMPLLine coverage: 90.0%90COVLinux compatibility tests: passing🐧

POSIX File Locking option group. More...

Data Structures

struct  flock
 File segment locking structure used with F_GETLK, F_SETLK, and F_SETLKW. More...
 

Macros

#define F_GETLK   ZVFS_F_GETLK
 Get the first lock that blocks the lock described by the argument.
 
#define F_SETLK   ZVFS_F_SETLK
 Set or clear a file segment lock (non-blocking).
 
#define F_SETLKW   ZVFS_F_SETLKW
 Set or clear a file segment lock (blocking).
 
#define F_RDLCK   ZVFS_F_RDLCK
 Lock type: shared read lock.
 
#define F_UNLCK   ZVFS_F_UNLCK
 Lock type: unlock (release a lock).
 
#define F_WRLCK   ZVFS_F_WRLCK
 Lock type: exclusive write lock.
 

Functions

void flockfile (FILE *file)
 Acquire a stdio stream lock.
 
int ftrylockfile (FILE *file)
 Try to acquire a stdio stream lock without blocking.
 
void funlockfile (FILE *file)
 Release a stdio stream lock.
 
int getc_unlocked (FILE *stream)
 Read a byte from a stream without acquiring the stream lock.
 
int getchar_unlocked (void)
 Read a byte from stdin without acquiring the stream lock.
 
int putc_unlocked (int c, FILE *stream)
 Write a byte to a stream without acquiring the stream lock.
 
int putchar_unlocked (int c)
 Write a byte to stdout without acquiring the stream lock.
 

Detailed Description

POSIX File Locking option group.

Macro Definition Documentation

◆ F_GETLK

#define F_GETLK   ZVFS_F_GETLK

Get the first lock that blocks the lock described by the argument.

Definition at line 48 of file fcntl.h.

◆ F_RDLCK

#define F_RDLCK   ZVFS_F_RDLCK

Lock type: shared read lock.

Definition at line 66 of file fcntl.h.

◆ F_SETLK

#define F_SETLK   ZVFS_F_SETLK

Set or clear a file segment lock (non-blocking).

Definition at line 50 of file fcntl.h.

◆ F_SETLKW

#define F_SETLKW   ZVFS_F_SETLKW

Set or clear a file segment lock (blocking).

Definition at line 52 of file fcntl.h.

◆ F_UNLCK

#define F_UNLCK   ZVFS_F_UNLCK

Lock type: unlock (release a lock).

Definition at line 68 of file fcntl.h.

◆ F_WRLCK

#define F_WRLCK   ZVFS_F_WRLCK

Lock type: exclusive write lock.

Definition at line 70 of file fcntl.h.

Function Documentation

◆ flockfile()

void flockfile ( FILE *  file)
flockfile line coverage: 90.0%90Linux compatibility tests: passing🐧

Acquire a stdio stream lock.

Parameters
fileStream to lock.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/flockfile.html

◆ ftrylockfile()

int ftrylockfile ( FILE *  file)
Linux compatibility tests: passing🐧

Try to acquire a stdio stream lock without blocking.

Parameters
fileStream to lock.
Returns
0 if the lock was acquired, non-zero otherwise.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftrylockfile.html

◆ funlockfile()

void funlockfile ( FILE *  file)
Linux compatibility tests: passing🐧

Release a stdio stream lock.

Parameters
fileStream to unlock.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/funlockfile.html

◆ getc_unlocked()

int getc_unlocked ( FILE *  stream)
Linux compatibility tests: passing🐧

Read a byte from a stream without acquiring the stream lock.

Parameters
streamStream to read from.
Returns
Byte read as an unsigned char cast to int, or EOF.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getc_unlocked.html

◆ getchar_unlocked()

int getchar_unlocked ( void  )
Linux compatibility tests: passing🐧

Read a byte from stdin without acquiring the stream lock.

Returns
Byte read as an unsigned char cast to int, or EOF.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getchar_unlocked.html

◆ putc_unlocked()

int putc_unlocked ( int  c,
FILE *  stream 
)
Linux compatibility tests: passing🐧

Write a byte to a stream without acquiring the stream lock.

Parameters
cByte to write.
streamStream to write to.
Returns
Byte written as an unsigned char cast to int, or EOF.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/putc_unlocked.html

◆ putchar_unlocked()

int putchar_unlocked ( int  c)
Linux compatibility tests: passing🐧

Write a byte to stdout without acquiring the stream lock.

Parameters
cByte to write.
Returns
Byte written as an unsigned char cast to int, or EOF.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/putchar_unlocked.html