Tcl Source Code

View Ticket
Login
Ticket UUID: 3517838
Title: Constants R_OK, W_OK, X_OK and F_OK are undefined
Type: Bug Created on: 2012-04-14 21:30:33
Submitter: lobotomy642 Assigned to: nijtmans
Subsystem: 37. File System Severity:
Priority: 5 Medium Last modified: 2012-04-17 04:34:55
Status: Closed Closed by: nijtmans
Resolution: Duplicate Closed on: 2012-04-16 21:34:55
Version: obsolete: 8.5.11
Description:
Hello,

When trying to write a Virtual File System extension, the function for FSAccessProc takes the parameter "mode" which is said from the corresponding TclLib man page to be a bit-field with these constant R_OK, W_OK, X_OK and F_OK.

However, in my current installation of TCL (v8.5.11 in Linux/debian), these constant are not available with the simple <tcl.h> include.
Furthermore, a quick search seemed to show that they are defined in "tcl-private/unix/tclUnixPort.h", which as far as it looks is for Unix flavours only, thus may bring compatibility issues.

Consequently, I propose to have these constants defined in the <tcl.h>. And a quick note in the man page to specify that F_OK is actually 0 and not a bit in the field, in case someone would try to do (mode & F_OK) in their code.
User Comments:
nijtmans added on 2012-04-16 17:19:05:
Those symbols are supposed to be
defined in <unistd.h> on UNIX and
<io.h> on Windows, that's what the
documentation should mention.

dgp added on 2012-04-16 22:21:23:
This is a dup of 945570.

nijtmans added on 2012-04-17 04:34:55:

allow_comments - 1

Thanks, Don!