Alexandre,
-static int FILE_GetUnixHandleType( HANDLE handle, DWORD access, enum fd_type *type, int *flags ) +static int FILE_GetUnixHandleType( HANDLE handle, DWORD access, enum fd_type *type, int *flags_ptr ) { - int ret, fd = -1; + int ret, flags, fd = -1;
- ret = wine_server_handle_to_fd( handle, access, &fd, type, flags ); + ret = wine_server_handle_to_fd( handle, access, &fd, type, &flags ); + if (flags_ptr) *flags_ptr = flags;
This is of course the most robust solution - but because FILE_GetUnixHandleType is internal, you might as well require all functions calling it to pass a valid flags pointer, and let FILE_GetUnixHandle call wine_server_handle_to_fd directly, at a minimum performance gain.
Martin
Martin Wilck Martin.Wilck@fujitsu-siemens.com writes:
-static int FILE_GetUnixHandleType( HANDLE handle, DWORD access, enum fd_type *type, int *flags ) +static int FILE_GetUnixHandleType( HANDLE handle, DWORD access, enum fd_type *type, int *flags_ptr ) {
- int ret, fd = -1;
- int ret, flags, fd = -1;
- ret = wine_server_handle_to_fd( handle, access, &fd, type, flags );
- ret = wine_server_handle_to_fd( handle, access, &fd, type, &flags );
- if (flags_ptr) *flags_ptr = flags;
This is of course the most robust solution - but because FILE_GetUnixHandleType is internal, you might as well require all functions calling it to pass a valid flags pointer, and let FILE_GetUnixHandle call wine_server_handle_to_fd directly, at a minimum performance gain.
My concern with that approach is that functions using FILE_GetUnixHandle wouldn't handle the shutdown flags correctly. The alternative would be to retire FILE_GetUnixHandle, or maybe move the shutdown flags handling into wine_server_handle_to_fd.
On 26 Apr 2002, Alexandre Julliard wrote:
My concern with that approach is that functions using FILE_GetUnixHandle wouldn't handle the shutdown flags correctly. The alternative would be to retire FILE_GetUnixHandle, or maybe move the shutdown flags handling into wine_server_handle_to_fd.
The shutdown flags are only needed for new calls to Read or Write routines _from the app_. The app is not allowed to e.g. write any more data, while we can still write data that had been queued before.
Thus (at least these) flags are IMO only needed in those places where we already call FILE_GetUnixHandleType.
Martin