<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56122>56122</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] Potential wrong syscall number reference in linux_file.cpp
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gytsen
</td>
</tr>
</table>
<pre>
While browsing the `File` implementation of the new LLVM libc, I spotted what I believe to be a potential typo in the linux file implementation:
The code looks for the `SYS__llseek` syscall number in the `#if defined` statement [on line 78](https://github.com/llvm/llvm-project/blob/aa88161b378ecb49388eefc28abe2926a229bcfc/libc/src/__support/File/linux_file.cpp#L78). However, when doing the actual syscall, `__llvm_libc::syscall` is called with `SYS__lseek` as argument [on line 80](https://github.com/llvm/llvm-project/blob/aa88161b378ecb49388eefc28abe2926a229bcfc/libc/src/__support/File/linux_file.cpp#L80). If I'm not mistaken that is a typo and the call should read
```cpp
long ret = __llvm_libc::syscall(SYS__llseek, lf->get_fd(), offset >> 32,
offset, &result, whence);
```
instead.
If this is not the case, feel free to close this issue as not relevant.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVNtq3DAQ_Rr7Zchiy3uxH_yQdBO6kEIhpaVPiyyN1mpky0jybvfvO1KyzQVK6VuNsC4jzZw5c6TOynP7rdcGoXP25PV4gNAjZOvijhapAz1MBgccAw_ajmBV2jDiCe7vv34CozuRsQ-wAz_ZEFDCqeeBph0ajUeEYGkIHMhKTjQ3EM6TBT0mP0aP809QEcDbQFl1nRXbrHj-f6G9wko6YO2jB2XdBefD94f93hiP-Bjh-rMX3BgY56FDdwlDloxVWoFEpUeUaScFSvEgW91QZgQFYVNnq23G6j6EyUcM7I7aQYd-7hbCDjQx5njpriZnf6AINO2M7ajjvK7LddlVmxpFt2yqukZUgtW8Q9awNWes6YQS0UFi7s67-N_v_TxN1kVXifloJ2r2kZqFmCaCf0_gWLOAj_ZExLrI-qnHEaS9lI2LMBPBzxzEDZRoZOc47FM4Sqi6vphjcT3EYawapfhC54VN7oG7w_yepbr4j1kicJGlnYJdxjYDjDbAoKnajxjFQOKkrPmTCvkoE3FJMr63s5HgkMtn6ZFqUoue04qxxLRDIqPawh-JZfVrUVIVjLrKqtsDhr2SZCV8cdUq5ZOrW2pQMVp7igJ__Z6OpgKztUM_m3CRg8Dovrp5l8Lry6RHHyjJxeu1XbzXRAy1SNgTKR6jV4VoQDlMd1kY6_Gy1c8YJRIPODR45GN44zSXbSWbquF50MFgSxJKbK228Pn3c3BykdR399ahQheTiTf4bY3z2Zn2n5WXwHoarNYlY3nfitWqkEsh6k7WVV3KZVmrJdvUsuOyWndlbkiMxkfMGWPxvUsuaEzwc92ygrFiXTblulqVxYJtlo0qliVndLgRZbYscODaLCKOhXWH3LUJUjcfPBkNKdK_GLn3-jBioij653PorWsP5-BxzFPkNiH_BaA2ze8">