|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 1665 Details
Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges
This page provides all information on Problem Report 1665.
Report 1665 Actions
Problem Report Number 1665 Submitter's Classification Test Suite problem State Resolved Resolution Rejected (REJ) Problem Resolution ID REJ.X.0469 Raised 1999-10-20 08:00 Updated 2003-03-13 08:00 Published null Product Standard Internationalised System Calls and Libraries Extended (UNIX 95) Certification Program The Open Brand certification program Test Suite VSU version 5.0.4 Test Identification base/ioctl 15 17 22 95 96 97 98 102 103 173 177 193 197 Problem Summary PG4U.00172 EBADF and EACCES errors when STREAM fd not open for reading and/or writing Problem Text
The common code to create the STREAMS-based pseudo ttys in
sreflect.c opens the master tty for read only
(O_RDONLY/filedes[0])
and the slave side for write only (O_WRONLY/filedes[1]). The
failing tests are using options I_FLUSH, I_FDINSERT, I_LINK and
I_PLINK, which require either write access on the master side of
the pueudo tty or read access from the slave side.
For example:
ioctl test #95 uses I_FDINSERT option, which requires write
access, but the command is issued on the master side which
was opened as read-only.
ioctl test #173 uses I_LINK option, which requires read and
write permissions, but the command is issued on the slave side
which was opened for write-only.
In case of readv test #39, a putmsg is attempted on filedes[0],
but filedes[1] is the end opened for write operations.
CAE specifications do not specifically allow or disallow
operations on STREAMS devices based on oflag used with the open.
This would mean that the general rules about what is permitted
on open descriptors should be applicable to STREAMS control
functions as well.
Our implementation is strict about allowing read/write
operations depending on the file access flags used with the open,
and so the tests are failing with EACCES error in some cases
or EBADF error in others.
CAE Specifications do not list EACCES or EBADF under the
discussion for the ioctl request parameters, but they do not
forbid an application from issuing these errors either. As per
the general discussion on 'Error Numbers' under section 2.3 of
CAE Specifications, it is valid for an implementation to
generate additional errors unless explicitly disallowed
for a particular function.
In case of readv test #39, a putmsg is attempted on filedes[0],
but filedes[1] is the end opened for write operations.
Since the tests seem to assume that all types of operations can
be done on either end, master or slave, sreflect.c should be
modified to allow read and write operations on both master
and slave sides. If the master and slave sides are opened with
O_RDWR, these tests pass, as all operations are allowed in this
case.Test Output
TEST PURPOSE #15
A successful call to int ioctl(int fildes, I_FLUSH,
FLUSHRW) when fildes refers to a STREAMS device shall
flush the STREAM's read and write queues and return a
value other than -1.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Set O_NONBLOCK on read and write end of STREAM
PREP: Put a normal priority message on the STREAM
TEST: ioctl returns other than -1
ERROR: ioctl failed, errno = 13(EACCES - Permission denied)
15 FAIL
TEST PURPOSE #17
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_FLUSH, int arg) when fildes refers
to a STREAMS device and arg is an invalid value.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 13(EACCES - Permission denied)
17 FAIL
TEST PURPOSE #22
A successful call to int ioctl(int fildes,
I_FLUSHBAND, (struct bandinfo *)arg) when fildes
refers to a STREAMS device and the bi_flags member of
the structure pointed to by arg is FLUSHRW shall flush
messages in the band specified by the bi_pri member of
the structure from the STREAM's read and write queues
and return a value other than -1.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Set O_NONBLOCK on both ends of the STREAM
PREP: Put a message on band 1 of one end
TEST: Flush of band 0 on the other end returns other than -1
ERROR: ioctl failed, errno = 13(EACCES - Permission denied)
22 UNRESOLVED
TEST PURPOSE #95
EINVAL in errno, return -1, and no partial message
sent on a call to int ioctl(int fildes, I_FDINSERT,
struct strfdinsert *arg) when fildes refers to a
STREAMS device and the fd member of the structure
pointed to by arg is not a valid open STREAM file
descriptor.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Find unused file descriptor
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
95 FAIL
TEST PURPOSE #96
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_FDINSERT, struct strfdinsert *arg)
when fildes refers to a STREAMS device and the size of
a pointer plus the offset member of the structure
pointed to by arg is greater than the ctlbuf.len
member of the structure pointed to by arg.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Setup strfdinsert structure
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
96 FAIL
TEST PURPOSE #97
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_FDINSERT, struct strfdinsert *arg)
when fildes refers to a STREAMS device and the offset
member of the structure pointed to by arg does not
specify a properly-aligned location in the data buffer.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Setup strfdinsert structure
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
97 FAIL
TEST PURPOSE #98
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_FDINSERT, struct strfdinsert *arg)
when fildes refers to a STREAMS device and an
undefined value is stored in the flags member of the
structure pointed to by arg.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Setup strfdinsert structure
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
98 FAIL
TEST PURPOSE #102
ERANGE in errno and return -1 on a call to int
ioctl(int fildes, I_FDINSERT, struct strfdinsert *arg)
when fildes refers to a STREAMS device and the
databuf.len member of the structure pointed to by arg
is larger than the maximum configured size of the data
part of a message.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Setup strfdinsert structure
TEST: ioctl returns -1
TEST: ioctl placed ERANGE in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
102 FAIL
TEST PURPOSE #103
ERANGE in errno and return -1 on a call to int
ioctl(int fildes, I_FDINSERT, struct strfdinsert *arg)
when fildes refers to a STREAMS device and the
ctlbuf.len member of the structure pointed to by arg
is larger than the maximum configured size of the
control part of a message.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Setup strfdinsert structure
TEST: ioctl returns -1
TEST: ioctl placed ERANGE in errno
ERROR: ioctl set errno to 9(EBADF - Bad file number)
103 FAIL
TEST PURPOSE #173
ENXIO in errno and return -1 on a call to int
ioctl(int fildes, I_LINK, int arg) when a hangup is
received on the STREAMS device referenced by fildes.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Close read end to generate hangup
TEST: ioctl returns -1
TEST: ioctl placed ENXIO in errno
ERROR: ioctl set errno to 13(EACCES - Permission denied)
173 FAIL
TEST PURPOSE #177
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_LINK, int arg) when fildes refers
to a STREAMS device that does not support multiplexing.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 13(EACCES - Permission denied)
177 FAIL
TEST PURPOSE #193
ENXIO in errno and return -1 on a call to int
ioctl(int fildes, I_PLINK, int arg) when a hangup is
received on the STREAMS device referenced by fildes.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Close read end to generate hangup
TEST: ioctl returns -1
TEST: ioctl placed ENXIO in errno
ERROR: ioctl set errno to 13(EACCES - Permission denied)
193 FAIL
TEST PURPOSE #197
EINVAL in errno and return -1 on a call to int
ioctl(int fildes, I_PLINK, int arg) when fildes refers
to a STREAMS device than does not support multiplexing.
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
TEST: ioctl returns -1
TEST: ioctl placed EINVAL in errno
ERROR: ioctl set errno to 13(EACCES - Permission denied)
197 FAIL
TEST CASE: readv
TEST PURPOSE #39
A call to ssize_t readv(int fildes, const struct iovec
*iov, int iovcnt) when fildes refers to a STREAMS file
and a hangup occurs on the STREAM shall continue to
operate normally until the STREAM head read queue is
empty.
PREP: Create a pipe
PREP: Determine if pipe is a stream
INFO: Pipes are STREAMS based on this implementation.
PREP: Ignore SIGPOLL, SIGHUP, and SIGPIPE signals
PREP: Set O_NONBLOCK on read end of STREAM
PREP: Set O_NONBLOCK on write end of STREAM
PREP: Put some messages on the STREAM
PREP: Hangup write end of STREAM
PREP: Sleep for a few seconds
TEST: readv operates normally until all data is read
PREP: Open master pseudo tty
PREP: Determine if pseudo tty is a stream
PREP: Open slave side of pseudo tty
PREP: Ignore SIGPOLL, SIGHUP, and SIGPIPE signals
PREP: Set O_NONBLOCK on read end of STREAM
PREP: Set O_NONBLOCK on write end of STREAM
PREP: Put some messages on the STREAM
ERROR: putpmsg failed, errno = 9(EBADF - Bad file number)
39 UNRESOLVED
TEST CASE: ttyslot
TEST PURPOSE #1
SPEC1170TESTSUITE CASE 1
If the Legacy Feature Group is supported or the
implementation supports the ttyslot() function as defined
in System Interfaces and Headers, Issue 5:
A successful call to int ttyslot(void) shall return
the index of an entry in the user accounting database
in which the utline member matches the terminal device
associated with the standard input, standard output,
or standard error (file descriptor 0, 1 or 2) of the
calling process.
PREP: Determine if the function ttyslot() is supported
INFO: The implementation supports this function
as defined in System Interfaces and Headers, Issue 5
PREP: Find name of current terminal
PREP: Close file descriptors
PREP: Redirect stdin to /dev/null
PREP: Redirect stdout to /dev/null
PREP: Redirect stderr to /dev/null
PREP: Associate /dev/pts/1 with stdin
ERROR: freopen failed, errno = 13(EACCES - Permission denied)Review Information
Review Type TSMA Review Start Date null Completed null Status Complete Review Recommendation No Resolution Given Review Response
While it is true that the specification for ioctl() does not say anything
about the need for a file descriptor to be open for reading and/or writing,
it is not clear how, or indeed whether, the `general rules' should apply.
It is a question of whether or not the requested operation can be
considered to be a read or write operation. The absence of an EBADF
error condition in the specification (other than for the case where the
file descriptor is not open at all) suggests that these ioctl() calls are
considered to be `control' operations and not read or write operations.
This is an issue that would need to be discussed by the base working group.
Each operation probably needs to be considered individually. For example
I_FDINSERT can optionally be used to send data, so perhaps could be
considered to be a write operation. However, I_FLUSH only causes a queue
to be flushed, it does not cause any data to be read or written, so this
would probably not be considered to be a read or write operation.
In the course of an I_LINK operation an acknowledgement message is
sent to the STREAM head, but no input or output of data to/from the
application is involved, so again this would probably not be considered
to be a read or write operation.
Although this issue would need to be resolved by the working group, it is
not recommended that this interpretation request is forwarded for review
in its present form. This is because some of the failures show an EACCES
condition instead of EBADF. The specifications states, `Implementations
will not generate a different error number from the ones described here
for error conditions described in this specification'. Thus, generating
EACCES when the error condition that applies is the one described for
EBADF is non-compliant behaviour. Also, the failure for ttyslot test 1
seems to be unrelated, and no rationale has been supplied for this
failure. (The failure for readv test 39 is also unrelated, but looks
to be a genuine fault, and a TSD for this could be issued if a separate
request for this test is submitted.)
It is recommended that this request be refused. If the submitter wishes
to pursue the issue of ioctl() and EBADF errors, a new request will need
to be submitted containing only test results with EBADF errors.
Review Type SA Review Start Date null Completed null Status Complete Review Resolution Rejected (REJ) Review Conclusion
This request is refused.
Problem Reporting System Options:
- View Report 1665
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority