Sponsored Content
Full Discussion: Hi...Need Help
Top Forums Programming Hi...Need Help Post 17972 by rwb1959 on Thursday 21st of March 2002 03:09:35 PM
Old 03-21-2002
I believe that when you are "setting" a semaphore,
the argument (4th parameter in semctl() ) needs to be
a union...

union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
} arg;

...check out sem.h for complete union def. for your system.
In which case you do...

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

main()
{
int semid,retval;
union semun args;
semid=semget(0x20,1,IPC_CREAT|0666);
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
args.val = 1;
semctl(semid,0,SETVAL,args);
printf("HI2\n");
retval= semctl(semid,0,GETVAL,0);
printf("The value returned by the Getval is %d\n",retval);
}
 
FIREWIRE(4)						   BSD Kernel Interfaces Manual 					       FIREWIRE(4)

NAME
firewire -- IEEE1394 High-performance Serial Bus SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file: device firewire Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): firewire_load="YES" DESCRIPTION
FreeBSD provides machine-independent bus support and raw drivers for firewire interfaces. The firewire driver consists of two layers: the controller and the bus layer. The controller attaches to a physical bus (like pci(4)). The firewire bus attaches to the controller. Additional drivers can be attached to the bus. Up to 63 devices, including the host itself, can be attached to a firewire bus. The root node is dynamically assigned with a PHY device function. Also, the other firewire bus specific parameters, e.g., node ID, cycle master, isochronous resource manager and bus manager, are dynamically assigned, after bus reset is initiated. On the firewire bus, every device is identified by an EUI 64 address. FILES
/dev/fw0.0 /dev/fwmem0.0 SEE ALSO
fwe(4), fwip(4), fwohci(4), pci(4), sbp(4), eui64(5), fwcontrol(8), kldload(8), sysctl(8) HISTORY
The firewire driver first appeared in FreeBSD 5.0. AUTHORS
The firewire driver was written by Katsushi Kobayashi and Hidetoshi Shimokawa for the FreeBSD project. BUGS
See fwohci(4) for security notes. BSD
April 1, 2006 BSD
All times are GMT -4. The time now is 10:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy