diff options
| author | Alejandro Colomar <alx@kernel.org> | 2023-03-17 17:08:01 +0100 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2023-03-30 15:14:55 +0200 |
| commit | 4131356cdab8d37fc395ca5466a0401c8573380c (patch) | |
| tree | 8c4c6f1c3172358b735b481cbbfdd9cc04b00ed9 /man3/getcwd.3 | |
| parent | fd00f831b52d61a91d59cb3b46182869145d9700 (diff) | |
| download | man-pages-4131356cdab8.tar.gz | |
man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sections
- Add a new HISTORY section that covers the history of an API, both
regarding implementations and regarding old standards. This was
previously covered in VERSIONS, and in some cases in STANDARDS.
- Repurpose VERSIONS to cover differing implementations in _current_
systems.
- STANDARDS is reduced to only cover current versions of standards.
That basically means only C11 (C99 has been superseeded by C11; C17
is just a bugfix of C11, so not really a new version), and
POSIX.1-2008 (*-2001 was superseeded by *-2008; *-2017 was just a
bugfix for *-2008). The section also mentions for example 'Linux',
'GNU' or 'BSD' when a non-standard API is Linux- or GNU-only or if
it's (de-facto) standard in the BSDs.
- In some cases content that should go into one of these sections was
in NOTES. Move it from there to where it corresponds.
- In the SYNOPSIS, I added [[deprecated]] in some functions that I
found are deprecated by the relevant standards.
- A few other related changes...
Cc: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'man3/getcwd.3')
| -rw-r--r-- | man3/getcwd.3 | 77 |
1 files changed, 43 insertions, 34 deletions
diff --git a/man3/getcwd.3 b/man3/getcwd.3 index e591b439ea..6ad8292205 100644 --- a/man3/getcwd.3 +++ b/man3/getcwd.3 @@ -203,48 +203,17 @@ T} Thread safety MT-Safe env .hy .ad .sp 1 -.SH STANDARDS -.BR getcwd () -conforms to POSIX.1-2001. -Note however that POSIX.1-2001 leaves the behavior of +.SH VERSIONS +POSIX.1-2001 leaves the behavior of .BR getcwd () unspecified if .I buf is NULL. .PP -.BR getwd () -is present in POSIX.1-2001, but marked LEGACY. -POSIX.1-2008 removes the specification of -.BR getwd (). -Use -.BR getcwd () -instead. POSIX.1-2001 does not define any errors for .BR getwd (). -.PP -.BR get_current_dir_name () -is a GNU extension. -.SH NOTES -Under Linux, these functions make use of the -.BR getcwd () -system call (available since Linux 2.1.92). -On older systems they would query -.IR /proc/self/cwd . -If both system call and proc filesystem are missing, a -generic implementation is called. -Only in that case can -these calls fail under Linux with -.BR EACCES . -.PP -These functions are often used to save the location of the current working -directory for the purpose of returning to it later. -Opening the current -directory (".") and calling -.BR fchdir (2) -to return is usually a faster and more reliable alternative when sufficiently -many file descriptors are available, especially on platforms other than Linux. -.\" +.SH VERSIONS .SS C library/kernel differences On Linux, the kernel provides a .BR getcwd () @@ -282,6 +251,46 @@ functions described in this page should consider checking whether the returned pathname starts with '/' or '(' to avoid misinterpreting an unreachable path as a relative pathname. +.SH STANDARDS +.TP +.BR getcwd () +POSIX.1-2008. +.TP +.BR get_current_dir_name () +GNU. +.TP +.BR getwd () +None. +.SH HISTORY +.TP +.BR getcwd () +POSIX.1-2001. +.TP +.BR getwd () +POSIX.1-2001, but marked LEGACY. +Removed in POSIX.1-2008. +Use +.BR getcwd () +instead. +.PP +Under Linux, these functions make use of the +.BR getcwd () +system call (available since Linux 2.1.92). +On older systems they would query +.IR /proc/self/cwd . +If both system call and proc filesystem are missing, a +generic implementation is called. +Only in that case can +these calls fail under Linux with +.BR EACCES . +.SH NOTES +These functions are often used to save the location of the current working +directory for the purpose of returning to it later. +Opening the current +directory (".") and calling +.BR fchdir (2) +to return is usually a faster and more reliable alternative when sufficiently +many file descriptors are available, especially on platforms other than Linux. .SH BUGS Since the Linux 2.6.36 change that added "(unreachable)" in the circumstances described above, the glibc implementation of |
