参照元†
- close-on-exec フラグを立てて open する。
- resmgr が有効の場合、resmgr を経由してファイルを開こうとする。
- アクセス権がないエラーを回避するため?resmgr ってなんだろ SUSE 由来?
- const char *filename
- int fmode
- アクセスモード、フラグ。open の第二引数と同じ。
返り値†
- int
- ファイルディスクリプタを返す。エラーの場合は -1 を返す。
static inline int snd_open_device(const char *filename, int fmode)
{
int fd;
#ifdef O_CLOEXEC
fmode |= O_CLOEXEC;
#endif
fd = open(filename, fmode);
/* open with resmgr */
#ifdef SUPPORT_RESMGR
if (fd < 0) {
if (errno == EAGAIN || errno == EBUSY)
return fd;
if (! access(filename, F_OK))
fd = rsm_open_device(filename, fmode);
}
#endif
if (fd >= 0)
fcntl(fd, F_SETFD, FD_CLOEXEC);
return fd;
}
コメント†