git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
@ 2009-12-29  1:18 Sebastian Schuberth
  2009-12-29 21:09 ` Johannes Sixt
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Schuberth @ 2009-12-29  1:18 UTC (permalink / raw)
  To: git

MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 compat/mingw.h |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index b3d299f..af2f810 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -6,6 +6,7 @@
  */
 
 typedef int pid_t;
+typedef int uid_t;
 #define hstrerror strerror
 
 #define S_IFLNK    0120000 /* Symbolic link */
@@ -75,17 +76,17 @@ static inline int symlink(const char *oldpath, const char *newpath)
 { errno = ENOSYS; return -1; }
 static inline int fchmod(int fildes, mode_t mode)
 { errno = ENOSYS; return -1; }
-static inline int fork(void)
+static inline pid_t fork(void)
 { errno = ENOSYS; return -1; }
 static inline unsigned int alarm(unsigned int seconds)
 { return 0; }
 static inline int fsync(int fd)
 { return 0; }
-static inline int getppid(void)
+static inline pid_t getppid(void)
 { return 1; }
 static inline void sync(void)
 {}
-static inline int getuid()
+static inline uid_t getuid()
 { return 1; }
 static inline struct passwd *getpwnam(const char *name)
 { return NULL; }
@@ -117,7 +118,7 @@ static inline int mingw_unlink(const char *pathname)
 }
 #define unlink mingw_unlink
 
-static inline int waitpid(pid_t pid, int *status, unsigned options)
+static inline pid_t waitpid(pid_t pid, int *status, unsigned options)
 {
 	if (options == 0)
 		return _cwait(status, pid, 0);
@@ -158,7 +159,7 @@ int poll(struct pollfd *ufds, unsigned int nfds, int timeout);
 struct tm *gmtime_r(const time_t *timep, struct tm *result);
 struct tm *localtime_r(const time_t *timep, struct tm *result);
 int getpagesize(void);	/* defined in MinGW's libgcc.a */
-struct passwd *getpwuid(int uid);
+struct passwd *getpwuid(uid_t uid);
 int setitimer(int type, struct itimerval *in, struct itimerval *out);
 int sigaction(int sig, struct sigaction *in, struct sigaction *out);
 int link(const char *oldpath, const char *newpath);
-- 
1.6.5.rc2.13.g1be2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for   greater compatibility
  2009-12-29  1:18 [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility Sebastian Schuberth
@ 2009-12-29 21:09 ` Johannes Sixt
  2009-12-30  0:49   ` Sebastian Schuberth
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Sixt @ 2009-12-29 21:09 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git

Sebastian Schuberth schrieb:
> MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility

Why this? Compatibility with what? What's the problem with the status quo?

-- Hannes

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t  for greater compatibility
  2009-12-29 21:09 ` Johannes Sixt
@ 2009-12-30  0:49   ` Sebastian Schuberth
  2009-12-30  0:55     ` Erik Faye-Lund
  2009-12-31 13:50     ` Johannes Sixt
  0 siblings, 2 replies; 10+ messages in thread
From: Sebastian Schuberth @ 2009-12-30  0:49 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git

On Tue, Dec 29, 2009 at 22:09, Johannes Sixt <j6t@kdbg.org> wrote:

>> MinGW: Use pid_t more consequently, introduce uid_t for greater
>> compatibility
>
> Why this? Compatibility with what? What's the problem with the status quo?

I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit. h2du
depends on libpopt, and either of the two requires the uid_t type, I
do not recall which. And while adding the missing uid_t, I felt it
would be right to actually use uid_t / pid_t in the function
prototypes.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t  for greater compatibility
  2009-12-30  0:49   ` Sebastian Schuberth
@ 2009-12-30  0:55     ` Erik Faye-Lund
  2009-12-30  1:16       ` Sebastian Schuberth
  2009-12-31 13:50     ` Johannes Sixt
  1 sibling, 1 reply; 10+ messages in thread
From: Erik Faye-Lund @ 2009-12-30  0:55 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: Johannes Sixt, git

On Wed, Dec 30, 2009 at 1:49 AM, Sebastian Schuberth
<sschuberth@gmail.com> wrote:
> On Tue, Dec 29, 2009 at 22:09, Johannes Sixt <j6t@kdbg.org> wrote:
>
>>> MinGW: Use pid_t more consequently, introduce uid_t for greater
>>> compatibility
>>
>> Why this? Compatibility with what? What's the problem with the status quo?
>
> I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit. h2du
> depends on libpopt, and either of the two requires the uid_t type, I
> do not recall which. And while adding the missing uid_t, I felt it
> would be right to actually use uid_t / pid_t in the function
> prototypes.
>

Perhaps I'm missing something here... why do you need to modify the
git-sources in order to include an external tool?

-- 
Erik "kusma" Faye-Lund

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t  for greater compatibility
  2009-12-30  0:55     ` Erik Faye-Lund
@ 2009-12-30  1:16       ` Sebastian Schuberth
  2009-12-30 11:11         ` Johannes Schindelin
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Schuberth @ 2009-12-30  1:16 UTC (permalink / raw)
  To: kusmabite; +Cc: Johannes Sixt, git

On Wed, Dec 30, 2009 at 01:55, Erik Faye-Lund <kusmabite@googlemail.com> wrote:

>>> Why this? Compatibility with what? What's the problem with the status quo?
>>
>> I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit. h2du
>> depends on libpopt, and either of the two requires the uid_t type, I
>> do not recall which. And while adding the missing uid_t, I felt it
>> would be right to actually use uid_t / pid_t in the function
>> prototypes.
>
> Perhaps I'm missing something here... why do you need to modify the
> git-sources in order to include an external tool?

