Skip to content

Commit

Permalink
doc: add missing ctype.h, sys/stat.h, stdlib.h descriptions
Browse files Browse the repository at this point in the history
JIRA: CI-269
  • Loading branch information
maska989 committed Aug 2, 2023
1 parent 3e432b8 commit 782ff21
Show file tree
Hide file tree
Showing 21 changed files with 793 additions and 26 deletions.
21 changes: 20 additions & 1 deletion libc/functions/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Functions

## _
## \_

[`_exit`](./_/_Exit.part-impl.md) <!-- #updated# -->
[`_Exit`](./_/_Exit.part-impl.md) <!-- #updated# -->
Expand Down Expand Up @@ -99,13 +99,15 @@ endthread,
[`fputc`](./f/fputc.part-impl.md), <!-- updated -->
[`fputs`](./f/fputs.part-impl.md), <!-- updated -->
[`fread`](./f/fread.part-impl.md), <!-- updated -->
[`free`](./f/free.part-impl.md), <!-- updated -->
[`freeaddrinfo`](./g/getaddrinfo.part-impl.md), <!-- updated -->
[`freopen`](./f/freopen.part-impl.md), <!-- updated -->
[`frexp`](./f/frexp.part-impl.md), <!-- updated -->
[`frexpf`](./f/frexp.part-impl.md), <!-- updated -->
[`fscanf`](./f/fscanf.part-impl.md), <!-- updated -->
[`fseek`](./f/fseek.part-impl.md), <!-- updated -->
[`fseeko`](./f/fseek.part-impl.md), <!-- updated -->
[`fstat`](./f/fstat.part-impl.md), <!-- updated -->
[`fstatat`](./s/stat.part-impl.md), <!-- updated -->
[`fsync`](./f/fsync.not-impl.md), <!-- updated -->
[`ftell`](./f/ftell.part-impl.md), <!-- updated -->
Expand Down Expand Up @@ -146,8 +148,20 @@ gettime,
## i

interrupt,
[`isalnum`](./i/isalnum.part-impl.md), <!-- updated -->
[`isalpha`](./i/isalpha.part-impl.md), <!-- updated -->
[`isatty`](./i/isatty.part-impl.md), <!-- updated -->
[`ioctl`](./i/ioctl.part-impl.md), <!-- updated -->
[`isblank`](./i/isblank.part-impl.md), <!-- updated -->
[`iscntrl`](./i/iscntrl.part-impl.md), <!-- updated -->
[`isdigit`](./i/isdigit.part-impl.md), <!-- updated -->
[`isgraph`](./i/isgraph.part-impl.md), <!-- updated -->
[`islower`](./i/islower.part-impl.md), <!-- updated -->
[`isprint`](./i/isprint.part-impl.md), <!-- updated -->
[`ispunct`](./i/ispunct.part-impl.md), <!-- updated -->
[`isspace`](./i/isspace.part-impl.md), <!-- updated -->
[`isupper`](./i/isupper.part-impl.md), <!-- updated -->
[`isxdigit`](./i/isxdigit.part-impl.md), <!-- updated -->

## k

Expand Down Expand Up @@ -285,13 +299,16 @@ resourceDestroy,
[`strcoll`](./s/strcoll.part-impl.md), <!-- updated -->
[`strcpy`](./s/strcpy.part-impl.md), <!-- updated -->
[`strcspn`](./s/strcspn.part-impl.md), <!-- updated -->
[`strdup`](./s/strdup.part-impl.md), <!-- updated -->
[`strerror`](./s/strerror.part-impl.md), <!-- updated -->
[`strlen`](./s/strlen.part-impl.md), <!-- updated -->
[`strncat`](./s/strncat.part-impl.md), <!-- updated -->
[`strncmp`](./s/strncmp.part-impl.md), <!-- updated -->
[`strncmp`](./s/strncmp.part-impl.md), <!-- updated -->
[`strncpy`](./s/strncpy.part-impl.md), <!-- updated -->
[`strpbrk`](./s/strpbrk.part-impl.md), <!-- updated -->
[`strrchr`](./s/strrchr.part-impl.md), <!-- updated -->
[`strsignal`](./s/strsignal.part-impl.md), <!-- updated -->
[`strspn`](./s/strspn.part-impl.md), <!-- updated -->
[`strstr`](./s/strstr.part-impl.md), <!-- updated -->
[`strtod`](./s/strtod.part-impl.md), <!-- updated -->
Expand Down Expand Up @@ -325,6 +342,8 @@ timeGet,
timeSet,
[`tmpfile`](./t/tmpfile.part-impl.md), <!-- #updated# -->
[`tmpnam`](./t/tmpnam.part-impl.md), <!-- #updated# -->
[`tolower`](./t/tolower.part-impl.md), <!-- #updated# -->
[`toupper`](./t/toupper.part-impl.md), <!-- #updated# -->
[`truncate`](./t/truncate.part-impl.md), <!-- updated -->
[`ttyname`](./t/ttyname.not-impl.md), <!-- updated -->
[`ttyname_r`](./t/ttyname.not-impl.md), <!-- updated -->
Expand Down
25 changes: 0 additions & 25 deletions libc/functions/f/free.impl.md

This file was deleted.

36 changes: 36 additions & 0 deletions libc/functions/f/free.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Synopsis

`#include <stdlib.h>`

`void free(void *ptr);`

## Description

