Logiweb(TM)

7.16.8 fileWrite and fileWriteExec

Prev Up Next Page 279 of 800 Search internet


A fileWrite request writes given contents to a given file. A fileWrite request is encoded as an lgcio request containing the following bytes:

First comes one byte which identifies the lgcio request as a fileWrite request. The value of that byte happens to be 1.

Then comes the path name p of the file be written. The path can be given as a vector tree. The path is not allowed to contain null characters.

Then comes a null character.

Finally comes the contents to be written to the file with no terminating null character. The contents is allowed to contain null characters.

To ease forging a fileWrite request, the base page defines the following construct:

eager define fileWrite ( p , c ) as lgcio ( FileWrite :: p :: EOS :: c ) end define

The reply has form

<< << r ,, i >> ,, p >>

where p is the empty list.

If the file does not exist, it is created with mode 0666 (read/write access to everybody). For a value of umask such as 0022 this results in mode 0644 (read/write to user, read to everybody).

fileWriteExec is similar but uses mode 0777 instead of mode 0666. Hence, created files become executable.

Prev Up Next Page 279 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05