~mmach/netext73/busybox

« back to all changes in this revision

Viewing changes to klibc-utils/resume.c

  • Committer: mmach
  • Date: 2022-08-22 15:28:31 UTC
  • Revision ID: netbit73@gmail.com-20220822152831-vrsxgw6c75b03ujx
1.35.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
        if (major(resume_device) == 0) {
104
104
                bb_error_msg_and_die("invalid resume device: %s", argv[0]);
105
105
        }
 
106
 
106
107
        ofs = (argv[1] ? xstrtoull(argv[1], 0) : 0);
 
108
        /* Old kernels have no /sys/power/resume_offset, set it only if necessary */
 
109
        if (ofs != 0) {
 
110
                fd = xopen("/sys/power/resume_offset", O_WRONLY);
 
111
                s = xasprintf("%llu", ofs);
 
112
                xwrite_str(fd, s);
 
113
        }
107
114
 
108
115
        fd = xopen("/sys/power/resume", O_WRONLY);
109
 
        s = xasprintf("%u:%u:%llu", major(resume_device), minor(resume_device), ofs);
 
116
        s = xasprintf("%u:%u", major(resume_device), minor(resume_device));
110
117
 
111
118
        xwrite_str(fd, s);
112
119
        /* if write() returns, resume did not succeed */