1

我想将一些数据保存到文件中。

我将代码添加到SurfaceFlinger. 并更改uid为root。并添加sdcard_rw组。

但它不能工作。

这是我的代码:

ALOGI("open file before");
int fd = open("/mnt/sdcard/test.bmp",  O_RDWR| O_CREAT, 600);
ALOGI("open file after %d %d", fd, errno);

运行结果:

10-03 12:48:07.883   666   666 I RenderEngine: open file before
10-03 12:48:07.883   666   666 I RenderEngine: open file after -1 13

surfaceflinger的状态:

Uid:    0   0   0   0
Gid:    1003    1003    1003    1003
Ngid:   0
FDSize: 128
Groups: 0 1015 1026 3009 

surfaceflinger.rc:

service surfaceflinger /system/bin/surfaceflinger
class core animation
user root
group graphics drmrpc readproc root sdcard_rw
capabilities SYS_NICE
onrestart restart zygote
task_profiles HighPerformance
socket pdx/system/vr/display/client     stream 0666 system graphics u:object_r:pdx_display_client_endpoint_socket:s0
socket pdx/system/vr/display/manager    stream 0666 system graphics u:object_r:pdx_display_manager_endpoint_socket:s0
socket pdx/system/vr/display/vsync      stream 0666 system graphics u:object_r:pdx_display_vsync_endpoint_socket:s0

那么如何写文件呢?

4

0 回答 0