Mercurial > mplayer.hg
comparison libvo/vo_vesa.c @ 8791:668b30187d48
Check if we can open /dev/mem in preinit(), so we can exit cleanly.
author | filon |
---|---|
date | Sun, 05 Jan 2003 11:24:13 +0000 |
parents | 605c85c27e68 |
children | c2e0f2cd8666 |
comparison
equal
deleted
inserted
replaced
8790:98252605e29f | 8791:668b30187d48 |
---|---|
26 #include <limits.h> | 26 #include <limits.h> |
27 #include <unistd.h> | 27 #include <unistd.h> |
28 #include <pwd.h> | 28 #include <pwd.h> |
29 #include <sys/types.h> | 29 #include <sys/types.h> |
30 #include <sys/stat.h> | 30 #include <sys/stat.h> |
31 #include <fcntl.h> | |
31 | 32 |
32 | 33 |
33 #include "video_out.h" | 34 #include "video_out.h" |
34 #include "video_out_internal.h" | 35 #include "video_out_internal.h" |
35 | 36 |
1007 } | 1008 } |
1008 | 1009 |
1009 static uint32_t preinit(const char *arg) | 1010 static uint32_t preinit(const char *arg) |
1010 { | 1011 { |
1011 int pre_init_err = 0; | 1012 int pre_init_err = 0; |
1013 int fd; | |
1012 if(verbose>1) printf("vo_vesa: preinit(%s) was called\n",arg); | 1014 if(verbose>1) printf("vo_vesa: preinit(%s) was called\n",arg); |
1013 if(verbose > 2) | 1015 if(verbose > 2) |
1014 printf("vo_vesa: subdevice %s is being initialized\n",arg); | 1016 printf("vo_vesa: subdevice %s is being initialized\n",arg); |
1015 subdev_flags = 0; | 1017 subdev_flags = 0; |
1016 if(arg) subdev_flags = parseSubDevice(arg); | 1018 if(arg) subdev_flags = parseSubDevice(arg); |
1017 if(lvo_name) pre_init_err = vlvo_preinit(lvo_name); | 1019 if(lvo_name) pre_init_err = vlvo_preinit(lvo_name); |
1018 #ifdef CONFIG_VIDIX | 1020 #ifdef CONFIG_VIDIX |
1019 else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa); | 1021 else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa); |
1020 #endif | 1022 #endif |
1023 // check if we can open /dev/mem (it will be opened later in config(), but if we | |
1024 // detect now that we can't we can exit cleanly) | |
1025 fd = open("/dev/mem", O_RDWR); | |
1026 if (fd < 0) | |
1027 return -1; | |
1021 if(verbose > 2) | 1028 if(verbose > 2) |
1022 printf("vo_subdevice: initialization returns: %i\n",pre_init_err); | 1029 printf("vo_subdevice: initialization returns: %i\n",pre_init_err); |
1023 return pre_init_err; | 1030 return pre_init_err; |
1024 } | 1031 } |
1025 | 1032 |