Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.
Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls to support wide characters. I created a patch to add ABI compatibility for the old calls, but I didn't get any feedback to that. It seems now people are upgrading from 8 to 9 they experience this issue, so add it anyway.
This commit is contained in:
parent
75f93b2483
commit
78d4d8eeb2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224126
@ -747,6 +747,7 @@ static int akbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP:
|
||||
case OPIO_KEYMAP:
|
||||
case PIO_KEYMAPENT:
|
||||
case PIO_DEADKEYMAP:
|
||||
default:
|
||||
|
@ -982,6 +982,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return error;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
state->ks_accents = 0;
|
||||
|
@ -837,13 +837,12 @@ static int fkey_change_ok(fkeytab_t *, fkeyarg_t *, struct thread *);
|
||||
int
|
||||
genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
{
|
||||
#ifndef KBD_DISABLE_KEYMAP_LOAD
|
||||
keymap_t *mapp;
|
||||
#endif
|
||||
okeymap_t *omapp;
|
||||
keyarg_t *keyp;
|
||||
fkeyarg_t *fkeyp;
|
||||
int s;
|
||||
int i;
|
||||
int i, j;
|
||||
int error;
|
||||
|
||||
s = spltty();
|
||||
@ -874,14 +873,39 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
sizeof(keymap_t));
|
||||
splx(s);
|
||||
return (error);
|
||||
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
|
||||
mapp = kbd->kb_keymap;
|
||||
omapp = (okeymap_t *)arg;
|
||||
omapp->n_keys = mapp->n_keys;
|
||||
for (i = 0; i < NUM_KEYS; i++) {
|
||||
for (j = 0; j < NUM_STATES; j++)
|
||||
omapp->key[i].map[j] =
|
||||
mapp->key[i].map[j];
|
||||
omapp->key[i].spcl = mapp->key[i].spcl;
|
||||
omapp->key[i].flgs = mapp->key[i].flgs;
|
||||
}
|
||||
return (0);
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
#ifndef KBD_DISABLE_KEYMAP_LOAD
|
||||
mapp = malloc(sizeof *mapp, M_TEMP, M_NOWAIT);
|
||||
error = copyin(*(void **)arg, mapp, sizeof *mapp);
|
||||
if (error != 0) {
|
||||
splx(s);
|
||||
free(mapp, M_TEMP);
|
||||
return (error);
|
||||
if (cmd == OPIO_KEYMAP) {
|
||||
omapp = (okeymap_t *)arg;
|
||||
mapp->n_keys = omapp->n_keys;
|
||||
for (i = 0; i < NUM_KEYS; i++) {
|
||||
for (j = 0; j < NUM_STATES; j++)
|
||||
mapp->key[i].map[j] =
|
||||
omapp->key[i].map[j];
|
||||
mapp->key[i].spcl = omapp->key[i].spcl;
|
||||
mapp->key[i].flgs = omapp->key[i].flgs;
|
||||
}
|
||||
} else {
|
||||
error = copyin(*(void **)arg, mapp, sizeof *mapp);
|
||||
if (error != 0) {
|
||||
splx(s);
|
||||
free(mapp, M_TEMP);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
|
||||
error = keymap_change_ok(kbd->kb_keymap, mapp, curthread);
|
||||
|
@ -1198,6 +1198,7 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
KBDMUX_LOCK(state);
|
||||
|
@ -1450,6 +1450,8 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
|
||||
case GIO_KEYMAP: /* get keyboard translation table */
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case GIO_DEADKEYMAP: /* get accent key translation table */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
case GETFKEY: /* get function key string */
|
||||
|
@ -739,6 +739,7 @@ sunkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
|
||||
case KDSETRAD:
|
||||
break;
|
||||
case PIO_KEYMAP:
|
||||
case OPIO_KEYMAP:
|
||||
case PIO_KEYMAPENT:
|
||||
case PIO_DEADKEYMAP:
|
||||
default:
|
||||
|
@ -1929,6 +1929,8 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return (ukbd_set_typematic(kbd, *(int *)arg));
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table
|
||||
* entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
|
@ -1208,6 +1208,7 @@ vkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
state->ks_accents = 0;
|
||||
|
@ -654,12 +654,12 @@ ibcs2_ioctl(td, uap)
|
||||
break;
|
||||
|
||||
case IBCS2_GIO_KEYMAP: /* Get keyboard map table */
|
||||
uap->cmd = GIO_KEYMAP;
|
||||
uap->cmd = OGIO_KEYMAP;
|
||||
error = ioctl(td, (struct ioctl_args *)uap);
|
||||
break;
|
||||
|
||||
case IBCS2_PIO_KEYMAP: /* Set keyboard map table */
|
||||
uap->cmd = PIO_KEYMAP;
|
||||
uap->cmd = OPIO_KEYMAP;
|
||||
error = ioctl(td, (struct ioctl_args *)uap);
|
||||
break;
|
||||
|
||||
|
@ -799,6 +799,7 @@ pckbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
state->ks_accents = 0;
|
||||
|
@ -120,6 +120,20 @@ struct keymap {
|
||||
};
|
||||
typedef struct keymap keymap_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
struct okeyent_t {
|
||||
u_char map[NUM_STATES];
|
||||
u_char spcl;
|
||||
u_char flgs;
|
||||
};
|
||||
|
||||
struct okeymap {
|
||||
u_short n_keys;
|
||||
struct okeyent_t key[NUM_KEYS];
|
||||
};
|
||||
typedef struct okeymap okeymap_t;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#endif /* !_KEYMAP_DECLARED */
|
||||
|
||||
/* defines for "special" keys (spcl bit set in keymap) */
|
||||
@ -223,6 +237,10 @@ typedef struct fkeyarg fkeyarg_t;
|
||||
/* XXX: Should have keymap_t as an argument, but that's too big for ioctl()! */
|
||||
#define GIO_KEYMAP _IO('k', 6)
|
||||
#define PIO_KEYMAP _IO('k', 7)
|
||||
#ifdef _KERNEL
|
||||
#define OGIO_KEYMAP _IOR('k', 6, okeymap_t)
|
||||
#define OPIO_KEYMAP _IOW('k', 7, okeymap_t)
|
||||
#endif /* _KERNEL */
|
||||
#define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t)
|
||||
#define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t)
|
||||
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
|
||||
|
Loading…
Reference in New Issue
Block a user