changeset 20233:b597bd161a5f stable

doc: Document that mkfifo's mode argument is in decimal (bug #45054). * dirfns.cc (Fmkdir): Document that umask is applied to the mode bits of a newly created directory. * file-io.cc (Ffopen): Document that umask is applied to the mode bits of a newly created file. * file-io.cc (Fumask): Add brief explanation of umask and UNIX permission bits. * syscalls.cc (Fmkfifo): Document that mode is in decimal and subject to umask processing.
author Rik <rik@octave.org>
date Sun, 17 May 2015 09:45:54 -0700
parents b0f7ee81d974
children 5fb4bc5f70ce f5d9e57d4380
files libinterp/corefcn/dirfns.cc libinterp/corefcn/file-io.cc libinterp/corefcn/syscalls.cc
diffstat 3 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/dirfns.cc	Thu May 14 14:25:37 2015 -0700
+++ b/libinterp/corefcn/dirfns.cc	Sun May 17 09:45:54 2015 -0700
@@ -230,7 +230,10 @@
 character strings ("").  Otherwise, @var{status} is 0, @var{msg} contains a\n\
 system-dependent error message, and @var{msgid} contains a unique message\n\
 identifier.\n\
-@seealso{rmdir, pwd, cd}\n\
+\n\
+When creating a directory permissions will be set to\n\
+@code{0777 - @var{umask}}.\n\
+@seealso{rmdir, pwd, cd, umask}\n\
 @end deftypefn")
 {
   octave_value_list retval;
--- a/libinterp/corefcn/file-io.cc	Thu May 14 14:25:37 2015 -0700
+++ b/libinterp/corefcn/file-io.cc	Sun May 17 09:45:54 2015 -0700
@@ -682,7 +682,10 @@
 @noindent\n\
 however, conversions are currently only supported for @samp{native}\n\
 @samp{ieee-be}, and @samp{ieee-le} formats.\n\
-@seealso{fclose, fgets, fgetl, fscanf, fread, fputs, fdisp, fprintf, fwrite, fskipl, fseek, frewind, ftell, feof, ferror, fclear, fflush, freport}\n\
+\n\
+When opening a new file that does not yet exist, permissions will be set to\n\
+@code{0666 - @var{umask}}.\n\
+@seealso{fclose, fgets, fgetl, fscanf, fread, fputs, fdisp, fprintf, fwrite, fskipl, fseek, frewind, ftell, feof, ferror, fclear, fflush, freport, umask}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -2239,7 +2242,13 @@
 \n\
 If successful, returns the previous value of the mask (as an integer to be\n\
 interpreted as an octal number); otherwise an error message is printed.\n\
-@seealso{fopen, mkdir}\n\
+\n\
+The permission mask is a UNIX concept used when creating new objects on a\n\
+file system such as files, directories, or named FIFOs.  The object to be\n\
+created has base permissions in an octal number @var{mode} which are\n\
+modified according to the octal value of @var{mask}.  The final permissions\n\
+for the new object are @code{@var{mode} - @var{mask}}.\n\
+@seealso{fopen, mkdir, mkfifo}\n\
 @end deftypefn")
 {
   octave_value_list retval;
--- a/libinterp/corefcn/syscalls.cc	Thu May 14 14:25:37 2015 -0700
+++ b/libinterp/corefcn/syscalls.cc	Sun May 17 09:45:54 2015 -0700
@@ -821,14 +821,18 @@
 
 DEFUNX ("mkfifo", Fmkfifo, args, ,
         "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} mkfifo (@var{name}, @var{mode})\n\
+@deftypefn  {Built-in Function} {@var{err} =} mkfifo (@var{name}, @var{mode})\n\
 @deftypefnx {Built-in Function} {[@var{err}, @var{msg}] =} mkfifo (@var{name}, @var{mode})\n\
-Create a FIFO special file named @var{name} with file mode @var{mode}\n\
+Create a FIFO special file named @var{name} with file mode @var{mode}.\n\
+\n\
+@var{mode} is interpreted as a decimal number (@emph{not} octal) and is\n\
+subject to umask processing.  The final calculated mode is\n\
+@code{@var{mode} - @var{umask}}.\n\
 \n\
 If successful, @var{err} is 0 and @var{msg} is an empty string.\n\
 Otherwise, @var{err} is nonzero and @var{msg} contains a system-dependent\n\
 error message.\n\
-@seealso{pipe}\n\
+@seealso{pipe, umask}\n\
 @end deftypefn")
 {
   octave_value_list retval;