[unix-ws] fcntl unter Solaris8
Boris Maric
Boris.Maric at consol.de
Mit Dez 11 14:13:46 CET 2002
Hi,
bei mir laeuft das (mit WorkShop 6 update 2 C 5.3 oder mit gcc kompiliert)
ohne Murren durch:
=================================
maric at kanada >uname -a
SunOS kanada 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-5_10
maric at kanada >./a.out
locking fcntl.c...
press <return> to unlock fcntl.c.
unlocking fcntl.c...
press <return> to continue.
maric at kanada >
=================================
ist nfs im Spiel ? Was spuckt ein truss -adef -v all -r all -w all -o
truss.out a.out
aus ?
Gruesse,
Boris
Martin Olschewski wrote:
>Hallo,
>
>seit dem Einspielen der letzten recommended Patches auf meine
>Sparc/Solaris 8 Maschinen bleiben dort alle Prozesse hängen,
>die versuchen mit fcntl einen Lock zu setzen. Beispiel:
>
>
>#include <stdio.h>
>#include <stdlib.h>
>#include <errno.h>
>
>#include <sys/types.h>
>#include <unistd.h>
>#include <fcntl.h>
>
>int main(void) {
>
> char fname[] = "fcntl.c"; /* lock own source */
> int fd;
> struct flock lock;
>
> if ((fd = open(fname, O_RDWR)) < 0) {
> perror(fname);
> return EXIT_FAILURE;
> }
> lock.l_type = F_WRLCK;
> lock.l_whence = SEEK_SET;
> lock.l_start = 0;
> lock.l_len = 4;
> printf("locking %s...\n", fname);
> if (fcntl(fd, F_SETLK, &lock) == -1) {
> perror(fname);
> return EXIT_FAILURE;
> }
> printf("press <return> to unlock %s.\n", fname);
> getchar();
>
> lock.l_type = F_UNLCK;
> printf("unlocking %s...\n", fname);
> if (fcntl(fd, F_SETLK, &lock) == -1) {
> perror(fname);
> return EXIT_FAILURE;
> }
> printf("press <return> to continue.\n");
> getchar();
>
> close(fd);
> return EXIT_SUCCESS;
>}
>
>
>Dieses billige Testprogramm bleibt jetzt schon hinter der
>"locking fcntl.c..."-Zeile hängen und läßt sich nur noch durch eine
>Kombination von ^C und kill -9 abbrechen.
>
>Hat noch jemand dieses Problem?
>Gibt es schon einen neuen Patch?
>Bin ich nur zu blöd, oder muß
>ich jemand anderen dafür treten?
>
>Fragen über Fragen, für Antworten bin ich dankbar,
>
> Martin Olschewski
>
--
+----------------------------------------------------------------------+
| Boris Maric Phone: ++49 89 45841-184 |
| ConSol GmbH, Sun-Service-Partner Fax: ++49 89 45841-111 |
| Franziskanerstr. 38 Email: boris.maric at consol.de |
| D-81669 Muenchen, Germany http://www.consol.de/ |
+----------------------------------------------------------------------+