Commit graph

228 commits

Author SHA1 Message Date
cinap_lenrek 0b33b3b8ad kernel: implement per file descriptor OCEXEC flag, reject ORCLOSE when opening /fd, /srv and /shr
The OCEXEC flag used to be maintained per channel,
making it shared between all the file desciptors.

This has a unexpected side effects with regard to
channel passing drivers such as devdup (/fd),
devsrv (/srv) and devshr (/shr).

For example, opening a /srv file with OCEXEC
makes it impossible to be remounted by exportfs
as it internally does a exec() to mount and
re-export it. There is no way to reset the flag.

This change makes the OCEXEC flag per file descriptor,
so a open with the OCEXEC flag only affects the fd
group of the calling process, and not the channel
itself.

On rfork(RFFDG), the per file descriptor flags get
copied.

On dup(), the per file descriptor flags are reset.

The second modification is that /fd, /srv and /shr
should reject the ORCLOSE flag, as the files that
are returned have already been opend.
2020-12-13 16:04:09 +01:00
Ori Bernstein 07e8c324a8 tmdate(2): remove lies
Initially the code tried to guess the date format. This
turned out to be a bit too magical, so the feature was
removed, but the manpage still documented the nonfeature.
2020-11-30 07:41:49 -08:00
Sigrid 808acd51f4 tmdate(2): failed to (p)arse 2020-11-18 20:14:26 +01:00
Sigrid 23620bb1db ctime(2): add tmdate(2) to "see also" 2020-11-18 20:11:55 +01:00
Ori Bernstein dbd54342fd libbio: add aux pointer to bio
This allows us to attach additional context
to the biobuf so can read from some sort of
data structure without a global variable.
2020-11-01 11:42:54 -08:00
Ori Bernstein 9bb519ac50 mp(2): correct documentation of error handling (thanks LordCreepity)
The documentation for mp(2) claimed we'd return nil on error, when
we actually sysfatal. This corrects the documentation to match our
actual behavior.
2020-10-24 17:24:59 -07:00
Ori Bernstein 9afa5550f7 tmdate(1): fix missing arg, fix formatting (thanks joe9) 2020-09-25 21:22:47 -07:00
Ori Bernstein eb6b1e672c merge 2020-09-25 16:51:08 -07:00
Ori Bernstein 022bc980b8 tmdate(2): fix mistakes in prototype (thanks moody) 2020-09-25 16:32:32 -07:00
Ori Bernstein 9f8d62ab64 libc: ignore '?' in date format strings
Ignoring '?' when formatting date strings allows
the format strings to be reused for parsing. This
is convenient, since we don't need to duplicate
the format strings.
2020-09-22 19:24:01 -07:00
Ori Bernstein 26cf6ec073 tmdate(1): document tz field 2020-09-12 17:36:14 -07:00
Ori Bernstein 732082c095 ctime(2), tmdate(2): document ctime/tmparse incompatibility
Tmparse and ctime don't mix. The timezone name may be
too long for the number of characters ctime mandates.
Document this footgun.
2020-09-10 16:26:42 -07:00
Ori Bernstein 703b0d3e6d tmdate(2): one more typo
no more top arse. only bottom arse.
2020-09-07 19:32:50 -07:00
Ori Bernstein ce5b6036f0 tmdate(2): fix examples, stale references (thanks deuteron)
There were a number of ideas that were tried out as the tmdate
api evolved. As a result, there were some references in the
manpage to things that are no more.

Fix them.
2020-09-07 19:28:30 -07:00
Ori Bernstein 4a1186ddfe tmdate(2): fix name of tm struct
There was a leftover from when this library was separate
with different types.
2020-09-07 18:49:00 -07:00
Ori Bernstein f444d6c3f2 tmparse: put in local timezone hack
Ctime is defined as printing a 3-character timezone
name. The timezone name is ambiguous. For example,
EST refers to both Australian and American eastern
time. On top of that, we don't want to make the
tzabbrev table exhaustive. So, we put in this hack:

Before we consult the well known table of timezones,
we check if the local time matches the timezone name.

On top of that, tm2sec

If you want unambiguous timezone parsing, use numeric
timezone offsets (Z, ZZ formats).
2020-09-01 19:32:45 -07:00
Ori Bernstein 17abfa51ca libc: tmparse should ignore leading whitespace
We almost always want to skip leading whitespace in time
formats, so make tmparse just do it. This fixes upas mbox
parsing, which leaves a leading whitespace at the start of
the date.
2020-08-26 10:23:00 -07:00
Alex Musolino 8727bfd9bd getwd(2): add reference to chdir(2) in SEE ALSO section 2020-08-25 20:51:38 +09:30
Alex Musolino 6fe18e7c7b chdir(2): add reference to getwd(2) in SEE ALSO section 2020-08-25 20:51:24 +09:30
Ori Bernstein 69c3c0e6f0 tmdate(2): fix typo (thanks mveety)
sysfata => sysfatal
2020-08-10 20:33:39 -07:00
Ori Bernstein 56e869ac70 libc: new date apis
The current date and time APIs on Plan 9 are not good. They're
inflexible, non-threadsafe, and don't expose timezone information.

This commit adds new time APIs that allow parsing arbitrary
dates, work from multiple threads, and can handle timezones
effectively.
2020-08-09 18:58:44 -07:00
kvik 359362395f graphics(2): fix typo 2020-06-28 23:45:18 +02:00
kvik f0ea4af5ef 9p(2): fix typo 2020-06-25 23:23:23 +02:00
cinap_lenrek febe84af75 libc: revert date change again. this is getting ridicuoulus.
this breaks the sample from the seconds manpage, and overall
produces funky results. this needs alot more testing.

term% seconds '23 may 2011'
seconds: tmparse: invalid date 23 may 2011 near 'may 2011'

term% seconds '2019-01-01 00:00:00'
-118370073600
2020-06-15 00:12:57 +02:00
Ori Bernstein 8b3efcfc4e libc, seconds: new time and date apis (try 2)
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.

As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.

The last commit missed a few removals, and made it
unnecessarily hard to do an update.
2020-06-14 09:33:32 -07:00
cinap_lenrek f380851ddb libc: reverting previous change until ori can fix it 2020-06-14 04:47:22 +02:00
Ori Bernstein e2ee991490 libc, seconds: new time and date apis.
Redo date handling in libc almost entirely. This allows
handling dates and times from outside your timezones,
fixes timezone loading in multithreaded applications,
and allows parsing and formatting using custom format
strings.

As a test of the APIs, we replace the formatting code in
seconds(1), shrinking it massively.
2020-06-13 12:38:49 -07:00
Alex Musolino a3f6976a76 notify(2): fix typo 2020-04-07 12:14:12 +09:30
Ori Bernstein 8589a591de we prefer nil over 0, make the example show it. 2020-03-28 20:32:53 -07:00
cinap_lenrek e9e55a21f6 lib9p: implement automatic remove-on-close cleanup in postsharesrv(), remove postfd() and sharefd() functions
with the latest changes to shr(3), we can use ORCLOSE on
the control file to get the mount in the share automatically
removed when the server exits or something goes wrong during
postsharesrv().

do not expose postfd() and sharefd() functions. they where
undocumented and leak the control file descriptors.
2020-03-08 22:00:23 +01:00
cinap_lenrek 06b9aa5039 9p(2): document all the effective rfork flags for postmountsrv() 2020-03-08 15:29:32 +01:00
cinap_lenrek bc1212faf2 9p(2): document the filedescriptor sharing behaviour of postmountsrv() 2020-03-08 14:49:34 +01:00
cinap_lenrek 225c359bea lib9p: get rid of Srv.nopipe and Srv.leavefdsopen hacks
it is unclear how Srv.nopipe flag should work inside
postmountserv(). if a server wants to serve on stdio
descriptors, he can just call srv() after initializing
Srv.infd and Srv.outfd.

The Srv.leavefdsopen hack can be removed now that acme
win has been fixed.
2020-03-07 20:19:14 +01:00
cinap_lenrek 64640083de libsec: remove hash pickle functions, document ripemd160, cleanup sechash(2) manpage 2020-03-01 15:07:44 +01:00
cinap_lenrek 95c166fc35 9p(2): fix sentence for wstat function (thanks jsmoody) 2019-12-21 15:31:10 +01:00
Alex Musolino 0bc963f928 thread(2): fix description of when/why procexec(l) functions return 2019-12-19 17:12:15 +10:30
Alex Musolino 47c188c0c6 flate(2): fix typos (thanks rgl) 2019-12-18 09:01:38 +10:30
Ori Bernstein 4dab28b14f thread(2): fix manpage typos (thanks rgl) 2019-11-12 13:01:38 -08:00
Ori Bernstein 52e92163a6 draw(2): fix manpage typo (thanks rgl) 2019-11-11 13:35:47 -08:00
David du Colombier 63ae9ed53a sys/src/libventi: implement vtreconn and vtredial functions 2019-09-06 11:54:44 -07:00
cinap_lenrek 4088f72903 rune(2): complete source references 2019-09-04 02:41:22 +02:00
cinap_lenrek a6fde3edc5 rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions 2019-08-30 07:35:54 +02:00
cinap_lenrek 704970074e nusb(2): remove startdevs() reference, document getdev() (thanks BurnZeZ) 2019-05-14 09:06:09 +02:00
BurnZeZ bf4f158707 memdraw(2): remove references to iprint() 2019-05-11 15:28:18 +00:00
BurnZeZ 424424fe50 fix bad function declarations in manpages 2019-04-09 18:34:17 +00:00
BurnZeZ 7b10062669 thread(2): threadsetname takes a fmt string 2019-04-08 22:18:15 +00:00
mischief c0383d8291 mach(2): fix byteswapping function signatures 2019-03-06 19:10:58 -08:00
cinap_lenrek 0af11f97b5 libip: replace v4parsecidr() with new parseipandmask()
we want to accept V4 subnets in CIDR notation consistently which
means we need to interpret the mask in context of the IP address.
so parseipmask() now has an additional v4 flag argument which
offsets the prefixlength by 96 so a /24 will be interpreted
as a /120.

parseipandmask() is the new function which handles this automatically
depending on the ip address type.

v4parsecidr() is now obsolete.
2019-02-11 23:26:57 +01:00
cinap_lenrek 5ef10e1642 mp(2): fix spelling 2018-11-21 02:08:15 +01:00
cinap_lenrek 39a7be7ea3 mp(2): clarify mptoa() and mpfmt() default base 2018-11-21 01:15:43 +01:00