From: bertrand@perceval.cnam.fr (BERTRAND Joël)
Subject: fnctl and Linux alpha
Date: 15 Nov 2001 13:40:24 GMT [thread overview]
Message-ID: <slrn9v7hdp.p4s.bertrand@perceval.cnam.fr> (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..." -+-
reply other threads:[~2001-11-15 13:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox