Commit Graph

81 Commits

Author SHA1 Message Date
Andrew Turner
b8a496dfb6 lib: Remove __ARM_ARCH checks that are always true
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45559
2024-06-12 11:49:05 +00:00
Ricardo Branco
ddbfb544c6 mqueuefs: Relax restriction that path must begin with a slash
This is needed to support Linux implementation which discards the leading slash when calling mq_open(2)

Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1248
2024-05-23 13:40:46 -06:00
Dag-Erling Smørgrav
a4be1eb211 access(2): Discourage use of these system calls.
Fixes:		421025a274
PR:		262895
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45240
2024-05-22 00:35:22 +02:00
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Gordon Bergling
421025a274 access.2: Mention that lstat(2) should be used for symbolic links
access(), eaccess() and faccessat() will always dereference
symbolic links.

So add a note in the manual page, that lstat(2) should be
used in the case of symbolic links.

PR:	262895
Reviewed by:	gbe, pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44890
2024-05-13 10:40:12 +02:00
Ed Maste
2d29d2eceb clock_gettime.2: fix markup
The CLOCK_* constants are "defined variable or preprocessor constants"
and so use .Dv.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45106
2024-05-06 17:52:22 -04:00
Alexander Ziaee
9a62cdc013 intro.2 as errno.2: Use the name macro for errno
Reviewed by: imp
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1192
2024-05-04 08:56:10 -06:00
Alexander Ziaee
69ff2d754c intro.2: Add sys/syscall.h to SYNOPSIS
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192
2024-05-04 08:56:06 -06:00
Alexander Ziaee
6dfbe695c3 intro.2 as errno.2: Update maximum hard link limit
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192
2024-05-04 08:55:59 -06:00
Brooks Davis
397d8f3c36 libsys: don't try to expose freebsd7___semctl
This has always been in libc and never exported directly.  I accidently
included it along side some freebsd11_* symbols based on a tree where I
moved semctl(2).

Fixes:		df1a09ba52 libsys: expose a few more symbols for libc's use
2024-04-30 19:06:10 +01:00
CismonX
d289382897 rights.4: various corrections on capability rights
- A file descriptor obtained from accept(2), accept4(2) and openat(2)
  is not always assigned all capability rights.  Instead, it inherits
  capability rights from the "parent" socket/dir file descriptor.
- getdents(2) and getdirentries(2) requires CAP_READ.
- openat(2) with O_WRONLY|O_TRUNC does not require CAP_SEEK.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1207
2024-04-28 22:48:31 -06:00
Mateusz Piotrowski
6662c2312e gettimeofday.2: Do mention improbable future removal
As kib@ noted:

> Obviously gettimeofday(2) is not going to be removed
> even in the far future.

Reported by:	kib
Fixes:		4395d3ced5 Document that gettimeofday() is obsolescent
MFC after:	3 days
2024-04-28 20:11:22 +02:00
Mateusz Piotrowski
4395d3ced5 Document that gettimeofday() is obsolescent
Reported by:	kaktus
Reviewed by:	kaktus, pstef
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23942
2024-04-25 11:42:59 +02:00
Brooks Davis
78101d437a syscalls.master: correct return type of {read,write}v
This was missed when read/write, etc were updated to return ssize_t.

Fixes:		2e83b28161 Fix a few syscall arguments to use size_t instead of u_int.

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D44930
2024-04-24 20:48:46 +01:00
Konstantin Belousov
dcc180c51b sigqueue(2): Document __SIGQUEUE_TID
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D44867
2024-04-23 19:51:10 +03:00
Brooks Davis
80ffc7398b libsys/arm: make vfork less of an outlier
Following the pattern of other architectures, make __sys_vfork the main
symbol and _vfork and vfork weak aliases.  This avoids the need to
special case vfork in the generated list of symbols.

Differential Revision:	https://reviews.freebsd.org/D44330
2024-04-22 21:28:51 +01:00
Brooks Davis
7448408656 Make __libsys_interposing_slot libsys only
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44881
2024-04-22 21:28:26 +01:00
Gordon Bergling
bbef63ec27 timerfd.2: Remove a double word
- s/is is/is/

