Back to index

libdrm  2.4.37
name_from_fd.c File Reference
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include "drmtest.h"

Go to the source code of this file.


int main (int argc, char **argv)
 Checks drmGetDeviceNameFromFd.

Function Documentation

int main ( int  argc,
char **  argv 

Checks drmGetDeviceNameFromFd.

This tests that we can get the actual version out, and that setting invalid major/minor numbers fails appropriately. It does not check the actual behavior differenses resulting from an increased DI version.

Definition at line 40 of file name_from_fd.c.

       int fd, ret;
       drm_set_version_t sv, version;
       const char *name = "/dev/dri/card0";
       char *v;

       fd = open("/dev/dri/card0", O_RDWR);
       if (fd == -1)
              return 0;

       v = drmGetDeviceNameFromFd(fd);

       assert(strcmp(name, v) == 0);

       return 0;

Here is the call graph for this function: