最近看apue,程序4-10中,编译时,使用两个宏major和minor来访问主次设备号,没有定义是怎么回事,应该怎么解决呢?
最近看apue,程序4-10中,编译时,使用两个宏major和minor来访问主次设备号,没有定义是怎么回事,应该怎么解决呢?
本人linux 系统 fedaro 9
------解决方案--------------------stat返回的那个dev_t吗?
The st_dev field describes the device on which this file resides. (The major(3) and minor(3) macros may be useful to decompose the
device ID in this field.)
SYNOPSIS
#define _BSD_SOURCE /* See feature_test_macros(7) */
#include <sys/types.h>
dev_t makedev(int maj, int min);
int major(dev_t dev);
int minor(dev_t dev);
------解决方案--------------------C/C++ code
SYNOPSIS
#define _BSD_SOURCE /* See feature_test_macros(7) */
#include <sys/types.h>
dev_t makedev(int maj, int min);
int major(dev_t dev);
int minor(dev_t dev);