MFC after:	3 days
2024-04-20 11:31:25 +02:00
Alexander Ziaee
de525c502a intro.2: Integrate introduction with state of page
Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065
2024-04-19 16:30:32 -06:00
Alexander Ziaee
d846f33bb6 intro.2: Section RETURN VALUES is actually ERRORS
Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065
2024-04-19 16:30:27 -06:00
Alexander Ziaee
4696ca7baf intro.2: Add FILES mentioning table of syscalls
Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065
2024-04-19 16:30:23 -06:00
Alexander Ziaee
9e8df7900f intro.2: Tweak grammar and syntax for consistency
Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065
2024-04-19 16:30:19 -06:00
Alexander Ziaee
bcc57e9715 intro.2: Import HISTORY from OpenBSD but our style
Reviewed by: imp, brooks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1065
2024-04-19 16:30:14 -06:00
Brooks Davis
6e83504c60 Revert "lib{c,sys}: normalize export of openat, setcontext, and swapcontext"
I put the symbols in the wrong file (should have been
lib/libc/sys/Symbol.map), added a duplicate pdfork entry due to a botch
rebase, and there seems to be a issue with gcc13/binutils not exposing
the symbols so revert the whole thing while I debug.

This reverts commit ee632fb9eb.
2024-04-19 22:25:04 +01:00
Brooks Davis
ee632fb9eb lib{c,sys}: normalize export of openat, setcontext, and swapcontext
List them in the symbol map rather than using the __sym_default to
expose them.  This will allow later improvements in the stub
implementations in libc.so.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44113
2024-04-17 23:39:46 +01:00
Brooks Davis
df1a09ba52 libsys: expose a few more symbols for libc's use
These private symbols are used by libc so expose as we do with
auxargs bits rather then relying on duplicate implementations in libc.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44114
2024-04-17 23:39:46 +01:00
Brooks Davis
1fd880742a libsys: add a libsys.h
This declares an API for libsys which currently consists of
__sys_<foo>() declarations for system call stubs and function pointer
typedefs of the form __sys_<foo>_t.  The vast majority of the
implementation resides in a generated _libsys.h which ensures that all
system call stub declarations match syscalls.master.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44387
2024-04-16 17:48:07 +01:00
Christopher Davidson
d3de1bd429 open.2: remove self-reference
Change .Xr reference to .Fn, which quiets a mandoc warning.

Reviewed by:	mhorne
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1135
2024-04-03 13:55:24 -03:00
Brooks Davis
b12090676c lib{c,sys}: correctly expose sched_getcpu
When moving the implementation, I failed to move the symbol entry.

Reviewed by:	kib
Fixes:		84dd0c080b libc: libc/gen/sched_getcpu_gen.c -> libsys/
Differential Revision:	https://reviews.freebsd.org/D44112
2024-03-15 22:52:07 +00:00
Brooks Davis
ccf4d5eed2 lib{c,sys}: fix powerpcspe build
libsys/powerpc/Symbol.sys.map was removed due to all symbols moving to
libc.

Fixes:		d7847a8d35 lib{c,sys}: return wrapped syscall APIs to libc
2024-03-13 20:09:41 +00:00
Brooks Davis
d7847a8d35 lib{c,sys}: return wrapped syscall APIs to libc
These provide standard APIs, but are implemented using another system
call (e.g., pipe implemented in terms of pipe2) or are interposed by the
threading library to support cancelation.

After discussion with kib (see D44111), I've concluded that it is
better to keep most public interfaces in libc with as little
as possible in libsys.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44241
2024-03-13 18:36:02 +00:00
Brooks Davis
ef5fddd344 libsys: make __libsys_interposing static
Access __libsys_interposing with __libc_interposing_slot() in all
cases to support a move of these wrappers back to libc.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44239
2024-03-13 17:31:48 +00:00
Brooks Davis
f7dbbbd176 libsys: don't expose sigwait wrapper
Long ago (e129c18a83) __sys_sigwait was wrapped to prevent sigwait()
from returning with EINTR.  Through a series of changes this wrapper
become __libc_sigwait which was internal to libc and used solely in the
interposing table.  To support a move of sigwait back to libc, move this
wrapper into libsys and rename it with an __libsys_ prefix.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44238
2024-03-13 17:04:07 +00:00
Brooks Davis
83392afeeb libsys: don't expose __init_elf_aux_vector
__init_elf_aux_vector is now complied statically so don't try to export
it from the dynamic library.

Fixes:	8271d9b99a libsys: remove usage of pthread_once and _once_stub

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44237
2024-03-07 01:02:25 +00:00
Brooks Davis
cc4ffc9786 libsys: don't try to expose yield
The undocumented yield system call has never been implemented via libc
or libsys (except accidentally for <15 minutes in 1998 between commits
abd529ceba and 0db2fac06a).  Avoid trying to export it now to avoid
failures when linking with --no-undefined-version.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44236
2024-03-07 01:01:36 +00:00
Brooks Davis
39a15d7470 syscall(2): make i386 less of an outlier
Unlike other architectures, i386 only defined syscall() and not
_syscall() or __sys_syscall().  The syscall() function then invoked the
desired system call directly rather than invoking syscall(2).  Keep the
latter as it's marginally more efficent, but also create the
conventional _syscall() and __sys_syscall() stubs.

This avoids the need to special case syscall(2) in the symbol list
generation in libsys.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44235
2024-03-07 00:59:07 +00:00
Brooks Davis
7b3836c281 libsys/aarch: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44234
2024-03-07 00:59:01 +00:00
Brooks Davis
0ee0ae2373 libsys/arm: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44233
2024-03-07 00:58:55 +00:00
Brooks Davis
e6ffc7669a libsys/riscv: Remove pointless MD syscall(2)
This file is functionally identical to the stub generated by
Makefile.sys once the MD version is removed.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44232
2024-03-07 00:58:44 +00:00
Brooks Davis
269593dc4a libsys/aarch64: end syscall stubs with newlines
Technically speaking, POSIX text files must end with a newline.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44231
2024-03-07 00:58:29 +00:00
Warner Losh
beadbca67b read(2): Add write cross reference
Add a write cross reference in the SEE ALSO section.

Sponsored by:		Netflix
2024-03-01 20:36:39 -07:00
Christopher Davidson
0d161f7b60 read.2: Use .Fn markup instead of .Xr for read/write calls
Udpate both write / read references from .Xr to .Fn to eliminate
self-reference cross reference.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1128
2024-03-01 20:34:10 -07:00
Brooks Davis
304cdac738 lib{c,sys}: expose _getlogin consistently
Historically we exposed _getlogin as a private symbol on a per-arch basis
(except on aarch64 and riscv) for no obvious reason.  We now need to
expose it for libc's use so remove the special case from
makesyscalls.lua and expose it in the generated syscalls.map.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44116
2024-02-29 19:46:33 +00:00
Brooks Davis
6d3f4dcda2 libsys: make PSEUDO take a bare syscall name
Rather than having PSEUDO be a list of object files when all consumers
want syscall names or source files, make it a list of bare syscall
names like INTERPOSED (which is built on PSEUDO).

Improve document of variables developers can set.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44108
2024-02-29 19:19:01 +00:00
Brooks Davis
f102db5028 libsys: consolidate PSEUDO definitions
Consolidate in preparation for further cleanup.

Also relocate the sole NOASM entry.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44107
2024-02-29 19:19:01 +00:00
Brooks Davis
e52a9177d9 libsys: reduce makefile declaration duplication
Every PSEUDO entry (_foo.o) has a corresponding NOASM entry (foo.o) to
suppress its addition to ASM.  Check PSEUDO instead when adding entries
to ASM.  No functional change.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44106
2024-02-29 19:19:01 +00:00
Brooks Davis
882d9f4507 lib{c,sys}: expose cap_sandboxed from libc/gen
It's a thin wrapper on cap_getmode() implemented in libc, not a system
call so the symbol should have been exposed by libc/gen/Symbol.map
alongside the implementation.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D44110
2024-02-28 23:39:55 +00:00
Brooks Davis
c5698afcd5 libsys: remove duplicate, commented out code 2024-02-23 22:25:35 +00:00
Konstantin Belousov
7d233b2220 libsys: fix sleep(3)/usleep(3) cancel behavior
Move functions back to libc/gen sources; they are only versioned from
libc and not libsys.
Access libsys interposing slots using __libsys_interposing_slot()
instead of direct __libsys_interposing array dereference, which cannot
work from libc.

Reported by:	glebius
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D44042
2024-02-23 19:39:44 +02:00
Konstantin Belousov
baa7d0741b libsys: link symbolic
so that libc/libthr do not preempt libsys symbols, esp. errno-related.

The issue is, if libsys is linked with DT_BIND_NOW flag, and then loaded
as filter, rtld tries to relocate its PLT symbols immediately, not as
filter.  There, during symbol lookup, rtld finds filtering symbols in
libc, and since libc is in loading filters mode, the resolution stops
there.  The end result is that libsys links to libc.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D44027
2024-02-23 19:39:42 +02:00