The `free()` function shall cause the space pointed to by _ptr_ to be deallocated; that is, made available for further
allocation.
If _ptr_ is a null pointer, no action shall occur. Otherwise, if the argument does not match a pointer earlier returned
by a function in `POSIX.1-2017` that allocates memory as if by `malloc()`, or if the space has been deallocated by a
call to `free()` or `realloc()`, the behavior is undefined.

Any use of a pointer that refers to freed space results in undefined behavior.

## Return value

The `free()` function shall not return a value.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
61 changes: 61 additions & 0 deletions libc/functions/f/fstat.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Synopsis

`#include <sys/stat.h>`

`int fstat(int fildes, struct stat *buf);`

## Description

The `fstat()` function shall obtain information about an open file associated with the file descriptor _fildes_, and
shall write it to the area pointed to by _buf_.

If _fildes_ references a shared memory object, the implementation shall update in the _stat_ structure pointed to by the
_buf_ argument the `st_uid`, `st_gid`, `st_size`, and `st_mode` fields, and only the `S_IRUSR`, `S_IWUSR`, `S_IRGRP`,
`S_IWGRP`, `S_IROTH`, and `S_IWOTH` file permission bits need be valid. The implementation may update other fields
and flags.

The buf argument is a pointer to a _stat_ structure, as defined in `<sys/stat.h>`, into which information is placed
concerning the file.

For all other file types defined in this volume of `POSIX.1-2017`, the structure members `st_mode`, `st_ino`, `st_dev`,
`st_uid`, `st_gid`, `st_atim`, `st_ctim`, and `st_mtim` shall have meaningful values and the value of the `st_nlink`
member shall be set to the number of links to the file.

An implementation that provides additional or alternative file access control mechanisms may, under
implementation-defined conditions, cause `fstat()` to fail.

The `fstat()` function shall update any time-related fields (as described in XBD File Times Update), before writing into
the _stat_ structure.

## Return value

Upon successful completion, `0` shall be returned. Otherwise, `-1` shall be returned and _errno_ set to indicate the
error.

## Errors

The `fstat()` function shall fail if:

- `[EBADF]` - The _fildes_ argument is not a valid file descriptor.

- `[EIO]` - An _I/O_ error occurred while reading from the file system.

- `[EOVERFLOW]` - The file size in bytes or the number of blocks allocated to the file or the file serial number cannot
be represented correctly in the structure pointed to by _buf_.

The `fstat()` function may fail if:

- `[EOVERFLOW]`- One of the values is too large to store into the structure pointed to by the _buf_ argument.

## Tests

Untested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
33 changes: 33 additions & 0 deletions libc/functions/i/isalnum.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Synopsis

`#include <ctype.h>`

`int isalnum(int c);`

## Description

The `isalnum()` function shall test whether _c_ is a character of class _alpha_ or _digit_ in the current locale.

The _c_ argument is an int, the value of which the application shall ensure is representable as a `unsigned char` or
equal to the value of the macro `EOF`. If the argument has any other value, the behavior is undefined.

## Return value

The `isalnum()` function shall return non-zero if _c_ is an alphanumeric character, otherwise shall return `0`.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
33 changes: 33 additions & 0 deletions libc/functions/i/isalpha.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Synopsis

`#include <ctype.h>`

`int isalpha(int c);`

## Description

The `isalpha()` function shall test whether _c_ is a character of class _alpha_ in the current locale.

The _c_ argument is an int, the value of which the application shall ensure is representable as a `unsigned char` or
equal to the value of the macro `EOF`. If the argument has any other value, the behavior is undefined.

## Return value

The `isalpha()` function shall return non-zero if _c_ is an alphanumeric character, otherwise shall return `0`.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
34 changes: 34 additions & 0 deletions libc/functions/i/isblank.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Synopsis

`#include <ctype.h>`

`int isblank(int c);`

## Description

The `isblank()` function shall test whether _c_ is a character of class _blank_ in the current locale.

The _c_ argument is a type int, the value of which the application shall ensure is a character representable as a
`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is
undefined.

## Return value

The `isblank()` function shall return non-zero if _c_ is a `<blank>`, otherwise shall return `0`.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
34 changes: 34 additions & 0 deletions libc/functions/i/iscntrl.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Synopsis

`#include <ctype.h>`

`int iscntrl(int c);`

## Description

The `iscntrl()` function shall test whether _c_ is a character of class _cntrl_ in the current locale.

The _c_ argument is a type int, the value of which the application shall ensure is a character representable as a
`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is
undefined.

## Return value

The `iscntrl()` function shall return non-zero if _c_ is a control character, otherwise shall return `0`.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
34 changes: 34 additions & 0 deletions libc/functions/i/isdigit.part-impl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Synopsis

`#include <ctype.h>`

`int isdigit(int c);`

## Description

The `isdigit()` function shall test whether _c_ is a character of class _digit_ in the current locale.

The _c_ argument is an int, the value of which the application shall ensure is a character representable as a
`unsigned char` or equal to the value of the macro `EOF`. If the argument has any other value, the behavior is
undefined.

## Return value

The `isdigit()` function shall return non-zero if _c_ is decimal digit, otherwise shall return `0`.

## Errors

No errors are defined.

## Tests

Tested

## Known bugs

None

## See Also

1. [Standard library functions](../README.md)
2. [Table of Contents](../../../README.md)
Loading

0 comments on commit 782ff21

Please sign in to comment.