Open xdelatour opened 1 year ago
Any idea what the correct values are?
Since it is not yet implemented, we would still have to make them up ;)
Values in mintlib do not neccessarily have to be the same as used in the kernel, but of course that would make the implementation in mintlib easier.
I do not now where the values in the kernel (https://github.com/freemint/freemint/blob/3dd75deb4ce6d77f281ccf6ef4b6621aaa0e8d9d/sys/mint/sem.h#L76) originally came from, but the values in mintlib are from current glibc, and i would recommend to use them. That would be:
/* Control commands for `msgctl', `semctl', and `shmctl'. */
#define IPC_RMID 0 /* Remove identifier. */
#define IPC_SET 1 /* Set `ipc_perm' options. */
#define IPC_STAT 2 /* Get `ipc_perm' options. */
#ifdef __USE_GNU
# define IPC_INFO 3 /* See ipcs. */
#endif
/* Commands for `semctl'. */
#define GETPID 11 /* get sempid */
#define GETVAL 12 /* get semval */
#define GETALL 13 /* get all semval's */
#define GETNCNT 14 /* get semncnt */
#define GETZCNT 15 /* get semzcnt */
#define SETVAL 16 /* set semval */
#define SETALL 17 /* set all semval's */
/* ipcs ctl cmds */
# define SHM_STAT 13
# define SHM_INFO 14
# define SHM_STAT_ANY 15
# define SEM_STAT 18
# define SEM_INFO 19
# define SEM_STAT_ANY 20
And glibc uses these values:
/* Get the argument only if required. */
switch (cmd)
{
case SETVAL: /* arg.val */
case GETALL: /* arg.array */
case SETALL:
case IPC_STAT: /* arg.buf */
case IPC_SET:
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_INFO: /* arg.__buf */
case SEM_INFO:
va_start (ap, cmd);
arg64 = va_arg (ap, union semun64);
va_end (ap);
break;
case IPC_RMID: /* arg ignored. */
case GETNCNT:
case GETPID:
case GETVAL:
case GETZCNT:
break;
default:
__set_errno (EINVAL);
return -1;
}
semctl()
commands are 0/1/2 (IPC_RMID/SET/STAT) and from 11 (GETPID) to 17 (SETALL). These values are defined in MiNTLib (include/bits/sem.h)semctl()
is equivalent toPsemctl()
(semctl.c)Any idea what the correct values are?