[   30.642753] devicemanagerse[271]: syscall 403
[   30.647108] Code: e1a00005 e3007193 e1a01004 ef000000 (e3700026)
[   30.653175] CPU: 3 PID: 271 Comm: devicemanagerse Not tainted 4.9.38 #1
[   30.659769] Hardware name: SmartChip, Smartx Development Stamp V2.2 (DT)
[   30.666444] task: ffffffc05ce4cd00 task.stack: ffffffc05ce74000
[   30.672336] PC is at 0xf7673b78
[   30.675461] LR is at 0xf7680b58
[   30.678592] pc : [<00000000f7673b78>] lr : [<00000000f7680b58>] pstate: 60000010
[   30.685956] sp : 00000000ffa79df8
[   30.689254] x12: 0000000000000000
[   30.692651] x11: 00000000ffa79e18 x10: 0000000000000000
[   30.697964] x9 : 00000000aabdb201 x8 : 0000000000000000
[   30.703268] x7 : 0000000000000193 x6 : 0000000000000000
[   30.708581] x5 : 0000000000000001 x4 : 00000000ffa7a028
[   30.713885] x3 : 00000000f76967e4 x2 : 0000000000000000
[   30.719199] x1 : 00000000ffa7a028 x0 : 0000000000000001
[   30.724506]

[   31.595980] sh[135]: syscall 397
[   31.599208] Code: e5900000 e50b0024 e1a0000c ef000000 (e2843020)
[   31.605275] CPU: 0 PID: 135 Comm: sh Not tainted 4.9.38 #1
[   31.610757] Hardware name: SmartChip, Smartx Development Stamp V2.2 (DT)
[   31.617434] task: ffffffc05cd5ac00 task.stack: ffffffc05cd54000
[   31.623327] PC is at 0xf777e954
[   31.626459] LR is at 0xaacfcd5c
[   31.629591] pc : [<00000000f777e954>] lr : [<00000000aacfcd5c>] pstate: a0000010
[   31.636955] sp : 00000000fff99ba8
[   31.640259] x12: 00000000ffffff9c
[   31.643655] x11: 00000000fff99d20 x10: 00000000fff99d38
[   31.648967] x9 : 00000000fff99c10 x8 : 00000000fff99c40
[   31.654274] x7 : 000000000000018d x6 : 0000000000000000
[   31.659594] x5 : 00000000fff99d28 x4 : 00000000fff99be0
[   31.664902] x3 : 00000000000007ff x2 : 0000000000000800
[   31.670220] x1 : 00000000aad33b54 x0 : 00000000ffffff9c

 

 

以下为397及402未在kernel 4.9中实际在musl中调用的地方,需要把内核中未实现的接口进行屏蔽

    57  diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c
    58  index 7b97216e..6d765f8d 100644
    59  --- a/src/stat/fstatat.c
    60  +++ b/src/stat/fstatat.c
    61  @@ -34,39 +34,15 @@ struct statx {
    62
    63   static int fstatat_statx(int fd, const char *restrict path, struct stat *restrict st, int flag)
    64   {
    65  -       struct statx stx;
    66
    67  -       flag |= AT_NO_AUTOMOUNT;
    68  -       int ret = __syscall(SYS_statx, fd, path, flag, 0x7ff, &stx);
    69  -       if (ret) return ret;
    70  +    // 清除 statx 特有的标志(保留 fstatat 支持的标志)
    71  +    flag &= ~AT_NO_AUTOMOUNT;  // Linux 4.9 的 fstatat 不支持 AT_NO_AUTOMOUNT,移除该标志
    72  +
    73  +    // 调用 fstatat 系统调用(SYS_fstatat)
    74  +    int ret = __syscall(SYS_fstatat, fd, path, st, flag);
    75  +
    76  +    return ret;
    77
    78  -       *st = (struct stat){
    79  -               .st_dev = makedev(stx.stx_dev_major, stx.stx_dev_minor),
    80  -               .st_ino = stx.stx_ino,
    81  -               .st_mode = stx.stx_mode,
    82  -               .st_nlink = stx.stx_nlink,
    83  -               .st_uid = stx.stx_uid,
    84  -               .st_gid = stx.stx_gid,
    85  -               .st_rdev = makedev(stx.stx_rdev_major, stx.stx_rdev_minor),
    86  -               .st_size = stx.stx_size,
    87  -               .st_blksize = stx.stx_blksize,
    88  -               .st_blocks = stx.stx_blocks,
    89  -               .st_atim.tv_sec = stx.stx_atime.tv_sec,
    90  -               .st_atim.tv_nsec = stx.stx_atime.tv_nsec,
    91  -               .st_mtim.tv_sec = stx.stx_mtime.tv_sec,
    92  -               .st_mtim.tv_nsec = stx.stx_mtime.tv_nsec,
    93  -               .st_ctim.tv_sec = stx.stx_ctime.tv_sec,
    94  -               .st_ctim.tv_nsec = stx.stx_ctime.tv_nsec,
    95  -#if _REDIR_TIME64
    96  -               .__st_atim32.tv_sec = stx.stx_atime.tv_sec,
    97  -               .__st_atim32.tv_nsec = stx.stx_atime.tv_nsec,
    98  -               .__st_mtim32.tv_sec = stx.stx_mtime.tv_sec,
    99  -               .__st_mtim32.tv_nsec = stx.stx_mtime.tv_nsec,
   100  -               .__st_ctim32.tv_sec = stx.stx_ctime.tv_sec,
   101  -               .__st_ctim32.tv_nsec = stx.stx_ctime.tv_nsec,
   102  -#endif
   103  -       };
   104  -       return 0;
   105   }
   106
   107   #ifdef SYS_fstatat
 

 

diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c
index 3a952a03..92db02b5 100644
--- a/src/time/clock_gettime.c
+++ b/src/time/clock_gettime.c
@@ -88,27 +88,6 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
        }
 #endif

-#ifdef SYS_clock_gettime64
-       r = -ENOSYS;
-       if (sizeof(time_t) > 4)
-               r = __syscall(SYS_clock_gettime64, clk, ts);
-       if (SYS_clock_gettime == SYS_clock_gettime64 || r!=-ENOSYS)
-               return __syscall_ret(r);
-       long ts32[2];
-       r = __syscall(SYS_clock_gettime, clk, ts32);
-#ifdef SYS_gettimeofday
-       if (r==-ENOSYS && clk==CLOCK_REALTIME) {
-               r = __syscall(SYS_gettimeofday, ts32, 0);
-               ts32[1] *= 1000;
-       }
-#endif
-       if (!r) {
-               ts->tv_sec = ts32[0];
-               ts->tv_nsec = ts32[1];
-               return r;
-       }
-       return __syscall_ret(r);
-#else
        r = __syscall(SYS_clock_gettime, clk, ts);
 #ifdef SYS_gettimeofday
        if (r == -ENOSYS) {
@@ -121,7 +100,6 @@ int __clock_gettime(clockid_t clk, struct timespec *ts)
        }
 #endif
        return __syscall_ret(r);
-#endif
 }

 weak_alias(__clock_gettime, clock_gettime);
 

 

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