osx sys/io.h not found

*爱你&永不变心* 提交于 2019-12-04 12:51:20

Include <sys/uio.h> instead.

or why not both?

#ifdef __APPLE__
        #include <sys/uio.h>
#else
        #include <sys/io.h>
#endif

In case of Apple OS (OSX/iOS) the code will know compile with <sys/uio.h>

niknak

What bibor has written is perfect. Though my file looks something like this and works well.

#ifdef __linux

#include <io.h>

#elseif __apple

#include<uio.h>
$ ls /usr/include/sys/io.h
ls: /usr/include/sys/io.h: No such file or directory

It doesn't look like it. You may have to do some porting.

Linux has this header file. It looks like it has to do with low level port input and output.

In general, things in /usr/include/sys are going to be operating-system specific, so you'll have to port to a new architecture if it's not already ported.

You can manually add it to your project, and it should compile.

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/master/sysroot/usr/include/sys/io.h

Edit: You need features.h as well

https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/+/master/sysroot/usr/include/features.h

Finally got cursor support in my kernel, although the functions in io.h weren't working for me. They compiled fine, and may help someone else. This is the code I'm going forward with...

static inline void outb(unsigned short port, unsigned char value)
{
    __asm__ __volatile__ ("outb %1, %0" : : "dN" (port), "a" (value));

}
static inline unsigned char inb(unsigned short port)
{
    unsigned char value;
    __asm__ __volatile__ ("inb %1, %0" : "=a"(value) : "Nd"(port));
    return value;
}

void update_cursor(int row, int col)
{
    unsigned short position=(row*80) + col;

    // cursor LOW port to vga INDEX register
    outb(0x3D4, 0x0F);
    outb(0x3D5, (unsigned char)(position&0xFF));
    // cursor HIGH port to vga INDEX register
    outb(0x3D4, 0x0E);
    outb(0x3D5, (unsigned char )((position>>8)&0xFF));
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!