The Samba-Bugzilla – Attachment 4911 Details for
Bug 6864
Problem in Solaris of FIONREAD
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
FIONREADsolaris.patch (text/plain), 4.38 KB, created by
ryu
on 2009-11-01 02:12:28 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
ryu
Created:
2009-11-01 02:12:28 UTC
Size:
4.38 KB
patch
obsolete
>diff -rc source3-org/lib/packet.c source3/lib/packet.c >*** source3-org/lib/packet.c Thu Oct 29 16:47:16 2009 >--- source3/lib/packet.c Sun Nov 1 16:51:11 2009 >*************** >*** 58,63 **** >--- 58,90 ---- > size_t new_size; > uint8 *in; > >+ #if defined(__sun__) >+ /* see libsmb/async_smb.c */ >+ #define FIONREAD_RETRY 10 >+ { >+ int retry = 0; >+ while(1) { >+ res = ioctl(ctx->fd, FIONREAD, &available); >+ >+ if (res == -1) { >+ DEBUG(10, ("ioctl(FIONREAD) failed: %s\n", strerror(errno))); >+ return map_nt_error_from_unix(errno); >+ } >+ >+ if (available == 0) { >+ if(retry > FIONREAD_RETRY) { >+ return NT_STATUS_END_OF_FILE; >+ } else { >+ retry++; >+ DEBUG(1, ("ioctl(FIONREAD) retry: %d\n", retry)); >+ usleep(100000); >+ } >+ } else { >+ break; >+ } >+ } >+ } >+ #else > res = ioctl(ctx->fd, FIONREAD, &available); > > if (res == -1) { >*************** >*** 70,76 **** > if (available == 0) { > return NT_STATUS_END_OF_FILE; > } >! > new_size = ctx->in.length + available; > > if (new_size < ctx->in.length) { >--- 97,103 ---- > if (available == 0) { > return NT_STATUS_END_OF_FILE; > } >! #endif > new_size = ctx->in.length + available; > > if (new_size < ctx->in.length) { >diff -rc source3-org/libsmb/async_smb.c source3/libsmb/async_smb.c >*** source3-org/libsmb/async_smb.c Thu Oct 29 16:47:16 2009 >--- source3/libsmb/async_smb.c Sun Nov 1 16:51:11 2009 >*************** >*** 1048,1053 **** >--- 1048,1097 ---- > size_t old_size, new_size; > char *tmp; > >+ >+ #if defined(__sun__) >+ /* man streamio >+ I_NREAD >+ Counts the number of data bytes in data >+ blocks in the first message on the STREAM >+ head read queue, and places this value in >+ the location pointed to by arg. The return >+ value for the command is the number of >+ messages on the STREAM head read queue. >+ For example, if zero is returned in arg, >+ but the ioctl return value is greater than >+ zero, this indicates that a zero-length >+ message is next on the queue. On failure, >+ errno is set to the following value: >+ */ >+ #define FIONREAD_RETRY 10 >+ { >+ int retry = 0; >+ while(1) { >+ res = ioctl(cli->fd, FIONREAD, &available); >+ if (res == -1) { >+ DEBUG(10, ("ioctl(FIONREAD) failed: %s\n", >+ strerror(errno))); >+ status = map_nt_error_from_unix(errno); >+ goto sock_error; >+ } >+ >+ if (available == 0) { >+ /* EOF */ >+ if(retry > FIONREAD_RETRY) { >+ status = NT_STATUS_END_OF_FILE; >+ goto sock_error; >+ } else { >+ retry++; >+ DEBUG(1, ("ioctl(FIONREAD) retry: %d\n", retry)); >+ usleep(100000); >+ } >+ } else { >+ break; >+ } >+ } >+ } >+ #else > res = ioctl(cli->fd, FIONREAD, &available); > if (res == -1) { > DEBUG(10, ("ioctl(FIONREAD) failed: %s\n", >*************** >*** 1061,1066 **** >--- 1105,1111 ---- > status = NT_STATUS_END_OF_FILE; > goto sock_error; > } >+ #endif > > old_size = talloc_get_size(cli->evt_inbuf); > new_size = old_size + available; >diff -rc source3-org/smbd/notify_inotify.c source3/smbd/notify_inotify.c >*** source3-org/smbd/notify_inotify.c Thu Oct 29 16:47:16 2009 >--- source3/smbd/notify_inotify.c Sun Nov 1 16:51:11 2009 >*************** >*** 239,249 **** >--- 239,275 ---- > filenames, and thus can't know how much to allocate > otherwise > */ >+ #if defined(__sun__) >+ /* see libsmb/async_smb.c */ >+ #define FIONREAD_RETRY 2 >+ { >+ int retry = 0; >+ while(1) { >+ if (ioctl(in->fd, FIONREAD, &bufsize) != 0) { >+ DEBUG(0,("No data on inotify fd?!\n")); >+ return; >+ } >+ if(bufsize == 0) { >+ if(retry > FIONREAD_RETRY) { >+ DEBUG(0,("No data on inotify fd?!\n")); >+ return; >+ } else { >+ retry++; >+ DEBUG(1, ("ioctl(FIONREAD) retry: %d\n", retry)); >+ usleep(100000); >+ } >+ } else { >+ break; >+ } >+ } >+ } >+ #else > if (ioctl(in->fd, FIONREAD, &bufsize) != 0 || > bufsize == 0) { > DEBUG(0,("No data on inotify fd?!\n")); > return; > } >+ #endif > > e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize); > if (e == NULL) return;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 6864
: 4911