Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Limkilde Svendsen
relibc
Commits
602f015e
Verified
Commit
602f015e
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Implement fpathconf and pathconf
parent
0dd801da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/header/unistd/pathconf.rs
+39
-6
39 additions, 6 deletions
src/header/unistd/pathconf.rs
tests/Makefile
+1
-0
1 addition, 0 deletions
tests/Makefile
tests/unistd/pathconf.c
+33
-0
33 additions, 0 deletions
tests/unistd/pathconf.c
with
73 additions
and
6 deletions
src/header/unistd/pathconf.rs
+
39
−
6
View file @
602f015e
use
header
::
errno
;
use
platform
;
use
platform
::
types
::
*
;
use
platform
::
types
::
*
;
pub
const
_PC_LINK_MAX
:
c_int
=
0
;
pub
const
_PC_LINK_MAX
:
c_int
=
0
;
...
@@ -22,12 +24,43 @@ pub const _PC_ALLOC_SIZE_MIN: c_int = 18;
...
@@ -22,12 +24,43 @@ pub const _PC_ALLOC_SIZE_MIN: c_int = 18;
pub
const
_PC_SYMLINK_MAX
:
c_int
=
19
;
pub
const
_PC_SYMLINK_MAX
:
c_int
=
19
;
pub
const
_PC_2_SYMLINKS
:
c_int
=
20
;
pub
const
_PC_2_SYMLINKS
:
c_int
=
20
;
// #[no_mangle]
fn
pc
(
name
:
c_int
)
->
c_long
{
pub
extern
"C"
fn
fpathconf
(
fildes
:
c_int
,
name
:
c_int
)
->
c_long
{
// Settings from musl, some adjusted
unimplemented!
();
match
name
{
_PC_LINK_MAX
=>
127
,
_PC_MAX_CANON
=>
255
,
_PC_MAX_INPUT
=>
255
,
_PC_NAME_MAX
=>
255
,
_PC_PATH_MAX
=>
4096
,
_PC_PIPE_BUF
=>
4096
,
_PC_CHOWN_RESTRICTED
=>
1
,
_PC_NO_TRUNC
=>
1
,
_PC_VDISABLE
=>
0
,
_PC_SYNC_IO
=>
1
,
_PC_ASYNC_IO
=>
-
1
,
_PC_PRIO_IO
=>
-
1
,
_PC_SOCK_MAXBUF
=>
-
1
,
_PC_FILESIZEBITS
=>
64
,
_PC_REC_INCR_XFER_SIZE
=>
-
1
,
_PC_REC_MAX_XFER_SIZE
=>
-
1
,
_PC_REC_MIN_XFER_SIZE
=>
4096
,
_PC_REC_XFER_ALIGN
=>
4096
,
_PC_ALLOC_SIZE_MIN
=>
4096
,
_PC_SYMLINK_MAX
=>
-
1
,
_PC_2_SYMLINKS
=>
1
,
_
=>
{
unsafe
{
platform
::
errno
=
errno
::
EINVAL
;
}
-
1
}
}
}
}
// #[no_mangle]
#[no_mangle]
pub
extern
"C"
fn
pathconf
(
path
:
*
const
c_char
,
name
:
c_int
)
->
c_long
{
pub
extern
"C"
fn
fpathconf
(
_fildes
:
c_int
,
name
:
c_int
)
->
c_long
{
unimplemented!
();
pc
(
name
)
}
#[no_mangle]
pub
extern
"C"
fn
pathconf
(
_path
:
*
const
c_char
,
name
:
c_int
)
->
c_long
{
pc
(
name
)
}
}
This diff is collapsed.
Click to expand it.
tests/Makefile
+
1
−
0
View file @
602f015e
...
@@ -104,6 +104,7 @@ BINS=\
...
@@ -104,6 +104,7 @@ BINS=\
unistd/gethostname
\
unistd/gethostname
\
unistd/getid
\
unistd/getid
\
unistd/link
\
unistd/link
\
unistd/pathconf
\
unistd/setid
\
unistd/setid
\
unistd/stat
\
unistd/stat
\
unistd/sysconf
unistd/sysconf
...
...
This diff is collapsed.
Click to expand it.
tests/unistd/pathconf.c
0 → 100644
+
33
−
0
View file @
602f015e
#include
<errno.h>
#include
<stdio.h>
#include
<unistd.h>
#define PC(N) { \
errno = 0; \
printf("%s (%d): %ld (%d)\n", #N, _PC_ ## N, fpathconf(0, _PC_ ## N), errno); \
}
int
main
(){
PC
(
LINK_MAX
);
PC
(
MAX_CANON
);
PC
(
MAX_INPUT
);
PC
(
NAME_MAX
);
PC
(
PATH_MAX
);
PC
(
PIPE_BUF
);
PC
(
CHOWN_RESTRICTED
);
PC
(
NO_TRUNC
);
PC
(
VDISABLE
);
PC
(
SYNC_IO
);
PC
(
ASYNC_IO
);
PC
(
PRIO_IO
);
PC
(
SOCK_MAXBUF
);
PC
(
FILESIZEBITS
);
PC
(
REC_INCR_XFER_SIZE
);
PC
(
REC_MAX_XFER_SIZE
);
PC
(
REC_MIN_XFER_SIZE
);
PC
(
REC_XFER_ALIGN
);
PC
(
ALLOC_SIZE_MIN
);
PC
(
SYMLINK_MAX
);
PC
(
2
_SYMLINKS
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment