diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-12-24 14:27:51 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-12-24 14:27:51 +0000 |
commit | d9b6a5820f195ef681d7cd15d70a184265b37a94 (patch) | |
tree | 49f952f89c5e6aa0992a0e45fdba636ab0d2bbca /src/posix/posix-umask.txt | |
parent | 2a96bc93c24f34a972740da3e7df031a2d36e7cb (diff) | |
download | execline-d9b6a5820f195ef681d7cd15d70a184265b37a94.tar.xz |
Add posix-umask; prepare for 2.6.0.0
Diffstat (limited to 'src/posix/posix-umask.txt')
-rw-r--r-- | src/posix/posix-umask.txt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/posix/posix-umask.txt b/src/posix/posix-umask.txt new file mode 100644 index 0000000..5bf49a2 --- /dev/null +++ b/src/posix/posix-umask.txt @@ -0,0 +1,37 @@ + + parsemode() function for posix-umask + + goal: parse the "u+r,g-wx,o=u" symbolic mode string and convert it +to a numeric value suitable for umask(). + In the purest skarnet.org tradition, we implement the parser via a DFA. + +class | 0 1 2 3 4 5 6 +st\ev | \0 , +-= ugo a rwxXst other +------------------------------------------------------------------------ +START | wo w w +0 | END START OP WHO WHO X X + +WHO | o w w +1 | END X OP WHO WHO X X + +OP | r o c p +2 | END START OP PERMCPY X PERM X + +PERMCPY | ! !rR !Ro +3 | END START OP X X X X + +PERM | ! !rR !Ro p +4 | END START OP X X PERM X +------------------------------------------------------------------------ + +END=5, X=6. -> states: 3 bits +7 actions -> 10 bits total, need uint16_t + + w: 0x020: who |= c + o: 0x040: store op + c: 0x080: copy perm from c + p: 0x100: perm |= c + r: 0x200: reset who + R: 0x400: reset perm + !: 0x800: apply (who, op, perm) change + |