fs-uae
fs-uae copied to clipboard
bsdsocket: FIOSETOWN and FIOGETDOWN implemented backwards?
See comment and code in pull request from @cdhooper: https://github.com/FrodeSolheim/fs-uae/pull/206
There seems to a problem yes, but the pull request does not look correct either. I've made a short test C program with code from the AmiTCP header files:
#include <stdio.h>
#include <stdint.h>
typedef int32_t __LONG;
// From AmiTCP netinclude/sys/ioccom.h:
#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
#define IOC_OUT (0x40000000UL)
/* copy parameters in */
#define IOC_IN (0x80000000UL)
/* copy paramters in and out */
#define _IOC(inout,group,num,len) \
(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
// From AmiTCP netinclude/sys/filio.h
#define FIONREAD _IOR('f', 127, __LONG) /* get # bytes to read */
#define FIONBIO _IOW('f', 126, __LONG) /* set/clear non-blocking i/o */
#define FIOSETOWN _IOW('f', 124, __LONG) /* set owner */
#define FIOGETOWN _IOR('f', 123, __LONG) /* get owner */
int main(int argc, char *argv[])
{
printf("FIOSETOWN %08lX\n", FIOSETOWN);
printf("FIOGETOWN %08lX\n", FIOGETOWN);
printf("FIONBIO %08lX\n", FIONBIO);
printf("FIONREAD %08lX\n", FIONREAD);
The output of this is:
FIOSETOWN 8004667C
FIOGETOWN 4004667B
FIONBIO 8004667E
FIONREAD 4004667F
Comparing with src/od-fs/bsdocket_posix.cpp, it looks like FIOGETOWN
is incorrect and should be 0x4004667B
while it is 0x8004667B
in the source code, currently.
You're right. |FIOGETOWN| should be |0x4004667B|. Sorry about that.
I confirmed by compiling a program linked against AmiTCP and had it print the value of each. FIOGETOWN=4004667b FIOSETOWN=8004667c
-Chris
Frode Solheim wrote on 11/28/21 4:21 AM:
Comparing with src/od-fs/bsdocket_posix.cpp, it looks like |FIOGETOWN| is incorrect and should be |0x4004667B| while it is |0x8004667B| in the source code, currently.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/FrodeSolheim/fs-uae/issues/291#issuecomment-981076033, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPKOWIYTCNZTSMQRYMGS7LUOINE3ANCNFSM5I5F4OLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.