mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Improve docs of more system calls
This change also found a few POSIX compliance bugs with errnos. Another bug was discovered where, on Windows, pread() and pwrite() could modify the file position in cases where ReadFile() returned an error e.g. when seeking past the end of file. We also have more tests!
This commit is contained in:
parent
af24c19db3
commit
ccbae7799e
39 changed files with 589 additions and 175 deletions
|
@ -16,18 +16,26 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/assert.h"
|
||||
#include "libc/calls/syscall-nt.internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
|
||||
/**
|
||||
* Returns parent process id.
|
||||
*
|
||||
* @return parent process id (always successful)
|
||||
* @note slow on Windows; needs to iterate process tree
|
||||
* @asyncsignalsafe
|
||||
* @threadsafe
|
||||
* @vforksafe
|
||||
*/
|
||||
int getppid(void) {
|
||||
int rc;
|
||||
if (!IsWindows()) {
|
||||
if (IsMetal()) {
|
||||
rc = 1;
|
||||
} else if (!IsWindows()) {
|
||||
if (!IsNetbsd()) {
|
||||
rc = sys_getppid();
|
||||
} else {
|
||||
|
@ -36,6 +44,7 @@ int getppid(void) {
|
|||
} else {
|
||||
rc = sys_getppid_nt();
|
||||
}
|
||||
STRACE("getppid() → %d% m", rc);
|
||||
_npassert(rc >= 0);
|
||||
STRACE("%s() → %d", "getppid", rc);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue