Hello again, some correction on the last message: It was working 2 or 3 times, now its not working at all again ..... argh Is there some problem with FIFOs, maybe with the size of my message, or could have something gone wrong during kernel patch ? I've been working on this problem for some hours now, but just cannot find out whats the basic problem here .... Thanks again Marco > -----Ursprüngliche Nachricht----- > Von: Schwarz, Marco (Exchange) > Gesendet am: Freitag, 15. September 2000 10:04 > An: '[EMAIL PROTECTED]' > Betreff: RTAI 1.4/FIFO problem > > Hello all, > > I have some strange effects when writing to FIFOs from user space with > write(). When I am trying to write my data(a struct) to the FIFO, I get a > segmentation fault. > > I got around this by doing > > memset (&cfg, 0, sizeof (CONFIG_DATA)); > > at the beginning of the function. How can this be ? I thought the data I > pass to write is handled like a buffer with n Bytes, but if seg fault > happens, somebody has to be interpreting something here ? > > I put some pieces of code below. Maybe somebody can tell me whats wrong > here, if not, i'll just do my memset :). > > Thanks in advance, > > Marco Schwarz. > > > > The function that looks like follows: > > int rtc_config_add_card (int nIfNr, int nBusType, int nPCIBus, int > nPCISlot, int nDeviceID, int nVendorID, int nRefreshTime, > > RTC_RETURN *ret) > { > CONFIG_DATA cfg; > int nBytesRead, nBytesSent; > > /* Segmentation fault if not set to 0 !!! */ > memset (&cfg, 0, sizeof (CONFIG_DATA)); > > cfg.nConfigAction = CA_ADD_CARD; > cfg.nIfNr = nIfNr; > cfg.nBusType = nBusType; > cfg.nPCIBus = nPCIBus; > cfg.nPCISlot = nPCISlot; > cfg.nDeviceID = nDeviceID; > cfg.nVendorID = nVendorID; > cfg.nRefreshTime = nRefreshTime; > > printf ("\nADD_CARD\n"); > printf ("cfg.nIfNr: %d\n",cfg.nIfNr); > printf ("cfg.nBusTyp: %d\n",cfg.nBusType); > printf ("cfg.nPCIBus: %d\n",cfg.nPCIBus); > printf ("cfg.nPCISlot: %d\n",cfg.nPCISlot); > printf ("cfg.nDeviceID: %x\n",cfg.nDeviceID); > printf ("cfg.nVendorID: %x\n",cfg.nVendorID); > printf ("cfg.nRefreshTime: %d\n",cfg.nRefreshTime); > > nBytesSent = write(nConfigSendFIFO, &cfg, sizeof(CONFIG_DATA)); > nBytesRead = read(nConfigReceiveFIFO, ret, sizeof(RTC_RETURN)); > > if (nBytesRead == sizeof (CONFIG_DATA)) > return 0; > else > return -1; > } > > Structure definition: > > typedef struct > { > /* Allg. Teil */ > int nConfigAction; > > /* Kartenkonfiguration */ > int nIfNr; > int nBusType; > int nPCIBus; > int nPCISlot; > int nDeviceID; > int nVendorID; > int nRefreshTime; > > /* Signalkonfiguration */ > int nSigNr; > int nSigType; > int nSigVM; > int nSigVMGrad; > int nSigVI; > int nSigVIInc; > int nConvPar; > float fRangeMax; > float fRangeMin; > } CONFIG_DATA; > > -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] --- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/