Sponsored Content
Full Discussion: Hi...Need Help
Top Forums Programming Hi...Need Help Post 17951 by jack_2205 on Thursday 21st of March 2002 11:58:43 AM
Old 03-21-2002
Hi...Need Help

Hi,

I am getting a bus error when i run the following code.

#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <errno.h>

main()
{
int semid,retval;
semid=semget(0x20,1,IPC_CREAT|0666);
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
semctl(semid,0,SETVAL,1);
printf("HI2\n");
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
}



The bus error is due to this statement semctl(semid,0,SETVAL,1);

Can any one help to solve the problem.

Ur help will be appreciated.

Thanks..Jack
 
I2C_ADD_NUMBERED_ADA(9) 				      I2C and SMBus Subsystem					   I2C_ADD_NUMBERED_ADA(9)

NAME
i2c_add_numbered_adapter - declare i2c adapter, use static bus number SYNOPSIS
int i2c_add_numbered_adapter(struct i2c_adapter * adap); ARGUMENTS
adap the adapter to register (with adap->nr initialized) CONTEXT
can sleep DESCRIPTION
This routine is used to declare an I2C adapter when its bus number matters. For example, use it for I2C adapters from system-on-chip CPUs, or otherwise built in to the system's mainboard, and where i2c_board_info is used to properly configure I2C devices. If the requested bus number is set to -1, then this function will behave identically to i2c_add_adapter, and will dynamically assign a bus number. If no devices have pre-been declared for this bus, then be sure to register the adapter before any dynamically allocated ones. Otherwise the required bus ID may not be available. When this returns zero, the specified adapter became available for clients using the bus number provided in adap->nr. Also, the table of I2C devices pre-declared using i2c_register_board_info is scanned, and the appropriate driver model device nodes are created. Otherwise, a negative errno value is returned. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 I2C_ADD_NUMBERED_ADA(9)
All times are GMT -4. The time now is 04:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy