Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Friedman Roy <roy@cs.technion.ac.il>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Cc: Manuel Fahndrich <maf@microsoft.com>,
	"'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: file permission integer
Date: Tue, 30 Mar 1999 09:33:12 +0200 (IST)	[thread overview]
Message-ID: <Pine.GSO.3.95-heb-2.07.990330092719.13509D-100000@csa.cs.technion.ac.il> (raw)
In-Reply-To: <19990329181056.50745@pauillac.inria.fr>

The only caveat is that in Unix this also sets the user/group/other
permissions, and the equivalent in NT involves writing a C function that
sets the ACL attributes for the file.

Roy

On Mon, 29 Mar 1999, Xavier Leroy wrote:

> > The OCAML core contains a function
> > 	open_out_gen : open_flag list -> int -> string -> out_channel
> > where the integer corresponds to the file permissions set when a new file is
> > created. How is this integer interpreted? Does it vary from platform to
> > platform? (Unix vs Windows).
> > If this information is described in the doc, I apologize, but I couldn't
> > find it.
> 
> No need to apologize, this is indeed not documented (oops!).
> 
> The integer argument to open_*_gen follows the Unix semantics,
> i.e. 0oABC, where A are the user permissions, B the group permissions,
> C the permissions for others.  A, B, C are single octal digits
> obtained by or-ing individual permission bits: 1 for execute permission,
> 2 for write permission, and 4 for read permission.
> 
> Under Windows, only the "write permission" bit of the "user
> permission" digit is consulted, and determines if the file is created
> read-write or read-only.  (The other permission bits don't have any
> equivalent in Win32, at least on a FAT file system.)
> 
> So, if you pass the correct permissions for Unix, your code should
> work just fine under Windows.
> 
> In Caml Light, we used to have symbolic names for the various
> permission bits.  I removed them in OCaml after realizing that the
> Unix bit-patterns work just fine in Windows as well.  However, the
> Unix encoding is a bit cryptic, so maybe those symbolic names were a
> good idea after all.
> 
> All the best,
> 
> - Xavier Leroy
> 
> 




  reply	other threads:[~1999-03-30  7:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-26 20:33 Manuel Fahndrich
1999-03-29 16:10 ` Xavier Leroy
1999-03-30  7:33   ` Friedman Roy [this message]
1999-03-30 18:13 Manuel Fahndrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.GSO.3.95-heb-2.07.990330092719.13509D-100000@csa.cs.technion.ac.il \
    --to=roy@cs.technion.ac.il \
    --cc=Xavier.Leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=maf@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox