* fnctl and Linux alpha
@ 2001-11-15 13:40 BERTRAND Joël
0 siblings, 0 replies; only message in thread
From: BERTRAND Joël @ 2001-11-15 13:40 UTC (permalink / raw)
Hello,
I have some troubles with fcntl() function. I have written a
big code and I use :
lock.l_type = F_RDLCK | F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0;
lock.l_pid = getpid();
if (fcntl(fileno((*((struct_fichier *) (*s_objet_resultat).objet))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.descripteur), F_GETLK, &lock) == -1)
^^^^^^^^^^^^ <- This horror is a FILE *
{
perror("fcntl");
if (fclose((*((struct_fichier *) (*s_objet_resultat).objet))
.descripteur) != 0)
{
liberation(s_objet_resultat);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- freeing a structure
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
return;
}
liberation(s_objet_resultat);
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier;
return;
}
When I try to execute this code (the file is open or created),
the fcntl() function returns -1 and I receive :
fcntl: Invalid argument
+++System : File input/output error
The file is opened by :
if (((*((struct_fichier *) (*s_objet_resultat).objet))
.descripteur = fopen(nom, "r+")) == NULL)
{
liberation(s_objet_argument);
free((struct_fichier *) (*s_objet_resultat).objet);
free(s_objet_resultat);
(*s_etat_processus).erreur_execution =
d_ex_erreur_acces_fichier;
return;
}
I have tested this program (you can download this program at
http://rpl2.free.fr, it's a langage for computations) with :
- PC, Linux 2.2.14, Linux 2.4.x (i586, i686, K6/3) ;
- sparc 5 (sun4m 2.2.19) ;
- alpha (ev6 2.2.19).
It works fine on PC and sparc and not on alpha. Why ?
Thank you for your answer,
JKB
--
� D�s que je clique sur "mount", il ne fait rien et le cdrom
reste "unmount". Quel est le probl�me ? �
-+- Popol in Guide du linuxien pervers : "De l'avantage des interfaces..." -+-
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-11-15 13:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-15 13:40 fnctl and Linux alpha BERTRAND Joël
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox