Skip to content

Commit 7d6835c

Browse files
committed
Release pledge v1.8
1 parent 05197af commit 7d6835c

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

libc/calls/read.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,27 @@
3535
*
3636
* This function changes the current file position. For documentation
3737
* on file position behaviors and gotchas, see the lseek() function.
38+
* This function may be used on socket file descriptors, including on
39+
* Windows.
3840
*
3941
* @param fd is something open()'d earlier
4042
* @param buf is copied into, cf. copy_file_range(), sendfile(), etc.
4143
* @param size in range [1..0x7ffff000] is reasonable
4244
* @return [1..size] bytes on success, 0 on EOF, or -1 w/ errno; with
4345
* exception of size==0, in which case return zero means no error
46+
* @raise EBADF if `fd` is negative or not an open file descriptor
47+
* @raise EBADF if `fd` is open in `O_WRONLY` mode
48+
* @raise EFAULT if `size` is nonzero and `buf` points to bad memory
49+
* @raise EPERM if pledge() is in play without the stdio promise
50+
* @raise EIO if low-level i/o error happened
51+
* @raise EINTR if signal was delivered instead
52+
* @raise ENOTCONN if `fd` is a socket and it isn't connected
53+
* @raise ECONNRESET if socket peer forcibly closed connection
54+
* @raise ETIMEDOUT if socket transmission timeout occurred
55+
* @raise EAGAIN if `O_NONBLOCK` is in play and read needs to block,
56+
* or `SO_RCVTIMEO` is in play and the time interval elapsed
57+
* @raise ENOBUFS is specified by POSIX
58+
* @raise ENXIO is specified by POSIX
4459
* @asyncsignalsafe
4560
* @restartable
4661
* @vforksafe

libc/calls/write.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*
3434
* This function changes the current file position. For documentation
3535
* on file position behaviors and gotchas, see the lseek() function.
36+
* This function may be used on socket file descriptors, including on
37+
* Windows.
3638
*
3739
* @param fd is open file descriptor
3840
* @param buf is copied from, cf. copy_file_range(), sendfile(), etc.

tool/build/pledge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
╚─────────────────────────────────────────────────────────────────────────────*/
1919
#include "libc/assert.h"
2020
#include "libc/calls/calls.h"
21-
#include "libc/mem/copyfd.internal.h"
2221
#include "libc/calls/landlock.h"
2322
#include "libc/calls/pledge.h"
2423
#include "libc/calls/pledge.internal.h"
@@ -40,6 +39,7 @@
4039
#include "libc/intrin/safemacros.internal.h"
4140
#include "libc/macros.internal.h"
4241
#include "libc/math.h"
42+
#include "libc/mem/copyfd.internal.h"
4343
#include "libc/mem/gc.internal.h"
4444
#include "libc/mem/mem.h"
4545
#include "libc/nexgen32e/kcpuids.h"
@@ -115,7 +115,7 @@ usage: pledge.com [-hnN] PROG ARGS...\n\
115115
- vminfo: allows /proc/stat, /proc/self/maps, etc.\n\
116116
- tmppath: allows /tmp, $TMPPATH, lstat, unlink\n\
117117
\n\
118-
pledge.com v1.7\n\
118+
pledge.com v1.8\n\
119119
copyright 2022 justine alexandra roberts tunney\n\
120120
https://twitter.com/justinetunney\n\
121121
https://linkedin.com/in/jtunney\n\

0 commit comments

Comments
 (0)