harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] [luni] Should Improve File System Exception Messages
Date Tue, 09 Dec 2008 13:04:42 GMT
Regis wrote:
> I found readImpl and writeImpl in OSFileSystem.c use
> netLookupErrorString(env, HYPORT_ERROR_FILE_LOCKED)
> to get error messages, which are hard coded in nethelp.c, my questions are:
> 1. why does file read/write need to get error messages from nethelp.c?
> We already have hyfile_error_message() can do that.

HYPORT_ERROR_* messges are platform independent so you can pass them
around in common code.

You should not use hyfile_error_message() since it is not thread safe -
i.e. you might get back an error/success for a different thread's file
operation.  Its use is deprecated.

> 2. error messages are hard coded in netLookupErrorString, is that expected?

That is used to map from the HYPORT_ERROR_* messages to a display
string, so yes it is expected, but maybe not what we want to use here.

In general, portlib functions that make OS calls set a per-thread error
code (using hyerror_set_last_error()), and the users of the portlib
retrieve it using hyerror_last_error_number() and the corresponding
display string using hyerror_last_error_message().

Take a look at the portlib functions in hyerror.c


View raw message