On Thu, Jan 06, 2005 at 12:34:27AM +0900, Berger, Daniel wrote: > I'm not sure I follow, because this has worked as expected in certain > circumstances in the past (i.e. it raised Errno::ENOENT). > > Perhaps I need more detail on how rb_sys_fail() actually works. Perhaps you need an abstraction like this one (from http://www.cs.wustl.edu/~schmidt/ACE_wrappers/ace/OS_NS_errno.inl): ACE_INLINE int ACE_OS::last_error (void) { // ACE_OS_TRACE ("ACE_OS::last_error"); #if defined (ACE_WIN32) // ACE_OS::last_error() prefers errnor since started out as a way to // avoid directly accessing errno in ACE code - particularly the ACE // C++ socket wrapper facades. On Windows, some things that would // use errno on UNIX require ::GetLastError(), so this method tries // to shield the rest of ACE from having to know about this. int lerror = ::GetLastError (); int lerrno = errno; return lerrno == 0 ? lerror : lerrno; #else return errno; #endif /* ACE_WIN32 */ Or perhaps rb_sys_fail() should do this behind the scenes. > That, or I need to figure out a way to explicitly raise Errno::ENOENT within > a C extension. The easiest way is to set errno to ENOENT before calling rb_sys_fail(). Paul