سؤال

hello friends I strace my android recovery n found this

 open("/dev/tty0",

 O_RDWR|O_DSYNC|O_LARGEFILE) = 3

ioctl(3, KDSETMODE, 0x1)                = 0

stat64("/dev/late_display/control",

 {st_mode=S_IFCHR|0660,

 st_rdev=makedev(248, 0), ...}) = 0


write(2, "splash screen display", 21)   = 21

write(2, ": ", 2)                       = 2

write(2, "No such file or directory", 25) = 25

write(2, "\n", 1)                       = 1

open("/dev/late_display/control",

 O_RDONLY|O_LARGEFILE) = 4

ioctl(4, SNDCTL_SEQ_SYNC, 0)            = 0


close(4)                                = 0

stat64("/dev/graphics/fb0",

 {st_mode=S_IFCHR|0660,

 st_rdev=makedev(29, 0), ...}) = 0


open("/dev/graphics/fb0",

 O_RDWR|O_LARGEFILE) = 4

my question is this what programs for this line in c. i write as same it is but it gave error expected expression before { token and becoz of this my build cwm isnot able to find fb0 framebuffer. thanks

 stat64("/dev/late_display/control",

 {st_mode=S_IFCHR|0660,

 st_rdev=makedev(248, 0), ...})
هل كانت مفيدة؟

المحلول

This is to use stat

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int main()
{
    struct stat buf;
    const char *filename = "/dev/late_display/control";
    if(stat(filename, &buf) != 0)
    {
        perror("stat");
        return 1;
    }
    printf("stat succeeded\n");
    return 0;
}

The man pages are an excellent reference for these functions man 2 stat

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top