libc

my libc
git clone git://git.evenfri.pw/libc.git
Log | Files | Refs | README

lseek.c (309B)


      1 /*
      2  * lseek.c - lseek system call
      3  * Copyright (C) 2026. All rights reserved.
      4  */
      5 
      6 #include "libc.h"
      7 
      8 off_t lseek(int fd, off_t offset, int whence) {
      9   long ret = syscall(SYS_lseek, (long)fd, (long)offset, (long)whence, 0, 0, 0);
     10 
     11   if (ret < 0) {
     12     errno = -ret;
     13     return -1;
     14   }
     15 
     16   return (off_t)ret;
     17 }