userland: Pass more sizes with ioctls where we can.
No "functional" change intended.
This commit is contained in:
parent
4c9e8f77e4
commit
9d06690ede
@ -284,7 +284,8 @@ KeyboardDevice::_ControlThread()
|
|||||||
memset(states, 0, sizeof(states));
|
memset(states, 0, sizeof(states));
|
||||||
|
|
||||||
if (fKeyboardID == 0) {
|
if (fKeyboardID == 0) {
|
||||||
if (ioctl(fFD, KB_GET_KEYBOARD_ID, &fKeyboardID) == 0) {
|
if (ioctl(fFD, KB_GET_KEYBOARD_ID, &fKeyboardID,
|
||||||
|
sizeof(fKeyboardID)) == 0) {
|
||||||
BMessage message(IS_SET_KEYBOARD_ID);
|
BMessage message(IS_SET_KEYBOARD_ID);
|
||||||
message.AddInt16("id", fKeyboardID);
|
message.AddInt16("id", fKeyboardID);
|
||||||
be_app->PostMessage(&message);
|
be_app->PostMessage(&message);
|
||||||
@ -529,7 +530,7 @@ KeyboardDevice::_UpdateSettings(uint32 opcode)
|
|||||||
if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK) {
|
if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK) {
|
||||||
LOG_ERR("error when get_key_repeat_rate\n");
|
LOG_ERR("error when get_key_repeat_rate\n");
|
||||||
} else if (ioctl(fFD, KB_SET_KEY_REPEAT_RATE,
|
} else if (ioctl(fFD, KB_SET_KEY_REPEAT_RATE,
|
||||||
&fSettings.key_repeat_rate) != B_OK) {
|
&fSettings.key_repeat_rate, sizeof(int32)) != B_OK) {
|
||||||
LOG_ERR("error when KB_SET_KEY_REPEAT_RATE, fd:%d\n", fFD);
|
LOG_ERR("error when KB_SET_KEY_REPEAT_RATE, fd:%d\n", fFD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +539,7 @@ KeyboardDevice::_UpdateSettings(uint32 opcode)
|
|||||||
if (get_key_repeat_delay(&fSettings.key_repeat_delay) != B_OK) {
|
if (get_key_repeat_delay(&fSettings.key_repeat_delay) != B_OK) {
|
||||||
LOG_ERR("error when get_key_repeat_delay\n");
|
LOG_ERR("error when get_key_repeat_delay\n");
|
||||||
} else if (ioctl(fFD, KB_SET_KEY_REPEAT_DELAY,
|
} else if (ioctl(fFD, KB_SET_KEY_REPEAT_DELAY,
|
||||||
&fSettings.key_repeat_delay) != B_OK) {
|
&fSettings.key_repeat_delay, sizeof(bigtime_t)) != B_OK) {
|
||||||
LOG_ERR("error when KB_SET_KEY_REPEAT_DELAY, fd:%d\n", fFD);
|
LOG_ERR("error when KB_SET_KEY_REPEAT_DELAY, fd:%d\n", fFD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,7 +571,7 @@ KeyboardDevice::_UpdateLEDs()
|
|||||||
if ((fModifiers & B_SCROLL_LOCK) != 0)
|
if ((fModifiers & B_SCROLL_LOCK) != 0)
|
||||||
lockIO[2] = 1;
|
lockIO[2] = 1;
|
||||||
|
|
||||||
ioctl(fFD, KB_SET_LEDS, &lockIO);
|
ioctl(fFD, KB_SET_LEDS, &lockIO, sizeof(lockIO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ TabletDevice::_UpdateSettings()
|
|||||||
if (get_click_speed(&fSettings.click_speed) != B_OK)
|
if (get_click_speed(&fSettings.click_speed) != B_OK)
|
||||||
LOG_ERR("error when get_click_speed\n");
|
LOG_ERR("error when get_click_speed\n");
|
||||||
else
|
else
|
||||||
ioctl(fDevice, MS_SET_CLICKSPEED, &fSettings.click_speed);
|
ioctl(fDevice, MS_SET_CLICKSPEED, &fSettings.click_speed, sizeof(bigtime_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -499,7 +499,8 @@ DataEditor::SetTo(BEntry &entry, const char *attribute)
|
|||||||
} else if (fIsDevice) {
|
} else if (fIsDevice) {
|
||||||
device_geometry geometry;
|
device_geometry geometry;
|
||||||
int device = fFile.Dup();
|
int device = fFile.Dup();
|
||||||
if (device < 0 || ioctl(device, B_GET_GEOMETRY, &geometry) < 0) {
|
if (device < 0 || ioctl(device, B_GET_GEOMETRY, &geometry,
|
||||||
|
sizeof(geometry)) < 0) {
|
||||||
if (device >= 0)
|
if (device >= 0)
|
||||||
close(device);
|
close(device);
|
||||||
fFile.Unset();
|
fFile.Unset();
|
||||||
|
@ -536,7 +536,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
|||||||
|
|
||||||
struct winsize ws = { handshake.row, handshake.col };
|
struct winsize ws = { handshake.row, handshake.col };
|
||||||
|
|
||||||
ioctl(0, TIOCSWINSZ, &ws);
|
ioctl(0, TIOCSWINSZ, &ws, sizeof(ws));
|
||||||
|
|
||||||
tcsetpgrp(0, getpgrp());
|
tcsetpgrp(0, getpgrp());
|
||||||
// set this process group ID as the controlling terminal
|
// set this process group ID as the controlling terminal
|
||||||
|
@ -79,7 +79,7 @@ update_leds(int fd, uint32 modifiers)
|
|||||||
if ((modifiers & B_SCROLL_LOCK) != 0)
|
if ((modifiers & B_SCROLL_LOCK) != 0)
|
||||||
lockIO[2] = 1;
|
lockIO[2] = 1;
|
||||||
|
|
||||||
ioctl(fd, KB_SET_LEDS, &lockIO);
|
ioctl(fd, KB_SET_LEDS, &lockIO, sizeof(lockIO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +106,8 @@ keyboard_reader(void* arg)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
raw_key_info rawKeyInfo;
|
raw_key_info rawKeyInfo;
|
||||||
if (ioctl(keyboard->device, KB_READ, &rawKeyInfo) != 0)
|
if (ioctl(keyboard->device, KB_READ, &rawKeyInfo,
|
||||||
|
sizeof(rawKeyInfo)) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
uint32 keycode = rawKeyInfo.keycode;
|
uint32 keycode = rawKeyInfo.keycode;
|
||||||
|
@ -412,7 +412,7 @@ command_list(int argc, const char* const* argv)
|
|||||||
|
|
||||||
// issue the request
|
// issue the request
|
||||||
ram_disk_ioctl_info request;
|
ram_disk_ioctl_info request;
|
||||||
if (ioctl(fd, RAM_DISK_IOCTL_INFO, &request) < 0)
|
if (ioctl(fd, RAM_DISK_IOCTL_INFO, &request, sizeof(request)) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int32 rowIndex = table.CountRows();
|
int32 rowIndex = table.CountRows();
|
||||||
|
@ -365,7 +365,7 @@ BSerialPort::FlowControl(void)
|
|||||||
status_t
|
status_t
|
||||||
BSerialPort::SetDTR(bool asserted)
|
BSerialPort::SetDTR(bool asserted)
|
||||||
{
|
{
|
||||||
status_t status = ioctl(ffd, TCSETDTR, &asserted);
|
status_t status = ioctl(ffd, TCSETDTR, &asserted, sizeof(asserted));
|
||||||
|
|
||||||
return (status >= 0) ? status : errno;
|
return (status >= 0) ? status : errno;
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ BSerialPort::SetDTR(bool asserted)
|
|||||||
status_t
|
status_t
|
||||||
BSerialPort::SetRTS(bool asserted)
|
BSerialPort::SetRTS(bool asserted)
|
||||||
{
|
{
|
||||||
status_t status = ioctl(ffd, TCSETRTS, &asserted);
|
status_t status = ioctl(ffd, TCSETRTS, &asserted, sizeof(asserted));
|
||||||
|
|
||||||
return (status >= 0) ? status : errno;
|
return (status >= 0) ? status : errno;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ get_device_icon(const char* device, void* icon, int32 size)
|
|||||||
// attributes. Should those attributes override the icon returned by
|
// attributes. Should those attributes override the icon returned by
|
||||||
// ioctl(,B_GET_ICON,)?
|
// ioctl(,B_GET_ICON,)?
|
||||||
device_icon iconData = {size, icon};
|
device_icon iconData = {size, icon};
|
||||||
if (ioctl(fd, B_GET_ICON, &iconData) != 0) {
|
if (ioctl(fd, B_GET_ICON, &iconData, sizeof(device_icon)) != 0) {
|
||||||
// legacy icon was not available, try vector icon
|
// legacy icon was not available, try vector icon
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ get_device_icon(const char* device, uint8** _data, size_t* _size,
|
|||||||
// Try to get the icon by name first
|
// Try to get the icon by name first
|
||||||
|
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
if (ioctl(fd, B_GET_ICON_NAME, name) >= 0) {
|
if (ioctl(fd, B_GET_ICON_NAME, name, sizeof(name)) >= 0) {
|
||||||
status_t status = get_named_icon(name, _data, _size, _type);
|
status_t status = get_named_icon(name, _data, _size, _type);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -508,13 +508,13 @@ Services::_Listener()
|
|||||||
if (connection.Type() == SOCK_STREAM) {
|
if (connection.Type() == SOCK_STREAM) {
|
||||||
// accept incoming connection
|
// accept incoming connection
|
||||||
int value = 1;
|
int value = 1;
|
||||||
ioctl(i, FIONBIO, &value);
|
ioctl(i, FIONBIO, &value, sizeof(value));
|
||||||
// make sure we don't wait for the connection
|
// make sure we don't wait for the connection
|
||||||
|
|
||||||
socket = accept(connection.socket, NULL, NULL);
|
socket = accept(connection.socket, NULL, NULL);
|
||||||
|
|
||||||
value = 0;
|
value = 0;
|
||||||
ioctl(i, FIONBIO, &value);
|
ioctl(i, FIONBIO, &value, sizeof(value));
|
||||||
|
|
||||||
if (socket < 0)
|
if (socket < 0)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user