eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'UnixOperatingSystem::FileDescriptorHandle':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FileDescriptorHandle (private in UnixOperatingSystem

This class is only visible from within UnixOperatingSystem.

Inheritance:

   Object
   |
   +--UnixOperatingSystem::FileDescriptorHandle

Package:
stx:libbasic
Category:
OS-Unix
Owner:
UnixOperatingSystem

Class protocol:

change & update
o  update: aspect with: argument from: anObject
one of our registered handles has been collected

initialization
o  initialize
self initialize

instance creation
o  for: aFileDescriptor
create an instance of myself for a given fileDescriptor


Instance protocol:

error handling
o  error: anErrorSymbolOrErrno
got an error; arg is either a symbol specifying a primitive error
or the error number as returned by the OperatingSystem

file access
o  close
close the descriptor

initialization
o  for: aFileDescriptor
create a file for a handle

input/output
o  readBytes: count into: aByteBuffer startingAt: firstIndex
read count bytes into a byte-buffer;
Return the number of bytes read.
The read is non-blocking. If the operation would block
either an incomplete count or nil will be returned.

An exception is raised on any other error

o  writeBytes: count from: aByteBuffer startingAt: firstIndex
write count bytes from a byte-buffer;
Return the number of bytes written (negative on error)

misc functions
o  nextError
retrieve the pending error from the current fileDescriptor
and raise an error exception.
This should be only called, when an error is pending.
Otherwise a byte may be lost

o  seekTo: newPosition from: whence
seek to newPosition
whence is one of: #begin #current #end.
Return the new position.

o  selectWithTimeOut: millis
wait for aFileDesriptor to become ready; timeout after t milliseconds.
Return true, if i/o ok, false if timed-out or interrupted.
With 0 as timeout argument, this can be used to check for availability (poll)
of read-data.

o  setBlocking: aBoolean
set/clear the blocking attribute - if set (which is the default)
a read on the fileDescriptor will block until data is available.
If cleared, a read operation will immediately return with a value of
nil if no data is available.

private-accessing
o  fileDescriptor
return the (integer) fileDescriptor

o  setFileDescriptor: anInteger

queries
o  canReadWithoutBlocking
return true, if data is available on a filedescriptor
(i.e. read is possible without blocking).
This depends on a working select or FIONREAD to be provided by the OS.

o  canWriteWithoutBlocking
return true, if filedescriptor can be written without blocking

o  isValid
answer true, if the handle is valid, i.e. connected to
a file or some other OS object

o  numAvailableForRead
return the number of bytes available for reading, without blocking.

registering
o  register
register myself as an open file

releasing
o  invalidate
a file handle has become invalid

waiting
o  readWaitWithTimeoutMs: timeout
suspend the current process, until the receiver
becomes ready for reading or a timeout (in milliseconds) expired.
If data is already available, return immediate.
Return true if a timeout occurred (i.e. false, if data is available).
The other threads are not affected by the wait.

o  writeWaitWithTimeoutMs: timeout
suspend the current process, until the receiver
becomes ready for writing or a timeout (in seconds) expired.
Return true if a timeout occurred (i.e. false, if data is available).
Return immediate if the receiver is already ready.
The other threads are not affected by the wait.



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 18 Aug 2022 13:13:59 GMT