unix/src/solaris-2-x/Unix.m3


Copyright (C) 1994, Digital Equipment Corp.
*************************************************************************
   Author:  Geoffrey Wyant - Sun Microsystems Labs BOS		   
*************************************************************************

$Revision$

MODULE Unix;

IMPORT Uerror;
FROM   Ctypes IMPORT int;

* This is to work around a bug in the Solaris-2 'libsocket' library * which redefines 'fcntl' in such a way as to zero out 'errno' if the * call is successful.

PROCEDURE fcntl(fd, request, arg: int): int =
  VAR
    errno := Uerror.errno;
    res   := raw_fcntl(fd, request, arg);
  BEGIN
    IF res = 0 THEN
      Uerror.errno := errno;
    END;
    RETURN res;
  END fcntl;

* This is to work around a bug in the Solaris-2 'libsocket' library * which redefines 'ioctl' in such a way as to zero out 'errno' if the * call is successful.

PROCEDURE ioctl(fd, request: int; argp: ADDRESS): int =
  VAR
    errno := Uerror.errno;
    res   := raw_ioctl(fd, request, argp);
  BEGIN
    IF res = 0 THEN
      Uerror.errno := errno;
    END;
    RETURN res;
  END ioctl;

BEGIN
END Unix.

interface Unix is in:


interface Uerror is in: