コード例 #1
0
ファイル: main.c プロジェクト: jbonaldo/Sincrotron
int main( void )
{
    c28_config();
    ethernet_config();
    shared_mem_init();
    
    while( 1 )
    {
        if( ethernet_main( &command.cmd, &command.length, command.data) )
            cmd_processCMD( &command );
    }
    
}
コード例 #2
0
ファイル: lib-sfs.c プロジェクト: TylerU/CS352Proj2
/**
 * Called once to initialize the shared memory data structures for this library.
 *
 * Parameters: 	sys_key - The ID of the shared memory segment all participating processes should use.
 * Returns: 1 on success, 0 otherwise
 */
int sfs_init(int sys_key) {
	// Initialize shared memory
	int id = get_segment_id(sys_key);
	if(id == -1) return 0;

	char *shared_mem = (char *) shmat(id, NULL, 0);
	if(shared_mem == (void *)-1) return 0;

	shared_mem_init(shared_mem);

	int result = shmdt(shared_mem);
	if(result == -1) return 0;

	return 1;
}