Use 'length' for the lenght of a string.
Use 'n' for the number of elements.
Use 'size' for the number of bytes. (And in wide-character string
functions, 'size' also refers to the number of wide characters.)
The change is quite large, and I might have made some mistakes.
But overall, this should improve consistency in use of these terms.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Sum of \fIsize\fR arguments of all
.BR malloc (3)
calls,
-products of arguments (\fInmemb\fR*\fIsize\fR) of all
+products of arguments (\fIn\fR*\fIsize\fR) of all
.BR calloc (3)
calls,
and sum of \fIlength\fR arguments of all
.B "heap peak"
Maximum of all \fIsize\fR arguments of
.BR malloc (3),
-all products of \fInmemb\fR*\fIsize\fR of
+all products of \fIn\fR*\fIsize\fR of
.BR calloc (3),
all \fIsize\fR arguments of
.BR realloc (3),
.B #include <keyutils.h>
.P
.BI "key_serial_t add_key(const char *" type ", const char *" description ,
-.BI " const void " payload [. plen "], size_t " plen ,
+.BI " const void " payload [. size "], size_t " size ,
.BI " key_serial_t " keyring ");"
.fi
.P
.IR description ,
instantiates it with the
.I payload
-of length
-.IR plen ,
+of size
+.IR size ,
attaches it to the nominated
.IR keyring ,
and returns the key's serial number.
If this interface is used to create a keyring, then
.I payload
should be NULL and
-.I plen
+.I size
should be zero.
.TP
.I \[dq]user\[dq]
alloc_hugepages, free_hugepages \- allocate or free huge pages
.SH SYNOPSIS
.nf
-.BI "void *syscall(SYS_alloc_hugepages, int " key ", void " addr [. len "], \
-size_t " len ,
+.BI "void *syscall(SYS_alloc_hugepages, int " key ", void " addr [. size "], \
+size_t " size ,
.BI " int " prot ", int " flag );
.\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
-.\" unsigned long len, int prot, int flag);
+.\" unsigned long size, int prot, int flag);
.BI "int syscall(SYS_free_hugepages, void *" addr );
.\" asmlinkage int sys_free_hugepages(unsigned long addr);
.fi
Addresses must be properly aligned.
.P
The
-.I len
-argument is the length of the required segment.
+.I size
+argument is the size of the required segment.
It must be a multiple of the huge page size.
.P
The
M68K:
.nf
.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
-.BI " unsigned long " len );
+.BI " unsigned long " size );
.fi
.TP
SH:
.nf
-.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op );
+.BI "int cacheflush(unsigned long " addr ", unsigned long " size ", int " op );
.fi
.TP
NDS32:
.P
.BI "ssize_t copy_file_range(int " fd_in ", off_t *_Nullable " off_in ,
.BI " int " fd_out ", off_t *_Nullable " off_out ,
-.BI " size_t " len ", unsigned int " flags );
+.BI " size_t " size ", unsigned int " flags );
.fi
.SH DESCRIPTION
The
without the additional cost of transferring data from the kernel to user space
and then back into the kernel.
It copies up to
-.I len
+.I size
bytes of data from the source file descriptor
.I fd_in
to the target file descriptor
Upon successful completion,
.BR copy_file_range ()
will return the number of bytes copied between files.
-This could be less than the length originally requested.
+This could be less than the size originally requested.
If the file offset of
.I fd_in
is at or past the end of file, no bytes are copied, and
main(int argc, char *argv[])
{
int fd_in, fd_out;
- off_t len, ret;
+ off_t size, ret;
struct stat stat;
\&
if (argc != 3) {
exit(EXIT_FAILURE);
}
\&
- len = stat.st_size;
+ size = stat.st_size;
\&
fd_out = open(argv[2], O_CREAT | O_WRONLY | O_TRUNC, 0644);
if (fd_out == \-1) {
}
\&
do {
- ret = copy_file_range(fd_in, NULL, fd_out, NULL, len, 0);
+ ret = copy_file_range(fd_in, NULL, fd_out, NULL, size, 0);
if (ret == \-1) {
perror("copy_file_range");
exit(EXIT_FAILURE);
}
\&
- len \-= ret;
- } while (len > 0 && ret > 0);
+ size \-= ret;
+ } while (size > 0 && ret > 0);
\&
close(fd_in);
close(fd_out);
.B #include <fcntl.h>
.P
.BI "int fallocate(int " fd ", int " mode ", off_t " offset \
-", off_t " len ");"
+", off_t " size );
.fi
.SH DESCRIPTION
This is a nonportable, Linux-specific system call.
for the byte range starting at
.I offset
and continuing for
-.I len
+.I size
bytes.
.P
The
allocates the disk space within the range specified by
.I offset
and
-.IR len .
+.IR size .
The file size (as reported by
.BR stat (2))
will be changed if
-.IR offset + len
+.IR offset + size
is greater than the file size.
Any subregion within the range specified by
.I offset
and
-.I len
+.I size
that did not contain data before the call will be initialized to zero.
This default behavior closely resembles the behavior of the
.BR posix_fallocate (3)
After a successful call, subsequent writes into the range specified by
.I offset
and
-.I len
+.I size
are guaranteed not to fail because of lack of disk space.
.P
If the
.IR mode ,
the behavior of the call is similar,
but the file size will not be changed even if
-.IR offset + len
+.IR offset + size
is greater than the file size.
Preallocating zeroed blocks beyond the end of the file in this manner
is useful for optimizing append workloads.
in the byte range starting at
.I offset
and continuing for
-.I len
+.I size
bytes.
Within the specified range, partial filesystem blocks are zeroed,
and whole filesystem blocks are removed from the file.
The byte range to be collapsed starts at
.I offset
and continues for
-.I len
+.I size
bytes.
At the completion of the operation,
the contents of the file starting at the location
-.I offset+len
+.I offset+size
will be appended at the location
.IR offset ,
and the file will be
-.I len
+.I size
bytes smaller.
.P
A filesystem may place limitations on the granularity of the operation,
Typically,
.I offset
and
-.I len
+.I size
must be a multiple of the filesystem logical block size,
which varies according to the filesystem type and configuration.
If a filesystem has such a requirement,
If the region specified by
.I offset
plus
-.I len
+.I size
reaches or passes the end of file, an error is returned;
instead, use
.BR ftruncate (2)
zeros space in the byte range starting at
.I offset
and continuing for
-.I len
+.I size
bytes.
Within the specified range, blocks are preallocated for the regions
that span the holes in the file.
.IR mode ,
the behavior of the call is similar,
but the file size will not be changed even if
-.IR offset + len
+.IR offset + size
is greater than the file size.
This behavior is the same as when preallocating space with
.B FALLOC_FL_KEEP_SIZE
The hole will start at
.I offset
and continue for
-.I len
+.I size
bytes.
When inserting the hole inside file, the contents of the file starting at
.I offset
will be shifted upward (i.e., to a higher file offset) by
-.I len
+.I size
bytes.
Inserting a hole inside a file increases the file size by
-.I len
+.I size
bytes.
.P
This mode has the same limitations as
is not a valid file descriptor, or is not opened for writing.
.TP
.B EFBIG
-.IR offset + len
+.IR offset + size
exceeds the maximum file size.
.TP
.B EFBIG
.B EINVAL
.I offset
was less than 0, or
-.I len
-.\" FIXME . (raise a kernel bug) Probably the len==0 case should be
+.I size
+.\" FIXME . (raise a kernel bug) Probably the size==0 case should be
.\" a no-op, rather than an error. That would be consistent with
-.\" similar APIs for the len==0 case.
+.\" similar APIs for the size==0 case.
.\" See "Re: [PATCH] fallocate.2: add FALLOC_FL_PUNCH_HOLE flag definition"
.\" 21 Sep 2012
.\" http://thread.gmane.org/gmane.linux.file-systems/48331/focus=1193526
and the range specified by
.I offset
plus
-.I len
+.I size
reaches or passes the end of the file.
.TP
.B EINVAL
but either
.I offset
or
-.I len
+.I size
is not a multiple of the filesystem block size.
.TP
.B EINVAL
.B #include <unistd.h>
.P
.BI "long syscall(SYS_get_robust_list, int " pid ,
-.BI " struct robust_list_head **" head_ptr ", size_t *" len_ptr );
+.BI " struct robust_list_head **" head_ptr ", size_t *" sizep );
.B long syscall(SYS_set_robust_list,
-.BI " struct robust_list_head *" head ", size_t " len );
+.BI " struct robust_list_head *" head ", size_t " size );
.fi
.P
.IR Note :
The size of the object pointed to by
.I **head_ptr
is stored in
-.IR len_ptr .
+.IR sizep .
.P
Permission to employ
.BR get_robust_list ()
.I head
argument is the list head to record.
The
-.I len
+.I size
argument should be
.IR sizeof(*head) .
.SH RETURN VALUE
system call can fail with the following error:
.TP
.B EINVAL
-.I len
+.I size
does not equal
.IR "sizeof(struct\ robust_list_head)" .
.P
.nf
.B #include <unistd.h>
.P
-.BI "int getdomainname(char *" name ", size_t " len );
-.BI "int setdomainname(const char *" name ", size_t " len );
+.BI "int getdomainname(char *" name ", size_t " size );
+.BI "int setdomainname(const char *" name ", size_t " size );
.fi
.P
.RS -4
sets the domain name to the value given in the character array
.IR name .
The
-.I len
+.I size
argument specifies the number of bytes in
.IR name .
(Thus,
.BR getdomainname ()
returns the null-terminated domain name in the character array
.IR name ,
-which has a length of
-.I len
+which has a size of
+.I size
bytes.
If the null-terminated domain name requires more than \fIlen\fP bytes,
.BR getdomainname ()
pointed outside of user address space.
.TP
.B EINVAL
-.I len
+.I size
was negative or too large.
.TP
.B EPERM
.I name
is NULL or
.I name
-is longer than
-.I len
+is equal or longer than
+.I size
bytes.
.SH VERSIONS
On most Linux architectures (including x86),
None.
.\" But they appear on most systems...
.SH HISTORY
-Since Linux 1.0, the limit on the length of a domain name,
+Since Linux 1.0, the limit on the size of a domain name,
including the terminating null byte, is 64 bytes.
In older kernels, it was 8 bytes.
.SH SEE ALSO
.nf
.B #include <unistd.h>
.P
-.BI "int gethostname(char *" name ", size_t " len );
-.BI "int sethostname(const char *" name ", size_t " len );
+.BI "int gethostname(char *" name ", size_t " size );
+.BI "int sethostname(const char *" name ", size_t " size );
.fi
.P
.RS -4
sets the hostname to the value given in the character array
.IR name .
The
-.I len
+.I size
argument specifies the number of bytes in
.IR name .
(Thus,
.BR gethostname ()
returns the null-terminated hostname in the character array
.IR name ,
-which has a length of
-.I len
+which has a size of
+.I size
bytes.
If the null-terminated hostname is too large to fit,
then the name is truncated, and no error is returned (but see VERSIONS below).
is an invalid address.
.TP
.B EINVAL
-.I len
+.I size
is negative
-.\" Can't occur for gethostbyname() wrapper, since 'len' has an
+.\" Can't occur for gethostbyname() wrapper, since 'size' has an
.\" unsigned type; can occur for the underlying system call.
or, for
.BR sethostname (),
-.I len
+.I size
is larger than the maximum allowed size.
.TP
.B ENAMETOOLONG
.RB "(glibc " gethostname ())
-.I len
+.I size
is smaller than the actual size.
(Before glibc 2.1, glibc uses
.B EINVAL
as a library function that calls
.BR uname (2)
and copies up to
-.I len
+.I size
bytes from the returned
.I nodename
field into
Having performed the copy, the function then checks if the length of the
.I nodename
was greater than or equal to
-.IR len ,
+.IR size ,
and if it is, then the function returns \-1 with
.I errno
set to
handle the case where the length of the
.I nodename
was greater than or equal to
-.I len
+.I size
differently: nothing is copied into
.I name
and the function returns \-1 with
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "int syscall(SYS_init_module, void " module_image [. len "], \
-unsigned long " len ,
+.BI "int syscall(SYS_init_module, void " module_image [. size "], \
+unsigned long " size ,
.BI " const char *" param_values );
.BI "int syscall(SYS_finit_module, int " fd ,
.BI " const char *" param_values ", int " flags );
.I module_image
argument points to a buffer containing the binary image
to be loaded;
-.I len
+.I size
specifies the size of that buffer.
The module image should be a valid ELF image, built for the running kernel.
.P
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "int syscall(SYS_lookup_dcookie, uint64_t " cookie ", char *" buffer ,
-.BI " size_t " len );
+.BI "int syscall(SYS_lookup_dcookie, uint64_t " cookie ", char " buffer [. size ],
+.BI " size_t " size );
.fi
.P
.IR Note :
.nf
.B #include <sys/mman.h>
.P
-.BI "int madvise(void " addr [. length "], size_t " length ", int " advice );
+.BI "int madvise(void " addr [. size "], size_t " size ", int " advice );
.fi
.P
.RS -4
about the address range beginning at address
.I addr
and with size
-.IR length .
+.IR size .
.BR madvise ()
only operates on whole pages, therefore
.I addr
must be page-aligned.
The value of
-.I length
+.I size
is rounded up to a multiple of page size.
In most cases,
the goal of such advice is to improve system or application performance.
Support for Huge TLB pages was added in Linux v5.18.
Addresses within a mapping backed by Huge TLB pages must be aligned
to the underlying Huge TLB page size,
-and the range length is rounded up
+and the range size is rounded up
to a multiple of the underlying Huge TLB page size.
.\"
.\" ======================================================================
Poison the pages in the range specified by
.I addr
and
-.I length
+.I size
and handle subsequent references to those pages
like a hardware memory corruption.
This operation is available only for privileged
Enable Kernel Samepage Merging (KSM) for the pages in the range specified by
.I addr
and
-.IR length .
+.IR size .
The kernel regularly scans those areas of user memory that have
been marked as mergeable,
looking for pages with identical content.
KSM unmerges whatever pages it had merged in the address range specified by
.I addr
and
-.IR length .
+.IR size .
.TP
.BR MADV_SOFT_OFFLINE " (since Linux 2.6.33)"
.\" commit afcf938ee0aac4ef95b1a23bac704c6fbeb26de6
Soft offline the pages in the range specified by
.I addr
and
-.IR length .
+.IR size .
The memory of each page in the specified range is preserved
(i.e., when next accessed, the same content will be visible,
but in a new physical page frame),
Enable Transparent Huge Pages (THP) for pages in the range specified by
.I addr
and
-.IR length .
+.IR size .
The kernel will regularly scan the areas marked as huge page candidates
to replace them with huge pages.
The kernel will also allocate huge pages directly when the region is
Ensures that memory in the address range specified by
.I addr
and
-.I length
+.I size
will not be backed by transparent hugepages.
.TP
.BR MADV_COLLAPSE " (since Linux 6.1)"
Exclude from a core dump those pages in the range specified by
.I addr
and
-.IR length .
+.IR size .
This is useful in applications that have large areas of memory
that are known not to be useful in a core dump.
The effect of
The application no longer requires the pages in the range specified by
.I addr
and
-.IR len .
+.IR size .
The kernel can thus free these pages,
but the freeing could be delayed until memory pressure occurs.
For each of the pages that has been marked to be freed
.B EINVAL
.I addr
is not page-aligned or
-.I length
+.I size
is negative.
-.\" .I length
+.\" .I size
.\" is zero,
.TP
.B EINVAL
The Linux implementation requires that the address
.I addr
be page-aligned, and allows
-.I length
+.I size
to be zero.
If there are some parts of the specified address range
that are not mapped, the Linux version of
.nf
.B "#include <numaif.h>"
.P
-.BI "long mbind(void " addr [. len "], unsigned long " len ", int " mode ,
+.BI "long mbind(void " addr [. size "], unsigned long " size ", int " mode ,
.BI " const unsigned long " nodemask [(. maxnode " + ULONG_WIDTH - 1)"
.B " / ULONG_WIDTH],"
.BI " unsigned long " maxnode ", unsigned int " flags );
for the memory range starting with
.I addr
and continuing for
-.I len
+.I size
bytes.
The memory policy defines from which node memory is allocated.
.P
If the memory range specified by the
-.IR addr " and " len
+.IR addr " and " size
arguments includes an "anonymous" region of memory\[em]that is
a region of memory created using the
.BR mmap (2)
Or, there was an unmapped hole in the specified memory range specified by
.I addr
and
-.IR len .
+.IR size .
.TP
.B EINVAL
An invalid value was specified for
or
.IR mode ;
or
-.I addr + len
+.I addr + size
was less than
.IR addr ;
or
{
int fd;
char *name, *seals_arg;
- ssize_t len;
+ ssize_t size;
unsigned int seals;
\&
if (argc < 3) {
}
\&
name = argv[1];
- len = atoi(argv[2]);
+ size = atoi(argv[2]);
seals_arg = argv[3];
\&
/* Create an anonymous file in tmpfs; allow seals to be
\&
/* Size the file as specified on the command line. */
\&
- if (ftruncate(fd, len) == \-1)
+ if (ftruncate(fd, size) == \-1)
err(EXIT_FAILURE, "truncate");
\&
printf("PID: %jd; fd: %d; /proc/%jd/fd/%d\[rs]n",
.nf
.B #include <sys/mman.h>
.P
-.BI "int mlock(const void " addr [. len "], size_t " len );
-.BI "int mlock2(const void " addr [. len "], size_t " len ", \
+.BI "int mlock(const void " addr [. size "], size_t " size );
+.BI "int mlock2(const void " addr [. size "], size_t " size ", \
unsigned int " flags );
-.BI "int munlock(const void " addr [. len "], size_t " len );
+.BI "int munlock(const void " addr [. size "], size_t " size );
.P
.BI "int mlockall(int " flags );
.B int munlockall(void);
locks pages in the address range starting at
.I addr
and continuing for
-.I len
+.I size
bytes.
All pages that contain a part of the specified address range are
guaranteed to be resident in RAM when the call returns successfully;
also locks pages in the specified range starting at
.I addr
and continuing for
-.I len
+.I size
bytes.
However, the state of the pages contained in that range after the call
returns successfully will depend on the value in the
unlocks pages in the address range starting at
.I addr
and continuing for
-.I len
+.I size
bytes.
After this call, all pages that contain a part of the specified
memory range can be moved to external swap space again by the kernel.
and
.BR munlock ())
The result of the addition
-.IR addr + len
+.IR addr + size
was less than
.I addr
(e.g., the addition may have resulted in an overflow).
meant that if the region specified by
.I addr
and
-.I len
+.I size
overlapped an existing lock,
then the already locked bytes in the overlapping region were counted twice
when checking against the limit.
.nf
.B #include <sys/mman.h>
.P
-.BI "int mprotect(void " addr [. len "], size_t " len ", int " prot );
+.BI "int mprotect(void " addr [. size "], size_t " size ", int " prot );
.P
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/mman.h>
.P
-.BI "int pkey_mprotect(void " addr [. len "], size_t " len ", int " prot ", int " pkey ");"
+.BI "int pkey_mprotect(void " addr [. size "], size_t " size ", int " prot ", int " pkey ");"
.fi
.SH DESCRIPTION
.BR mprotect ()
changes the access protections for the calling process's memory pages
containing any part of the address range in the
-interval [\fIaddr\fP,\ \fIaddr\fP+\fIlen\fP\-1].
+interval [\fIaddr\fP,\ \fIaddr\fP+\fIsize\fP\-1].
.I addr
must be aligned to a page boundary.
.P
changes the protection on the pages specified by
.I addr
and
-.IR len .
+.IR size .
The
.I pkey
argument specifies the protection key (see
.B ENOMEM
Addresses in the range
.RI [ addr ,
-.IR addr + len \-1]
+.IR addr + size \-1]
are invalid for the address space of the process,
or specify one or more pages that are not mapped.
(Before Linux 2.4.19, the error
.B #include <pci.h>
.P
.BI "int pciconfig_read(unsigned long " bus ", unsigned long " dfn ,
-.BI " unsigned long " off ", unsigned long " len ,
+.BI " unsigned long " off ", unsigned long " size ,
.BI " unsigned char *" buf );
.BI "int pciconfig_write(unsigned long " bus ", unsigned long " dfn ,
-.BI " unsigned long " off ", unsigned long " len ,
+.BI " unsigned long " off ", unsigned long " size ,
.BI " unsigned char *" buf );
.BI "int pciconfig_iobase(int " which ", unsigned long " bus ,
.BI " unsigned long " devfn );
.SH ERRORS
.TP
.B EINVAL
-.I len
+.I size
value is invalid.
This does not apply to
.BR pciconfig_iobase ().
};
\&
union {
- __u64 bp_len; /* breakpoint length */
+ __u64 bp_len; /* breakpoint size */
__u64 kprobe_addr; /* with kprobe_func == NULL */
__u64 probe_offset; /* for perf_[k,u]probe */
__u64 config2; /* extension of config1 */
.IR bp_len " (since Linux 2.6.33)"
.\" commit 24f1e32c60c45c89a997c73395b69c8af6f0a84e
.I bp_len
-is the length of the breakpoint being measured if
+is the size of the breakpoint being measured if
.I type
is
.BR PERF_TYPE_BREAKPOINT .
.I addr
is the address of the allocated memory.
.I len
-is the length of the allocated memory.
+is the size of the allocated memory.
.I pgoff
is the page offset of the allocated memory.
.I filename
If
.B PERF_SAMPLE_RAW
is enabled, then a 32-bit value indicating size
-is included followed by an array of 8-bit values of length size.
+is included followed by an array of 8-bit values of size
+.IR size .
The values are padded with 0 to have 64-bit alignment.
.IP
This RAW record data is opaque with respect to the ABI.
is the address of the allocated memory.
.TP
.I len
-is the length of the allocated memory.
+is the size of the allocated memory.
.TP
.I pgoff
is the page offset of the allocated memory.
is the address of the kernel symbol.
.TP
.I len
-is the length of the kernel symbol.
+is the size of the kernel symbol.
.TP
.I ksym_type
is the type of the kernel symbol.
.\" commit e17d43b93e544f5016c0251d2074c15568d5d963
This record indicates a change in the kernel text.
This includes addition and removal of the text
-and the corresponding length is zero in this case.
+and the corresponding size is zero in this case.
.IP
.in +4n
.EX
is the address of the change
.TP
.I old_len
-is the old length
+is the old size
.TP
.I new_len
-is the new length
+is the new size
.TP
.I bytes
contains old bytes immediately followed by new bytes.
.nf
.B #include <fcntl.h>
.P
-.BI "int posix_fadvise(int " fd ", off_t " offset ", off_t " len \
+.BI "int posix_fadvise(int " fd ", off_t " offset ", off_t " size \
", int " advice ");"
.fi
.P
If the application requires that data be considered for discarding, then
.I offset
and
-.I len
+.I size
must be page-aligned.
.IP
The implementation
.in +4n
.EX
.BI "long arm_fadvise64_64(int " fd ", int " advice ,
-.BI " loff_t " offset ", loff_t " len );
+.BI " loff_t " offset ", loff_t " size );
.EE
.in
.P
configuration option.
.P
The type of the
-.I len
+.I size
argument was changed from
.I size_t
to
to the mapping.
.SH BUGS
Before Linux 2.6.6, if
-.I len
+.I size
was specified as 0, then this was interpreted literally as "zero bytes",
rather than as meaning "all bytes through to the end of the file".
.SH SEE ALSO
.I data
points to a
.BR "struct iovec" ,
-which describes the destination buffer's location and length.
+which describes the destination buffer's location and size.
On return, the kernel modifies
.B iov.len
to indicate the actual number of bytes returned.
.nf
.B #include <sys/socket.h>
.P
-.BI "ssize_t recv(int " sockfd ", void " buf [. len "], size_t " len ,
+.BI "ssize_t recv(int " sockfd ", void " buf [. size "], size_t " size ,
.BI " int " flags );
-.BI "ssize_t recvfrom(int " sockfd ", void " buf "[restrict ." len "], size_t " len ,
+.BI "ssize_t recvfrom(int " sockfd ", void " buf "[restrict ." size "], size_t " size ,
.BI " int " flags ,
.BI " struct sockaddr *_Nullable restrict " src_addr ,
.BI " socklen_t *_Nullable restrict " addrlen );
.P
.in +4n
.EX
-recv(sockfd, buf, len, flags);
+recv(sockfd, buf, size, flags);
.EE
.in
.P
.P
.in +4n
.EX
-recvfrom(sockfd, buf, len, flags, NULL, NULL);
+recvfrom(sockfd, buf, size, flags, NULL, NULL);
.EE
.in
.P
-All three calls return the length of the message on successful
+All three calls return the size of the message on successful
completion.
If a message is too long to fit in the supplied buffer, excess
bytes may be discarded depending on the type of socket the message is
and UNIX datagram as well as sequenced-packet
.\" commit 9f6f9af7694ede6314bed281eec74d588ba9474f
(since Linux 3.4) sockets:
-return the real length of the packet or datagram,
+return the real size of the packet or datagram,
even when it was longer than the passed buffer.
.IP
For use with Internet stream sockets, see
places the received message into the buffer
.IR buf .
The caller must specify the size of the buffer in
-.IR len .
+.IR size .
.P
If
.I src_addr
.P
.in +4n
.EX
-recvfrom(fd, buf, len, flags, NULL, 0);
+recvfrom(fd, buf, size, flags, NULL, 0);
.EE
.in
.\"
struct iovec *msg_iov; /* Scatter/gather array */
size_t msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* Ancillary data, see below */
- size_t msg_controllen; /* Ancillary data buffer len */
+ size_t msg_controllen; /* Ancillary data buffer size */
int msg_flags; /* Flags on received message */
};
.EE
to the size of this buffer before this call;
upon return from a successful call,
.I msg_namelen
-will contain the length of the returned address.
+will contain the size of the returned address.
If the application does not need to know the source address,
.I msg_name
can be specified as NULL.
.P
The field
.IR msg_control ,
-which has length
+which has size
.IR msg_controllen ,
points to a buffer for other protocol control-related messages or
miscellaneous ancillary data.
.BR recvmsg ()
is called,
.I msg_controllen
-should contain the length of the available buffer in
+should contain the size of the available buffer in
.IR msg_control ;
-upon return from a successful call it will contain the length
+upon return from a successful call it will contain the size
of the control message sequence.
.P
The messages are of the form:
the return value will be 0 (the traditional "end-of-file" return).
.P
Datagram sockets in various domains (e.g., the UNIX and Internet domains)
-permit zero-length datagrams.
+permit zero-size datagrams.
When such a datagram is received, the return value is 0.
.P
The value 0 may also be returned if the requested number of bytes
.B MSG_WAITALL
flags.
.SH NOTES
-If a zero-length datagram is pending,
+If a zero-size datagram is pending,
.BR read (2)
and
.BR recv ()
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/socket.h>
.P
-.BI "int recvmmsg(int " sockfd ", struct mmsghdr *" msgvec \
-", unsigned int " vlen ","
+.BI "int recvmmsg(int " sockfd \
+", struct mmsghdr " msgvec [. n "], unsigned int " n ,
.BI " int " flags ", struct timespec *" timeout ");"
.fi
.SH DESCRIPTION
.I mmsghdr
structures.
The size of this array is specified in
-.IR vlen .
+.IR n .
.P
The
.I mmsghdr
A blocking
.BR recvmmsg ()
call blocks until
-.I vlen
+.I n
messages have been received
or until the timeout expires.
A nonblocking call reads as many messages as are available
(up to the limit specified by
-.IR vlen )
+.IR n )
and returns immediately.
.P
On return from
.\" http://thread.gmane.org/gmane.linux.man/5677
The timeout is checked only after the receipt of each datagram,
so that if up to
-.I vlen\-1
+.I n\-1
datagrams are received before the timeout expires,
but then no further datagrams are received, the call will block forever.
.P
/* Access the memory of the target process in order to fetch the
pathname referred to by the system call argument \[aq]argNum\[aq] in
\[aq]req\->data.args[]\[aq]. The pathname is returned in \[aq]path\[aq],
- a buffer of \[aq]len\[aq] bytes allocated by the caller.
+ a buffer of \[aq]size\[aq] bytes allocated by the caller.
\&
Returns true if the pathname is successfully fetched, and false
otherwise. For possible causes of failure, see the comments below. */
\&
static bool
getTargetPathname(struct seccomp_notif *req, int notifyFd,
- int argNum, char *path, size_t len)
+ int argNum, char *path, size_t size)
{
int procMemFd;
char procMemPath[PATH_MAX];
\&
/* Read bytes at the location containing the pathname argument */
\&
- nread = pread(procMemFd, path, len, req\->data.args[argNum]);
+ nread = pread(procMemFd, path, size, req\->data.args[argNum]);
\&
close(procMemFd);
\&
.nf
.B #include <sys/socket.h>
.P
-.BI "ssize_t send(int " sockfd ", const void " buf [. len "], size_t " len \
+.BI "ssize_t send(int " sockfd ", const void " buf [. size "], size_t " size \
", int " flags );
-.BI "ssize_t sendto(int " sockfd ", const void " buf [. len "], size_t " len \
+.BI "ssize_t sendto(int " sockfd ", const void " buf [. size "], size_t " size \
", int " flags ,
.BI " const struct sockaddr *" dest_addr ", socklen_t " addrlen );
.BI "ssize_t sendmsg(int " sockfd ", const struct msghdr *" msg \
.P
.in +4n
.EX
-send(sockfd, buf, len, flags);
+send(sockfd, buf, size, flags);
.EE
.in
.P
.P
.in +4n
.EX
-sendto(sockfd, buf, len, flags, NULL, 0);
+sendto(sockfd, buf, size, flags, NULL, 0);
.EE
.in
.P
.BR sendto (),
the message is found in
.I buf
-and has length
-.IR len .
+and has size
+.IR size .
For
.BR sendmsg (),
the message is pointed to by the elements of the array
struct iovec *msg_iov; /* Scatter/gather array */
size_t msg_iovlen; /* # elements in msg_iov */
void *msg_control; /* Ancillary data, see below */
- size_t msg_controllen; /* Ancillary data buffer len */
+ size_t msg_controllen; /* Ancillary data buffer size */
int msg_flags; /* Flags (unused) */
};
.EE
and
.I msg_controllen
members.
-The maximum control buffer length the kernel can process is limited
+The maximum control buffer size the kernel can process is limited
per socket by the value in
.IR /proc/sys/net/core/optmem_max ;
see
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/socket.h>
.P
-.BI "int sendmmsg(int " sockfd ", struct mmsghdr *" msgvec \
-", unsigned int " vlen ","
+.BI "int sendmmsg(int " sockfd \
+", struct mmsghdr " msgvec [. n "], unsigned int " n ,
.BI " int " flags ");"
.fi
.SH DESCRIPTION
.I mmsghdr
structures.
The size of this array is specified in
-.IR vlen .
+.IR n .
.P
The
.I mmsghdr
A blocking
.BR sendmmsg ()
call blocks until
-.I vlen
+.I n
messages have been sent.
A nonblocking call sends as many messages as possible
(up to the limit specified by
-.IR vlen )
+.IR n )
and returns immediately.
.P
On return from
returns the number of messages sent from
.IR msgvec ;
if this is less than
-.IR vlen ,
+.IR n ,
the caller can retry with a further
.BR sendmmsg ()
call to send the remaining messages.
glibc 2.14.
.SH NOTES
The value specified in
-.I vlen
+.I n
is capped to
.B UIO_MAXIOV
(1024).
{
int semid, shmid;
char *addr;
- size_t len;
+ size_t size;
struct sembuf sop;
\&
if (argc != 4) {
exit(EXIT_FAILURE);
}
\&
- len = strlen(argv[3]) + 1; /* +1 to include trailing \[aq]\[rs]0\[aq] */
- if (len > MEM_SIZE) {
+ size = strlen(argv[3]) + 1; /* +1 to include trailing \[aq]\[rs]0\[aq] */
+ if (size > MEM_SIZE) {
fprintf(stderr, "String is too big!\[rs]n");
exit(EXIT_FAILURE);
}
if (addr == (void *) \-1)
errExit("shmat");
\&
- memcpy(addr, argv[3], len);
+ memcpy(addr, argv[3], size);
\&
/* Decrement semaphore to 0. */
\&
.P
.BI "ssize_t splice(int " fd_in ", off_t *_Nullable " off_in ,
.BI " int " fd_out ", off_t *_Nullable " off_out ,
-.BI " size_t " len ", unsigned int " flags );
+.BI " size_t " size ", unsigned int " flags );
.\" Return type was long before glibc 2.7
.fi
.SH DESCRIPTION
moves data between two file descriptors
without copying between kernel address space and user address space.
It transfers up to
-.I len
+.I size
bytes of data from the file descriptor
.I fd_in
to the file descriptor
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "int syscall(SYS_subpage_prot, unsigned long " addr ", unsigned long " len ,
+.BI "int syscall(SYS_subpage_prot, unsigned long " addr ", unsigned long " size ,
.BI " uint32_t *" map );
.fi
.P
The protection map is applied to the memory pages in the region starting at
.I addr
and continuing for
-.I len
+.I size
bytes.
Both of these arguments must be aligned to a 64-kB boundary.
.P
(so, the number of 32-bit words pointed to by
.I map
should equate to the number of 64-kB pages specified by
-.IR len ).
+.IR size ).
Each 2-bit field in the protection map is either 0 to allow any access,
1 to prevent writes, or 2 or 3 to prevent all accesses.
.SH RETURN VALUE
The
.I addr
or
-.I len
+.I size
arguments are incorrect.
Both of these arguments must be aligned to a multiple of the system page size,
and they must not refer to a region outside of the
.EX
struct __sysctl_args {
int *name; /* integer vector describing variable */
- int nlen; /* length of this vector */
+ int nlen; /* number of elements of this vector */
void *oldval; /* 0 or address where to store old value */
size_t *oldlenp; /* available room for old value,
overwritten by actual size of old value */
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "int syscall(SYS_syslog, int " type ", char *" bufp ", int " len );
+.BI "int syscall(SYS_syslog, int " type ", char *" bufp ", int " size );
.P
/* The glibc interface */
.B #include <sys/klog.h>
.P
-.BI "int klogctl(int " type ", char *" bufp ", int " len );
+.BI "int klogctl(int " type ", char *" bufp ", int " size );
.fi
.SH DESCRIPTION
.IR Note :
buffer; the glibc wrapper function for the system call is called
.BR klogctl ().
.SS The kernel log buffer
-The kernel has a cyclic buffer of length
+The kernel has a cyclic buffer of size
.B LOG_BUF_LEN
in which messages given as arguments to the kernel function
.BR printk ()
The
.I bufp
and
-.I len
+.I size
arguments are ignored.
.IP
This command does not really clear the ring buffer.
The
.I bufp
and
-.I len
+.I size
arguments are ignored.
.TP
.BR SYSLOG_ACTION_CONSOLE_ON " (7)"
The
.I bufp
and
-.I len
+.I size
arguments are ignored.
.TP
.BR SYSLOG_ACTION_CONSOLE_LEVEL " (8)"
The call sets
.I console_loglevel
to the value given in
-.IR len ,
+.IR size ,
which must be an integer between 1 and 8 (inclusive).
The kernel silently enforces a minimum value of
.I minimum_console_loglevel
for
-.IR len .
+.IR size .
See the
.I log level
section for details.
The
.I bufp
and
-.I len
+.I size
arguments are ignored.
.TP
.BR SYSLOG_ACTION_SIZE_BUFFER " (10) (since Linux 2.6.6)"
The
.I bufp
and
-.I len
+.I size
arguments are ignored.
.P
All commands except 3 and 10 require privilege.
.I buf
is NULL,
or
-.I len
+.I size
is less than zero; or for
.I type
8, the
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <fcntl.h>
.P
-.BI "ssize_t tee(int " fd_in ", int " fd_out ", size_t " len \
+.BI "ssize_t tee(int " fd_in ", int " fd_out ", size_t " size \
", unsigned int " flags );
.fi
.\" Return type was long before glibc 2.7
.\" one pipe to two other pipes.
.BR tee ()
duplicates up to
-.I len
+.I size
bytes of data from the pipe referred to by the file descriptor
.I fd_in
to the pipe referred to by the file descriptor
main(int argc, char *argv[])
{
int fd;
- ssize_t len, slen;
+ ssize_t size, ssize;
\&
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\[rs]n", argv[0]);
/*
* tee stdin to stdout.
*/
- len = tee(STDIN_FILENO, STDOUT_FILENO,
+ size = tee(STDIN_FILENO, STDOUT_FILENO,
INT_MAX, SPLICE_F_NONBLOCK);
- if (len < 0) {
+ if (size < 0) {
if (errno == EAGAIN)
continue;
perror("tee");
exit(EXIT_FAILURE);
}
- if (len == 0)
+ if (size == 0)
break;
\&
/*
* Consume stdin by splicing it to a file.
*/
- while (len > 0) {
- slen = splice(STDIN_FILENO, NULL, fd, NULL,
- len, SPLICE_F_MOVE);
- if (slen < 0) {
+ while (size > 0) {
+ ssize = splice(STDIN_FILENO, NULL, fd, NULL,
+ size, SPLICE_F_MOVE);
+ if (ssize < 0) {
perror("splice");
exit(EXIT_FAILURE);
}
- len \-= slen;
+ size \-= ssize;
}
}
\&
struct { /* Since Linux 4.11 */
__u64 from; /* Old address of remapped area */
__u64 to; /* New address of remapped area */
- __u64 len; /* Original mapping length */
+ __u64 len; /* Original mapping size */
} remap;
\&
struct { /* Since Linux 4.11 */
.BR mremap (2).
.TP
.I remap.len
-The original length of the memory range that was remapped using
+The original size of the memory range that was remapped using
.BR mremap (2).
.TP
.I remove.start
char c;
char *addr; /* Start of region handled by userfaultfd */
long uffd; /* userfaultfd file descriptor */
- size_t len, l; /* Length of region handled by userfaultfd */
+ size_t size, i; /* Size of region handled by userfaultfd */
pthread_t thr; /* ID of thread that handles page faults */
struct uffdio_api uffdio_api;
struct uffdio_register uffdio_register;
}
\&
page_size = sysconf(_SC_PAGE_SIZE);
- len = strtoull(argv[1], NULL, 0) * page_size;
+ size = strtoull(argv[1], NULL, 0) * page_size;
\&
/* Create and enable userfaultfd object. */
\&
actually touch the memory, it will be allocated via
the userfaultfd. */
\&
- addr = mmap(NULL, len, PROT_READ | PROT_WRITE,
+ addr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, \-1, 0);
if (addr == MAP_FAILED)
err(EXIT_FAILURE, "mmap");
missing pages (i.e., pages that have not yet been faulted in). */
\&
uffdio_register.range.start = (unsigned long) addr;
- uffdio_register.range.len = len;
+ uffdio_register.range.len = size;
uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == \-1)
err(EXIT_FAILURE, "ioctl\-UFFDIO_REGISTER");
locations 1024 bytes apart. This will trigger userfaultfd
events for all pages in the region. */
\&
- l = 0xf; /* Ensure that faulting address is not on a page
+ i = 0xf; /* Ensure that faulting address is not on a page
boundary, in order to test that we correctly
handle that case in fault_handling_thread(). */
- while (l < len) {
- c = addr[l];
- printf("Read address %p in %s(): ", addr + l, __func__);
+ while (i < size) {
+ c = addr[i];
+ printf("Read address %p in %s(): ", addr + i, __func__);
printf("%c\[rs]n", c);
- l += 1024;
+ i += 1024;
usleep(100000); /* Slow things down a little */
}
\&
.EX
.B struct uffdio_range {
.BR " __u64 start;" " /* Start of range */"
-.BR " __u64 len;" " /* Length of range (bytes) */"
+.BR " __u64 len;" " /* Size of range (bytes) */"
.B };
\&
.B struct uffdio_register {
.P
.B "#include <aio.h>"
.P
-.BI "int aio_suspend(const struct aiocb *const " aiocb_list "[], int " nitems ,
+.BI "int aio_suspend(const struct aiocb *const " aiocb_list "[], int " n ,
.BI " const struct timespec *restrict " timeout );
.fi
.SH DESCRIPTION
.BR nanosleep (2).)
.P
The
-.I nitems
+.I n
argument specifies the number of items in
.IR aiocb_list .
Each item in the list pointed to by
.B #include <stdlib.h>
.P
.BI "void *bsearch(const void " key [. size "], \
-const void " base [. size " * ." nmemb ],
-.BI " size_t " nmemb ", size_t " size ,
+const void " base [. size " * ." n ],
+.BI " size_t " n ", size_t " size ,
.BI " int (*" compar ")(const void [." size "], \
const void [." size ]));
.fi
The
.BR bsearch ()
function searches an array of
-.I nmemb
+.I n
objects,
the initial member of which is pointed to by
.IR base ,
.BI "void cfree(void *" ptr );
.P
/* In SCO OpenServer */
-.BI "void cfree(char " ptr [. size " * ." num "], unsigned int " num ", \
+.BI "void cfree(char " ptr [. size " * ." n "], unsigned int " n ", \
unsigned int " size );
.P
/* In Solaris watchmalloc.so.1 */
-.BI "void cfree(void " ptr [. elsize " * ." nelem "], size_t " nelem ", \
-size_t " elsize );
+.BI "void cfree(void " ptr [. size " * ." n "], size_t " n ", size_t " size );
.fi
.P
.RS -4
.P
An SCO manual writes: "The cfree routine is provided for compliance
to the iBCSe2 standard and simply calls free.
-The num and size
+The n and size
arguments to cfree are not used."
.SH RETURN VALUE
The SunOS version of
.P
.BI "[[deprecated]] int ecvt_r(double " number ", int " ndigits ,
.BI " int *restrict " decpt ", int *restrict " sign ,
-.BI " char *restrict " buf ", size_t " len );
+.BI " char *restrict " buf ", size_t " size );
.BI "[[deprecated]] int fcvt_r(double " number ", int " ndigits ,
.BI " int *restrict " decpt ", int *restrict " sign ,
-.BI " char *restrict " buf ", size_t " len );
+.BI " char *restrict " buf ", size_t " size );
.P
.BI "[[deprecated]] int qecvt_r(long double " number ", int " ndigits ,
.BI " int *restrict " decpt ", int *restrict " sign ,
-.BI " char *restrict " buf ", size_t " len );
+.BI " char *restrict " buf ", size_t " size );
.BI "[[deprecated]] int qfcvt_r(long double " number ", int " ndigits ,
.BI " int *restrict " decpt ", int *restrict " sign ,
-.BI " char *restrict " buf ", size_t " len );
+.BI " char *restrict " buf ", size_t " size );
.fi
.P
.RS -4
buffer, but instead use the supplied
.I buf
of size
-.IR len .
+.IR size .
See
.BR ecvt (3)
and
.nf
.B #include <stdio.h>
.P
-.BI "size_t fread(void " ptr "[restrict ." size " * ." nmemb ],
-.BI " size_t " size ", size_t " nmemb ,
+.BI "size_t fread(void " ptr "[restrict ." size " * ." n ],
+.BI " size_t " size ", size_t " n ,
.BI " FILE *restrict " stream );
-.BI "size_t fwrite(const void " ptr "[restrict ." size " * ." nmemb ],
-.BI " size_t " size ", size_t " nmemb ,
+.BI "size_t fwrite(const void " ptr "[restrict ." size " * ." n ],
+.BI " size_t " size ", size_t " n ,
.BI " FILE *restrict " stream );
.fi
.SH DESCRIPTION
The function
.BR fread ()
reads
-.I nmemb
+.I n
items of data, each
.I size
bytes long, from the stream pointed to by
The function
.BR fwrite ()
writes
-.I nmemb
+.I n
items of data, each
.I size
bytes long, to the stream pointed to by
.IP \[bu]
A pointer to the socket address is placed in the
.I ai_addr
-field, and the length of the socket address, in bytes,
+field, and the size of the socket address, in bytes,
is placed in the
.I ai_addrlen
field.
{
int sfd, s;
char buf[BUF_SIZE];
- size_t len;
+ size_t size;
ssize_t nread;
struct addrinfo hints;
struct addrinfo *result, *rp;
datagrams, and read responses from server. */
\&
for (size_t j = 3; j < argc; j++) {
- len = strlen(argv[j]) + 1;
+ size = strlen(argv[j]) + 1;
/* +1 for terminating null byte */
\&
- if (len > BUF_SIZE) {
+ if (size > BUF_SIZE) {
fprintf(stderr,
"Ignoring long message in argument %zu\[rs]n", j);
continue;
}
\&
- if (write(sfd, argv[j], len) != len) {
+ if (write(sfd, argv[j], size) != size) {
fprintf(stderr, "partial/failed write\[rs]n");
exit(EXIT_FAILURE);
}
.B #include <netdb.h>
.P
.BI "int getaddrinfo_a(int " mode ", struct gaicb *" list [restrict],
-.BI " int " nitems ", struct sigevent *restrict " sevp );
-.BI "int gai_suspend(const struct gaicb *const " list "[], int " nitems ,
+.BI " int " n ", struct sigevent *restrict " sevp );
+.BI "int gai_suspend(const struct gaicb *const " list "[], int " n ,
.BI " const struct timespec *" timeout );
.P
.BI "int gai_error(struct gaicb *" req );
.I list
specifies the look-up requests to process.
The
-.I nitems
+.I n
argument specifies the number of elements in
.IR list .
The requested look-up operations are started in parallel.
waiting for the completion of one or more requests in the array
.IR list .
The
-.I nitems
+.I n
argument specifies the size of the array
.IR list .
The call blocks until one of the following occurs:
static size_t nreqs = 0;
\&
static inline void *
-reallocarrayf(void *p, size_t nmemb, size_t size)
+reallocarrayf(void *p, size_t n, size_t size)
{
void *q;
\&
- q = reallocarray(p, nmemb, size);
- if (q == NULL && nmemb != 0 && size != 0)
+ q = reallocarray(p, n, size);
+ if (q == NULL && n != 0 && size != 0)
free(p);
return q;
}
.B [[deprecated]] extern int h_errno;
.P
.BI "[[deprecated]] struct hostent *gethostbyname(const char *" name );
-.BI "[[deprecated]] struct hostent *gethostbyaddr(const void " addr [. len ],
-.BI " socklen_t " len ", int " type );
+.BI "[[deprecated]] struct hostent *gethostbyaddr(const void " addr [. size ],
+.BI " socklen_t " size ", int " type );
.P
.BI "[[deprecated]] void herror(const char *" s );
.BI "[[deprecated]] const char *hstrerror(int " err );
.BI " int *restrict " h_errnop );
.P
.B [[deprecated]]
-.BI "int gethostbyaddr_r(const void " addr "[restrict ." len "], socklen_t " len ,
+.BI "int gethostbyaddr_r(const void " addr "[restrict ." size "], socklen_t " size ,
.BI " int " type ,
.BI " struct hostent *restrict " ret ,
.BI " char " buf "[restrict ." buflen "], size_t " buflen ,
The
.BR gethostbyaddr ()
function returns a structure of type \fIhostent\fP
-for the given host address \fIaddr\fP of length \fIlen\fP and address type
+for the given host address \fIaddr\fP of size \fIlen\fP and address type
\fItype\fP.
Valid address types are
.B AF_INET
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
- int h_length; /* length of address */
+ int h_length; /* size of address */
char **h_addr_list; /* list of addresses */
}
#define h_addr h_addr_list[0] /* for backward compatibility */
at present.
.TP
.I h_length
-The length of the address in bytes.
+The size of the address in bytes.
.TP
.I h_addr_list
An array of pointers to network addresses for the host (in network byte
does not suffice, since it contains pointers; a deep copy is required.
.P
In the original BSD implementation the
-.I len
+.I size
argument
of
.BR gethostbyname ()
was an
.IR int .
The SUSv2 standard is buggy and declares the
-.I len
+.I size
argument of
.BR gethostbyaddr ()
to be of type
.P
.BI "[[deprecated]] struct hostent *getipnodebyname(const char *" name ", int " af ,
.BI " int " flags ", int *" error_num );
-.BI "[[deprecated]] struct hostent *getipnodebyaddr(const void " addr [. len ],
-.BI " size_t " len ", int " af ,
+.BI "[[deprecated]] struct hostent *getipnodebyaddr(const void " addr [. size ],
+.BI " size_t " size ", int " af ,
.BI " int *" "error_num" );
.BI "[[deprecated]] void freehostent(struct hostent *" "ip" );
.fi
argument points to a
.I struct in_addr
and
-.I len
+.I size
must be set to
.IR "sizeof(struct in_addr)" .
.TP
argument points to a
.I struct in6_addr
and
-.I len
+.I size
must be set to
.IR "sizeof(struct in6_addr)" .
.SH RETURN VALUE
{
FILE *stream;
char *line = NULL;
- size_t len = 0;
+ size_t size = 0;
ssize_t nread;
\&
if (argc != 2) {
exit(EXIT_FAILURE);
}
\&
- while ((nread = getline(&line, &len, stream)) != \-1) {
+ while ((nread = getline(&line, &size, stream)) != \-1) {
printf("Retrieved line of length %zd:\[rs]n", nread);
fwrite(line, nread, 1, stdout);
}
.nf
.B #include <stdlib.h>
.P
-.BI "int getloadavg(double " loadavg[] ", int " nelem );
+.BI "int getloadavg(double " loadavg[] ", int " n );
.fi
.P
.RS -4
function returns the number of processes in the system run queue
averaged over various periods of time.
Up to
-.I nelem
+.I n
samples are retrieved and assigned to successive elements of
.IR loadavg[] .
The system imposes a maximum of 3 samples, representing averages
.P
.BI "int lio_listio(int " mode ,
.BI " struct aiocb *restrict const " aiocb_list [restrict],
-.BI " int " nitems ", struct sigevent *restrict " sevp );
+.BI " int " n ", struct sigevent *restrict " sevp );
.fi
.SH DESCRIPTION
The
structures that describe I/O operations.
These operations are executed in an unspecified order.
The
-.I nitems
+.I n
argument specifies the size of the array
.IR aiocb_list .
Null pointers in
.B EAGAIN
.\" Doesn't happen in glibc(?)
The number of I/O operations specified by
-.I nitems
+.I n
would cause the limit
.B AIO_MAX
to be exceeded.
.I mode
is invalid, or
.\" Doesn't happen in glibc(?)
-.I nitems
+.I n
exceeds the limit
.BR AIO_LISTIO_MAX .
.TP
.nf
.B #include <unistd.h>
.P
-.BI "int lockf(int " fd ", int " op ", off_t " len );
+.BI "int lockf(int " fd ", int " op ", off_t " size );
.fi
.P
.RS -4
a file descriptor open for writing, the action by
.IR op ,
and the section consists of byte positions
-.IR pos .. pos + len \-1
+.IR pos .. pos + size \-1
if
-.I len
+.I size
is positive, and
-.IR pos \- len .. pos \-1
+.IR pos \- size .. pos \-1
if
-.I len
+.I size
is negative, where
.I pos
is the current file position, and if
-.I len
+.I size
is zero, the section extends from the current file position to
infinity, encompassing the present and future end-of-file positions.
In all cases, the section may extend past current end-of-file.
.B #include <search.h>
.P
.BI "void *lfind(const void " key [. size "], \
-const void " base [*. nmemb " * ." size ],
-.BI " size_t *" nmemb ", size_t " size ,
+const void " base [*. n " * ." size ],
+.BI " size_t *" n ", size_t " size ,
.BI " int(*" compar ")(const void [." size "], \
const void [." size ]));
.BI "void *lsearch(const void " key [. size "], \
-void " base [*. nmemb " * ." size ],
-.BI " size_t *" nmemb ", size_t " size ,
+void " base [*. n " * ." size ],
+.BI " size_t *" n ", size_t " size ,
.BI " int(*" compar ")(const void [." size "], \
const void [." size ]));
.fi
in the array
.I base
which has
-.I *nmemb
+.I *n
elements of
.I size
bytes each.
does not find a matching element, then the
.I key
object is inserted at the end of the table, and
-.I *nmemb
+.I *n
is
incremented.
In particular, one should know that a matching element
.P
.BI "void *malloc(size_t " size );
.BI "void free(void *_Nullable " ptr );
-.BI "void *calloc(size_t " nmemb ", size_t " size );
+.BI "void *calloc(size_t " n ", size_t " size );
.BI "void *realloc(void *_Nullable " ptr ", size_t " size );
-.BI "void *reallocarray(void *_Nullable " ptr ", size_t " nmemb ", size_t " size );
+.BI "void *reallocarray(void *_Nullable " ptr ", size_t " n ", size_t " size );
.fi
.P
.RS -4
The
.BR calloc ()
function allocates memory for an array of
-.I nmemb
+.I n
elements of
.I size
bytes each and returns a pointer to the allocated memory.
The memory is set to zero.
If
-.I nmemb
+.I n
or
.I size
is 0, then
.BR free ().
.P
If the multiplication of
-.I nmemb
+.I n
and
.I size
would result in integer overflow, then
.P
.in +4n
.EX
-malloc(nmemb * size);
+malloc(n * size);
.EE
.in
.SS realloc()
the memory block pointed to by
.I ptr
to be large enough for an array of
-.I nmemb
+.I n
elements, each of which is
.I size
bytes.
.P
.in +4n
.EX
-realloc(ptr, nmemb * size);
+realloc(ptr, n * size);
.EE
.in
.P
#define MALLOCARRAY(n, type) ((type *) my_mallocarray(n, sizeof(type)))
#define MALLOC(type) MALLOCARRAY(1, type)
\&
-static inline void *my_mallocarray(size_t nmemb, size_t size);
+static inline void *my_mallocarray(size_t n, size_t size);
\&
int
main(void)
}
\&
static inline void *
-my_mallocarray(size_t nmemb, size_t size)
+my_mallocarray(size_t n, size_t size)
{
- return reallocarray(NULL, nmemb, size);
+ return reallocarray(NULL, n, size);
}
.EE
.SH SEE ALSO
.nf
.B #include <wchar.h>
.P
-.BI "size_t mbsnrtowcs(wchar_t " dest "[restrict ." len "], const char **restrict " src ,
-.BI " size_t " nms ", size_t " len \
+.BI "size_t mbsnrtowcs(wchar_t " dest "[restrict ." size "], const char **restrict " src ,
+.BI " size_t " nms ", size_t " size \
", mbstate_t *restrict " ps );
.fi
.P
to a wide-character string starting at
.IR dest .
At most
-.I len
+.I size
wide characters are written to
.IR dest .
The shift state
.I nms
limit forces a stop,
or
-.I len
+.I size
non-L\[aq]\[rs]0\[aq] wide characters
have been stored at
.IR dest .
If
.I dest
is NULL,
-.I len
+.I size
is ignored, and the conversion proceeds as
above, except that the converted wide characters
are not written out to memory,
-and that no destination length limit exists.
+and that no destination size limit exists.
.P
In both of the above cases, if
.I ps
function is used instead.
.P
The programmer must ensure that there is room for at least
-.I len
+.I size
wide
characters at
.IR dest .
.B #include <asm/types.h>
.B #include <linux/netlink.h>
.P
-.BI "int NLMSG_ALIGN(size_t " len );
-.BI "int NLMSG_LENGTH(size_t " len );
-.BI "int NLMSG_SPACE(size_t " len );
+.BI "int NLMSG_ALIGN(size_t " size );
+.BI "int NLMSG_LENGTH(size_t " size );
+.BI "int NLMSG_SPACE(size_t " size );
.BI "void *NLMSG_DATA(struct nlmsghdr *" nlh );
-.BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " len );
-.BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " len );
-.BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " len );
+.BI "struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *" nlh ", int " size );
+.BI "int NLMSG_OK(struct nlmsghdr *" nlh ", int " size );
+.BI "int NLMSG_PAYLOAD(struct nlmsghdr *" nlh ", int " size );
.fi
.SH DESCRIPTION
.I <linux/netlink.h>
be accessed using only these macros.
.TP
.BR NLMSG_ALIGN ()
-Round the length of a netlink message up to align it properly.
+Round the size of a netlink message up to align it properly.
.TP
.BR NLMSG_LENGTH ()
-Given the payload length,
-.IR len ,
-this macro returns the aligned length to store in the
+Given the payload size,
+.IR size ,
+this macro returns the aligned size to store in the
.I nlmsg_len
field of the
.IR nlmsghdr .
.TP
.BR NLMSG_SPACE ()
Return the number of bytes that a netlink message with payload of
-.I len
+.I size
would occupy.
.TP
.BR NLMSG_DATA ()
.B NLMSG_DONE
set\[em]this function doesn't return NULL on end.
The
-.I len
-argument is an lvalue containing the remaining length
+.I size
+argument is an lvalue containing the remaining size
of the message buffer.
-This macro decrements it by the length of the message header.
+This macro decrements it by the size of the message header.
.TP
.BR NLMSG_OK ()
Return true if the netlink message is not truncated and
is in a form suitable for parsing.
.TP
.BR NLMSG_PAYLOAD ()
-Return the length of the payload associated with the
+Return the size of the payload associated with the
.IR nlmsghdr .
.SH VERSIONS
It is often better to use netlink via
.nf
.B #include <fcntl.h>
.P
-.BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " len );
+.BI "int posix_fallocate(int " fd ", off_t " offset ", off_t " size );
.fi
.P
.ad l
for the bytes in the range starting at
.I offset
and continuing for
-.I len
+.I size
bytes.
After a successful call to
.BR posix_fallocate (),
guaranteed not to fail because of lack of disk space.
.P
If the size of the file is less than
-.IR offset + len ,
+.IR offset + size ,
then the file is increased to this size;
otherwise the file size is left unchanged.
.SH RETURN VALUE
is not a valid file descriptor, or is not opened for writing.
.TP
.B EFBIG
-.I offset+len
+.I offset+size
exceeds the maximum file size.
.TP
.B EINTR
.B EINVAL
.I offset
was less than 0, or
-.I len
+.I size
was less than or equal to 0, or the underlying filesystem does not
support the operation.
.TP
give the
.B EINVAL
error if
-.I len
+.I size
was 0, or
.I offset
was less than 0.
give the
.B EINVAL
error if
-.I len
+.I size
is less than 0, or
.I offset
was less than 0, and
.I may
give the error if
-.I len
+.I size
equals zero.
.SH CAVEATS
In the glibc implementation,
.nf
.B #include <sys/mman.h>
.P
-.BI "int posix_madvise(void " addr [. len "], size_t " len ", int " advice );
+.BI "int posix_madvise(void " addr [. size "], size_t " size ", int " advice );
.fi
.P
.RS -4
patterns of usage of memory in the address range starting at
.I addr
and continuing for
-.I len
+.I size
bytes.
The system is free to use this advice in order to improve the performance
of memory accesses (or to ignore the advice altogether), but calling
.B EINVAL
.I addr
is not a multiple of the system page size or
-.I len
+.I size
is negative.
.TP
.B EINVAL
the caller's address space.
.SH VERSIONS
POSIX.1 permits an implementation to generate an error if
-.I len
+.I size
is 0.
On Linux, specifying
-.I len
+.I size
as 0 is permitted (as a successful no-op).
.P
In glibc, this function is implemented using
.nf
.B #include <stdlib.h>
.P
-.BI "void qsort(void " base [. size " * ." nmemb "], size_t " nmemb ", \
+.BI "void qsort(void " base [. size " * ." n "], size_t " n ", \
size_t " size ,
.BI " int (*" compar ")(const void [." size "], \
const void [." size ]));
-.BI "void qsort_r(void " base [. size " * ." nmemb "], size_t " nmemb ", \
+.BI "void qsort_r(void " base [. size " * ." n "], size_t " n ", \
size_t " size ,
.BI " int (*" compar ")(const void [." size "], \
const void [." size "], void *),"
.SH DESCRIPTION
The
.BR qsort ()
-function sorts an array with \fInmemb\fP elements of
+function sorts an array with \fIn\fP elements of
size \fIsize\fP.
The \fIbase\fP argument points to the start of the
array.
.P
.nf
.BI "AUTH *authunix_create(char *" host ", uid_t " uid ", gid_t " gid ,
-.BI " int " len ", gid_t " aup_gids [. len ]);
+.BI " int " n ", gid_t " aup_gids [. n ]);
.fi
.IP
Create and return an RPC authentication handle that contains
is the user's user ID;
.I gid
is the user's current group ID;
-.I len
+.I n
and
.I aup_gids
refer to a counted array of groups to which the user belongs.
.BI "struct rtattr *RTA_NEXT(struct rtattr *" rta \
", unsigned int " rtabuflen );
.P
-.BI "unsigned int RTA_LENGTH(unsigned int " length );
-.BI "unsigned int RTA_SPACE(unsigned int "length );
+.BI "unsigned int RTA_LENGTH(unsigned int " size );
+.BI "unsigned int RTA_SPACE(unsigned int "size );
.fi
.SH DESCRIPTION
All
.I rta
points to a valid routing attribute;
.I attrlen
-is the running length of the attribute buffer.
+is the running size of the attribute buffer.
When not true then you must assume there are no more attributes in the
message, even if
.I attrlen
returns a pointer to the start of this attribute's data.
.P
.BI RTA_PAYLOAD( rta )
-returns the length of this attribute's data.
+returns the size of this attribute's data.
.P
.BI RTA_NEXT( rta ", " attrlen )
gets the next attribute after
.B RTA_OK
to check the validity of the returned pointer.
.P
-.BI RTA_LENGTH( len )
-returns the length which is required for
-.I len
+.BI RTA_LENGTH( size )
+returns the size which is required for
+.I size
bytes of data plus the header.
.P
-.BI RTA_SPACE( len )
+.BI RTA_SPACE( size )
returns the amount of space which will be needed in a message with
-.I len
+.I size
bytes of data.
.SH STANDARDS
Linux.
int res;
\&
if (argc < 3) {
- fprintf(stderr, "Usage: %s <str1> <str2> [<len>]\[rs]n", argv[0]);
+ fprintf(stderr, "Usage: %s <str1> <str2> [<n>]\[rs]n", argv[0]);
exit(EXIT_FAILURE);
}
\&
char *p;
char *buf1;
char *buf2;
- size_t len, maxsize;
+ size_t len, size;
\&
- maxsize = strlen("Hello ") + strlen("world") + strlen("!") + 1;
- buf1 = malloc(sizeof(*buf1) * maxsize);
+ size = strlen("Hello ") + strlen("world") + strlen("!") + 1;
+ buf1 = malloc(sizeof(*buf1) * size);
if (buf1 == NULL)
err(EXIT_FAILURE, "malloc()");
- buf2 = malloc(sizeof(*buf2) * maxsize);
+ buf2 = malloc(sizeof(*buf2) * size);
if (buf2 == NULL)
err(EXIT_FAILURE, "malloc()");
\&
.nf
.B #include <wchar.h>
.P
-.BI "size_t wcsnrtombs(char " dest "[restrict ." len "], \
+.BI "size_t wcsnrtombs(char " dest "[restrict ." size "], \
const wchar_t **restrict " src ,
-.BI " size_t " nwc ", size_t " len ", \
+.BI " size_t " nwc ", size_t " size ", \
mbstate_t *restrict " ps );
.fi
.P
to a multibyte string starting at
.IR dest .
At most
-.I len
+.I size
bytes are written to
.IR dest .
The shift state
.I nwc
wide characters have been
converted without encountering a null wide character (L\[aq]\[rs]0\[aq]),
-or the length limit forces a stop.
+or the size limit forces a stop.
In this case,
.I *src
is left pointing
If
.I dest
is NULL,
-.I len
+.I size
is ignored,
and the conversion proceeds as above,
except that the converted bytes are not written out to memory, and that
-no destination length limit exists.
+no destination size limit exists.
.P
In both of the above cases,
if
function is used instead.
.P
The programmer must ensure that there is room for at least
-.I len
+.I size
bytes
at
.IR dest .
.nf
.B #include <wchar.h>
.P
-.BI "size_t wcsrtombs(char " dest "[restrict ." len "], \
+.BI "size_t wcsrtombs(char " dest "[restrict ." size "], \
const wchar_t **restrict " src ,
-.BI " size_t " len ", mbstate_t *restrict " ps );
+.BI " size_t " size ", mbstate_t *restrict " ps );
.fi
.SH DESCRIPTION
If
to a multibyte string starting at
.IR dest .
At most
-.I len
+.I size
bytes are written to
.IR dest .
The shift state
is set to
.BR EILSEQ .
.IP \[bu]
-The length limit forces a stop.
+The size limit forces a stop.
In this case,
.I *src
is left pointing
If
.I dest
is NULL,
-.I len
+.I size
is ignored,
and the conversion proceeds as above, except that the converted bytes
are not written out to memory, and that
-no length limit exists.
+no size limit exists.
.P
In both of the above cases,
if
function is used instead.
.P
The programmer must ensure that there is room for at least
-.I len
+.I size
bytes
at
.IR dest .
.in +4n
.EX
struct fuse_in_header {
- uint32_t len; /* Total length of the data,
+ uint32_t len; /* Total size of the data,
including this header */
uint32_t opcode; /* The kind of operation (see below) */
uint64_t unique; /* A unique identifier for this request */
.EE
.in
.P
-The header is followed by a variable-length data portion
+The header is followed by a variable-size data portion
(which may be empty) specific to the requested operation
(the requested operation is indicated by
.IR opcode ).
.in +4n
.EX
struct fuse_out_header {
- uint32_t len; /* Total length of data written to
+ uint32_t len; /* Total size of data written to
the file descriptor */
int32_t error; /* Any error that occurred (0 if none) */
uint64_t unique; /* The value from the
structure are as follows:
.TP
.I event_len
-This is the length of the data for the current event and the offset
+This is the size of the data for the current event and the offset
to the next event in the buffer.
Unless the group identifies filesystem objects by file handles, the value of
.I event_len
.BR FAN_EVENT_METADATA_LEN .
For a group that identifies filesystem objects by file handles,
.I event_len
-also includes the variable length file identifier records.
+also includes the variable size file identifier records.
.TP
.I vers
This field holds a version number for the structure.
This field is not used.
.TP
.I metadata_len
-This is the length of the structure.
+This is the size of the structure.
The field was introduced to facilitate the implementation of
optional headers per event type.
No such optional headers exist in the current implementation.
with the same fanotify group is not supported.
.TP
.I handle
-This field contains a variable-length structure of type
+This field contains a variable-size structure of type
.IR "struct file_handle" .
It is an opaque handle that corresponds to a specified object on a
filesystem as returned by
.BR read (2)
from an fanotify file descriptor:
.TP
-.B FAN_EVENT_OK(meta, len)
-This macro checks the remaining length
-.I len
+.B FAN_EVENT_OK(meta, size)
+This macro checks the remaining size
+.I size
of the buffer
.I meta
-against the length of the metadata structure and the
+against the size of the metadata structure and the
.I event_len
field of the first metadata structure in the buffer.
.TP
-.B FAN_EVENT_NEXT(meta, len)
-This macro uses the length indicated in the
+.B FAN_EVENT_NEXT(meta, size)
+This macro uses the size indicated in the
.I event_len
field of the metadata structure pointed to by
.I meta
to calculate the address of the next metadata structure that follows
.IR meta .
-.I len
+.I size
is the number of bytes of metadata that currently remain in the buffer.
The macro returns a pointer to the next metadata structure that follows
.IR meta ,
and reduces
-.I len
+.I size
by the number of bytes in the metadata structure that
has been skipped over (i.e., it subtracts
.I meta\->event_len
from
-.IR len ).
+.IR size ).
.P
In addition, there is:
.TP
If a call to
.BR read (2)
processes multiple events from the fanotify queue and an error occurs,
-the return value will be the total length of the events successfully
+the return value will be the total size of the events successfully
copied to the user-space buffer before the error occurred.
The return value will not be \-1, and
.I errno
{
const struct fanotify_event_metadata *metadata;
struct fanotify_event_metadata buf[200];
- ssize_t len;
+ ssize_t size;
char path[PATH_MAX];
ssize_t path_len;
char procfd_path[PATH_MAX];
\&
/* Read some events. */
\&
- len = read(fd, buf, sizeof(buf));
- if (len == \-1 && errno != EAGAIN) {
+ size = read(fd, buf, sizeof(buf));
+ if (size == \-1 && errno != EAGAIN) {
perror("read");
exit(EXIT_FAILURE);
}
\&
/* Check if end of available data reached. */
\&
- if (len <= 0)
+ if (size <= 0)
break;
\&
/* Point to the first event in the buffer. */
\&
/* Loop over all events in the buffer. */
\&
- while (FAN_EVENT_OK(metadata, len)) {
+ while (FAN_EVENT_OK(metadata, size)) {
\&
/* Check that run\-time and compile\-time structures match. */
\&
\&
/* Advance to next event. */
\&
- metadata = FAN_EVENT_NEXT(metadata, len);
+ metadata = FAN_EVENT_NEXT(metadata, size);
}
}
}
main(int argc, char *argv[])
{
int fd, ret, event_fd, mount_fd;
- ssize_t len, path_len;
+ ssize_t size, path_len;
char path[PATH_MAX];
char procfd_path[PATH_MAX];
char events_buf[BUF_SIZE];
\&
/* Read events from the event queue into a buffer. */
\&
- len = read(fd, events_buf, sizeof(events_buf));
- if (len == \-1 && errno != EAGAIN) {
+ size = read(fd, events_buf, sizeof(events_buf));
+ if (size == \-1 && errno != EAGAIN) {
perror("read");
exit(EXIT_FAILURE);
}
/* Process all events within the buffer. */
\&
for (metadata = (struct fanotify_event_metadata *) events_buf;
- FAN_EVENT_OK(metadata, len);
- metadata = FAN_EVENT_NEXT(metadata, len)) {
+ FAN_EVENT_OK(metadata, size);
+ metadata = FAN_EVENT_NEXT(metadata, size)) {
fid = (struct fanotify_event_info_fid *) (metadata + 1);
file_handle = (struct file_handle *) fid\->handle;
\&
field counts all of the bytes in
.IR name ,
including the null bytes;
-the length of each
+the size of each
.I inotify_event
structure is thus
-.IR "sizeof(struct inotify_event)+len" .
+.IR "sizeof(struct inotify_event)+size" .
.P
The behavior when the buffer given to
.BR read (2)
\&
/* Read all available inotify events from the file descriptor \[aq]fd\[aq].
wd is the table of watch descriptors for the directories in argv.
- argc is the length of wd and argv.
+ argc is the size of wd and argv.
argv is the list of watched directories.
Entry 0 of wd and argv is unused. */
\&
char buf[4096]
__attribute__ ((aligned(__alignof__(struct inotify_event))));
const struct inotify_event *event;
- ssize_t len;
+ ssize_t size;
\&
/* Loop while events can be read from inotify file descriptor. */
\&
\&
/* Read some events. */
\&
- len = read(fd, buf, sizeof(buf));
- if (len == \-1 && errno != EAGAIN) {
+ size = read(fd, buf, sizeof(buf));
+ if (size == \-1 && errno != EAGAIN) {
perror("read");
exit(EXIT_FAILURE);
}
it returns \-1 with errno set to EAGAIN. In that case,
we exit the loop. */
\&
- if (len <= 0)
+ if (size <= 0)
break;
\&
/* Loop over all events in the buffer. */
\&
- for (char *ptr = buf; ptr < buf + len;
+ for (char *ptr = buf; ptr < buf + size;
ptr += sizeof(struct inotify_event) + event\->len) {
\&
event = (const struct inotify_event *) ptr;
.in +4n
.EX
struct nlmsghdr {
- __u32 nlmsg_len; /* Length of message including header */
+ __u32 nlmsg_len; /* Size of message including header */
__u16 nlmsg_type; /* Type of message content */
__u16 nlmsg_flags; /* Additional flags */
__u32 nlmsg_seq; /* Sequence number */
* unless NETLINK_CAP_ACK was set
* or the ACK indicates success (error == 0).
* For example Generic Netlink message with attributes.
- * message length is aligned with NLMSG_ALIGN()
+ * message size is aligned with NLMSG_ALIGN()
*/
/*
* followed by TLVs defined in enum nlmsgerr_attrs
.P
.in +4n
.EX
-int len;
+int size;
/* 8192 to avoid message truncation on platforms with
page size > 4096 */
struct nlmsghdr buf[8192/sizeof(struct nlmsghdr)];
struct nlmsghdr *nh;
\&
msg = { &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
-len = recvmsg(fd, &msg, 0);
+size = recvmsg(fd, &msg, 0);
\&
-for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, len);
- nh = NLMSG_NEXT (nh, len)) {
+for (nh = (struct nlmsghdr *) buf; NLMSG_OK (nh, size);
+ nh = NLMSG_NEXT (nh, size)) {
/* The end of multipart message */
if (nh\->nlmsg_type == NLMSG_DONE)
return;
.BR recv (2),
or
.BR recvfrom (2),
-the real length of the packet on the wire is always returned,
+the real size of the packet on the wire is always returned,
even when it is longer than the buffer.
.SS Address types
The
int sll_ifindex; /* Interface number */
unsigned short sll_hatype; /* ARP hardware type */
unsigned char sll_pkttype; /* Packet type */
- unsigned char sll_halen; /* Length of address */
+ unsigned char sll_halen; /* Size of address */
unsigned char sll_addr[8]; /* Physical\-layer address */
};
.EE
.I sll_addr
.TQ
.I sll_halen
-contain the physical-layer (e.g., IEEE 802.3) address and its length.
+contain the physical-layer (e.g., IEEE 802.3) address and its size.
The exact interpretation depends on the device.
.P
When you send packets, it is enough to specify
struct packet_mreq {
int mr_ifindex; /* interface index */
unsigned short mr_type; /* action */
- unsigned short mr_alen; /* address length */
+ unsigned short mr_alen; /* address size */
unsigned char mr_address[8]; /* physical\-layer address */
};
.EE
.EX
struct tpacket_auxdata {
__u32 tp_status;
- __u32 tp_len; /* packet length */
- __u32 tp_snaplen; /* captured length */
+ __u32 tp_len; /* packet size */
+ __u32 tp_snaplen; /* captured size */
__u16 tp_mac;
__u16 tp_net;
__u16 tp_vlan_tci;
When
.B ETH_P_802_3
is specified as protocol for sending the kernel creates the
-802.3 frame and fills out the length field; the user has to supply the LLC
+802.3 frame and fills out the size field; the user has to supply the LLC
header to get a fully conforming packet.
Incoming 802.3 packets are not multiplexed on the DSAP/SSAP protocol
fields; instead they are supplied to the user as protocol
This means the names of network devices longer than 14 bytes
will be truncated to fit into
.IR spkt_device .
-All these lengths include the terminating null byte (\[aq]\[rs]0\[aq])).
+All these sizes include the terminating null byte (\[aq]\[rs]0\[aq])).
.P
Issues from this with old code typically show up with
very long interface names used by the
The payload associated with this attribute is the pathname to which
the socket was bound (a sequence of bytes up to
.B UNIX_PATH_MAX
-length).
+size).
.TP
.B UDIAG_SHOW_VFS
The attribute reported in answer to this request is
.I udiag_rqueue
For listening sockets:
the number of pending connections.
-The length of the array associated with the
+The size of the array associated with the
.B UNIX_DIAG_ICONS
response attribute is equal to this value.
.IP
.TP
.I udiag_wqueue
For listening sockets:
-the backlog length which equals to the value passed as the second argument to
+the backlog size which equals to the value passed as the second argument to
.BR listen (2).
.IP
For established sockets:
.TP
.I idiag_wqueue
For listening sockets:
-the backlog length.
+the backlog size.
.IP
For other sockets:
the amount of memory available for sending.
}
\&
static int
-print_diag(const struct unix_diag_msg *diag, unsigned int len)
+print_diag(const struct unix_diag_msg *diag, unsigned int size)
{
- if (len < NLMSG_LENGTH(sizeof(*diag))) {
+ if (size < NLMSG_LENGTH(sizeof(*diag))) {
fputs("short response\[rs]n", stderr);
return \-1;
}
return \-1;
}
\&
- unsigned int rta_len = len \- NLMSG_LENGTH(sizeof(*diag));
+ unsigned int rta_len = size \- NLMSG_LENGTH(sizeof(*diag));
unsigned int peer = 0;
size_t path_len = 0;
char path[sizeof(((struct sockaddr_un *) 0)\->sun_path) + 1];
program to the socket for use as a filter of incoming packets.
A packet will be dropped if the filter program returns zero.
If the filter program returns a
-nonzero value which is less than the packet's data length,
-the packet will be truncated to the length returned.
+nonzero value which is less than the packet's data size,
+the packet will be truncated to the size returned.
If the value returned by the filter is greater than or equal to the
-packet's data length, the packet is allowed to proceed unmodified.
+packet's data size, the packet is allowed to proceed unmodified.
.IP
The argument for
.B SO_ATTACH_FILTER
Bind this socket to a particular device like \[lq]eth0\[rq],
as specified in the passed interface name.
If the
-name is an empty string or the option length is zero, the socket device
+name is an empty string or the option size is zero, the socket device
binding is removed.
-The passed option is a variable-length null-terminated
+The passed option is a variable-size null-terminated
interface name string with the maximum size of
.BR IFNAMSIZ .
If a socket is bound to an interface,
Maximum number of packets in the global input queue.
.TP
.I optmem_max
-Maximum length of ancillary data and user control data like the iovecs
+Maximum size of ancillary data and user control data like the iovecs
per socket.
.\" netdev_fastroute is not documented because it is experimental
.SS Ioctls
three numbers delimited by white space.
The first two numbers specify the starting user ID in
each of the two user namespaces.
-The third number specifies the length of the mapped range.
+The third number specifies the size of the mapped range.
In detail, the fields are interpreted as follows:
.IP (1) 5
The start of the range of user IDs in
that created this user namespace.
.RE
.IP (3)
-The length of the range of user IDs that is mapped between the two
+The size of the range of user IDs that is mapped between the two
user namespaces.
.P
System calls that return user IDs (group IDs)\[em]for example,
This mapping tells us
that the range starting at user ID 0 in this namespace
maps to a range starting at 0 in the (nonexistent) parent namespace,
-and the length of the range is the largest 32-bit unsigned integer.
+and the size of the range is the largest 32-bit unsigned integer.
This leaves 4294967295 (the 32-bit signed \-1 value) unmapped.
This is deliberate:
.I (uid_t)\~\-1
fpe("\[rs]n");
fpe("Map strings for \-M and \-G consist of records of the form:\[rs]n");
fpe("\[rs]n");
- fpe(" ID\-inside\-ns ID\-outside\-ns len\[rs]n");
+ fpe(" ID\-inside\-ns ID\-outside\-ns size\[rs]n");
fpe("\[rs]n");
fpe("A map string can contain multiple records, separated"
" by commas;\[rs]n");
GID mapping consists of one or more newline\-delimited records
of the form:
\&
- ID_inside\-ns ID\-outside\-ns length
+ ID_inside\-ns ID\-outside\-ns size
\&
Requiring the user to supply a string that contains newlines is
of course inconvenient for command\-line use. Thus, we permit the