static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; int err; int pid; switch(cmd) { case FIOSETOWN: case SIOCSPGRP: err = get_user(pid, (int *) arg); if (err) return err; if (current->pid != pid && current->pgrp != -pid && !suser()) return -EPERM; sk->proc = pid; return(0); case FIOGETOWN: case SIOCGPGRP: return put_user(sk->proc, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; err = -EFAULT; if (!copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval))) err = 0; return err; case SIOCGIFFLAGS: case SIOCSIFFLAGS: case SIOCGIFCONF: case SIOCGIFMETRIC: case SIOCSIFMETRIC: case SIOCGIFMEM: case SIOCSIFMEM: case SIOCGIFMTU: case SIOCSIFMTU: case SIOCSIFLINK: case SIOCGIFHWADDR: case SIOCSIFHWADDR: case SIOCSIFMAP: case SIOCGIFMAP: case SIOCSIFSLAVE: case SIOCGIFSLAVE: case SIOCGIFINDEX: case SIOCGIFNAME: case SIOCGIFCOUNT: case SIOCSIFHWBROADCAST: return(dev_ioctl(cmd,(void *) arg)); case SIOCSIFADDR: case SIOCGIFADDR: return ec_dev_ioctl(sock, cmd, (void *)arg); break; default: return(dev_ioctl(cmd,(void *) arg)); } /*NOTREACHED*/ return 0; }
static int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; int err = -EINVAL; int pid; switch(cmd) { case FIOSETOWN: case SIOCSPGRP: err = get_user(pid, (int *) arg); if(err) return err; /* see sock_no_fcntl */ if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN)) return -EPERM; sk->proc = pid; return(0); case FIOGETOWN: case SIOCGPGRP: err = put_user(sk->proc,(int *)arg); if(err) return err; return(0); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; err = copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)); if (err) return -EFAULT; return 0; case SIOCADDRT: case SIOCDELRT: return(ipv6_route_ioctl(cmd,(void *)arg)); case SIOCSIFADDR: return addrconf_add_ifaddr((void *) arg); case SIOCDIFADDR: return addrconf_del_ifaddr((void *) arg); case SIOCSIFDSTADDR: return addrconf_set_dstaddr((void *) arg); default: if ((cmd >= SIOCDEVPRIVATE) && (cmd <= (SIOCDEVPRIVATE + 15))) return(dev_ioctl(cmd,(void *) arg)); if(sk->prot->ioctl==0 || (err=sk->prot->ioctl(sk, cmd, arg))==-ENOIOCTLCMD) return(dev_ioctl(cmd,(void *) arg)); return err; } /*NOTREACHED*/ return(0); }
void start(void) { uint16_t count; uint8_t index; buffer = (char *)mos_mem_alloc((uint16_t)BUFFER_SIZE); memset(buffer, 'X', BUFFER_SIZE); /* For safety, erase entire FLASH */ dev_ioctl(DEV_TELOS_FLASH, TELOS_FLASH_BULK_ERASE); /* Turn on the FLASH */ dev_mode(DEV_TELOS_FLASH, DEV_MODE_ON); /* Acquire lock on FLASH and preliminarly * write 64 bits of data */ dev_open(DEV_TELOS_FLASH); count = dev_write(DEV_TELOS_FLASH, "abcdefgh", 8); printf("%d bytes of data have been written to FLASH memory\n", count); dev_close(DEV_TELOS_FLASH); /* Perform experiments over R/W pointer to FLASH */ /* Experiment#1 - flash is on, lock is free; aquire lock and read * without using any SEEK function */ dev_open(DEV_TELOS_FLASH); count = dev_read(DEV_TELOS_FLASH, buffer, 1); printf("#1 : %c has been read from FLASH memory\n", buffer[0]); dev_close(DEV_TELOS_FLASH); /* Move pointer */ dev_open(DEV_TELOS_FLASH); dev_ioctl(DEV_TELOS_FLASH, DEV_SEEK, 3); dev_close(DEV_TELOS_FLASH); /* Experiment#2 - flash is on, lock is free; aquire lock, read single data, * write single data and read multiple data from it */ dev_open(DEV_TELOS_FLASH); dev_read(DEV_TELOS_FLASH, buffer, 1); printf("#2 : %c has been read\n" " : FLASH memory written\n", buffer[0]); dev_write(DEV_TELOS_FLASH, "l", 1); count = dev_read(DEV_TELOS_FLASH, buffer, 1); printf(" : %d bytes have been read from FLASH memory: ", count); for(index = 0; index < count; index++) { printf("%c ", buffer[index]); } printf("\n"); dev_close(DEV_TELOS_FLASH); /* Release lock and free resources */ dev_close(DEV_TELOS_FLASH); dev_mode(DEV_TELOS_FLASH, DEV_MODE_OFF); mos_mem_free(buffer); return; }
int ybs_set_vr(int d) //set Vref { int uv_per_bit = (int)(VREF_DAC * 1e6 / (1 << 16)); d = d2uv(d) / uv_per_bit; d = (d > 0xffff) ? 0xffff : d; d = (d < 0) ? 0 : d; dev_ioctl(ybs_fd_dac, DAC_SET_CH, 0); dev_write(ybs_fd_dac, &d, 0); dev_ioctl(ybs_fd_dac, DAC_SET_CH, 1); //for fast ch1 write purpose return 0; }
NTSTATUS remove_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath) { NTSTATUS Status; MOUNTMGR_MOUNT_POINT* mmp; ULONG mmpsize; MOUNTMGR_MOUNT_POINTS mmps1, *mmps2; TRACE("removing drive letter\n"); mmpsize = sizeof(MOUNTMGR_MOUNT_POINT) + devpath->Length; mmp = ExAllocatePoolWithTag(PagedPool, mmpsize, ALLOC_TAG); if (!mmp) { ERR("out of memory\n"); return STATUS_INSUFFICIENT_RESOURCES; } RtlZeroMemory(mmp, mmpsize); mmp->DeviceNameOffset = sizeof(MOUNTMGR_MOUNT_POINT); mmp->DeviceNameLength = devpath->Length; RtlCopyMemory(&mmp[1], devpath->Buffer, devpath->Length); Status = dev_ioctl(mountmgr, IOCTL_MOUNTMGR_DELETE_POINTS, mmp, mmpsize, &mmps1, sizeof(MOUNTMGR_MOUNT_POINTS), FALSE, NULL); if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW) { ERR("IOCTL_MOUNTMGR_DELETE_POINTS 1 returned %08x\n", Status); ExFreePool(mmp); return Status; } if (Status != STATUS_BUFFER_OVERFLOW || mmps1.Size == 0) { ExFreePool(mmp); return STATUS_NOT_FOUND; } mmps2 = ExAllocatePoolWithTag(PagedPool, mmps1.Size, ALLOC_TAG); if (!mmps2) { ERR("out of memory\n"); ExFreePool(mmp); return STATUS_INSUFFICIENT_RESOURCES; } Status = dev_ioctl(mountmgr, IOCTL_MOUNTMGR_DELETE_POINTS, mmp, mmpsize, mmps2, mmps1.Size, FALSE, NULL); if (!NT_SUCCESS(Status)) ERR("IOCTL_MOUNTMGR_DELETE_POINTS 2 returned %08x\n", Status); ExFreePool(mmps2); ExFreePool(mmp); return Status; }
//retrieve the x&y values of the accelerometer void accel_get_val () { uint8_t x, y; accel_on(); //turn accel on to read value dev_ioctl(DEV_ADC, ADC_SET_CHANNEL, 1); dev_read(DEV_ADC, &x, sizeof(x)); dev_ioctl(DEV_ADC, ADC_SET_CHANNEL, 1); dev_read(DEV_ADC, &y, sizeof(y)); accel_off(); //turn off accel printf("%C\t%C\n",x,y); }
void ext_flash_read() { uint32_t address = 0; //uint8_t data [534]; //uint8_t data[80]; uint16_t i; comBuf pkt; for (i = 0; i < sizeof (data); i++) { data[i] = '0'; } dev_ioctl (DEV_ATMEL_FLASH, DEV_SEEK, address); dev_read (DEV_ATMEL_FLASH, data, sizeof (data)); //printf ("%s", (char *)data); pkt.size = 3; pkt.data[0] = 245; for (i = 0; i < sizeof (data); i++) { //printf ("%c", data[i]); *((uint16_t *)&pkt.data[1]) = data[i]; com_send (IFACE_SERIAL, &pkt); } //printf('\n'); }
static NTSTATUS vol_is_writable(volume_device_extension* vde) { pdo_device_extension* pdode = vde->pdode; NTSTATUS Status; LIST_ENTRY* le; BOOL writable = FALSE; ExAcquireResourceSharedLite(&pdode->child_lock, TRUE); le = pdode->children.Flink; while (le != &pdode->children) { volume_child* vc = CONTAINING_RECORD(le, volume_child, list_entry); Status = dev_ioctl(vc->devobj, IOCTL_DISK_IS_WRITABLE, NULL, 0, NULL, 0, TRUE, NULL); if (NT_SUCCESS(Status)) { writable = TRUE; break; } else if (Status != STATUS_MEDIA_WRITE_PROTECTED) goto end; le = le->Flink; } Status = writable ? STATUS_SUCCESS : STATUS_MEDIA_WRITE_PROTECTED; end: ExReleaseResourceLite(&pdode->child_lock); return STATUS_SUCCESS; }
static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { FAR struct inode *inode = filep->f_inode; FAR struct can_dev_s *dev = inode->i_private; int ret = OK; canvdbg("cmd: %d arg: %ld\n", cmd, arg); /* Handle built-in ioctl commands */ switch (cmd) { /* CANIOCTL_RTR: Send the remote transmission request and wait for the * response. Argument is a reference to struct canioctl_rtr_s * (casting to uintptr_t first eliminates complaints on some * architectures where the sizeof long is different from the size of * a pointer). */ case CANIOCTL_RTR: ret = can_rtrread(dev, (struct canioctl_rtr_s*)((uintptr_t)arg)); break; /* Not a "built-in" ioctl command.. perhaps it is unique to this * device driver. */ default: ret = dev_ioctl(dev, cmd, arg); break; } return ret; }
static NTSTATUS vol_check_verify(volume_device_extension* vde) { pdo_device_extension* pdode = vde->pdode; NTSTATUS Status; LIST_ENTRY* le; ExAcquireResourceSharedLite(&pdode->child_lock, TRUE); le = pdode->children.Flink; while (le != &pdode->children) { volume_child* vc = CONTAINING_RECORD(le, volume_child, list_entry); Status = dev_ioctl(vc->devobj, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, FALSE, NULL); if (!NT_SUCCESS(Status)) goto end; le = le->Flink; } Status = STATUS_SUCCESS; end: ExReleaseResourceLite(&pdode->child_lock); return Status; }
void accel_off () { uint8_t i; dev_ioctl(DEV_AVR_I2C, I2C_SET_BRR, 50); //set speed dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, ADG715_PWR_ADDR); //set dest address dev_read(DEV_AVR_I2C, &i, sizeof(i)); //get current value i &= ~(1 <<5); //turn off accel dev_write(DEV_AVR_I2C, &i, sizeof(i)); //write value back printf("Weatherboard accelerometer off.\n"); }
NTSTATUS mountmgr_add_drive_letter(PDEVICE_OBJECT mountmgr, PUNICODE_STRING devpath) { NTSTATUS Status; ULONG mmdltsize; MOUNTMGR_DRIVE_LETTER_TARGET* mmdlt; MOUNTMGR_DRIVE_LETTER_INFORMATION mmdli; mmdltsize = (ULONG)offsetof(MOUNTMGR_DRIVE_LETTER_TARGET, DeviceName[0]) + devpath->Length; mmdlt = ExAllocatePoolWithTag(NonPagedPool, mmdltsize, ALLOC_TAG); if (!mmdlt) { ERR("out of memory\n"); return STATUS_INSUFFICIENT_RESOURCES; } mmdlt->DeviceNameLength = devpath->Length; RtlCopyMemory(&mmdlt->DeviceName, devpath->Buffer, devpath->Length); TRACE("mmdlt = %.*S\n", mmdlt->DeviceNameLength / sizeof(WCHAR), mmdlt->DeviceName); Status = dev_ioctl(mountmgr, IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER, mmdlt, mmdltsize, &mmdli, sizeof(MOUNTMGR_DRIVE_LETTER_INFORMATION), FALSE, NULL); if (!NT_SUCCESS(Status)) ERR("IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER returned %08x\n", Status); else TRACE("DriveLetterWasAssigned = %u, CurrentDriveLetter = %c\n", mmdli.DriveLetterWasAssigned, mmdli.CurrentDriveLetter); ExFreePool(mmdlt); return Status; }
static void get_cb() { boot_control_block_t cb; dev_ioctl(DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR); dev_read(DEV_AVR_EEPROM, (uint8_t *)&cb, sizeof(cb)); printf("Node id: %d, Byte Count: %l, Start addr: %l, Reprogram: %d\n", cb.node_id, cb.byte_count, cb.start_addr, cb.reprogram); }
void eep_write () { // boot control block is at addr 0, so start somewhere else uint16_t address = 100; uint8_t data[] = "mantis rocks yo"; dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, address); dev_write (DEV_AVR_EEPROM, data, sizeof (data)); }
static void clear_cb () { boot_control_block_t cb; dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR); cb.node_id = mos_node_id_get (); cb.byte_count = (uint32_t)0; cb.start_addr = (uint32_t)0; cb.reprogram = 0; dev_write (DEV_AVR_EEPROM, (uint8_t *)&cb, sizeof (cb)); }
void eep_read () { uint16_t address = 100; uint8_t data [20]; memset (data, 0, sizeof (data)); dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, address); dev_read (DEV_AVR_EEPROM, data, sizeof (data)); printf ("%s", (char *)data); }
void gps_on(void) { uint8_t i; // set speed dev_ioctl(DEV_AVR_I2C, I2C_SET_BRR, 50); // set the address from which to read/write dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, SWITCH_1); // read the current value dev_read(DEV_AVR_I2C, &i, sizeof(i)); // set the appropriate bits. i |= GPS_ENABLE_MASK; // write the value back dev_write(DEV_AVR_I2C, &i, sizeof(i)); // verify that the bits have been written correctly. do { i = 0; dev_read(DEV_AVR_I2C, &i, sizeof(i)); }while((i & (GPS_ENABLE_MASK)) != GPS_ENABLE_MASK); }
void ext_flash_write() { uint32_t address = 0; //uint8_t data[] = "mantis"; uint16_t i; for (i = 0; i < sizeof (data); i++) { data[i] = (i % 10) + '0'; } dev_ioctl (DEV_ATMEL_FLASH, DEV_SEEK, address); dev_write (DEV_ATMEL_FLASH, data, sizeof (data)); }
void poll() { uint8_t i; uint16_t j; uint8_t x, y; dev_mode(DEV_ADC, DEV_MODE_ON); for(i = 0; i < 40; i++) { dev_ioctl(DEV_ADC, ADC_SET_CHANNEL, 1); dev_read(DEV_ADC, &x, sizeof(x)); dev_ioctl(DEV_ADC, ADC_SET_CHANNEL, 2); dev_read(DEV_ADC, &y, sizeof(y)); printf("%C\t%C\n",x,y); for(j=0;j<0xffff;j++); for(j=0;j<0xffff;j++); for(j=0;j<0xffff;j++); for(j=0;j<0xffff;j++); } }
void setup() { uint8_t i; uint8_t j; i = (1 << 5); uint8_t retval; mos_led_display(7); printf("Setting bit rate reg to 10.\n"); dev_ioctl(DEV_AVR_I2C, I2C_SET_BRR, 50); printf("Setting dest address to 72.\n"); dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, 72); printf("Writing %C to ADG715!\n", i); retval = dev_write(DEV_AVR_I2C, &i, sizeof(i)); printf("Wrote %C bytes.\n", retval); printf("Retrieving current value.\n"); retval = dev_read(DEV_AVR_I2C, &j, sizeof(j)); printf("retval: %C\nCurr Val: %C\n", retval, j); if(i == j) { printf("ADG715 is working properly.\n"); } else { printf("ADG715 returned incorrect value.\n"); } printf("done.\n"); mos_led_display(0); }
void start(void) { // get an exclusive lock on the GPS driver. this is // actually unnecessary, since no other threads are // present/trying to use the GPS, but it's good // practice. dev_open(DEV_MICA2_GPS); dev_mode(DEV_MICA2_GPS, DEV_MODE_ON); // tell the driver that we want to read a gps_gga_t // structure when we call dev_read(). The other // option is to read a string which may or may not // be GGA data (ie, might be some other packet type) dev_ioctl(DEV_MICA2_GPS, MICA2_GPS_READ_GGA); while(1) { // read the next available GGA packet into our structure. dev_read(DEV_MICA2_GPS, &gga, sizeof(gga)); // only print gga packets which contain some information if (gga.satellite_count > 0) { // print the data. this function parses all the // information for us, so that we don't have to. mica2_gps_print_gga(&gga); } else { printf("no satellites found; sleeping.\n"); // send the system to idle mode for 5 seconds. mos_thread_sleep(5000); } } // if the while loop above were not infinite, // it would be good practice to turn off the device // and release our exclusive lock on it. dev_mode(DEV_MICA2_GPS, DEV_MODE_OFF); dev_close(DEV_MICA2_GPS); }
static void reprogram() { /*boot_control_block_t cb; dev_ioctl(DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR); dev_read(DEV_AVR_EEPROM, (uint8_t *)&cb, sizeof(cb));*/ //printf ("Receiving a code image over serial\n"); //uint32_t image_size = reprogram_iface (IFACE_SERIAL, &cb, 0); mos_file* file = reprogram_iface (IFACE_SERIAL, NULL); mos_file_flush(file); boot_control_block_t cb; cb.node_id = mos_node_id_get (); cb.byte_count = file->length; cb.start_addr = file->start; cb.reprogram = 1; dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR); dev_write (DEV_AVR_EEPROM, (uint8_t *)&cb, CONTROL_BLOCK_SIZE); }
int32_t read_sectors(info_t *info, uint32_t seccount, uint64_t lba, char *buf) { ata_req_t req; req.protocol = ATA_PROTO_PIO; req.channel = info->drive->channel; req.drvnum = info->drive->drvnum; req.seccount = seccount; req.lba = lba; req.amode = info->drive->mode; req.cmd = req.amode == ATA_AMODE_LBA48 ? ATA_CMD_READ_PIO_EXT: ATA_CMD_READ_PIO; req.buf = (uint8_t *) buf; req.bufsize = seccount*512; req.drqsize = 512; req.direction = ATA_DIR_READ; req.wmode = ATA_WMODE_IRQ; return dev_ioctl(info->dev->parent_bus->ctl, 0, &req); }
int sim_sock_ioctl (struct SimSocket *socket, int request, char *argp) { struct socket *sock = (struct socket *)socket; struct sock *sk; struct net *net; int err; sk = sock->sk; net = sock_net(sk); err = sock->ops->ioctl(sock, request, (long)argp); /* * If this ioctl is unknown try to hand it down * to the NIC driver. */ if (err == -ENOIOCTLCMD) err = dev_ioctl(net, request, argp); return err; }
void gps_off(void) { uint8_t i; // set the address from which to read/write dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, SWITCH_1); // read the current value dev_read(DEV_AVR_I2C, &i, sizeof(i)); // mask out the appropriate bits i &= (uint8_t)(~GPS_ENABLE_MASK); // write the value back. dev_write(DEV_AVR_I2C, &i, sizeof(i)); // verify that the bits have been cleared. do { i = 0; dev_read(DEV_AVR_I2C, &i, sizeof(i)); }while((i & (GPS_ENABLE_MASK))); }
static void set_cb () { uint32_t addr; uint32_t size; uint8_t reprogram; printf ("Start address? "); addr = prompt_longlong ("#:"); printf ("Image size? "); size = prompt_longlong ("#:"); printf ("Reprogram? "); reprogram = prompt_long ("#:"); boot_control_block_t cb; cb.node_id = mos_node_id_get (); cb.byte_count = size; cb.start_addr = addr; cb.reprogram = reprogram; dev_ioctl (DEV_AVR_EEPROM, DEV_SEEK, CONTROL_BLOCK_ADDR); dev_write (DEV_AVR_EEPROM, (uint8_t *)&cb, CONTROL_BLOCK_SIZE); }
void gps_disable_bits(uint8_t mask) { uint8_t i; // set the address from which to read/write dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, SWITCH_2); // read the current value dev_read(DEV_AVR_I2C, &i, sizeof(i)); // clear the RX/TX bits i &= ~(mask); // write the value back dev_write(DEV_AVR_I2C, &i, sizeof(i)); // verify that the bits have been cleared. do { i = 0; dev_read(DEV_AVR_I2C, &i, sizeof(i)); }while(i & (mask)); // disable rx UCSR1B &= ~(1 << RXEN1); }
static int msg_loop() { PDEVMSG pMsg; int ret; device_t hdl = 0; pMsg = (PDEVMSG)malloc(sizeof(DEVMSG)+512); while(pMsg) { ret = msgrcv(g_msgid,pMsg,MSGMAXSIZE,DEVMSGTYPE,0); if(ret > 0) { ret = -1; switch(pMsg->cmd) { case REG_DEV: hdl = register_device((char *)pMsg->param); break; case UNREG_DEV: ret = unregister_device(pMsg->sohdl); break; case DEV_CTRL: ret = dev_ioctl(pMsg); default: break; } } if(pMsg->ret) { pMsg->ret = ret; pMsg->sohdl = hdl; pMsg->type = pMsg->timing; msgsnd(g_retmsgid,pMsg,MSGMAXSIZE,0); } } return DEV_SUC; }
void gps_enable_bits(uint8_t mask) { // disable uart1 interrupt UCSR1B &= ~((1 << RXCIE1) | (1 << RXEN1)); // enable rx UCSR1B |= (1 << RXEN1); uint8_t i; // set the address from which to read/write dev_ioctl(DEV_AVR_I2C, I2C_DEST_ADDR, SWITCH_2); // read the current value dev_read(DEV_AVR_I2C, &i, sizeof(i)); // set the RX/TX bits i |= (mask); // write the value back dev_write(DEV_AVR_I2C, &i, sizeof(i)); //overwrite value // verify that the bits have been written correctly. do { i = 0; dev_read(DEV_AVR_I2C, &i, sizeof(i)); }while((i & (mask)) != (mask)); }
static int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk=(struct sock *)sock->data; int err, pid; switch(cmd) { case FIOSETOWN: case SIOCSPGRP: err=verify_area(VERIFY_READ,(int *)arg,sizeof(long)); if(err) return err; pid = get_fs_long((int *) arg); /* see inet_fcntl */ if (current->pid != pid && current->pgrp != -pid && !suser()) return -EPERM; sk->proc = pid; return(0); case FIOGETOWN: case SIOCGPGRP: err=verify_area(VERIFY_WRITE,(void *) arg, sizeof(long)); if(err) return err; put_fs_long(sk->proc,(int *)arg); return(0); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; err=verify_area(VERIFY_WRITE,(void *)arg,sizeof(struct timeval)); if(err) return err; memcpy_tofs((void *)arg,&sk->stamp,sizeof(struct timeval)); return 0; case SIOCADDRT: case SIOCADDRTOLD: case SIOCDELRT: case SIOCDELRTOLD: return(ip_rt_ioctl(cmd,(void *) arg)); case SIOCDARP: case SIOCGARP: case SIOCSARP: return(arp_ioctl(cmd,(void *) arg)); #ifdef CONFIG_INET_RARP case SIOCDRARP: case SIOCGRARP: case SIOCSRARP: return(rarp_ioctl(cmd,(void *) arg)); #endif case SIOCGIFCONF: case SIOCGIFFLAGS: case SIOCSIFFLAGS: case SIOCGIFADDR: case SIOCSIFADDR: /* begin multicast support change */ case SIOCADDMULTI: case SIOCDELMULTI: /* end multicast support change */ case SIOCGIFDSTADDR: case SIOCSIFDSTADDR: case SIOCGIFBRDADDR: case SIOCSIFBRDADDR: case SIOCGIFNETMASK: case SIOCSIFNETMASK: case SIOCGIFMETRIC: case SIOCSIFMETRIC: case SIOCGIFMEM: case SIOCSIFMEM: case SIOCGIFMTU: case SIOCSIFMTU: case SIOCSIFLINK: case SIOCGIFHWADDR: case SIOCSIFHWADDR: case OLD_SIOCGIFHWADDR: case SIOCSIFMAP: case SIOCGIFMAP: case SIOCSIFSLAVE: case SIOCGIFSLAVE: return(dev_ioctl(cmd,(void *) arg)); default: if ((cmd >= SIOCDEVPRIVATE) && (cmd <= (SIOCDEVPRIVATE + 15))) return(dev_ioctl(cmd,(void *) arg)); if (sk->prot->ioctl==NULL) return(-EINVAL); return(sk->prot->ioctl(sk, cmd, arg)); } /*NOTREACHED*/ return(0); }