modules/batt_health/sys.c
int BHD_SYS_sys_param_int_get(const char *path, int missing_value)
{
	int value;
        char s[1024];
        ssize_t r;
        int fd = open(path, O_RDONLY);
        if (fd < 0) {
		ALOGE("Failed to open %s for reading, errno = %d (%s)",
			path, errno, strerror(errno));
                return missing_value;
	}
        r = read(fd, s, sizeof(s) - 1);
        close(fd);
        if (r < 0) {
		ALOGE("Failed to read file %s, r = %lu, errno = %d (%s)",
			path, r, errno, strerror(errno));
                return missing_value;
	}
        s[(int) r] = '\0';
	value = atoi(s);

	ALOGV("Get %s = %d", path, value);
        return value;
}
/* Reads an integer value from a sysfs file */
Reads an integer value from a sysfs file
Reads an integer value from a sysfs file
int BHD_SYS_sys_param_int_get(const char *path, int missing_value)
{
	int value;
        char s[1024];
        ssize_t r;
        int fd = open(path, O_RDONLY);
        if (fd < 0) {
		ALOGE("Failed to open %s for reading, errno = %d (%s)",
			path, errno, strerror(errno));
                return missing_value;
	}
        r = read(fd, s, sizeof(s) - 1);
        close(fd);
        if (r < 0) {
		ALOGE("Failed to read file %s, r = %lu, errno = %d (%s)",
			path, r, errno, strerror(errno));
                return missing_value;
	}
        s[(int) r] = '\0';
	value = atoi(s);
	ALOGV("Get %s = %d", path, value);
        return value;
}
int BHD_SYS_sys_param_int_get ( const char * path , int missing_value ) { int value ; char s [ 1024 ] ; ssize_t r ; int fd = open ( path , O_RDONLY ) ; if ( fd < 0 ) { ALOGE ( " " , path , errno , strerror ( errno ) ) ; return missing_value ; } r = read ( fd , s , sizeof ( s ) - 1 ) ; close ( fd ) ; if ( r < 0 ) { ALOGE ( " " , path , r , errno , strerror ( errno ) ) ; return missing_value ; } s [ ( int ) r ] = ' \0 ' ; value = atoi ( s ) ; ALOGV ( " " , path , value ) ; return value ; }
Reads an integer value from a sysfs file
Reads an integer value from a sysfs file