From: Frederic Weisbecker <fweisbec@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
David Gstir <david@sigma-star.at>
Subject: Re: [PATCH] Implement leftpad syscall
Date: Fri, 1 Apr 2016 03:33:34 +0200 [thread overview]
Message-ID: <20160401013333.GA7875@lerouge> (raw)
In-Reply-To: <1459463613-32473-2-git-send-email-richard@nod.at>
On Fri, Apr 01, 2016 at 12:33:32AM +0200, Richard Weinberger wrote:
> From: David Gstir <david@sigma-star.at>
>
> Implement the leftpad() system call such that userspace,
> especially node.js applications, can in the near future directly
> use it and no longer depend on fragile npm packages.
>
> Signed-off-by: David Gstir <david@sigma-star.at>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> arch/x86/entry/syscalls/syscall_64.tbl | 1 +
> include/linux/syscalls.h | 1 +
> kernel/sys.c | 35 ++++++++++++++++++++++++++++++++++
> kernel/sys_ni.c | 1 +
> 4 files changed, 38 insertions(+)
>
> diff --git a/arch/x86/entry/syscalls/syscall_64.tbl b/arch/x86/entry/syscalls/syscall_64.tbl
> index cac6d17..f287712 100644
> --- a/arch/x86/entry/syscalls/syscall_64.tbl
> +++ b/arch/x86/entry/syscalls/syscall_64.tbl
> @@ -335,6 +335,7 @@
> 326 common copy_file_range sys_copy_file_range
> 327 64 preadv2 sys_preadv2
> 328 64 pwritev2 sys_pwritev2
> +329 common leftpad sys_leftpad
>
> #
> # x32-specific system call numbers start at 512 to avoid cache impact
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index d795472..a0850bb 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -898,4 +898,5 @@ asmlinkage long sys_copy_file_range(int fd_in, loff_t __user *off_in,
>
> asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
>
> +asmlinkage long sys_leftpad(char *str, char pad, char *dst, size_t dst_len);
> #endif
> diff --git a/kernel/sys.c b/kernel/sys.c
> index cf8ba54..e42d972 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2432,3 +2432,38 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
> return 0;
> }
> #endif /* CONFIG_COMPAT */
> +
> +
> +SYSCALL_DEFINE4(leftpad, char *, src, char, pad, char *, dst, size_t, dst_len)
Have you considered /dev/leftpad instead?
next prev parent reply other threads:[~2016-04-01 1:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 22:33 New syscall: leftpad() Richard Weinberger
2016-03-31 22:33 ` [PATCH] Implement leftpad syscall Richard Weinberger
[not found] ` <1459463613-32473-2-git-send-email-richard-/L3Ra7n9ekc@public.gmane.org>
2016-03-31 22:46 ` Michael Kerrisk (man-pages)
2016-03-31 23:09 ` Greg KH
2016-04-01 3:22 ` kbuild test robot
2016-04-01 6:56 ` Richard Cochran
2016-04-01 1:33 ` Frederic Weisbecker [this message]
2016-04-01 7:14 ` Scotty Bauer
2016-03-31 22:33 ` [PATCH] leftpad.2: Document new syscall Richard Weinberger
[not found] ` <1459463613-32473-3-git-send-email-richard-/L3Ra7n9ekc@public.gmane.org>
2016-04-08 18:10 ` Heinrich Schuchardt
2016-04-09 14:12 ` Richard Weinberger
[not found] ` <1459463613-32473-1-git-send-email-richard-/L3Ra7n9ekc@public.gmane.org>
2016-03-31 23:36 ` New syscall: leftpad() Randy Dunlap
[not found] ` <56FDB478.4020609-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-04-01 8:06 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160401013333.GA7875@lerouge \
--to=fweisbec@gmail.com \
--cc=david@sigma-star.at \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).