You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Enable SLEEP_LOCK
2. compile
What is the expected output? What do you see instead?
gcc -g -c snooze.c
snooze.c: In function `snooze':
snooze.c:51: error: `LOCK_EX' undeclared (first use in this function)
snooze.c:51: error: (Each undeclared identifier is reported only once
snooze.c:51: error: for each function it appears in.)
*** Error code 1
make: Fatal error: Command failed for target `snooze.o'
What version of the product are you using? On what operating system?
pwauth 2.3.8
SunOS 5.11 snv_151a i86pc i386 i86pc
Please provide any additional information below.
It looks like the LOCK_EX macro isn't defined in Solaris, and there isn't an
easy way to replace it. The code compiles just fine with SLEEP_LOCK disabled.
Original issue reported on code.google.com by FISHMAN...@gmail.com on 9 Dec 2010 at 12:00
The text was updated successfully, but these errors were encountered:
Ugh. Solaris seems to have manual pages claiming it has flock() but they lie.
Probably I should rewrite this using fcntl() which is probably more portable.
Probably the function would change to something like:
snooze(int seconds)
{
int slfd;
struct flock lock;
lock.l_type= F_WRLCK;
lock.l_whence= SEEK_SET;
lock.l_start= 0;
lock.l_len= 0;
/* Lock the sleep-lock file to serialize our sleeps */
if ((slfd= open(SLEEP_LOCK,O_CREAT|O_RDWR,0644)) >= 0)
fcntl(slfd,F_SETLKW,&lock);
sleep(seconds);
/* Release sleep-lock file */
/*lock.l_type= F_UNLCK; fcntl(slfd,F_SETLK,&lock);*/
close(slfd);
}
But I haven't tested that at all.
Original comment by j...@unixpapa.com on 5 Oct 2011 at 4:16
Version 2.3.10 has been modified to use fcntl() locking instead of flock()
locking. Since fcntl() is a POSIX standard, I believe it should be more
portable and should work on Solaris.
Original comment by j...@unixpapa.com on 6 Oct 2011 at 2:32
Original issue reported on code.google.com by
FISHMAN...@gmail.com
on 9 Dec 2010 at 12:00The text was updated successfully, but these errors were encountered: