From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111c93,b993af56bc71b59f,start X-Google-Attributes: gid111c93,public X-Google-ArrivalTime: 2001-11-15 05:41:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!opentransit.net!jussieu.fr!cnam.fr!bertrand From: bertrand@perceval.cnam.fr (BERTRAND =?iso-8859-1?Q?Jo=EBl?=) Newsgroups: comp.os.linux.alpha Subject: fnctl and Linux alpha Date: 15 Nov 2001 13:40:24 GMT Organization: Conservatoire National des Arts et Metiers Message-ID: Reply-To: bertrand@cnam.fr NNTP-Posting-Host: perceval.cnam.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: kelvin.cnam.fr 1005831624 24975 163.173.213.84 (15 Nov 2001 13:40:24 GMT) X-Complaints-To: usenet@news.cnam.fr NNTP-Posting-Date: 15 Nov 2001 13:40:24 GMT User-Agent: slrn/0.9.6.4 (Linux) Xref: archiver1.google.com comp.os.linux.alpha:4240 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..." -+-