Because I'm building that external tool in the msysGit environment. As
you know, the way we include external tools (like vim, unzip etc.) to
the msysGit distribution is to create release.sh scripts that download
the sources, apply patches, and build the tool. Patching the original
hd2u sources to include compat/mingw.h was the best way that I saw to
get some required symbols, with only two symbols missing, and those
missing symbols are added by my patches.

Anyway, IMHO the correct declaration of e.g. getuid() is not "int
getuid()", but "uid_t getuid()" etc. So even if the uid_t type was not
required, it's a good change I think.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
  2009-12-30  1:16       ` Sebastian Schuberth
@ 2009-12-30 11:11         ` Johannes Schindelin
  0 siblings, 0 replies; 10+ messages in thread
From: Johannes Schindelin @ 2009-12-30 11:11 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: kusmabite, Johannes Sixt, git

Hi,

On Wed, 30 Dec 2009, Sebastian Schuberth wrote:

> Anyway, IMHO the correct declaration of e.g. getuid() is not "int 
> getuid()", but "uid_t getuid()" etc. So even if the uid_t type was not 
> required, it's a good change I think.

FWIW I concur with this reasoning.  Even if in this particular case, we 
could work around the issue, it is basically a non-intrusive, minimal 
janitorial patch.  Especially since the original author of the wrong 
signature concurs.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
  2009-12-30  0:49   ` Sebastian Schuberth
  2009-12-30  0:55     ` Erik Faye-Lund
@ 2009-12-31 13:50     ` Johannes Sixt
  2009-12-31 14:12       ` Johannes Schindelin
  1 sibling, 1 reply; 10+ messages in thread
From: Johannes Sixt @ 2009-12-31 13:50 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git

Sebastian Schuberth schrieb:
> On Tue, Dec 29, 2009 at 22:09, Johannes Sixt <j6t@kdbg.org> wrote:
> 
>>> MinGW: Use pid_t more consequently, introduce uid_t for greater
>>> compatibility
>> Why this? Compatibility with what? What's the problem with the status quo?
> 
> I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit.

We have dos2unix. What's wrong with it?

-- Hannes

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
  2009-12-31 13:50     ` Johannes Sixt
@ 2009-12-31 14:12       ` Johannes Schindelin
  2009-12-31 14:14         ` Sebastian Schuberth
  2009-12-31 14:20         ` Johannes Schindelin
  0 siblings, 2 replies; 10+ messages in thread
From: Johannes Schindelin @ 2009-12-31 14:12 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Sebastian Schuberth, git

Hi,

On Thu, 31 Dec 2009, Johannes Sixt wrote:

> Sebastian Schuberth schrieb:
> > On Tue, Dec 29, 2009 at 22:09, Johannes Sixt <j6t@kdbg.org> wrote:
> > 
> > > > MinGW: Use pid_t more consequently, introduce uid_t for greater
> > > > compatibility
> > > Why this? Compatibility with what? What's the problem with the status quo?
> > 
> > I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit.
> 
> We have dos2unix. What's wrong with it?

hd2u can handle mixed line endings, and it has a dry run mode IIUC.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t  for greater compatibility
  2009-12-31 14:12       ` Johannes Schindelin
@ 2009-12-31 14:14         ` Sebastian Schuberth
  2009-12-31 14:20         ` Johannes Schindelin
  1 sibling, 0 replies; 10+ messages in thread
From: Sebastian Schuberth @ 2009-12-31 14:14 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Johannes Sixt, git

On Thu, Dec 31, 2009 at 15:12, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:

>> > I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit.
>>
>> We have dos2unix. What's wrong with it?
>
> hd2u can handle mixed line endings, and it has a dry run mode IIUC.

Right. One of the best features over dos2unix IMHO is that hd2u can
detect line-endings (and any problems like mixed / stray line-endings)
without actually modifying any files. This makes it a very nice tool
to detect any line-ending issues in the working tree of cross-platform
projects due to wrong autocrlf configurations.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility
  2009-12-31 14:12       ` Johannes Schindelin
  2009-12-31 14:14         ` Sebastian Schuberth
@ 2009-12-31 14:20         ` Johannes Schindelin
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Schindelin @ 2009-12-31 14:20 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Sebastian Schuberth, git

Hi,

On Thu, 31 Dec 2009, Johannes Schindelin wrote:

> On Thu, 31 Dec 2009, Johannes Sixt wrote:
> 
> > Sebastian Schuberth schrieb:
> > > On Tue, Dec 29, 2009 at 22:09, Johannes Sixt <j6t@kdbg.org> wrote:
> > > 
> > > > > MinGW: Use pid_t more consequently, introduce uid_t for greater 
> > > > > compatibility
> > > > Why this? Compatibility with what? What's the problem with the 
> > > > status quo?
> > > 
> > > I wanted to include Hany's Dos2Unix tool (hd2u) into msysGit.
> > 
> > We have dos2unix. What's wrong with it?
> 
> hd2u can handle mixed line endings, and it has a dry run mode IIUC.

Having said that, I strongly feel this issue is over-discussed.  We'll 
just carry the necessary patches in 4msysgit.git and you can do what you 
want.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-12-31 14:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-29  1:18 [PATCH 1/2] MinGW: Use pid_t more consequently, introduce uid_t for greater compatibility Sebastian Schuberth
2009-12-29 21:09 ` Johannes Sixt
2009-12-30  0:49   ` Sebastian Schuberth
2009-12-30  0:55     ` Erik Faye-Lund
2009-12-30  1:16       ` Sebastian Schuberth
2009-12-30 11:11         ` Johannes Schindelin
2009-12-31 13:50     ` Johannes Sixt
2009-12-31 14:12       ` Johannes Schindelin
2009-12-31 14:14         ` Sebastian Schuberth
2009-12-31 14:20         ` Johannes Schindelin

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).