Hi there !
I just solved the problem that produced following error in smb.log file:
'check_access_allowed_for_current_user: The process is no longer
waiting!'
Since nobody gave me any help I had to dig this out myself :-)
This error happens if two programs hold more than 10 same files
simultaneously open through Samba and
check_access_allowed_for_current_user() gets called. And this failed
occassionally!
The problem was that HPUX 9.0x and earlier don't restart (by default!)
system
calls! And here waitpid() gets interrupted!
-----------------------------------
ftp://ftp.interworks.org/pub/comp.hp/porting_info/sun_hpux_port_ascii_0295
..
SunOS's sigaction() automatically restarts system calls. The default
behavior on HP-UX is to not restart. As noted in the Solaris Porting FAQ,
code that depends on restarting system calls is generally considered to be
bad practice and should be avoided. SunOS provides the SA_INTERRUPT option,
which is used to prevent system calls from being restarted. SA_INTERRUPT is
not available on HP-UX, but is the default behavior of sigaction() on HP-UX
(that is, does not restart signal calls).
SA_RESTART is used on SunOS to make system calls restart. It is not
available on HP-UX. Instead, the sigcontext parameter passed to the signal
handler can be used within the signal handler itself to specify SIG_RESTART
or SIG_RETURN after handling an interrupted system call:
..
<code example>!!!!
-----------------------------------
Good code example HPUX 9.0x specific code for signals:
ftp://ftp.cup.hp.com/dist/networking/benchmarks/netperf/netperf-2.1pl3.tar.gz
-----------------------------------
OK, here's my fix HPUX9.0x patch against Samba 2.0.0:
There are actually two patches, only one is obligatory.
The ugly one is the restartable signal code for HPUX < 10.20. I think 10.20
has SA_RESTART according to people's code example posts to usenet, but
since I don't have access to 10.20 right now, please verify! (our only
10.20 burned its hard drive recently!)
The open.c patch is a must on OS's (there can be more than just HPUX
<10.20
!) where system calls are not restarted automatically!
-----------------------------------
diff -u --recursive --new-file source/lib/signal.c source.new/lib/signal.c
--- source/lib/signal.c Thu Jan 14 22:07:33 1999
+++ source.new/lib/signal.c Sun Jan 24 23:32:44 1999
@@ -47,8 +47,21 @@
catch child exits - leave status;
****************************************************************************/
-static void sig_cld_leave_status(int signum)
+static void
+#if defined(HPUX) && !defined(SA_RESTART) /* e.g. HPUX 9.0x */
+sig_cld_leave_status(int signum, int code, struct sigcontext *scp)
+#else
+sig_cld_leave_status(int signum)
+#endif
{
+#if defined(HPUX) && !defined(SA_RESTART) /* e.g. HPUX 9.0x */
+ extern int DEBUGLEVEL;
+ if(scp->sc_syscall!=SYS_NOTSYSCALL) {
+ scp->sc_syscall_action = SIG_RESTART; /* default: SIG_RETURN */
+ /* waitpid() -> scp->sc_syscall == 200 ! */
+ DEBUG(9,("sig_cld_leave_status: syscall %d
restarted\n",scp->sc_syscall));
+ }
+#endif
/*
* Turns out it's *really* important not to
* restore the signal handler here if we have real POSIX
@@ -134,5 +147,5 @@
void CatchChildLeaveStatus(void)
{
- CatchSignal(SIGCLD, sig_cld_leave_status);
+ CatchSignal(SIGCLD, SIGNAL_CAST sig_cld_leave_status);
}
diff -u --recursive --new-file source/smbd/open.c source.new/smbd/open.c
--- source/smbd/open.c Thu Dec 31 03:37:01 1998
+++ source.new/smbd/open.c Sun Jan 24 23:32:32 1999
@@ -225,8 +225,10 @@
*/
pid_t wpid;
int status_code;
- if ((wpid = sys_waitpid(child_pid, &status_code, 0)) < 0) {
- DEBUG(0,("check_access_allowed_for_current_user: The process is no
longer waiting!\n"));
+ while ((wpid = sys_waitpid(child_pid, &status_code, 0)) < 0) {
+ if(errno == EINTR)
+ continue;
+ DEBUG(0,("check_access_allowed_for_current_user: The process is no
longer waiting, errno = %d!\n", errno));
CatchChild();
return(False);
}
-----------------------------------
------
Panu Outinen Tel. +358 3 318 2500
Vertex Systems Oy Fax +358 3 318 2450
Vaajakatu 9 http://www.vertex.fi
33720 Tampere, FINLAND email: Panu.Outinen@vertex.fi